H-A-335: a held module's share of a holder's words is what runs
The reads runtime on ace restarted twice in two minutes because its MESH_SECRET_PLACES changed: the holders of node-reads and node-files were told the node's secret places and owned paths from held modules' stubs, which differ pass by pass while a part is withheld. While a module is held, the resolution now takes its share from each runtime process as it runs: the secret places are those the modules not held compose merged with every place that runs, and the owned paths keep each running entry a held module owns. Two passes with the same held set compose every runtime process the same; a module that answered and changed is still composed from its build. Builds: design 47 H H-A-335, H-A-337, H-A-306 (2), (3)
This commit is contained in:
@@ -457,6 +457,39 @@ func RuntimeRunning(running []engcomp.Composed) map[string]string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RuntimesRunning is the environment of each runtime process as the node runs it, by its id: the tool runner's
|
||||
// (`<its module>.runtime`) and each runtime of a module of its own account (`<module>.own-runtime`), or nil when running
|
||||
// holds none (Node.RunsRuntimes).
|
||||
func RuntimesRunning(running []engcomp.Composed) map[string]map[string]string {
|
||||
var out map[string]map[string]string
|
||||
for _, c := range running {
|
||||
for _, raw := range c.Resources {
|
||||
var r struct {
|
||||
ID string `json:"id"`
|
||||
Module string `json:"module"`
|
||||
Type string `json:"type"`
|
||||
Env map[string]string `json:"env"`
|
||||
}
|
||||
if json.Unmarshal(raw, &r) != nil || r.Env == nil {
|
||||
continue
|
||||
}
|
||||
owner := r.Module
|
||||
if owner == "" {
|
||||
owner, _ = declaration.ModuleGuess(r.ID)
|
||||
}
|
||||
if runtimeOwner(r.ID, r.Module, r.Type) == "" && (r.Type != "process" || owner == "" ||
|
||||
r.ID != owner+"."+catalogue.OwnRuntimeID()) {
|
||||
continue
|
||||
}
|
||||
if out == nil {
|
||||
out = map[string]map[string]string{}
|
||||
}
|
||||
out[r.ID] = r.Env
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// runtimeOwner is the module of the tool runner's process a resource is (`<its module>.runtime`), or "" when it is none.
|
||||
func runtimeOwner(id, module, kind string) string {
|
||||
if kind != "process" {
|
||||
|
||||
Reference in New Issue
Block a user