E5: answer the node-engine seat's composition-diff
The node-engine serves seat verbs and no tools bundle, so composed values read by resource are a read verb beside composition: per resource, the entries that differ between what runs and a revision or digest of its composition key, environment entries by name, a secret's value masked. Builds: design 47 H2 §813 (3); H-A-349 DQ-12b
This commit is contained in:
@@ -44,6 +44,9 @@ const (
|
||||
ActSetuidSearch = nodeengine.VerbSetuidSearch
|
||||
// ActComposition reads a module's composition beside what runs of it; read-only, no warrant (issue 774).
|
||||
ActComposition = nodeengine.VerbComposition
|
||||
// ActCompositionDiff reads a module's running composition beside another revision of it, by resource; read-only (design
|
||||
// 47 H2 §813 (3)).
|
||||
ActCompositionDiff = nodeengine.VerbCompositionDiff
|
||||
// ActCompose composes the node now, the recovery of a failed composition (issue 774).
|
||||
ActCompose = nodeengine.VerbCompose
|
||||
// ActPackages reads the packages this node's compositions declare, and with write writes its key again (novox/hq
|
||||
@@ -163,6 +166,9 @@ type HandActs struct {
|
||||
// Composition reads one module's composition beside what runs of it, read-only (the verb composition, issue 774):
|
||||
// the latest of its want's build or the one whose digest is given, and with diff the resources that differ.
|
||||
Composition func(module, digest string, diff bool) (any, error)
|
||||
// CompositionDiff answers the verb composition-diff: the entries that differ per resource between the module's running
|
||||
// composition and the revision or digest given (design 47 H2 §813 (3)).
|
||||
CompositionDiff func(module string, revision int64, digest string) (any, error)
|
||||
// Compose makes a pass of the node's composition now and says how it went; with module, its apply is also tried
|
||||
// again (the verb compose, issue 774).
|
||||
Compose func(module string) (any, error)
|
||||
@@ -248,6 +254,20 @@ func (h *HandActs) Call(c EngineCall) (any, error) {
|
||||
diff = b
|
||||
}
|
||||
return h.Composition(arg("module"), arg("digest"), diff)
|
||||
case ActCompositionDiff:
|
||||
if h.CompositionDiff == nil {
|
||||
return nil, errors.New("this engine reads no composition yet: its node agent has not started")
|
||||
}
|
||||
var revision int64
|
||||
switch r := c.Args["revision"].(type) {
|
||||
case float64:
|
||||
revision = int64(r)
|
||||
case int64:
|
||||
revision = r
|
||||
case int:
|
||||
revision = int64(r)
|
||||
}
|
||||
return h.CompositionDiff(arg("module"), revision, arg("digest"))
|
||||
case ActCompose:
|
||||
if h.Compose == nil {
|
||||
return nil, errors.New("this engine composes nothing on a call yet: its node agent has not started")
|
||||
|
||||
Reference in New Issue
Block a user