Every module follows the assigner's new places: the contracts' go/ path, mesh-wants in the delivery contracts, the state and tool assignments (issue 1966)
The legacy key form placement.<node> is gone from the client, so the readers and their fixtures lose it. The check noplacement now also refuses the assigner's retired names in a manifest. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -12,7 +12,9 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
meshseat "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
catalogclient "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
|
||||
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
"os"
|
||||
@@ -63,7 +65,23 @@ func published(t *testing.T, s *memStore, c today) {
|
||||
s.write(t, ComposedRead, mustKey(engineclient.HaveNodeKey(c.Node)), `{"v":1,"node":"`+c.Node+`","resources":[]}`)
|
||||
}
|
||||
|
||||
// goldenMesh is the store as the provisioner reads it for frombustest's mesh: the indexer's modules, n1's placement, the
|
||||
// writeAssignments writes a node's assignments as the seat does, its node key and a key per module (research 072 row 37).
|
||||
func writeAssignments(t *testing.T, s *memStore, node string, modules ...string) {
|
||||
t.Helper()
|
||||
a := meshseat.Assignments{V: assignerclient.Version, Node: node}
|
||||
for _, m := range modules {
|
||||
a.Modules = append(a.Modules, meshseat.PlacedModule{Module: m})
|
||||
}
|
||||
values, err := assignerclient.AssignmentsValues(a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for key, raw := range values {
|
||||
s.write(t, AssignmentsRead, key, string(raw))
|
||||
}
|
||||
}
|
||||
|
||||
// goldenMesh is the store as the provisioner reads it for frombustest's mesh: the indexer's modules, n1's assignments, the
|
||||
// vault's on n2, restic's want.
|
||||
func goldenMesh(t *testing.T, c today) *memStore {
|
||||
t.Helper()
|
||||
@@ -80,9 +98,8 @@ func goldenMesh(t *testing.T, c today) *memStore {
|
||||
s.write(t, ManifestsRead, mustKey(catalogclient.ManifestsKey(digest)), string(value))
|
||||
s.write(t, ModulesRead, module, `{"v":1,"fp2":"`+fp+`","manifest":"`+digest+`"}`)
|
||||
}
|
||||
s.write(t, PlacementRead, "placement."+c.Node, `{"v":1,"node":"`+c.Node+`","decided":{},"modules":[{"module":"store"},`+
|
||||
`{"module":"postgres"},{"module":"mesh-provisioner-client"},{"module":"restic"}]}`)
|
||||
s.write(t, PlacementRead, "placement.n2", `{"v":1,"node":"n2","decided":{},"modules":[{"module":"mesh-vault"}]}`)
|
||||
writeAssignments(t, s, c.Node, "store", "postgres", "mesh-provisioner-client", "restic")
|
||||
writeAssignments(t, s, "n2", "mesh-vault")
|
||||
s.write(t, WantsRead, "want."+c.Node+".restic", `{"v":1,"fp":"`+c.KeptAt["restic"]+`","self":true}`)
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package main
|
||||
// (`<node>.<consumer>.<provision>[.<local>]`), which it alone writes. It composes nothing: each plan is the one the
|
||||
// node-engine's published composition carries (`composed-<node>`, ADR 0593 §6), the node-engine alone composing.
|
||||
//
|
||||
// - **Made per node.** A change of a node's placement, of one of its wants or of one of its published compositions
|
||||
// - **Made per node.** A change of a node's assignments, of one of its wants or of one of its published compositions
|
||||
// makes that node's plans again; a change of the indexer's module does it for the nodes the module is placed on.
|
||||
// Each node's plans are read twice: at the builds its wants name (its plans, what its client applies) and at the
|
||||
// newest build of each placed module, so a build that adds a requirement has its key before its want (clause 2).
|
||||
@@ -31,9 +31,9 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient"
|
||||
meshseat "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
|
||||
meshseat "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
catalogclient "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
|
||||
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
@@ -69,11 +69,11 @@ type Refusal struct {
|
||||
// The reads it makes the plans from. ComposedRead is every node's published compositions, `composed-<node>` (ADR 0593
|
||||
// §6), read as the node-engine's named state: its keys are `<node>.<module>.<fingerprint hex>` and `<node>.node`.
|
||||
const (
|
||||
PlacementRead = (assignerModule + "." + meshseat.StatePlacement)
|
||||
WantsRead = assignerModule + ".wants"
|
||||
ModulesRead = indexerModule + "." + catalog.StateModules
|
||||
ManifestsRead = indexerModule + "." + catalog.StateManifests
|
||||
HaveRead = "node-engine.have"
|
||||
AssignmentsRead = (assignerModule + "." + meshseat.StateAssignments)
|
||||
WantsRead = assignerModule + ".wants"
|
||||
ModulesRead = indexerModule + "." + catalog.StateModules
|
||||
ManifestsRead = indexerModule + "." + catalog.StateManifests
|
||||
HaveRead = "node-engine.have"
|
||||
// BuildsRead is the builder's builds, `<module>.<fingerprint part>`: the key of the build a provider runs names the
|
||||
// digest of the manifest it was built from (novox/hq ADR 0603 clause 5).
|
||||
BuildsRead = builds.BuilderModule + ".builds"
|
||||
@@ -609,7 +609,7 @@ func (h *Holder) judgeNode(node string, needed map[string]meshprovisionerclient.
|
||||
case manyAtOnce(len(leaving), len(consumers)) && !retireMany:
|
||||
fault := fmt.Sprintf("On %s, one pass would retire the provisions of %d of the %d consumers that hold any (%s): "+
|
||||
"most likely a read stopped listing them (a node's compositions published in part, a want, a have or the "+
|
||||
"placement not read whole), not their removal. Nothing is retired and nothing is asked; the keys stay as they "+
|
||||
"assignments not read whole), not their removal. Nothing is retired and nothing is asked; the keys stay as they "+
|
||||
"were. If the removal is meant, provisioner_compose with retire-many retires them, each asked.",
|
||||
node, len(leaving), len(consumers), strings.Join(sortedKeys(leaving), ", "))
|
||||
hold(fault)
|
||||
@@ -1321,8 +1321,8 @@ func (h *Holder) put(key string, p meshprovisionerclient.Provision) {
|
||||
|
||||
// ---- what a change touches --------------------------------------------------------------------------------------
|
||||
|
||||
// NodesOfPlacement is the node a placement key names, in either form (research 072 row 37).
|
||||
func NodesOfPlacement(key string) []string {
|
||||
// NodesOfAssignments is the node an assignment key names (research 072 row 37).
|
||||
func NodesOfAssignments(key string) []string {
|
||||
if n, _, _, err := assignerclient.ParseKey(key); err == nil {
|
||||
return []string{n}
|
||||
}
|
||||
@@ -1356,20 +1356,20 @@ func (h *Holder) NodesOfModule(module string) []string {
|
||||
return sortedKeys(nodes)
|
||||
}
|
||||
|
||||
// placedOn is every node a module is placed on, sorted, from the placement's keys in either form
|
||||
// (assignerclient.PlacementsOf; research 072 row 37). A node whose keys do not read whole is read as they stand.
|
||||
// placedOn is every node a module is placed on, sorted, from the assignments' keys
|
||||
// (assignerclient.AssignmentsOf; research 072 row 37). A node whose keys do not read whole is read as they stand.
|
||||
func (h *Holder) placedOn(module string) []string {
|
||||
nodes := map[string]bool{}
|
||||
raw := map[string][]byte{}
|
||||
if keys, err := h.Store.Keys(PlacementRead); err == nil {
|
||||
if keys, err := h.Store.Keys(AssignmentsRead); err == nil {
|
||||
for _, k := range keys {
|
||||
if e, err := h.Store.Get(PlacementRead, k); err == nil && e != nil {
|
||||
if e, err := h.Store.Get(AssignmentsRead, k); err == nil && e != nil {
|
||||
raw[k] = e.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
placements, _ := assignerclient.PlacementsOf(raw)
|
||||
for n, p := range placements {
|
||||
assignments, _ := assignerclient.AssignmentsOf(raw)
|
||||
for n, p := range assignments {
|
||||
for _, m := range p.Modules {
|
||||
if m.Module == module {
|
||||
nodes[n] = true
|
||||
@@ -1578,22 +1578,22 @@ func publishedOn(s Store, node string) (map[string]publishedPlan, error) {
|
||||
// placedModules is every module placed on node, sorted, and the indexer's newest fingerprint (FP2) of each.
|
||||
func placedModules(s Store, node string) ([]string, map[string]string, error) {
|
||||
raw := map[string][]byte{}
|
||||
keys, err := s.Keys(PlacementRead)
|
||||
keys, err := s.Keys(AssignmentsRead)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("the placement cannot be read: %w", err)
|
||||
return nil, nil, fmt.Errorf("the assignments cannot be read: %w", err)
|
||||
}
|
||||
for _, k := range keys {
|
||||
if n, _, _, err := assignerclient.ParseKey(k); err != nil || n != node {
|
||||
continue
|
||||
}
|
||||
if e, err := s.Get(PlacementRead, k); err == nil && e != nil {
|
||||
if e, err := s.Get(AssignmentsRead, k); err == nil && e != nil {
|
||||
raw[k] = e.Value
|
||||
}
|
||||
}
|
||||
placements, _ := assignerclient.PlacementsOf(raw)
|
||||
assignments, _ := assignerclient.AssignmentsOf(raw)
|
||||
var placed []string
|
||||
fp2 := map[string]string{}
|
||||
for _, m := range placements[node].Modules {
|
||||
for _, m := range assignments[node].Modules {
|
||||
placed = append(placed, m.Module)
|
||||
mk, err := catalogclient.ModulesKey(m.Module)
|
||||
if err != nil {
|
||||
@@ -1609,10 +1609,10 @@ func placedModules(s Store, node string) ([]string, map[string]string, error) {
|
||||
return placed, fp2, nil
|
||||
}
|
||||
|
||||
// WatchedReads are the states the holder reads whole, each from the watched copy (ADR 0580 clause 2): the placement,
|
||||
// WatchedReads are the states the holder reads whole, each from the watched copy (ADR 0580 clause 2): the assignments,
|
||||
// the wants, the indexer's modules, the haves and the published compositions, and the providers' entries, whose watch
|
||||
// is also what rejudges a key.
|
||||
var WatchedReads = append([]string{PlacementRead, WantsRead, ModulesRead, HaveRead, ComposedRead}, boundReads()...)
|
||||
var WatchedReads = append([]string{AssignmentsRead, WantsRead, ModulesRead, HaveRead, ComposedRead}, boundReads()...)
|
||||
|
||||
// OwnStates are the states the holder alone writes (ADR 0570 clause 1), read from the watched copy too (issue 1954: some
|
||||
// 250 to 400 reads by key per composition): each of its own writes is taken into the copy at once (WatchedStates.Wrote),
|
||||
|
||||
@@ -6,7 +6,7 @@ package main
|
||||
// states and every input it reads are a real nats-server's key-value buckets, read through the watched copy of those
|
||||
// buckets (ADR 0580 clause 2); the plans come from n1's published compositions in `composed-n1` (ADR 0593 §6), as
|
||||
// captured from the composition of mesh-sdk's frombustest mesh (restic on n1, requiring postgres-database from postgres
|
||||
// there), and nothing is composed. A placement, a want and a published composition make the key; the providers'
|
||||
// there), and nothing is composed. An assignment, a want and a published composition make the key; the providers'
|
||||
// outcomes (the vault's entry for the credential, postgres's own have) turn it provided; restic leaving the node makes
|
||||
// it retiring and raises the ask.
|
||||
|
||||
@@ -14,6 +14,8 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
meshseat "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
catalogclient "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
|
||||
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
@@ -128,7 +130,7 @@ func TestTheHolderPlansProvidesAndAsksOnTheBus(t *testing.T) {
|
||||
var c today
|
||||
readJSON(t, "testdata/today-composed.json", &c)
|
||||
node := c.Node
|
||||
// The bus as the holder reads it: the indexer's modules and manifests, n1's placement and the vault's on n2, the
|
||||
// The bus as the holder reads it: the indexer's modules and manifests, n1's assignments and the vault's on n2, the
|
||||
// want of restic on n1, and what n1's engine published.
|
||||
mem := goldenMesh(t, c)
|
||||
published(t, mem, c)
|
||||
@@ -210,7 +212,7 @@ func TestTheHolderPlansProvidesAndAsksOnTheBus(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if p := state(key); p.State != meshprovisionerclient.Asked || p.Provider.Module != "postgres" {
|
||||
t.Fatalf("the placement and the want composed %+v", p)
|
||||
t.Fatalf("the assignments and the want composed %+v", p)
|
||||
}
|
||||
if e, _ := s.Get(PlansState, node+".restic"); e == nil {
|
||||
t.Fatal("restic's plan is not on the bus")
|
||||
@@ -263,14 +265,24 @@ func TestTheHolderPlansProvidesAndAsksOnTheBus(t *testing.T) {
|
||||
t.Fatalf("the outcomes did not turn it provided: %+v", p)
|
||||
}
|
||||
// restic leaves the node and its want goes: retiring, one ask. Its compositions stay until its engine deletes them.
|
||||
if err := s.Put(PlacementRead, "placement."+node, json.RawMessage(`{"v":1,"node":"`+node+`","decided":{},`+
|
||||
`"modules":[{"module":"store"},{"module":"postgres"},{"module":"mesh-provisioner-client"}]}`)); err != nil {
|
||||
left := meshseat.Assignments{V: assignerclient.Version, Node: node, Modules: []meshseat.PlacedModule{{Module: "store"}, {Module: "postgres"},
|
||||
{Module: "mesh-provisioner-client"}}}
|
||||
values, err := assignerclient.AssignmentsValues(left)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for k, raw := range values {
|
||||
if err := s.Put(AssignmentsRead, k, json.RawMessage(raw)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := s.Delete(AssignmentsRead, node+".restic"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := s.Delete(WantsRead, "want."+node+".restic"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
settled(PlacementRead, "placement."+node)
|
||||
settled(AssignmentsRead, node+".node")
|
||||
settled(WantsRead, "want."+node+".restic")
|
||||
if _, err := h.ComposeNode(ctx, node); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient"
|
||||
meshseat "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
|
||||
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
|
||||
meshseat "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
|
||||
catalogclient "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
|
||||
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
@@ -225,15 +225,15 @@ func TestAKeysStateFollowsItsProvidersOutcome(t *testing.T) {
|
||||
// A provision's credential is the vault's own provision, on the consumer's node for a login of its own, and the
|
||||
// provision depends on it (clauses 3, 6).
|
||||
c := newMesh()
|
||||
// The placement in its keys per module and node (research 072 row 37).
|
||||
novox, err := assignerclient.PlacementValues(meshseat.Placement{Node: "novox", Modules: []meshseat.PlacedModule{{Module: "mesh-vault"}}})
|
||||
// The assignments in its keys per module and node (research 072 row 37).
|
||||
novox, err := assignerclient.AssignmentsValues(meshseat.Assignments{Node: "novox", Modules: []meshseat.PlacedModule{{Module: "mesh-vault"}}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for k, v := range novox {
|
||||
c.s.write(t, PlacementRead, k, string(v))
|
||||
if n := NodesOfPlacement(k); !slices.Equal(n, []string{"novox"}) {
|
||||
t.Errorf("NodesOfPlacement(%q) = %v", k, n)
|
||||
c.s.write(t, AssignmentsRead, k, string(v))
|
||||
if n := NodesOfAssignments(k); !slices.Equal(n, []string{"novox"}) {
|
||||
t.Errorf("NodesOfAssignments(%q) = %v", k, n)
|
||||
}
|
||||
}
|
||||
pair := pgDB
|
||||
@@ -749,8 +749,7 @@ func TestARetirementIsJudgedOnlyFromAWholePicture(t *testing.T) {
|
||||
readJSON(t, "testdata/today-composed.json", &c)
|
||||
s := goldenMesh(t, c)
|
||||
published(t, s, c)
|
||||
s.write(t, PlacementRead, "placement."+c.Node, `{"v":1,"node":"`+c.Node+`","decided":{},"modules":[{"module":"store"},`+
|
||||
`{"module":"postgres"},{"module":"mesh-provisioner-client"},{"module":"restic"},{"module":"de-spiegel"}]}`)
|
||||
writeAssignments(t, s, c.Node, "store", "postgres", "mesh-provisioner-client", "restic", "de-spiegel")
|
||||
got := FromCompositions(s)(context.Background(), c.Node, map[string]string{"photos": fp})
|
||||
if !strings.Contains(got.AtWants.Held["de-spiegel"], "no build") || !slices.Equal(got.Unpublished, []string{"photos"}) {
|
||||
t.Errorf("held %v, unpublished %v", got.AtWants.Held, got.Unpublished)
|
||||
|
||||
@@ -102,18 +102,18 @@ func (l *loads) missing() string {
|
||||
return strings.Join(out, ", ")
|
||||
}
|
||||
|
||||
// heldBack is, once every read has loaded, every node the placement names: the passes their loads held back.
|
||||
// heldBack is, once every read has loaded, every node the assignments names: the passes their loads held back.
|
||||
func (l *loads) heldBack(h *Holder) []string {
|
||||
if l.missing() != "" {
|
||||
return nil
|
||||
}
|
||||
keys, err := h.Store.Keys(PlacementRead)
|
||||
keys, err := h.Store.Keys(AssignmentsRead)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
nodes := map[string]bool{}
|
||||
for _, k := range keys {
|
||||
for _, n := range NodesOfPlacement(k) {
|
||||
for _, n := range NodesOfAssignments(k) {
|
||||
nodes[n] = true
|
||||
}
|
||||
}
|
||||
@@ -176,17 +176,17 @@ func slowest(took []Took) time.Duration {
|
||||
|
||||
// The owners' read tools of the states the provisioner follows, which the manifest invokes (ADR 0615).
|
||||
const (
|
||||
PlacementTool = assignerModule + ".assigner_read_placement"
|
||||
WantsTool = assignerModule + ".assigner_read_wants"
|
||||
ModulesTool = indexerModule + ".indexer_read_modules"
|
||||
ManifestsTool = indexerModule + ".indexer_read_manifests"
|
||||
AssignmentsTool = assignerModule + ".assigner_read_assignments"
|
||||
WantsTool = assignerModule + ".assigner_read_wants"
|
||||
ModulesTool = indexerModule + ".indexer_read_modules"
|
||||
ManifestsTool = indexerModule + ".indexer_read_manifests"
|
||||
)
|
||||
|
||||
// newViews is the provisioner's pictures of the assigner's placement and wants and the indexer's modules and manifests:
|
||||
// newViews is the provisioner's pictures of the assigner's assignments and wants and the indexer's modules and manifests:
|
||||
// each asked once of its owner's read tool, then followed by the owner's events (ADR 0615).
|
||||
func newViews() *views.Reader {
|
||||
v := &views.Reader{Module: Module, Logf: logf, Findings: meshconditionsclient.FindingWriter{State: stdio.State("findings")}, Acts: meshhandactsclient.Recorder{Ask: stdio.Ask}}
|
||||
v.Follow(assignerModule, "placement", PlacementTool)
|
||||
v.Follow(assignerModule, "assignments", AssignmentsTool)
|
||||
v.Follow(assignerModule, "wants", WantsTool)
|
||||
v.Follow(indexerModule, "modules", ModulesTool)
|
||||
v.Follow(indexerModule, "manifests", ManifestsTool)
|
||||
@@ -236,7 +236,7 @@ func main() {
|
||||
w := &work{pending: map[string]bool{}, wake: make(chan struct{}, 1)}
|
||||
// No pass judges before every read it composes from has loaded once (issue 940); each load wakes every node it
|
||||
// held back, through its follower's handler.
|
||||
loads := newLoads(PlacementRead, WantsRead, ComposedRead, HaveRead, ModulesRead)
|
||||
loads := newLoads(AssignmentsRead, WantsRead, ComposedRead, HaveRead, ModulesRead)
|
||||
h.Loaded = loads.missing
|
||||
go w.run(h)
|
||||
go starting(h)
|
||||
@@ -248,7 +248,7 @@ func main() {
|
||||
w.add(loads.heldBack(h)...)
|
||||
}()
|
||||
}
|
||||
follow(PlacementRead, func(c stdio.StateChange) error { w.add(NodesOfPlacement(c.Key)...); return nil })
|
||||
follow(AssignmentsRead, func(c stdio.StateChange) error { w.add(NodesOfAssignments(c.Key)...); return nil })
|
||||
follow(WantsRead, func(c stdio.StateChange) error { w.add(NodesOfWant(c.Key)...); return nil })
|
||||
follow(ComposedRead, func(c stdio.StateChange) error { w.add(NodesOfNodeKey(c.Key)...); return nil })
|
||||
follow(HaveRead, func(c stdio.StateChange) error { w.add(NodesOfNodeKey(c.Key)...); return nil })
|
||||
|
||||
@@ -74,7 +74,7 @@ func (m *memStore) write(t *testing.T, state, key, raw string) {
|
||||
}
|
||||
|
||||
// The registry answers every kind a moved module's template may name (ADR 0349 clause 2): config, secret, bound,
|
||||
// collected and the placement namespaces, each with its domain and where a client finds it.
|
||||
// collected and the assignments namespaces, each with its domain and where a client finds it.
|
||||
func TestTheRegistryAnswersEveryKindATemplateMayName(t *testing.T) {
|
||||
var kinds []string
|
||||
for _, a := range TheRegistry {
|
||||
@@ -104,7 +104,7 @@ func TestTheRegistryAnswersEveryKindATemplateMayName(t *testing.T) {
|
||||
t.Errorf("the registry's kinds are %v, want %v", kinds, want)
|
||||
}
|
||||
// The buckets a client is granted to read its node's keys of (mesh-controller internal/broker/provisioner.go):
|
||||
// the config domain's resolved values, this module's own collections, and placement in each module's assignment,
|
||||
// the config domain's resolved values, this module's own collections, and assignments in each module's assignment,
|
||||
// where the controller carries the provisioner's plan (issue 671): a client never reads the node's declaration.
|
||||
for kind, bucket := range map[string]string{"config": "mesh-config_resolved", "collected": "mesh-provisioner_" + Collect,
|
||||
"shell": "mesh-provisioner_" + Collect, "environment": "mesh-provisioner_" + Collect,
|
||||
@@ -340,9 +340,9 @@ func TestTheManifestDeclaresWhatTheCodeKeeps(t *testing.T) {
|
||||
}
|
||||
// The builds read serves only haveOutcome's offer check (ADR 0603 clause 5: which manifest the build a provider runs
|
||||
// was made from) and makes no plan, so ADR 0593 §8 ("it composes nothing") holds.
|
||||
// The assigner's placement and wants and the indexer's modules and manifests are asked once of their owners' read
|
||||
// The assigner's assignments and wants and the indexer's modules and manifests are asked once of their owners' read
|
||||
// tools and followed by their events, not read (ADR 0615 §1).
|
||||
followed := []string{PlacementRead, WantsRead, ModulesRead, ManifestsRead}
|
||||
followed := []string{AssignmentsRead, WantsRead, ModulesRead, ManifestsRead}
|
||||
for _, r := range append(slices.Clone(WatchedReads), BuildsRead) {
|
||||
if slices.Contains(followed, r) {
|
||||
if slices.Contains(m.Reads, r) {
|
||||
@@ -354,8 +354,8 @@ func TestTheManifestDeclaresWhatTheCodeKeeps(t *testing.T) {
|
||||
t.Errorf("the manifest does not read %s, which the holder reads", r)
|
||||
}
|
||||
}
|
||||
if !slices.Equal(m.Invokes, []string{PlacementTool, WantsTool, ModulesTool, ManifestsTool, "seat:mesh-hand-acts.hand-act"}) ||
|
||||
!slices.Equal(m.Consumes, []string{"mesh-delivery-assigner.views.placement", "mesh-delivery-assigner.views.wants",
|
||||
if !slices.Equal(m.Invokes, []string{AssignmentsTool, WantsTool, ModulesTool, ManifestsTool, "seat:mesh-hand-acts.hand-act"}) ||
|
||||
!slices.Equal(m.Consumes, []string{"mesh-delivery-assigner.views.assignments", "mesh-delivery-assigner.views.wants",
|
||||
"mesh-delivery-indexer.views.modules", "mesh-delivery-indexer.views.manifests"}) {
|
||||
t.Errorf("invokes %v, consumes %v", m.Invokes, m.Consumes)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
meshwants "git.novox.be/novox/mesh-contracts/placement/go/seats/meshwants"
|
||||
meshwants "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshwants"
|
||||
)
|
||||
|
||||
// The holders whose states this module reads, one constant each (a reader names its holder once; ADR 0634 §4).
|
||||
|
||||
@@ -48,15 +48,15 @@ type Answer struct {
|
||||
Decision string `json:"decision"`
|
||||
}
|
||||
|
||||
// placement is the seat's: where a module runs, its directories, accesses, ports, seats and the machine's facts (ADR
|
||||
// assignments is the seat's: where a module runs, its directories, accesses, ports, seats and the machine's facts (ADR
|
||||
// 0349 clause 6), in the provisioning plan this seat composes of each module on each node from the bus, its state
|
||||
// `plans` (novox/hq ADR 0570 clauses 1, 2): a client never reads the node's declaration, which the node-engine keeps for
|
||||
// root alone, nor the controller's assignments.
|
||||
func placement(kind, what string) Answer {
|
||||
func assignments(kind, what string) Answer {
|
||||
return Answer{Kind: kind, Domain: Module, From: FromBucket, Bucket: Module + "_" + PlansState,
|
||||
Key: "<node>.<module>",
|
||||
Why: what + ": placement, in the provisioning plan the seat mesh-provisioner composes of the module on the node " +
|
||||
"(plans, plan.placement)", Decision: "novox/hq ADR 0570 clause 1"}
|
||||
Why: what + ": assignments, in the provisioning plan the seat mesh-provisioner composes of the module on the node " +
|
||||
"(plans, plan.assignments)", Decision: "novox/hq ADR 0570 clause 1"}
|
||||
}
|
||||
|
||||
// oldCollection is a namespace read as a collection of its own name (novox/hq ADR 0349 clause 13, design 57 L1).
|
||||
@@ -95,12 +95,12 @@ var TheRegistry = []Answer{
|
||||
oldCollection("shell", "a shell's code in one slot, or a session file's or a power moment's"),
|
||||
oldCollection("environment", "the account's environment in one format"),
|
||||
oldCollection("contribution", "what a seat's holder receives of one kind"),
|
||||
placement("dir", "a module's directory"),
|
||||
placement("access", "a directory a module reaches of another's"),
|
||||
placement("port", "a module's port"),
|
||||
placement("seat", "where a seat's holder is reached"),
|
||||
placement("machine", "a fact of the machine"),
|
||||
placement("backup", "what the machine's modules back up: `lines` and `data`, as the controller derives them from each module's declared data"),
|
||||
assignments("dir", "a module's directory"),
|
||||
assignments("access", "a directory a module reaches of another's"),
|
||||
assignments("port", "a module's port"),
|
||||
assignments("seat", "where a seat's holder is reached"),
|
||||
assignments("machine", "a fact of the machine"),
|
||||
assignments("backup", "what the machine's modules back up: `lines` and `data`, as the controller derives them from each module's declared data"),
|
||||
}
|
||||
|
||||
// Publish brings the registry bucket to TheRegistry: a kind whose answer differs is written, a kind no longer in
|
||||
|
||||
Reference in New Issue
Block a user