selfcompose: a module that runs with no entry of its wanted or running build counts what its trunk build provides (A-480a)
Builds: design 47 G A-480a (G-22-lead-answers-2.md)
This commit is contained in:
@@ -296,6 +296,14 @@ func (c *Composer) wantedBuilds() map[string]bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
// The trunk build of a module this node runs without an entry of its wanted or running build is asked too (A-480a).
|
||||
for module, tb := range c.trunkBuilds {
|
||||
if tb.fp != "" && c.runsWithoutEntry(module) {
|
||||
if _, named := out[tb.fp]; !named {
|
||||
out[tb.fp] = false
|
||||
}
|
||||
}
|
||||
}
|
||||
// The build each module runs here, as the node's own record of it says: its entry, kept in the composition state, stays held
|
||||
// for the judgement of a move's data forms though the catalog half dropped it and no event of the stream names it.
|
||||
for _, r := range running {
|
||||
@@ -463,6 +471,17 @@ func (c *Composer) layModules() {
|
||||
}
|
||||
continue
|
||||
}
|
||||
// Running here with no entry of its wanted or running build and none of the newest: it stands, for resolution alone, as its
|
||||
// trunk build, so the module that requires what it provides is no "nothing provides" (A-480a); its want stays held.
|
||||
if _, laid := modules[module]; !laid && c.runsWithoutEntry(module) {
|
||||
if tb := c.trunkBuilds[module]; tb.fp != "" && lay(module, tb.fp) {
|
||||
m := modules[module]
|
||||
m.Fp2 = w.Fp
|
||||
modules[module] = m
|
||||
said = append(said, fmt.Sprintf("%s runs a build whose manifest the node does not hold, so it counts what the trunk build %s of %s provides; its want stays held", module, tb.fp, module))
|
||||
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
|
||||
@@ -530,6 +549,22 @@ func (c *Composer) needsAddressOf(node, module string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// runsWithoutEntry says this node runs module (heard, not stopped) and holds no entry of its wanted build nor of its running build
|
||||
// (c.mu held): the case where its provisions are read from its trunk build (A-480a).
|
||||
func (c *Composer) runsWithoutEntry(module string) bool {
|
||||
run, ok := c.heard[c.env.Node][module]
|
||||
w, wanted := c.wants[module]
|
||||
if !ok || run.stopped || !wanted || w.Fp == "" {
|
||||
return false
|
||||
}
|
||||
for _, fp := range []string{w.Fp, run.fingerprint} {
|
||||
if k, held := c.keptEnt[fp]; held && k.entry.Module != "" {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// askTrunkBuilds asks, for each module another node runs at a build with no entry and whose placement names no build, the trunk
|
||||
// build by the seat's verb `module`, once per running build (A-461b). Called before the lock is taken: the verb is a call.
|
||||
func (c *Composer) askTrunkBuilds() (wait func()) {
|
||||
@@ -553,6 +588,22 @@ func (c *Composer) askTrunkBuilds() (wait func()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// A module this node runs whose wanted build and running build have no entry stands as its trunk build, for resolution alone
|
||||
// (A-480a): asked once per running build, as another node's is.
|
||||
for _, pm := range c.assignments[c.env.Node].Modules {
|
||||
module := pm.Module
|
||||
if !c.runsWithoutEntry(module) || c.trunkAsking[module] {
|
||||
continue
|
||||
}
|
||||
running := c.heard[c.env.Node][module].fingerprint
|
||||
if had, asked := c.trunkBuilds[module]; !asked || had.running != running {
|
||||
asks = append(asks, ask{c.env.Node, module, running})
|
||||
if c.trunkAsking == nil {
|
||||
c.trunkAsking = map[string]bool{}
|
||||
}
|
||||
c.trunkAsking[module] = true
|
||||
}
|
||||
}
|
||||
c.mu.Unlock()
|
||||
// Asked beside the pass, a few at a time: no pass waits on the catalog half's answer, and a module that waits for it is only
|
||||
// the one needing that address (A-461e). An answer asks a pass.
|
||||
|
||||
Reference in New Issue
Block a user