Node-engine: a running module without an entry resolves as the newest build its want names
Builds: design 47 G §421, lead answers A-405 and A-407
This commit is contained in:
@@ -228,6 +228,12 @@ func (c *Composer) wantedBuilds() map[string]bool {
|
||||
if module != agent.NodeModule && strings.HasPrefix(w.Fp, meshcatalogclient.SourcePrefix2) {
|
||||
out[w.Fp] = true
|
||||
}
|
||||
// The build its want says is being built describes, for resolution alone, a module whose wanted build has no entry (A-405, A-407).
|
||||
if module != agent.NodeModule && strings.HasPrefix(w.Newest, meshcatalogclient.SourcePrefix2) {
|
||||
if _, named := out[w.Newest]; !named {
|
||||
out[w.Newest] = false
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, mods := range c.heard {
|
||||
for _, run := range mods {
|
||||
@@ -309,6 +315,12 @@ func (c *Composer) syncEntries(ctx context.Context) {
|
||||
// layModules lays c.modules and c.manifests from the entries held: what each node was heard to run first, then each module this
|
||||
// node's want names, at the want's fingerprint (a want wins).
|
||||
func (c *Composer) layModules() {
|
||||
var said []string
|
||||
defer func() {
|
||||
for _, line := range said {
|
||||
c.sayOnceEach(line)
|
||||
}
|
||||
}()
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
modules := map[string]meshcatalog.ModulesByModuleValue{}
|
||||
@@ -343,9 +355,26 @@ func (c *Composer) layModules() {
|
||||
}
|
||||
}
|
||||
for module, w := range c.wants {
|
||||
if module != agent.NodeModule && w.Fp != "" {
|
||||
lay(module, w.Fp)
|
||||
if module == agent.NodeModule || w.Fp == "" {
|
||||
continue
|
||||
}
|
||||
if k, ok := c.keptEnt[w.Fp]; ok && k.entry.Module != "" {
|
||||
lay(module, w.Fp)
|
||||
continue
|
||||
}
|
||||
// A module the node runs whose wanted build has no entry stands as the build its want says is being built, for resolution
|
||||
// alone: what that entry provides, claims and requires stands for the running build. Its want stays held (entryHolds), at
|
||||
// the want's fingerprint, and nothing new of it is composed (A-405, A-407).
|
||||
if k, ok := c.keptEnt[w.Newest]; ok && w.Newest != "" && k.entry.Module != "" && c.runsHere(module) {
|
||||
lay(module, w.Newest)
|
||||
if m, laid := modules[module]; laid {
|
||||
m.Fp2 = w.Fp
|
||||
modules[module] = m
|
||||
said = append(said, fmt.Sprintf("%s runs a build whose entry the catalog half does not hold, so the node resolves around it as the build %s its want says is being built; its want stays held", module, w.Newest))
|
||||
}
|
||||
continue
|
||||
}
|
||||
lay(module, w.Fp)
|
||||
}
|
||||
// A module an assignment places whose entry is not held (not wanted here, not heard running, or its entry asked and not
|
||||
// answered) stands in the catalogue as its name alone, so the placement still finds it: a module held for its entry offers
|
||||
@@ -651,3 +680,19 @@ func (c *Composer) askBuildsEntries(fps map[string]string) (pending string) {
|
||||
}
|
||||
return pending
|
||||
}
|
||||
|
||||
// runsHere says whether this node runs the module: heard to, or in what the node runs now (c.mu held; env.Running reads the
|
||||
// agent's own record).
|
||||
func (c *Composer) runsHere(module string) bool {
|
||||
if run, ok := c.heard[c.env.Node][module]; ok && !run.stopped {
|
||||
return true
|
||||
}
|
||||
if c.env.Running != nil {
|
||||
for _, r := range c.env.Running() {
|
||||
if r.Module == module {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user