Files
mesh-delivery/modules/mesh-delivery-assigner/internal/buckets/buckets.go
T
jschoubben dc72860ce0 A2: the assigner pulls the seat mesh-wants' work queue and takes each ask once
A step ask put while the assigner was down waited for nobody: the plain
subscription heard only what came while it ran. The assigner now pulls every
waiting ask from the seat's one worker, takes it once by its id in its state
taken (for ask-taken-bound), says ask-taken at the pull, sends in-progress
while the step runs and acknowledges once the step's end is said. It serves
the seat's act drop: a running ask is cancelled, one not yet pulled is kept in
taken as dropped.<ask>; either ends its step could not run naming the drop.
assigner_asks reads what waits on the queue (stdio.QueueWaiting) and what is
taken or dropped; assigner_ask_drop ends one ask, written in the hand-act log.
The manifest declares taken, drop, the two tools, ask-taken-bound and the
kept-call pace as runtime settings.

Builds: design 47 H2 §777, §775, §778, §820; H-A-381, H-A-401, H-A-404, H-A-410
2026-11-22 01:05:07 +01:00

81 lines
4.7 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"
// 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"
// CompositionRunsState holds the composition runs, one key `<candidate key>.<machine>` per run and its bound keys
// `bound.<run key>` and `untaken.<run key>` (design 47 G §719, §720, A-470).
CompositionRunsState = "composition-runs"
// 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 PutWaits() string { return own(PutWaitsState) }
func Inputs() string { return own(InputsState) }
func CompositionRuns() string { return own(CompositionRunsState) }
func Policies() string { return own(PoliciesState) }
// Taken is the bucket of the state taken (design 47 H2 §775, §777): the asks of the seat mesh-wants taken once, and their
// drops; named as mesh-sdk's process.TakenState.
func Taken() string { return own("taken") }
// 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
// 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
)