diff --git a/internal/buckets/buckets.go b/internal/buckets/buckets.go index 0cfa161..7aa1075 100644 --- a/internal/buckets/buckets.go +++ b/internal/buckets/buckets.go @@ -5,12 +5,11 @@ 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" - catalogclient "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient" catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog" "git.novox.be/novox/mesh-sdk/go/keys" ) @@ -32,23 +31,27 @@ const HaveHistory = 20 // 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`, and each of its modules, `.`. - Placement = assigner.PlacementBucket + Placement = AssignerHolder + "_" + seat.StatePlacement // PlacementCandidates holds a node's candidate of a proposal, `.`. - PlacementCandidates = assigner.Module + "_" + seat.StateCandidates + PlacementCandidates = AssignerHolder + "_" + seat.StateCandidates // Wants holds what each node should run, `want..` and `want..node`. - Wants = assigner.Module + "_" + wants.StateWants + Wants = AssignerHolder + "_" + wants.StateWants + + // AssignerHolder is the module holding the seat mesh-module-assigner and the seat mesh-wants. + AssignerHolder = "mesh-delivery-assigner" ) // 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" + Modules = CatalogHolder + "_modules" + Manifests = CatalogHolder + "_manifests" + Verdicts = CatalogHolder + "_verdicts" + Candidates = CatalogHolder + "_candidates" - catalogHolder = catalogclient.Module + // 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` diff --git a/internal/buckets/buckets_test.go b/internal/buckets/buckets_test.go index d24750b..cedb16b 100644 --- a/internal/buckets/buckets_test.go +++ b/internal/buckets/buckets_test.go @@ -54,3 +54,18 @@ func TestACandidateKeyEscapesTheGroup(t *testing.T) { t.Error("a key was made for no group") } } + +// The holders' buckets are the names the grants part grants and the holders' manifests declare: no client carries a +// holder (ADR 0625 §4), so these rows are the one place the node-engine's code says them. +func TestTheHoldersBucketsAreTheirStatesBuckets(t *testing.T) { + for name, c := range map[string][2]string{ + "Placement": {Placement, "mesh-delivery-assigner_placement"}, "PlacementCandidates": {PlacementCandidates, "mesh-delivery-assigner_candidates"}, + "Wants": {Wants, "mesh-delivery-assigner_wants"}, "Modules": {Modules, "mesh-delivery-indexer_modules"}, + "Manifests": {Manifests, "mesh-delivery-indexer_manifests"}, "Verdicts": {Verdicts, "mesh-delivery-indexer_verdicts"}, + "Candidates": {Candidates, "mesh-delivery-indexer_candidates"}, + } { + if c[0] != c[1] { + t.Errorf("%s = %q, want %q", name, c[0], c[1]) + } + } +} diff --git a/internal/compose/frombus/states.go b/internal/compose/frombus/states.go index d59d302..0eb785d 100644 --- a/internal/compose/frombus/states.go +++ b/internal/compose/frombus/states.go @@ -12,6 +12,9 @@ import ( "crypto/sha256" "encoding/hex" "fmt" + "strings" + "time" + "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient" "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient" @@ -19,19 +22,18 @@ import ( "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient" "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" + "github.com/novox/mesh-host/internal/buckets" "github.com/novox/mesh-host/internal/compose" "github.com/novox/mesh-host/internal/compose/resolution" - "strings" - "time" ) // The states a module names in its manifest's `reads` to compose through StatesReader. const ( // The holders' names are kept here, in the engine's own code, as the names of the states a manifest's reads use // (ADR 0634 §1, finding F4); a seat's contract names a state locally, not the module that holds it. - PlacementRead = meshmoduleassignerclient.PlacementRead - ModulesRead = meshcatalogclient.ModulesRead - ManifestsRead = meshcatalogclient.ManifestsRead + PlacementRead = buckets.AssignerHolder + ".placement" + ModulesRead = buckets.CatalogHolder + ".modules" + ManifestsRead = buckets.CatalogHolder + ".manifests" BuildsRead = builds.BuilderModule + ".builds" HaveRead = "node-engine.have" ResolvedRead = "mesh-config.resolved"