mesh/delivery-group group feat/sdk1 rejected: composed together: the checker's verdict at the members' heads (428d048dd50a): unit: git.novox.be/novox/mesh-sdk/…
mesh/delivery closed: a newer head of the same pull request
mesh/check failed: unit: git.novox.be/novox/mesh-sdk/go/process.TestStatePutWritesAKeyWhole: a Put through a short blackout: 0, mesh-mail's state send…
Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
58 lines
2.4 KiB
Go
58 lines
2.4 KiB
Go
package catalogue
|
|
|
|
// Merge is how a file's content is combined with settings. A module names one per resource.
|
|
const (
|
|
// MergeJSON treats the content as a JSON document and merges settings into it by key.
|
|
MergeJSON = "json"
|
|
)
|
|
|
|
// Layer is one source of settings, in the order they are applied.
|
|
type Layer struct {
|
|
// Where these came from, for saying which layer set a value.
|
|
From string
|
|
Values map[string]any
|
|
// Default marks the layer a module's own defaults make (novox/hq ADR 0262). Marked rather than
|
|
// recognised by From, which is a node's name for a node's layer, and a node may be called anything.
|
|
Default bool
|
|
// Placement is the assignment's placement at this layer's scope — `places`, `accesses`, `networks`,
|
|
// `endpoints`, `expose`, `reach`, `ports` — which the controller holds apart from settings (novox/hq
|
|
// ADR 0348 clause 11, issues 651 and 736): read by their readers only, and never from Values. LayerOf
|
|
// splits a layer as a person says it into the two.
|
|
Placement map[string]any
|
|
}
|
|
|
|
// ServedSettings is every key a module's served values and its zone's name fill from its settings (`${setting:<key>}`
|
|
// in a top-level string, as Settle fills them), sorted: what every consumer of the module is told, wherever it runs,
|
|
// and so the one part of a module's config values on its node that a node composing a consumer elsewhere reads (issue
|
|
// 1126). None for a module that serves only literals.
|
|
func ServedSettings(m Manifest) []string {
|
|
seen := map[string]bool{}
|
|
note := func(v any) {
|
|
if s, ok := v.(string); ok {
|
|
for _, k := range settingsUsed(s) {
|
|
seen[k] = true
|
|
}
|
|
}
|
|
}
|
|
for _, values := range m.Serves {
|
|
for _, v := range values {
|
|
note(v)
|
|
}
|
|
}
|
|
if m.Zone != nil {
|
|
note(m.Zone.Name)
|
|
}
|
|
return sortedKeys(seen)
|
|
}
|
|
|
|
// NetworksSetting is the settings key that keeps a found network for a taken container, on one
|
|
// adopted machine (novox/hq ADR 0163, rule 4):
|
|
//
|
|
// {"networks": {"server": ["predecessor_default"]}}
|
|
//
|
|
// has the module's container `server` also join `predecessor_default` once taken, so a neighbour
|
|
// that resolves it by name on that network keeps resolving it. Migration scaffolding in the sense
|
|
// of ADR 0104: assigned only on an adopted machine, reported while it stands, removed when the
|
|
// neighbours are taken. Keyed by the container's resource id; the value is the networks it keeps.
|
|
const NetworksSetting = "networks"
|