Files
mesh-delivery/sdk/graph/entry.go
T
jschoubben 7a7b504836 W5.10 (base): the module graph's node of a catalog entry is read in the domain SDK's graph, for every reader of the catalog half
graph.NodeOf moves from the indexer's own package to sdk/graph, since the assigner reads its verb edges from the catalog
half too (a second reader).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §47 to §50, §121, §122, §378
2026-11-11 14:36:24 +01:00

27 lines
1013 B
Go

package graph
import (
"maps"
"slices"
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
)
// NodeOf is the node of the module graph a catalog graph entry carries, as the indexer took it in (design 47, *Two
// graphs*): the catalog half's holder reads its graph back from its newest trunk revision, and every part that reads the
// catalog half reads the module graph from its entries, never from the holder's state.
func NodeOf(e meshcatalog.CatalogEntry) Node {
n := Node{V: Version, FP: e.Fp, None: e.None, Repository: e.Repository, Path: e.Path, Bases: e.Bases,
Provides: e.Provides, Requires: e.Requires, Awaits: e.Awaits, Invokes: e.Invokes, Serves: e.Serves, LeftOut: e.LeftOut}
if len(e.Packages) > 0 {
n.Packages = slices.Sorted(maps.Keys(e.Packages))
}
for language, t := range e.Toolchains {
if n.Toolchains == nil {
n.Toolchains = map[string]Toolchain{}
}
n.Toolchains[language] = Toolchain{Module: t.Module, Version: t.Version, Recipe: t.Recipe}
}
return n
}