Files
mesh-delivery/modules/mesh-delivery-view/internal/view/names.go
T
jschoubben da8384d10e VW5: the view takes each watched branch's source from the gate's verb source, per branch
The view read the gate's state source and its history, fixed to the branch main. Each watched branch's source is now
the seat mesh-delivery's verb source given that branch, asked again on its source-moved; the source row and the event
delivered are per branch, a repository's reach is from the source of its modules' registration's first branch, laid
over the reach the view's own state kept at its start, and view_tiers given no revision answers per branch. The
manifest drops its read of mesh-delivery-gate.source and names the source answer's fields it relies on.

Builds: design 47 G §507, §512, §532, §558, A-173, A-225

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:21:49 +01:00

91 lines
3.8 KiB
Go

package view
import (
"fmt"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/trunk"
"git.novox.be/novox/mesh-sdk/go/keys"
)
// The holders, states and buckets the view names, taken from its own manifest (module.json: its `reads`, `invokes` and
// `consumes`); a unit row checks them against it (TestTheNamesAreTheManifests). No contract names a holder (novox/hq
// ADR 0625 §4, ADR 0634 §1). The indexer's module and its reads are the catalog client's.
const (
IndexerModule = "mesh-delivery-indexer"
AssignerModule = "mesh-delivery-assigner"
// ProvisionsRead is the seat mesh-provisioner's state provisions, as the manifest's `reads` names it.
ProvisionsRead = "mesh-provisioner.provisions"
WatchmanModule = "mesh-delivery-watchman"
GateModule = "mesh-delivery-gate"
TellerModule = "mesh-delivery-teller"
VaultModule = "mesh-vault"
EngineModule = "node-engine"
// The indexer's states the view reads.
CandidatesBucket = IndexerModule + "_candidates"
TakenBucket = IndexerModule + "_taken"
PackagesState = "packages"
PackagesBucket = IndexerModule + "_" + PackagesState
// IndexerPredefinedState and IndexerConfigCandidatesState are the indexer's states of the foundation's predefined list
// and of the config candidates; PredefinedListKey is the one key of the first.
IndexerPredefinedState = "predefined"
PredefinedListKey = "list"
IndexerConfigCandidatesState = "config-candidates"
// The assigner's states.
AssignmentsState = "assignments"
AssignmentsBucket = AssignerModule + "_" + AssignmentsState
AssignerWantsBucket = AssignerModule + "_wants"
AssignerAsksBucket = AssignerModule + "_asks"
// SourceBucket names, in the model's entries, each watched branch's source as the seat mesh-delivery's verb source answers
// it, keyed by the escaped branch (design 47 G §507, A-173): never a bucket the view reads. The teller's state answers as
// the view follows it by its views family (design 47 G §431, A-175): its picture `<owner>_<state>`.
SourceBucket = GateModule + "_source"
AnswersState = "answers"
AnswersBucket = TellerModule + "_" + AnswersState
// The watchman's and the node-engine's states.
PresenceBucket = WatchmanModule + "_presence"
StuckBucket = WatchmanModule + "_stuck"
HaveBucket = EngineModule + "_have"
// StepsState is the state of steps each build module keeps (reads: mesh-build-<language>.steps), whose pauses are buildstep's.
StepsState = "steps"
// The revisions each of those states keeps per key.
AnswersHistory = 5
AssignerAsksHistory = 5
// SignersRead is the vault's state of signing keys as a manifest's `reads` names it, SignersKeyKey its one key.
SignersRead = VaultModule + ".signers"
SignersKeyKey = "key"
)
// CandidatesKey is the key, in the indexer's candidates, of a group: the group name as a key part. ParseCandidatesKey is its inverse.
func CandidatesKey(group string) (string, error) {
if group == "" {
return "", fmt.Errorf("view: the group name is empty")
}
return keys.EscapeName(group), nil
}
// ParseCandidatesKey is the inverse of CandidatesKey.
func ParseCandidatesKey(key string) (string, error) {
group, err := keys.UnescapeName(key)
if err != nil || group == "" {
return "", fmt.Errorf("view: %q is not a candidates key: %v", key, err)
}
return group, nil
}
// PackagesKey is the key, in the indexer's packages, of a mesh Go module (its module path): the path as a key part. It refuses
// a path that is no mesh Go module's.
func PackagesKey(module string) (string, error) {
if _, _, ok := trunk.PackageRepository(module); !ok {
return "", fmt.Errorf("view: %q is no mesh Go module's path", module)
}
return meshcatalog.PackagesByModuleKey(keys.EscapeName(module)), nil
}