73 lines
3.4 KiB
Go
73 lines
3.4 KiB
Go
// Package buckets holds the names of the bus buckets the node-engine reads and writes, and how many revisions it keeps of
|
|
// each. A contract carries the local name of a state, not the module that holds it (ADR 0625 §4, §7); the node-engine
|
|
// reads through grants composed in code, so the holder's name is kept here, in its own code (ADR 0634 §1, finding F4).
|
|
package buckets
|
|
|
|
import (
|
|
"errors"
|
|
vault "git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshvault"
|
|
|
|
assigner "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient"
|
|
seat "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
|
|
wants "git.novox.be/novox/mesh-contracts/placement/go/seats/meshwants"
|
|
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
|
"git.novox.be/novox/mesh-sdk/go/keys"
|
|
)
|
|
|
|
// The node-engine's own states and the have state, written by every node's engine for its own keys.
|
|
const (
|
|
// Have holds a module's have on a node, `<node>.<module>`, and the node's own facts, `<node>.node`.
|
|
Have = "node-engine_have"
|
|
// Data holds a module's data items on a node.
|
|
Data = "mesh-host_data"
|
|
// Health holds a node's own health report.
|
|
Health = "mesh-host_health"
|
|
)
|
|
|
|
// HaveHistory is the number of revisions the have bucket keeps per key.
|
|
const HaveHistory = 20
|
|
|
|
// The states of the placement seat's holder and of the wants seat's holder that the engine reads, named by the holder's
|
|
// module as every state is (ADR 0634 §1, finding F4: the holder's name is kept here, in the engine's code).
|
|
const (
|
|
// Placement holds a node's placement, `<node>.node`, and each of its modules, `<node>.<module>`.
|
|
Placement = assigner.PlacementBucket
|
|
// PlacementCandidates holds a node's candidate of a proposal, `<proposal>.<node>`.
|
|
PlacementCandidates = assigner.Module + "_" + seat.StateCandidates
|
|
// Wants holds what each node should run, `want.<node>.<module>` and `want.<node>.node`.
|
|
Wants = assigner.Module + "_" + wants.StateWants
|
|
)
|
|
|
|
// The states of the catalogue seat's holder that the engine reads, named by the holder's module (ADR 0634 §1, finding F4).
|
|
const (
|
|
// Modules holds a module's source, `<module>`; Manifests a manifest by its digest; Verdicts the judge's verdict of a
|
|
// manifest by its digest; Candidates a group's candidate, by the group's key part (CandidateKey).
|
|
Modules = catalogHolder + "_modules"
|
|
Manifests = catalogHolder + "_manifests"
|
|
Verdicts = catalogHolder + "_verdicts"
|
|
Candidates = catalogHolder + "_candidates"
|
|
|
|
catalogHolder = "mesh-delivery-indexer"
|
|
)
|
|
|
|
// CandidateKey is the key of a group's candidate in Candidates: the group as a key part, a branch such as `fix/1.2`
|
|
// escaped so it keys.
|
|
func CandidateKey(group string) (string, error) {
|
|
if group == "" {
|
|
return "", errors.New("buckets: the group name is empty")
|
|
}
|
|
return catalog.CandidatesByGroupKey(keys.EscapeName(group)), nil
|
|
}
|
|
|
|
// The states of the vault seat's holder that the engine reads, named by the holder's module (ADR 0634 §1, finding F4).
|
|
const (
|
|
// Signers holds the vault's public signing halves; NodeLogins each node's logins, `<node>`.
|
|
Signers = vaultHolder + "_" + vault.StateSigners
|
|
NodeLogins = vaultHolder + "_" + vault.StateNodeLogins
|
|
// SignersRead and NodeLoginsRead are the states as a manifest's reads names them.
|
|
SignersRead = vaultHolder + "." + vault.StateSigners
|
|
NodeLoginsRead = vaultHolder + "." + vault.StateNodeLogins
|
|
|
|
vaultHolder = "mesh-vault"
|
|
)
|