diff --git a/cmd/mesh-host/filling.go b/cmd/mesh-host/filling.go index c874f08..e508678 100644 --- a/cmd/mesh-host/filling.go +++ b/cmd/mesh-host/filling.go @@ -9,9 +9,9 @@ import ( "path/filepath" "sync/atomic" - provisions "git.novox.be/novox/mesh-contracts/provisioning/go/clients/meshprovisionerclient" "git.novox.be/novox/mesh-sdk/go/declaration" "github.com/novox/mesh-host/internal/apply" + "github.com/novox/mesh-host/internal/buckets" "github.com/novox/mesh-host/internal/filling" "github.com/novox/mesh-host/internal/link" "github.com/novox/mesh-host/internal/store" @@ -130,7 +130,7 @@ func provisionSecretsOn(queue *link.Session, node, statePath string) provisionSe p.list = func(ctx context.Context, prefix string) (map[string][]byte, error) { wctx, cancel := context.WithCancel(ctx) defer cancel() - updates, err := queue.KVWatch(wctx, provisions.ProvisionsBucket, prefix+">") + updates, err := queue.KVWatch(wctx, buckets.Provisions, prefix+">") if err != nil { return nil, err } @@ -141,7 +141,7 @@ func provisionSecretsOn(queue *link.Session, node, statePath string) provisionSe return nil, ctx.Err() case u, ok := <-updates: if !ok { - return nil, fmt.Errorf("the watch of %s ended before it caught up", provisions.ProvisionsBucket) + return nil, fmt.Errorf("the watch of %s ended before it caught up", buckets.Provisions) } switch { case u.Caught: diff --git a/cmd/mesh-host/provision_secrets.go b/cmd/mesh-host/provision_secrets.go index 8d77c21..6af67fb 100644 --- a/cmd/mesh-host/provision_secrets.go +++ b/cmd/mesh-host/provision_secrets.go @@ -10,6 +10,7 @@ import ( provisions "git.novox.be/novox/mesh-contracts/provisioning/go/clients/meshprovisionerclient" "git.novox.be/novox/mesh-sdk/go/catalogue" + "github.com/novox/mesh-host/internal/buckets" ) // provisionSecrets fills a provision's value into a file the provisioner's client hands the node-engine to write @@ -92,7 +93,7 @@ func byName(keys map[string][]byte, name string) (provisions.Provision, string, } switch len(hit) { case 0: - return provisions.Provision{}, "", fmt.Errorf("no provision of %s goes by that name: nothing asks for it", provisions.ProvisionsRead) + return provisions.Provision{}, "", fmt.Errorf("no provision of %s goes by that name: nothing asks for it", buckets.ProvisionsRead) case 1: return got, hit[0], nil } diff --git a/internal/buckets/buckets.go b/internal/buckets/buckets.go index 7aa1075..c83279d 100644 --- a/internal/buckets/buckets.go +++ b/internal/buckets/buckets.go @@ -41,6 +41,15 @@ const ( 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 diff --git a/internal/buckets/buckets_test.go b/internal/buckets/buckets_test.go index cedb16b..4700d39 100644 --- a/internal/buckets/buckets_test.go +++ b/internal/buckets/buckets_test.go @@ -62,7 +62,8 @@ func TestTheHoldersBucketsAreTheirStatesBuckets(t *testing.T) { "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"}, + "Candidates": {Candidates, "mesh-delivery-indexer_candidates"}, "Provisions": {Provisions, "mesh-provisioner_provisions"}, + "ProvisionsRead": {ProvisionsRead, "mesh-provisioner.provisions"}, } { if c[0] != c[1] { t.Errorf("%s = %q, want %q", name, c[0], c[1])