diff --git a/go/seats/meshmoduleassigner/contract.go b/go/seats/meshmoduleassigner/contract.go index 2451180..e8a5beb 100644 --- a/go/seats/meshmoduleassigner/contract.go +++ b/go/seats/meshmoduleassigner/contract.go @@ -20,6 +20,7 @@ const ( VerbPropose = "propose" VerbWithdraw = "withdraw" VerbAgain = "again" + VerbPlacement = "placement" ) const ( @@ -31,7 +32,7 @@ const ( // Verbs is every verb the seat serves, in its definition's order: a new copy each call. func Verbs() []string { - return []string{VerbAssignments, VerbProposals, VerbPropose, VerbWithdraw, VerbAgain} + return []string{VerbAssignments, VerbProposals, VerbPropose, VerbWithdraw, VerbAgain, VerbPlacement} } // Events is every event published on the seat's subject: a new copy each call. @@ -401,6 +402,12 @@ type Holding struct { Site string `json:"site,omitempty"` } +// ModulePlacement is the nodes that run a module from one watched branch. +type ModulePlacement struct { + Branch string `json:"branch"` + Nodes []string `json:"nodes"` +} + // NodeDecided is what a person decides of a node; no secret and no key material. type NodeDecided struct { Account string `json:"account,omitempty"` @@ -624,6 +631,18 @@ type AgainInput struct { // AgainAnswer is what again answers. type AgainAnswer = map[string]any +// PlacementInput is what placement takes. +type PlacementInput struct { + // the module + Module string `json:"module"` +} + +// PlacementAnswer is what placement answers. +type PlacementAnswer struct { + // one per branch, the nodes that run the module from it + Placements []ModulePlacement `json:"placements"` +} + // AssignmentsProposedEvent is the body of the event assignments-proposed. type AssignmentsProposedEvent = AssignmentsEvent diff --git a/seats/mesh-module-assigner/seat.json b/seats/mesh-module-assigner/seat.json index 247f86b..09eb93b 100644 --- a/seats/mesh-module-assigner/seat.json +++ b/seats/mesh-module-assigner/seat.json @@ -154,6 +154,39 @@ "type": "object", "description": "what was judged or asked again" } + }, + { + "name": "placement", + "description": "Read the placements of one module as the assignments rows hold them: for each watched branch a node runs it from, the nodes that run it from there.", + "optional": true, + "input": { + "properties": { + "module": { + "description": "the module", + "type": "string" + } + }, + "required": [ + "module" + ], + "type": "object" + }, + "answer": { + "properties": { + "placements": { + "type": "array", + "items": { + "$ref": "#/defs/ModulePlacement" + }, + "description": "one per branch, the nodes that run the module from it" + } + }, + "required": [ + "placements" + ], + "type": "object" + }, + "class": "read" } ], "events": [ @@ -1009,6 +1042,25 @@ "scope", "holders" ] + }, + "ModulePlacement": { + "type": "object", + "description": "the nodes that run a module from one watched branch", + "properties": { + "branch": { + "type": "string" + }, + "nodes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "branch", + "nodes" + ] } } } diff --git a/ts/seats/meshmoduleassigner/index.d.ts b/ts/seats/meshmoduleassigner/index.d.ts index b0f6280..44beeef 100644 --- a/ts/seats/meshmoduleassigner/index.d.ts +++ b/ts/seats/meshmoduleassigner/index.d.ts @@ -10,6 +10,7 @@ export declare const verbs: { readonly propose: "propose"; readonly withdraw: "withdraw"; readonly again: "again"; + readonly placement: "placement"; }; export declare const events: { @@ -143,6 +144,12 @@ export interface Holding { "site"?: string; } +/** the nodes that run a module from one watched branch */ +export interface ModulePlacement { + "branch": string; + "nodes": string[]; +} + /** what a person decides of a node; no secret and no key material */ export interface NodeDecided { "account"?: string; @@ -353,6 +360,18 @@ export interface AgainInput { /** is what again answers. */ export type AgainAnswer = Record; +/** is what placement takes. */ +export interface PlacementInput { + /** the module */ + "module": string; +} + +/** is what placement answers. */ +export interface PlacementAnswer { + /** one per branch, the nodes that run the module from it */ + "placements": ModulePlacement[]; +} + /** is the body of the event assignments-proposed. */ export type AssignmentsProposedEvent = AssignmentsEvent; diff --git a/ts/seats/meshmoduleassigner/index.js b/ts/seats/meshmoduleassigner/index.js index 654af67..32f20bf 100644 --- a/ts/seats/meshmoduleassigner/index.js +++ b/ts/seats/meshmoduleassigner/index.js @@ -10,6 +10,7 @@ export const verbs = { propose: "propose", withdraw: "withdraw", again: "again", + placement: "placement", }; export const events = {