Compose: an artifact store with no known address holds the modules that fetch from it, not the node (A-461, second part)
Builds: design 47 G A-461 (second sentence; the first, laying another node's module from its want's entry, waits on a lead answer)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay"
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"github.com/novox/mesh-host/internal/compose/resolution"
|
||||
"github.com/novox/mesh-host/internal/registryforms"
|
||||
)
|
||||
|
||||
// The contracts of the node-engine's statement that gate what a machine is sent, as the controller's link package names them
|
||||
@@ -41,6 +42,8 @@ type Placed struct {
|
||||
// manifest's own number as the Reading mode composes them, and never invented. The controller's adapter allocates and
|
||||
// composes again.
|
||||
ForeseenPorts []string
|
||||
// storeHeld are the modules left out of the declaration because the artifact store has no known address, and why (A-461).
|
||||
storeHeld map[string]string
|
||||
}
|
||||
|
||||
// Places composes the place half of the rendering for a node (the controller's renderingFor in the Reading and Foreseeing modes,
|
||||
@@ -92,9 +95,12 @@ func (c *composer) places(nodeName string, resolved Resolved) (Placed, error) {
|
||||
r.MeshRange = c.overlayRange()
|
||||
|
||||
// The artifact store as this node reaches it now, with what the mesh has built.
|
||||
// Where no address is known (the holder opens no listen to the mesh, or two), only the modules that fetch from the store
|
||||
// wait, with the words of an unanswered requirement; the node composes the rest (design 47 G A-461, A-452).
|
||||
store, err := c.artifactStoreAddress(nodeName)
|
||||
if err != nil {
|
||||
return out, err
|
||||
out.storeHeld = modulesNeedingTheStore(plan.Modules, err)
|
||||
store = ""
|
||||
}
|
||||
r.ArtifactStore = store
|
||||
r.Built = make(map[string]bool, len(c.in.Built))
|
||||
@@ -327,6 +333,29 @@ func (c *composer) namesInTheMesh() map[string]string {
|
||||
return out
|
||||
}
|
||||
|
||||
// modulesNeedingTheStore are the modules with a resource whose image or source is a kept reference into the artifact store, each
|
||||
// with why it waits: nothing provides the store's address (A-461).
|
||||
func modulesNeedingTheStore(modules []catalogue.Manifest, why error) map[string]string {
|
||||
out := map[string]string{}
|
||||
for _, m := range modules {
|
||||
for _, res := range m.Resources {
|
||||
needs := false
|
||||
for _, key := range []string{"image", "source"} {
|
||||
if written, ok := res[key].(string); ok {
|
||||
if _, kept := registryforms.Forms.InArtifactStore(written); kept {
|
||||
needs = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if needs {
|
||||
out[m.Module] = fmt.Sprintf("nothing provides %q, wanted by %s: %v", "the artifact store's address", m.Module, why)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// StoreSeat is the seat whose holder is the artifact store (novox/hq ADR 0632 §1): the store's address is that holder's
|
||||
// listen open to the mesh, on the machine assignment puts it on. The provision artifact-store it was found by before is
|
||||
// retired; no module serves it.
|
||||
|
||||
Reference in New Issue
Block a user