Files
mesh-contracts/ts/seats/nodeengine/index.js
T

233 lines
7.4 KiB
JavaScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "node-engine", defined whole (seats/node-engine/seat.json): The node seat every node's engine holds (novox/hq ADR 0563, ADR 0618 §3, §4): its hand acts on the operator's warrant, its read-only judgements, its compositions and what it reads of a manifest. Each verb is answered on this node's subject, mesh.seat.node-engine.tool.<verb>.<node>, and each event is published on mesh.seat.node-engine.event.<event>.<node>, the node's name its last token, or, for an event whose subject names <node>, there (composed.<node>, running.<node>.<module>): the grants part grants a node's account only its own node's subjects (ADR 0363 §2).
export const seat = "node-engine";
export const verbs = {
handOver: "hand-over",
accessAct: "access-act",
judgeDirectories: "judge-directories",
setuidSearch: "setuid-search",
rootFree: "root-free",
acts: "acts",
packages: "packages",
composition: "composition",
compose: "compose",
composeCandidate: "compose-candidate",
manifestReads: "manifest-reads",
seatList: "seat-list",
seatListAgain: "seat-list-again",
firstViews: "first-views",
firstViewAgain: "first-view-again",
entryAgain: "entry-again",
processBuilds: "process-builds",
};
export const events = {
asked: "asked",
done: "done",
refused: "refused",
manifestReadsChanged: "manifest-reads-changed",
composed: "composed",
running: "running",
waitHeld: "wait-held",
waitEnded: "wait-ended",
};
export const family = { name: "node-engine.events", maxAgeDays: 7 };
export function askedSubject(caller) {
return "mesh.seat.node-engine.event.asked." + caller;
}
export function doneSubject(caller) {
return "mesh.seat.node-engine.event.done." + caller;
}
export function refusedSubject(caller) {
return "mesh.seat.node-engine.event.refused." + caller;
}
export function manifestReadsChangedSubject(caller) {
return "mesh.seat.node-engine.event.manifest-reads-changed." + caller;
}
export function composedSubject(node) {
return "mesh.seat.node-engine.event.composed." + node;
}
export const composedSubjectAll = "mesh.seat.node-engine.event.composed.*";
export const runningStream = "SEAT_node-engine_running";
export function runningSubject(node, module) {
return "mesh.seat.node-engine.event.running." + node + "." + module;
}
export const runningSubjectAll = "mesh.seat.node-engine.event.running.*.*";
export const waitHeldStream = "SEAT_node-engine_wait-held";
export function waitHeldSubject(node, module) {
return "mesh.seat.node-engine.event.wait-held." + node + "." + module;
}
export const waitHeldSubjectAll = "mesh.seat.node-engine.event.wait-held.*.*";
export const waitEndedStream = "SEAT_node-engine_wait-ended";
export function waitEndedSubject(node, module) {
return "mesh.seat.node-engine.event.wait-ended." + node + "." + module;
}
export const waitEndedSubjectAll = "mesh.seat.node-engine.event.wait-ended.*.*";
export const states = {
have: "have",
composed: "composed",
data: "data",
packages: "packages",
health: "health",
findings: "findings",
};
/** The key of one value of the state have under the form "<node>.<module>". */
export function haveByNodeModuleKey(node, module) {
return node + "." + module;
}
/** The parts of a key of the form "<node>.<module>", or undefined for a key of another form. */
export function parseHaveByNodeModuleKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const module = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, module };
}
/** The key of one value of the state have under the form "<node>.node". */
export function haveByNodeNodeKey(node) {
return node + ".node";
}
/** The parts of a key of the form "<node>.node", or undefined for a key of another form. */
export function parseHaveByNodeNodeKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".node");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 5);
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state composed under the form "<node>.<module>.<fingerprint>". */
export function composedByNodeModuleFingerprintKey(node, module, fingerprint) {
return node + "." + module + "." + fingerprint;
}
/** The parts of a key of the form "<node>.<module>.<fingerprint>", or undefined for a key of another form. */
export function parseComposedByNodeModuleFingerprintKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const module = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
if (_rest === "") return undefined;
const fingerprint = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, module, fingerprint };
}
/** The key of one value of the state composed under the form "<node>.node". */
export function composedByNodeNodeKey(node) {
return node + ".node";
}
/** The parts of a key of the form "<node>.node", or undefined for a key of another form. */
export function parseComposedByNodeNodeKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".node");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 5);
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state data under the form "<node>.<module>". */
export function dataByNodeModuleKey(node, module) {
return node + "." + module;
}
/** The parts of a key of the form "<node>.<module>", or undefined for a key of another form. */
export function parseDataByNodeModuleKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const module = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, module };
}
/** The key of one value of the state packages under the form "<node>". */
export function packagesByNodeKey(node) {
return node;
}
/** The parts of a key of the form "<node>", or undefined for a key of another form. */
export function parsePackagesByNodeKey(_key) {
let _rest = _key;
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state health under the form "<node>". */
export function healthByNodeKey(node) {
return node;
}
/** The parts of a key of the form "<node>", or undefined for a key of another form. */
export function parseHealthByNodeKey(_key) {
let _rest = _key;
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state findings under the form "<key>". */
export function findingsByKeyKey(key) {
return key;
}
/** The parts of a key of the form "<key>", or undefined for a key of another form. */
export function parseFindingsByKeyKey(_key) {
let _rest = _key;
if (_rest === "") return undefined;
const key = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { key };
}