Merge branch 'feat/47-G-fix11-a3h' into feat/47-G-join11
# Conflicts: # node-tools/internal/runtime/runtime.go
This commit is contained in:
@@ -19,6 +19,8 @@ type Gate interface {
|
||||
Unserved(module, fingerprint string, registered []string) []string
|
||||
// Run is a call through the gate: run is called only when the call may run now, once.
|
||||
Run(call approval.Call, run func() (any, error)) (any, error)
|
||||
// Approvals is the seat verb `approvals` for a caller: the calls the gate holds, its acts and claims (A-265, A-271).
|
||||
Approvals(caller string) (approval.Approvals, error)
|
||||
}
|
||||
|
||||
// gatedRun is how a handler calls a tool: through the gate where there is one.
|
||||
@@ -33,6 +35,14 @@ func (c *consumers) gated(call approval.Call, t launch.Tool, caller string) (any
|
||||
return c.gate.Run(call, run)
|
||||
}
|
||||
|
||||
// approvalsOf is how the runner answers a held seat's verb `approvals`: from its gate's record, nil without a gate.
|
||||
func (r *runner) approvalsOf() func(caller string) (any, error) {
|
||||
if r.events.gate == nil {
|
||||
return nil
|
||||
}
|
||||
return func(caller string) (any, error) { return r.events.gate.Approvals(caller) }
|
||||
}
|
||||
|
||||
// WithGate serves every call through the approval gate.
|
||||
func WithGate(g Gate) Option { return func(c *consumers) { c.gate = g } }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user