Join 9: claude-code adopts its licence binding's first view through its views reader (A-134)
The manager says binding.changed.<consumer>: the module's views reader hears it by the adoption and asks the first view (FirstBinding) once its subscription is taken, instead of a subscription of the exact subject of its own. Builds: design 47 G A-134 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -18,6 +18,7 @@ package main
|
||||
// every node, `<node>.<server>` for one — which every node watches.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
@@ -30,6 +31,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/views"
|
||||
)
|
||||
|
||||
// Seat is the licence manager's role, and Manager the module whose events this one consumes.
|
||||
@@ -481,7 +484,25 @@ func fetched(p Paths, b *BindingState, ask Ask, write WriteManaged) (string, err
|
||||
|
||||
// BindingChanged is the manager's event of a binding written or deleted (design 39 bus-and-switch §21), which this
|
||||
// module consumes (§22).
|
||||
const BindingChanged = Manager + ".binding.changed"
|
||||
const BindingChanged = Manager + "." + BindingChangedEvent
|
||||
|
||||
// BindingChangedEvent is that event's name as the manager says it, with the consumer as its further part
|
||||
// (`binding.changed.<consumer>`, design 47 G A-134).
|
||||
const BindingChangedEvent = "binding.changed"
|
||||
|
||||
// bindingsFollower is this node's first view of its licence binding, adopted by the module's views reader (A-134): its
|
||||
// ask is FirstBinding, whose outcome goes to applied; the picture keeps no binding, which the node's own files hold.
|
||||
func bindingsFollower(p Paths, ask Ask, write WriteManaged, applied func(string, error)) *views.Follower {
|
||||
return &views.Follower{Owner: Manager, Tool: SeatVerb("bindings"), State: "bindings",
|
||||
Ask: func(context.Context, string) (views.Answer, error) {
|
||||
done, err := FirstBinding(p, ask, write)
|
||||
if err != nil {
|
||||
return views.Answer{}, err
|
||||
}
|
||||
applied(done, nil)
|
||||
return views.Answer{Owner: Manager, State: "bindings", Values: map[string]json.RawMessage{}, At: time.Now()}, nil
|
||||
}}
|
||||
}
|
||||
|
||||
// bindingOf is a consumer's binding as the manager says it, in binding.changed and in the verb bindings' answer: an
|
||||
// empty licence is a release (B22: decoded from a copy of the writer's form, testdata/binding-changed.json).
|
||||
|
||||
Reference in New Issue
Block a user