A bus module that both offers and asks bus state waited on itself for good at its first such build; it now waits on nobody for it, as the graph and catalogue.Awaited leave a module's own provision out. Claude-Session: https://claude.ai/code/session_01JG73KG7AfSdh6FP8VrBqCn
39 lines
1.9 KiB
Go
39 lines
1.9 KiB
Go
package assign
|
|
|
|
import (
|
|
"slices"
|
|
|
|
"git.novox.be/novox/mesh-delivery/sdk/graph"
|
|
)
|
|
|
|
// verbWaiting says why the module's want on node waits for a verb it invokes (novox/hq ADR 0614 §2): the first seat verb or
|
|
// module tool of Invokes (the module graph's verb edges, those it leaves out on a cycle not among them, §3) that no
|
|
// running healthy build serves. Nil Served (nothing read of what runs) waits for none, and a verb a running build serves
|
|
// already adds no wait. It holds under the provisions' rule (RuleProvisions): no reader knows a rule number of its own
|
|
// yet, so the words name the edge (graph.VerbWaitWords, which the delivery view reads).
|
|
func (m Module) verbWaiting(node string) (string, bool) {
|
|
if m.Served == nil {
|
|
return "", false
|
|
}
|
|
for _, v := range slices.Sorted(slices.Values(m.Invokes)) {
|
|
if !m.Served(v) {
|
|
return graph.VerbWaitWords(v, m.Name, node), true
|
|
}
|
|
}
|
|
return "", false
|
|
}
|
|
|
|
// busStateWaiting says why the module's want on node waits for bus state (ADR 0614 §5): its manifest asks bus state (a
|
|
// bus-state entry, as the module graph reads it) and no build whose manifest offers bus-state runs healthy on a node
|
|
// present. The provision bus-state is answered with no credential of a consumer's own, so ADR 0603 §5 counts the
|
|
// provider's own have and no provisioner key is waited for, handed or not. Nil Offering (nothing read of what runs) waits
|
|
// for none, and neither does a module that offers bus-state itself. It holds under the provisions' rule, its words naming bus state (graph.BusStateWaitWords).
|
|
func (m Module) busStateWaiting(node string) (string, bool) {
|
|
if len(m.Manifest.BusState) == 0 || m.Offering == nil || m.Offering(graph.BusState) ||
|
|
slices.Contains(m.Manifest.Offers(), graph.BusState) { // the bus module offering it waits on nobody for it
|
|
|
|
return "", false
|
|
}
|
|
return graph.BusStateWaitWords(m.Name, node), true
|
|
}
|