// 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" seat "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog" wants "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshwants" "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, `.`, and the node's own facts, `.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 assigner 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 ( // Assignments holds a node's assignments, `.node`, and each of its modules, `.`. Assignments = AssignerHolder + "_" + seat.StateAssignments // ProposalCandidates holds a node's candidate of a proposal, `.`. ProposalCandidates = AssignerHolder + "_" + seat.StateCandidates // Wants holds what each node should run, `want..` and `want..node`. Wants = AssignerHolder + "_" + wants.StateWants // AssignerHolder is the module holding the seat mesh-module-assigner and the seat mesh-wants. AssignerHolder = "mesh-delivery-assigner" ) // The state of the provisioner seat's holder that the engine reads, named by the holder's module (ADR 0634 §1, finding F4). const ( // ProvisionerHolder is the module holding the seat mesh-provisioner; Provisions its state provisions, which the engine // watches for the key of a provision it fills (`.>`), ProvisionsRead the name a manifest's reads gives it. ProvisionerHolder = "mesh-provisioner" Provisions = ProvisionerHolder + "_provisions" ProvisionsRead = ProvisionerHolder + ".provisions" ) // 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, ``; 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 is the module holding the seat mesh-catalog. 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, ``. 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" )