From 15f0888b4f23b17bbb1bad973c0652b7d23f15f7 Mon Sep 17 00:00:00 2001 From: mesh-tools Date: Tue, 20 Oct 2026 11:13:51 +0000 Subject: [PATCH] stage 4 of 8 for issue 1389 --- cmd/mesh-controller/plan.go | 519 +----------------------------------- 1 file changed, 1 insertion(+), 518 deletions(-) diff --git a/cmd/mesh-controller/plan.go b/cmd/mesh-controller/plan.go index 40e34796..3813d03b 100644 --- a/cmd/mesh-controller/plan.go +++ b/cmd/mesh-controller/plan.go @@ -15,11 +15,8 @@ import ( "sync" "git.novox.be/novox/mesh-sdk/go/catalogue" - "git.novox.be/novox/mesh-sdk/go/overlay" "github.com/novox/mesh-controller/internal/broker" - "github.com/novox/mesh-controller/internal/chain" "github.com/novox/mesh-controller/internal/inventory" - "github.com/novox/mesh-controller/internal/licences" "github.com/novox/mesh-controller/internal/link" ) @@ -55,339 +52,6 @@ func unresolvable(err error) bool { return errors.As(err, &n) } -// planFor works out everything a node should run, from what was assigned to it. -// -// A failure to compose the node's own modules is wrapped as notResolvable; every other failure is -// returned as it is. Callers gathering across the mesh must tell them apart — see notResolvable. -func planFor(ctx context.Context, open *stores, nodeName string) (catalogue.Resolution, catalogue.SettingsBy, error) { - inv := open.inventory - shelf, err := inv.Catalogue(ctx) - if err != nil { - return catalogue.Resolution{}, nil, err - } - assigned, err := inv.Assigned(ctx, nodeName) - if err != nil { - return catalogue.Resolution{}, nil, err - } - capabilities, err := inv.ProfileOf(ctx, nodeName) - if err != nil { - return catalogue.Resolution{}, nil, err - } - - places, err := inv.Overlays(ctx) - if err != nil { - return catalogue.Resolution{}, nil, err - } - var site string - for _, p := range places { - if p.Name == nodeName { - site = p.Site - } - } - - world, err := theRestOfTheMesh(ctx, inv, shelf, nodeName) - if err != nil { - return catalogue.Resolution{}, nil, err - } - world.Pinned, err = inv.PinsFor(ctx, nodeName) - if err != nil { - return catalogue.Resolution{}, nil, err - } - // Where each of its consumers of a provision that keeps data was last sent (novox/hq ADR 0232): - // a resolution that would answer one from anywhere else keeps it there, and says so. - world.Bound, err = inv.BindingsFor(ctx, nodeName) - if err != nil { - return catalogue.Resolution{}, nil, err - } - - onNetwork, err := whereEveryoneIs(ctx, inv, shelf) - if err != nil { - return catalogue.Resolution{}, nil, err - } - - // What this mesh can answer with a record rather than a machine, and which record each of - // this node's modules was put on. Read across a context boundary by name, which is what - // crossing one is allowed to carry (novox/hq ADR 0008). - world.Licences, world.Using, err = licencesFor(ctx, open, nodeName) - if err != nil { - return catalogue.Resolution{}, nil, err - } - - // The domain this node composes its routed names under (novox/hq ADR 0066). A route - // contribution carries only a label; the resolver joins