Files
mesh-delivery/modules/mesh-delivery-assigner/internal/buckets/buckets.go
T
jschoubben 2a85e55d4e D1 (assigner): the assigner names its own states from its credential's module
Its buckets (the seat's states, wants, asks, puts, waits, findings, policies, pins, marks, first views) are functions of the module SetModule was told at its start (its credential's; the tools program's served-as), no longer constants of its name.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:44:33 +01:00

85 lines
5.0 KiB
Go

// Package buckets holds the names of the bus buckets the assigner reads and the states it keeps beside the seats' own. A
// contract carries the local name of a state, not the module that holds it (ADR 0625 §4, §7), and the assigner opens
// buckets through grants its manifest declares, so the holder's name is kept here, in the assigner's own code, and held equal
// to the manifest by its test (ADR 0634 §1, finding F4).
package buckets
import (
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
catalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
wants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate"
plc "mesh-delivery-assigner/internal/assignment"
)
// The states the assigner keeps beside the seat's: its own asks, puts, waits and policies.
const (
// WaitsState holds the waits on an outside cause, one key `<node>.<module>.<fingerprint hex>` (design 47 G §706).
WaitsState = "waits"
// DeliveredAgainState holds each ask of assigner_delivered_again, one key `<module>`, its value the version, who asked and why, and
// why it does not hold yet (design 47 G §376, A-250).
DeliveredAgainState = "delivered-again"
// DeliveryWaitsState holds each dependent's delivery wait the assigner said, one key `<module>`, its value the wait-held said
// (design 47 G §376, §498, A-246).
DeliveryWaitsState = "delivery-waits"
// PutWaitsState holds each put wait the assigner said, one key `<node>.<module>`, its value the wait's id and the put as said
// (design 47 G A-204, A-211), so a put that ends while the assigner is stopped gets its wait-ended at the next start.
PutWaitsState = "put-waits"
// InputsState holds the inputs of the composition steps, `<time>.<digest>`, which the seat mesh-wants' verb input answers (design 47 G §354).
InputsState = "inputs"
// PoliciesState is the state of the policies a person set for a module's upgrade.
PoliciesState = "policies"
)
// The assigner's own buckets, `<module>_<state>` of the module it runs as (its credential's, plc.SetModule), never a
// constant of its name (design 47 G A-296, §428).
func own(state string) string { return plc.Module() + "_" + state }
func Wants() string { return own(wants.StateWants) }
func Differences() string { return own(wants.StateDifferences) }
func Asks() string { return own("asks") }
func Puts() string { return own("puts") }
func Waits() string { return own(WaitsState) }
func DeliveredAgain() string { return own(DeliveredAgainState) }
func DeliveryWaits() string { return own(DeliveryWaitsState) }
func PutWaits() string { return own(PutWaitsState) }
func Inputs() string { return own(InputsState) }
func Policies() string { return own(PoliciesState) }
// AsksHistory is the revisions the bucket of asks keeps per key.
const AsksHistory = 5
// The states of the other seats' holders that the assigner reads, named by the holder's module as every state is.
const (
// Have holds a module's have on a node, `<node>.<module>`, and the node's own facts, `<node>.node`.
Have = "node-engine_" + nodeengine.StateHave
// ComposedRead is the family of the node-engine's composed states, one bucket per node.
ComposedRead = "mesh-host." + nodeengine.StateComposed
// IndexerModule is the holder of the seat mesh-catalog, named from this module's manifest (`consumes` its views, `invokes`
// its tools; TestTheIndexerIsTheManifests), since no client names a holder (ADR 0625 §4).
IndexerModule = "mesh-delivery-indexer"
// Modules, Manifests and Graph are the indexer's buckets; ModulesRead and ManifestsRead the addresses of the states
// modules and manifests as a first view names them.
Modules = IndexerModule + "_" + catalog.StateModules
Manifests = IndexerModule + "_" + catalog.StateManifests
Graph = IndexerModule + "_graph"
ModulesRead = IndexerModule + "." + catalog.StateModules
ManifestsRead = IndexerModule + "." + catalog.StateManifests
// ProvisionerModule is the holder of the seat mesh-provisioner, named from this module's manifest (reads its provisions); Provisions
// is its state provisions.
ProvisionerModule = "mesh-provisioner"
Provisions = ProvisionerModule + "_provisions"
// TellerModule is the module whose hand the operator's answers pass: the one that holds each ask's answer, and the
// name the hand-act log records a warrant under. Held equal to the manifest's reads by its test.
TellerModule = "mesh-delivery-teller"
// AnswersState is the teller's state of its answer to each ask, followed through its first view by AnswersReadTool and its
// views family `views.answers` (design 47 G A-175, A-178), never its bucket; Answers is the picture's name, `<owner>_<state>`.
AnswersState = "answers"
AnswersReadTool = "teller_read_answers"
Answers = TellerModule + "_" + AnswersState
// Grants is the grants part's.
Grants = grantsstate.PartGrantsBucket
)