@mark1russell7/service 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,7 +1,10 @@
1
- import { i as recoverSpan, n as asWindow, r as failSpan, t as asDebounce } from "./timing-DxZ4nkQg.js";
2
- import { n as mayReissue, r as operationProblems, t as realClock } from "./clock-DlJFFZlX.js";
1
+ import { platformClock, realClock } from "./clock.js";
2
+ import { detectionTime, heartbeat } from "./heartbeat.js";
3
+ import { a as recoverSpan, i as heartbeatDetection, n as asWindow, r as failSpan, t as asDebounce } from "./timing-DGRi3XCI.js";
4
+ import { n as operationProblems, t as mayReissue } from "./operation-DL5RxFds.js";
5
+ import { backoffBand, backoffDelay, backoffProblems } from "./backoff.js";
3
6
  import { convertExact, convertible, quantity, rationals, valueIn } from "@mark1russell7/quantity";
4
- import { arr, fromStates } from "@mark1russell7/algebra";
7
+ import { replay } from "@mark1russell7/algebra/replay";
5
8
  //#region src/description.ts
6
9
  /**
7
10
  * This is the format of a service as data: what `describe()` exports, and nothing starts. The
@@ -1359,6 +1362,7 @@ const verdictOf = (rule, bind, evaluated) => {
1359
1362
  //#region src/lint.ts
1360
1363
  /** These are the identifiers of the rules that each declaration gets. */
1361
1364
  const SERVICE_RULES = [
1365
+ "O04",
1362
1366
  "O09",
1363
1367
  "O10",
1364
1368
  "O11",
@@ -1405,6 +1409,8 @@ const serviceBindings = (svc, scenario) => {
1405
1409
  set("startup_budget@pod", secondsOf(svc.policies.startup), "the declared startup budget");
1406
1410
  set("process_drain_time@process", svc.shutdown.phases.reduce((total, phase) => total + secondsOf(phase.cap), 0), `the shutdown phases' caps, summed (${svc.shutdown.phases.map((phase) => phase.name).join(", ")})`);
1407
1411
  set("cooperative_window@process", boundOf(svc.shutdown.cooperativeWindow), "the declared cooperative window");
1412
+ const hold = svc.shutdown.phases.find((phase) => phase.name === "fail readiness");
1413
+ set("readiness_hold@process", hold === void 0 ? 0 : secondsOf(hold.cap), hold === void 0 ? "no fail readiness phase: the intake stops at once after the signal" : "the cap of the fail readiness phase, which holds while the endpoints update");
1408
1414
  for (const [symbol, amount] of Object.entries(scenario.platform)) set(symbol, boundOf(amount), "the scenario");
1409
1415
  return {
1410
1416
  bind,
@@ -1450,7 +1456,8 @@ const lint = (svc, scenario, rules) => {
1450
1456
  /**
1451
1457
  * The machines of the runtime as `mark1russell7.machine/1` documents. The documents are the
1452
1458
  * specification, and TypeScript implements them. A test records the transitions of the runtime
1453
- * and replays them against each document, thus the code and the documents cannot disagree.
1459
+ * and replays them against each document (`replay` of `@mark1russell7/algebra`), thus the code and
1460
+ * the documents cannot disagree.
1454
1461
  */
1455
1462
  const SOURCE = [{
1456
1463
  ref: "packages/service/src (the runtime implements this document)",
@@ -1877,25 +1884,7 @@ const MACHINES = {
1877
1884
  exit: EXIT_MACHINE,
1878
1885
  watchdog: WATCHDOG_MACHINE
1879
1886
  };
1880
- /**
1881
- * This function replays the transitions of one machine of the runtime against its document. Each
1882
- * instance starts in the state that its first transition leaves. Each transition must leave the
1883
- * state where the replay is. The document must have a transition from that state, on that event,
1884
- * to that state. The function gives each disagreement.
1885
- */
1886
- const replay = (doc, events) => {
1887
- const problems = [];
1888
- const at = /* @__PURE__ */ new Map();
1889
- for (const event of events) {
1890
- const where = at.get(event.instance) ?? event.from;
1891
- if (doc.states[where] === void 0) problems.push(`${event.instance}: the state ${where} is not in ${doc.id}`);
1892
- if (event.from !== where) problems.push(`${event.instance}: the runtime left ${event.from} on ${event.on}, but the replay is in ${where}`);
1893
- if (!doc.transitions.some((each) => fromStates(doc, each.from).includes(event.from) && arr(each.on).includes(event.on) && each.to === event.to)) problems.push(`${event.instance}: ${doc.id} has no transition from ${event.from} on ${event.on} to ${event.to}`);
1894
- at.set(event.instance, event.to);
1895
- }
1896
- return problems;
1897
- };
1898
1887
  //#endregion
1899
- export { EXIT_MACHINE, EXIT_SIGNALS, FORMAT, GATE_MACHINE, LATCH_MACHINE, MACHINES, POLLER_MACHINE, SERVICE_RULES, STAGES, WATCHDOG_MACHINE, WINDOW_MACHINE, asDebounce, asWindow, capKnob, cooperativeAbortAt, drainMachine, evaluate, failSpan, inequalities, lint, mayReissue, nodeProcess, realClock, recoverSpan, replay, service, serviceBindings, stageRank, symbolsOf, verdictOf, watchdog };
1888
+ export { EXIT_MACHINE, EXIT_SIGNALS, FORMAT, GATE_MACHINE, LATCH_MACHINE, MACHINES, POLLER_MACHINE, SERVICE_RULES, STAGES, WATCHDOG_MACHINE, WINDOW_MACHINE, asDebounce, asWindow, backoffBand, backoffDelay, backoffProblems, capKnob, cooperativeAbortAt, detectionTime, drainMachine, evaluate, failSpan, heartbeat, heartbeatDetection, inequalities, lint, mayReissue, nodeProcess, platformClock, realClock, recoverSpan, replay, service, serviceBindings, stageRank, symbolsOf, verdictOf, watchdog };
1900
1889
 
1901
1890
  //# sourceMappingURL=index.js.map