C6: the watchdogs seat declares presence's answer: with machine, that machine's online and since; without, the keys of the state presence (issue 1966, ADR 0596 §2, ADR 0668 §3; review round 3, finding 1)
The builder and the indexer ask whether a node's machine is heard through this verb instead of reading the watchman's state; regenerated with seatgen, whose -check names nothing new. Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -202,8 +202,31 @@ type PresenceInput struct {
|
||||
Machine string `json:"machine,omitempty"`
|
||||
}
|
||||
|
||||
// PresenceAnswerKeysItem is a type of the contract.
|
||||
type PresenceAnswerKeysItem struct {
|
||||
// <node> or part.<part>.<instance>
|
||||
Key string `json:"key"`
|
||||
// the key's revision
|
||||
Revision int64 `json:"revision,omitempty"`
|
||||
// the key's value, online and its layout's version
|
||||
Value map[string]any `json:"value"`
|
||||
}
|
||||
|
||||
// PresenceAnswer is what presence answers.
|
||||
type PresenceAnswer = map[string]any
|
||||
type PresenceAnswer struct {
|
||||
// without machine: how many keys the state holds
|
||||
Holds int64 `json:"holds,omitempty"`
|
||||
// without machine: each key of the state presence, <node> or part.<part>.<instance>, with its value
|
||||
Keys []PresenceAnswerKeysItem `json:"keys,omitempty"`
|
||||
// the machine asked, with machine
|
||||
Machine string `json:"machine,omitempty"`
|
||||
// with machine: whether the watchman hears the machine now; false for a machine it holds no word of
|
||||
Online bool `json:"online,omitempty"`
|
||||
// with machine: when its presence last changed, RFC 3339; empty for a machine the watchman holds no word of
|
||||
Since string `json:"since,omitempty"`
|
||||
// without machine: the state read, presence
|
||||
State string `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
// DeadLettersInput is what dead-letters takes.
|
||||
type DeadLettersInput struct {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
},
|
||||
{
|
||||
"name": "presence",
|
||||
"description": "Every machine and tool runner the watchman sees connected, with its last word, and those it says silent; a machine that said it sleeps is shown as sleeping, not silent.",
|
||||
"description": "Every machine and tool runner the watchman sees connected, with its last word, and those it says silent; a machine that said it sleeps is shown as sleeping, not silent. With machine, that machine's presence alone: whether the watchman hears it and since when.",
|
||||
"input": {
|
||||
"properties": {
|
||||
"machine": {
|
||||
@@ -55,7 +55,54 @@
|
||||
},
|
||||
"answer": {
|
||||
"type": "object",
|
||||
"description": "who is connected and who is silent"
|
||||
"description": "with machine, that machine: online and since; without, every key of the state presence",
|
||||
"properties": {
|
||||
"machine": {
|
||||
"type": "string",
|
||||
"description": "the machine asked, with machine"
|
||||
},
|
||||
"online": {
|
||||
"type": "boolean",
|
||||
"description": "with machine: whether the watchman hears the machine now; false for a machine it holds no word of"
|
||||
},
|
||||
"since": {
|
||||
"type": "string",
|
||||
"description": "with machine: when its presence last changed, RFC 3339; empty for a machine the watchman holds no word of"
|
||||
},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"description": "without machine: the state read, presence"
|
||||
},
|
||||
"holds": {
|
||||
"type": "integer",
|
||||
"description": "without machine: how many keys the state holds"
|
||||
},
|
||||
"keys": {
|
||||
"type": "array",
|
||||
"description": "without machine: each key of the state presence, <node> or part.<part>.<instance>, with its value",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "<node> or part.<part>.<instance>"
|
||||
},
|
||||
"value": {
|
||||
"type": "object",
|
||||
"description": "the key's value, online and its layout's version"
|
||||
},
|
||||
"revision": {
|
||||
"type": "integer",
|
||||
"description": "the key's revision"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"key",
|
||||
"value"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -116,8 +116,30 @@ export interface PresenceInput {
|
||||
"machine"?: string;
|
||||
}
|
||||
|
||||
export interface PresenceAnswerKeysItem {
|
||||
/** <node> or part.<part>.<instance> */
|
||||
"key": string;
|
||||
/** the key's revision */
|
||||
"revision"?: number;
|
||||
/** the key's value, online and its layout's version */
|
||||
"value": Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** is what presence answers. */
|
||||
export type PresenceAnswer = Record<string, unknown>;
|
||||
export interface PresenceAnswer {
|
||||
/** without machine: how many keys the state holds */
|
||||
"holds"?: number;
|
||||
/** without machine: each key of the state presence, <node> or part.<part>.<instance>, with its value */
|
||||
"keys"?: PresenceAnswerKeysItem[];
|
||||
/** the machine asked, with machine */
|
||||
"machine"?: string;
|
||||
/** with machine: whether the watchman hears the machine now; false for a machine it holds no word of */
|
||||
"online"?: boolean;
|
||||
/** with machine: when its presence last changed, RFC 3339; empty for a machine the watchman holds no word of */
|
||||
"since"?: string;
|
||||
/** without machine: the state read, presence */
|
||||
"state"?: string;
|
||||
}
|
||||
|
||||
/** is what dead-letters takes. */
|
||||
export interface DeadLettersInput {
|
||||
|
||||
Reference in New Issue
Block a user