SD-M2b: mesh-broker's events carry the binding and the verdict's revision (the lead's ruling, 12:4x)

The binding a module receives is one named type, Binding, the provision's form and each event's binding.

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
2026-11-04 12:35:30 +01:00
parent e9c97f9e9f
commit f3a9cd17d6
3 changed files with 70 additions and 48 deletions
+17 -11
View File
@@ -73,6 +73,18 @@ const SubjectRecreated = "mesh.seat.mesh-broker.event.recreated"
// SubjectDropped is where dropped is published.
const SubjectDropped = "mesh.seat.mesh-broker.event.dropped"
// Binding is the binding a module receives in its membership for one entry (ADR 0595 §1, §7).
type Binding struct {
// the entry's name on the bus
BusName string `json:"bus-name"`
// how the bus keeps it
StorageType string `json:"storage-type"`
// its subjects, for a stream
Subjects []string `json:"subjects,omitempty"`
// its template
Template string `json:"template,omitempty"`
}
// Entry is one piece of bus state as a manifest asks it.
type Entry struct {
// its own configuration, where no template fits
@@ -131,7 +143,8 @@ type Named struct {
// Said is the body of every event of the seat.
type Said struct {
// the settings asked
Asked map[string]any `json:"asked,omitempty"`
Asked map[string]any `json:"asked,omitempty"`
Binding *Binding `json:"binding,omitempty"`
// its name on the bus
BusName string `json:"bus-name"`
// its own configuration, where no template fits
@@ -145,6 +158,8 @@ type Said struct {
Module string `json:"module"`
// the template's options the module set, within their bounds
Options map[string]any `json:"options,omitempty"`
// the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears
Revision int64 `json:"revision,omitempty"`
// the stream snapshot taken before a recreate or drop
Snapshot string `json:"snapshot,omitempty"`
// how the bus keeps it
@@ -278,13 +293,4 @@ type RecreatedEvent = Said
type DroppedEvent = Said
// BusStateForm is the form of the provision bus-state.
type BusStateForm struct {
// the entry's name on the bus
BusName string `json:"bus-name"`
// how the bus keeps it
StorageType string `json:"storage-type"`
// its subjects, for a stream
Subjects []string `json:"subjects,omitempty"`
// its template
Template string `json:"template,omitempty"`
}
type BusStateForm = Binding
+37 -27
View File
@@ -258,33 +258,7 @@
{
"name": "bus-state",
"form": {
"type": "object",
"properties": {
"bus-name": {
"type": "string",
"description": "the entry's name on the bus"
},
"storage-type": {
"type": "string",
"description": "how the bus keeps it"
},
"template": {
"type": "string",
"description": "its template"
},
"subjects": {
"type": "array",
"items": {
"type": "string"
},
"description": "its subjects, for a stream"
}
},
"required": [
"bus-name",
"storage-type"
],
"description": "the binding a module receives in its membership for one entry (ADR 0595 §1, §7)"
"$ref": "#/defs/Binding"
}
}
],
@@ -487,6 +461,13 @@
"snapshot": {
"type": "string",
"description": "the stream snapshot taken before a recreate or drop"
},
"binding": {
"$ref": "#/defs/Binding"
},
"revision": {
"type": "integer",
"description": "the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears"
}
},
"required": [
@@ -539,6 +520,35 @@
"warrant",
"why"
]
},
"Binding": {
"type": "object",
"properties": {
"bus-name": {
"type": "string",
"description": "the entry's name on the bus"
},
"storage-type": {
"type": "string",
"description": "how the bus keeps it"
},
"template": {
"type": "string",
"description": "its template"
},
"subjects": {
"type": "array",
"items": {
"type": "string"
},
"description": "its subjects, for a stream"
}
},
"required": [
"bus-name",
"storage-type"
],
"description": "the binding a module receives in its membership for one entry (ADR 0595 §1, §7)"
}
}
}
+16 -10
View File
@@ -47,6 +47,18 @@ export const recreatedSubject = "mesh.seat.mesh-broker.event.recreated";
export const droppedSubject = "mesh.seat.mesh-broker.event.dropped";
/** the binding a module receives in its membership for one entry (ADR 0595 §1, §7) */
export interface Binding {
/** the entry's name on the bus */
"bus-name": string;
/** how the bus keeps it */
"storage-type": string;
/** its subjects, for a stream */
"subjects"?: string[];
/** its template */
"template"?: string;
}
/** one piece of bus state as a manifest asks it */
export interface Entry {
/** its own configuration, where no template fits */
@@ -104,6 +116,7 @@ export interface Named {
export interface Said {
/** the settings asked */
"asked"?: Record<string, unknown>;
"binding"?: Binding;
/** its name on the bus */
"bus-name": string;
/** its own configuration, where no template fits */
@@ -117,6 +130,8 @@ export interface Said {
"module": string;
/** the template's options the module set, within their bounds */
"options"?: Record<string, unknown>;
/** the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears */
"revision"?: number;
/** the stream snapshot taken before a recreate or drop */
"snapshot"?: string;
/** how the bus keeps it */
@@ -248,14 +263,5 @@ export type RecreatedEvent = Said;
export type DroppedEvent = Said;
/** is the form of the provision bus-state. */
export interface BusStateForm {
/** the entry's name on the bus */
"bus-name": string;
/** how the bus keeps it */
"storage-type": string;
/** its subjects, for a stream */
"subjects"?: string[];
/** its template */
"template"?: string;
}
export type BusStateForm = Binding;