H-15: the apply guard and the yields read the node-engine's module from the entry claiming its seat
The module is the one whose catalog entry claims node-engine, else the one this node heard run the build its own fingerprint names; no name is fixed in the guard or in the compose. Builds: design 47 G §364, §527, §428 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -160,6 +160,13 @@ type Scope struct {
|
||||
// composing node's own consumer (design 47 G §199): the passing of a seat reads it, and a module nothing was heard of
|
||||
// counts by the trunk's entry. Never read from a have key, a want or a call.
|
||||
Heard map[string]map[string]Heard
|
||||
// Engine is told, at each composing of the node's input, the node-engine's own module: the one whose entry of the catalog half
|
||||
// claims the seat node-engine, else the one of the node's heard modules that runs the build OwnFingerprint names (design 47 G
|
||||
// §527); "" when neither shows it. Nil: told to nobody.
|
||||
Engine func(module string)
|
||||
// OwnFingerprint is the fingerprint this node-engine was started at (its MESH_FINGERPRINT); empty when it was started
|
||||
// without one, as an engine of before G.
|
||||
OwnFingerprint string
|
||||
// HeldToday is, in an answer, the modules the node keeps today as they run ("node" for its own composition), each with
|
||||
// how ("held", "failed", "runs a build of the old form"): a candidate that cannot compose one, or holds one only
|
||||
// behind one of them, keeps it as today, which is said under CandidateAnswer.Held and is no refusal (issue 1126).
|
||||
@@ -593,6 +600,31 @@ type Heard struct {
|
||||
Stopped bool
|
||||
}
|
||||
|
||||
// EngineModule is the node-engine's own module (design 47 G §527): the module whose catalog entry claims the seat node-engine,
|
||||
// which the validator makes one per revision (§508). With none claiming it, which only a revision of before G shows, as at a
|
||||
// revert of G, the module this node heard run the build its own fingerprint names; "" when neither shows it.
|
||||
func EngineModule(in compose.Input, node, ownFingerprint string) string {
|
||||
for _, name := range sortedKeys(in.Catalogue) {
|
||||
if resolution.ClaimsEngine(in.Catalogue[name]) {
|
||||
return name
|
||||
}
|
||||
}
|
||||
if ownFingerprint == "" {
|
||||
return ""
|
||||
}
|
||||
for i := range in.Nodes {
|
||||
if in.Nodes[i].Name != node {
|
||||
continue
|
||||
}
|
||||
for _, module := range sortedKeys(in.Nodes[i].Heard) {
|
||||
if in.Nodes[i].Heard[module].Fingerprint == ownFingerprint {
|
||||
return module
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// keepHeard puts, as each node's Heard, what it said it runs of each module it is assigned, with the manifest of the build
|
||||
// read by the event's digest; a digest that cannot be read leaves the entry unread, and the passing says so (§459).
|
||||
func keepHeard(in *compose.Input, s Scope, read func(module, digest string) (catalogue.Manifest, error)) {
|
||||
@@ -643,6 +675,9 @@ func Compose(ctx context.Context, r Reader, mesh Mesh, s Scope, fps map[string]s
|
||||
if err != nil {
|
||||
return nil, nil, held, err
|
||||
}
|
||||
if s.Engine != nil {
|
||||
s.Engine(EngineModule(in, s.Node, s.OwnFingerprint))
|
||||
}
|
||||
if s.Holds != nil {
|
||||
holds := map[string]compose.Hold{}
|
||||
for name := range held {
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
"github.com/novox/mesh-host/internal/compositions"
|
||||
"maps"
|
||||
"os"
|
||||
"reflect"
|
||||
"slices"
|
||||
@@ -592,6 +593,19 @@ func TestInput(t *testing.T) {
|
||||
t.Errorf("anchor's Heard holds %+v, want f2 unread", n.Heard)
|
||||
}
|
||||
}
|
||||
// Design 47 G §527: the node-engine's own module is the one whose entry claims its seat; with none, the one this node heard
|
||||
// run the build its own fingerprint names; with neither, none.
|
||||
if got := EngineModule(in, "laptop", "f1"); got != "xterm" {
|
||||
t.Errorf("by the own fingerprint: %q, want xterm", got)
|
||||
}
|
||||
if got := EngineModule(in, "laptop", "other"); got != "" {
|
||||
t.Errorf("an unheard fingerprint names %q", got)
|
||||
}
|
||||
in.Catalogue = maps.Clone(in.Catalogue)
|
||||
in.Catalogue["the-engine"] = catalogue.Manifest{Module: "the-engine", Claims: []catalogue.Claim{{Name: "node-engine"}}}
|
||||
if got := EngineModule(in, "laptop", "f1"); got != "the-engine" {
|
||||
t.Errorf("by the claim: %q, want the-engine", got)
|
||||
}
|
||||
// Issue 1126, the seed's refusals. restic and the provisioner's client as the catalogue holds them (mesh-catalog
|
||||
// c05aa5e6), restic moved with an own secret the vault leaves out (it hands it to the client, mesh-vault ownnode.go
|
||||
// handed): composed from the indexer's manifest restic is not handed and stands in for that secret, as novox's,
|
||||
|
||||
Reference in New Issue
Block a user