Tell a bundle the kinds its membership names

This commit is contained in:
jochen
2026-10-09 10:12:39 +02:00
committed by jschoubben
parent 7b4428c510
commit c6087129ce
3 changed files with 28 additions and 1 deletions
+21
View File
@@ -31,6 +31,27 @@ type SeatTraffic struct {
Answers []string `json:"answers,omitempty"`
Workers []SeatWorker `json:"workers,omitempty"`
Records []string `json:"records,omitempty"`
// Kinds are the holders of every kinded bench the module uses or watches, with what each promises: the
// controller's record of their claims (novox/hq ADR 0259 §5).
Kinds []KindHeld `json:"kinds,omitempty"`
}
// KindHeld is one kind of a kinded bench and who holds it.
type KindHeld struct {
Seat string `json:"seat"`
Kind string `json:"kind"`
Module string `json:"module"`
Node string `json:"node"`
Capabilities []string `json:"capabilities,omitempty"`
}
// SeatKinds is the kinds the module's membership names, as the controller issued them.
func (c *Conn) SeatKinds(module string) ([]KindHeld, error) {
t, err := c.trafficOf(module)
if err != nil {
return nil, err
}
return append([]KindHeld{}, t.Kinds...), nil
}
// SeatWorker is one work queue a holder takes from.
+1 -1
View File
@@ -258,7 +258,7 @@ func Start(module, entry string, env []string, mesh Bus, logf func(string, ...an
subscriber = c
mu.Unlock()
err = mesh.Subscribe(deliver)
case "mesh/seat.publish", "mesh/seat.prove", "mesh/seat.record":
case "mesh/seat.publish", "mesh/seat.prove", "mesh/seat.record", "mesh/seat.kinds":
var answered json.RawMessage
if answered, err = mesh.Seat(strings.TrimPrefix(m.Method, "mesh/seat."), m.Params, nil); err == nil {
result = answered
+6
View File
@@ -717,6 +717,12 @@ func (b *moduleBus) Seat(verb string, params json.RawMessage, handOn func(string
return json.Marshal(map[string]any{"sequence": seq})
case "prove":
return conn.SeatProve(b.module, asked.Subject, asked.Body)
case "kinds":
kinds, err := conn.SeatKinds(b.module)
if err != nil {
return nil, err
}
return json.Marshal(kinds)
case "record":
entry, err := conn.SeatRecord(b.module, asked.Bucket, asked.Key)
if err != nil || entry == nil {