contracts-node-engine-apply-order-and-word: the verb apply-order and the constant want:version on the seat node-engine
Generated with seatgen whose identifier function splits on ':' (H-A-64, the contracts-indexer-bridge developer's change in mesh-delivery-sdk/seatgen); seatgen -check passes only with it. Builds: design 47 H §771, §772, H-A-45, H-A-46, H-A-63, H-A-64
This commit is contained in:
@@ -26,6 +26,7 @@ const (
|
||||
VerbCompose = "compose"
|
||||
VerbComposeCandidate = "compose-candidate"
|
||||
VerbManifestReads = "manifest-reads"
|
||||
VerbApplyOrder = "apply-order"
|
||||
VerbSeatList = "seat-list"
|
||||
VerbSeatListAgain = "seat-list-again"
|
||||
VerbFirstViews = "first-views"
|
||||
@@ -47,7 +48,7 @@ const (
|
||||
|
||||
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
||||
func Verbs() []string {
|
||||
return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds}
|
||||
return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbApplyOrder, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds}
|
||||
}
|
||||
|
||||
// Events is every event published on the seat's subject: a new copy each call.
|
||||
@@ -705,6 +706,14 @@ type LoginFallback struct {
|
||||
Why string `json:"why"`
|
||||
}
|
||||
|
||||
// ManifestReadWord is the word a node-engine states in manifest-reads when it reads a want by version and not by digests (design 47 H 772, H-A-45); the assigner holds a node whose engine does not state it. Other words in manifest-reads are free.
|
||||
type ManifestReadWord = string
|
||||
|
||||
// The values of ManifestReadWord.
|
||||
const (
|
||||
ManifestReadWordWantVersion = "want:version"
|
||||
)
|
||||
|
||||
// ManifestReadsChanged is what a node-engine says when what it reads changed or its node returned (ADR 0618 §4).
|
||||
type ManifestReadsChanged struct {
|
||||
// when it says it, RFC 3339
|
||||
@@ -1404,6 +1413,32 @@ type ManifestReadsAnswer struct {
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// ApplyOrderInput is what apply-order takes.
|
||||
type ApplyOrderInput struct {
|
||||
}
|
||||
|
||||
// ApplyOrderAnswerOrderItem is a type of the contract.
|
||||
type ApplyOrderAnswerOrderItem struct {
|
||||
// the module whose want waits to be applied
|
||||
Module string `json:"module"`
|
||||
// the want's pipeline (its key); absent for a want in none
|
||||
Pipeline string `json:"pipeline,omitempty"`
|
||||
// its place in the order, the first applied being 1
|
||||
Position int64 `json:"position"`
|
||||
// the mover's tier in its pipeline; absent for a want in none
|
||||
Rank int64 `json:"rank,omitempty"`
|
||||
// the modules it waits on; empty when it waits for nothing
|
||||
Waits []string `json:"waits"`
|
||||
// why it stands there, in one sentence
|
||||
Why string `json:"why"`
|
||||
}
|
||||
|
||||
// ApplyOrderAnswer is what apply-order answers.
|
||||
type ApplyOrderAnswer struct {
|
||||
// one row per unapplied changed want, in the order it will be applied
|
||||
Order []ApplyOrderAnswerOrderItem `json:"order"`
|
||||
}
|
||||
|
||||
// SeatListInput is what seat-list takes.
|
||||
type SeatListInput struct {
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@ func TestFixtures(t *testing.T) {
|
||||
decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "composition says withheld unknown when the grants part does not answer", subject: "", given: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"zsh\",\"node\":\"workstation\",\"started\":false,\"withheld-unknown\":\"withheld unknown: the grants part does not answer\"}", wire: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"zsh\",\"node\":\"workstation\",\"started\":false,\"withheld-unknown\":\"withheld unknown: the grants part does not answer\"}",
|
||||
decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "apply-order answers the changed wants in the order they are applied, with why and what each waits on", subject: "", given: "{\"order\":[{\"module\":\"mesh-broker\",\"position\":1,\"waits\":[],\"why\":\"the bus module is applied first\"},{\"module\":\"mesh-delivery-view\",\"pipeline\":\"main.2\",\"position\":2,\"rank\":2,\"waits\":[\"mesh-delivery-indexer\"],\"why\":\"rank 2 of main.2, after rank 1\"}]}", wire: "{\"order\":[{\"module\":\"mesh-broker\",\"position\":1,\"waits\":[],\"why\":\"the bus module is applied first\"},{\"module\":\"mesh-delivery-view\",\"pipeline\":\"main.2\",\"position\":2,\"rank\":2,\"waits\":[\"mesh-delivery-indexer\"],\"why\":\"rank 2 of main.2, after rank 1\"}]}",
|
||||
decode: func(b []byte) (any, error) { var v ApplyOrderAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
}
|
||||
for _, c := range cases {
|
||||
v, err := c.decode([]byte(c.given))
|
||||
|
||||
@@ -259,5 +259,29 @@
|
||||
},
|
||||
"withheld-unknown": "withheld unknown: the grants part does not answer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "apply-order answers the changed wants in the order they are applied, with why and what each waits on",
|
||||
"of": "verb:apply-order.answer",
|
||||
"given": {
|
||||
"order": [
|
||||
{
|
||||
"module": "mesh-broker",
|
||||
"position": 1,
|
||||
"why": "the bus module is applied first",
|
||||
"waits": []
|
||||
},
|
||||
{
|
||||
"module": "mesh-delivery-view",
|
||||
"pipeline": "main.2",
|
||||
"rank": 2,
|
||||
"position": 2,
|
||||
"why": "rank 2 of main.2, after rank 1",
|
||||
"waits": [
|
||||
"mesh-delivery-indexer"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -724,6 +724,67 @@
|
||||
},
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
"name": "apply-order",
|
||||
"optional": true,
|
||||
"description": "The order this machine's engine will apply its changed wants in, with why: one row per unapplied changed want, the bus module and the backup holder first, then each pipeline's wants by rank, then the rest by name, its own want last, a reverted module first (design 47 H 771, H-A-46). Read-only. Answered by this machine's engine alone.",
|
||||
"input": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"answer": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"module": {
|
||||
"type": "string",
|
||||
"description": "the module whose want waits to be applied"
|
||||
},
|
||||
"pipeline": {
|
||||
"type": "string",
|
||||
"description": "the want's pipeline (its key); absent for a want in none"
|
||||
},
|
||||
"rank": {
|
||||
"type": "integer",
|
||||
"description": "the mover's tier in its pipeline; absent for a want in none"
|
||||
},
|
||||
"position": {
|
||||
"type": "integer",
|
||||
"description": "its place in the order, the first applied being 1"
|
||||
},
|
||||
"why": {
|
||||
"type": "string",
|
||||
"description": "why it stands there, in one sentence"
|
||||
},
|
||||
"waits": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "the modules it waits on; empty when it waits for nothing"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"module",
|
||||
"position",
|
||||
"why",
|
||||
"waits"
|
||||
]
|
||||
},
|
||||
"description": "one row per unapplied changed want, in the order it will be applied"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"order"
|
||||
],
|
||||
"description": "the order this machine's engine applies its changed wants in"
|
||||
},
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
"name": "seat-list",
|
||||
"description": "The seat list this engine holds and what it waits for (novox/hq ADR 0636 §7): each seat's source (trunk or bootstrap) and digest, the seats held from the bootstrap alone, the definitions refused, the last error and whether the seat mesh-catalog has answered. Read-only.",
|
||||
@@ -1855,6 +1916,13 @@
|
||||
],
|
||||
"description": "the answer of an act the operator is asked"
|
||||
},
|
||||
"ManifestReadWord": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"want:version"
|
||||
],
|
||||
"description": "the word a node-engine states in manifest-reads when it reads a want by version and not by digests (design 47 H 772, H-A-45); the assigner holds a node whose engine does not state it. Other words in manifest-reads are free"
|
||||
},
|
||||
"ManifestReadsChanged": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Vendored
+29
@@ -16,6 +16,7 @@ export declare const verbs: {
|
||||
readonly compose: "compose";
|
||||
readonly composeCandidate: "compose-candidate";
|
||||
readonly manifestReads: "manifest-reads";
|
||||
readonly applyOrder: "apply-order";
|
||||
readonly seatList: "seat-list";
|
||||
readonly seatListAgain: "seat-list-again";
|
||||
readonly firstViews: "first-views";
|
||||
@@ -378,6 +379,9 @@ export interface LoginFallback {
|
||||
"why": string;
|
||||
}
|
||||
|
||||
/** the word a node-engine states in manifest-reads when it reads a want by version and not by digests (design 47 H 772, H-A-45); the assigner holds a node whose engine does not state it. Other words in manifest-reads are free */
|
||||
export type ManifestReadWord = "want:version";
|
||||
|
||||
/** what a node-engine says when what it reads changed or its node returned (ADR 0618 §4) */
|
||||
export interface ManifestReadsChanged {
|
||||
/** when it says it, RFC 3339 */
|
||||
@@ -1028,6 +1032,31 @@ export interface ManifestReadsAnswer {
|
||||
"v": number;
|
||||
}
|
||||
|
||||
/** is what apply-order takes. */
|
||||
export interface ApplyOrderInput {
|
||||
}
|
||||
|
||||
export interface ApplyOrderAnswerOrderItem {
|
||||
/** the module whose want waits to be applied */
|
||||
"module": string;
|
||||
/** the want's pipeline (its key); absent for a want in none */
|
||||
"pipeline"?: string;
|
||||
/** its place in the order, the first applied being 1 */
|
||||
"position": number;
|
||||
/** the mover's tier in its pipeline; absent for a want in none */
|
||||
"rank"?: number;
|
||||
/** the modules it waits on; empty when it waits for nothing */
|
||||
"waits": string[];
|
||||
/** why it stands there, in one sentence */
|
||||
"why": string;
|
||||
}
|
||||
|
||||
/** is what apply-order answers. */
|
||||
export interface ApplyOrderAnswer {
|
||||
/** one row per unapplied changed want, in the order it will be applied */
|
||||
"order": ApplyOrderAnswerOrderItem[];
|
||||
}
|
||||
|
||||
/** is what seat-list takes. */
|
||||
export interface SeatListInput {
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export const verbs = {
|
||||
compose: "compose",
|
||||
composeCandidate: "compose-candidate",
|
||||
manifestReads: "manifest-reads",
|
||||
applyOrder: "apply-order",
|
||||
seatList: "seat-list",
|
||||
seatListAgain: "seat-list-again",
|
||||
firstViews: "first-views",
|
||||
|
||||
Reference in New Issue
Block a user