Carry each contribution, composed, and the consumer's address in its plan entry, and let a process read another module's state, so route-proxy serves routes from the seat's plans alone (issue 774, research 072 row 34)

This commit is contained in:
2026-10-31 09:27:26 +01:00
parent a320f8e2cd
commit a4e7629742
6 changed files with 121 additions and 5 deletions
+44
View File
@@ -134,6 +134,21 @@ type PlanProvision struct {
// alone knows the node's domains, and carried unchanged by the provider's helper into the consumer's entry. Nil
// where the consumer contributes nothing to the provision, and the entry is then as it was.
Names map[string]string `json:"names,omitempty"`
// Given is each contribution of the consumer to this provision as its provider receives it (issue 774, research
// 072 row 34: a route is a provision, served from the plans alone): settled with the node's settings, its
// endpoint's port filled in and its names composed, by the same composition a received file was written from.
// ConsumerAt is where the consumer's machine is on the private network, empty when it is not on one: a provider
// that reaches back to its consumer (a reverse proxy) is told it rather than deriving it from a node's name. Both
// are on the first entry of the provision alone, nil where the consumer contributes nothing to it.
Given []PlanGiven `json:"given,omitempty"`
ConsumerAt string `json:"consumer-at,omitempty"`
}
// PlanGiven is one contribution of a consumer to a provision, composed: Local is its local name among several
// (`contributes-many`), empty for the one of `contributes`.
type PlanGiven struct {
Local string `json:"local,omitempty"`
Values map[string]any `json:"values"`
}
// provisionsOf is, from a resolution's needs, each provision module requires and its provider, by provision then
@@ -603,6 +618,25 @@ type handedFiles struct {
// keyedOnly is each module with a plan only for what Keyed keys of a consumer not handed: a provision its
// provider's helper answers (issue 774), such as a route.
keyedOnly map[string]bool
// given is each handed module's contributions composed, by requirement, and at its machine's private name
// (PlanProvision.Given, issue 774).
given map[string]map[string][]PlanGiven
at map[string]string
}
// give records a handed module's contributions to one requirement, composed, and where its machine is.
func (h *handedFiles) give(module, provision, at string, given []PlanGiven) {
if len(given) == 0 {
return
}
if h.given == nil {
h.given, h.at = map[string]map[string][]PlanGiven{}, map[string]string{}
}
if h.given[module] == nil {
h.given[module] = map[string][]PlanGiven{}
}
h.given[module][provision] = given
h.at[module] = at
}
// keyed starts the plan of a module begin started none for, when the composition keys any of its needs as a consumer
@@ -830,6 +864,16 @@ func (h *handedFiles) finished(needs []Needed) map[string]Plan {
provisions[i].Names = maps.Clone(h.names[module][provisions[i].Provision])
}
sortProvisions(provisions)
// **What the consumer contributes, composed, on the provision's first entry** (issue 774): a provider serving
// from the plans alone reads each contribution once, however many local names the requirement has.
gave := map[string]bool{}
for i := range provisions {
if given := h.given[module][provisions[i].Provision]; len(given) > 0 && !gave[provisions[i].Provision] {
gave[provisions[i].Provision] = true
provisions[i].Given = slices.Clone(given)
provisions[i].ConsumerAt = h.at[module]
}
}
plan.Provisions = provisions
h.plans[module] = plan
}