@mark1russell7/service 0.5.13 → 0.5.15
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/README.md +6 -0
- package/build/{builder-DawJhq4p.d.ts → builder-CsSO4LzB.d.ts} +2 -2
- package/build/{core-BPLRDcUJ.d.ts → core-D8iXeoE4.d.ts} +10 -3
- package/build/{dial-DA8vJfh2.d.ts → dial-DJolDmOK.d.ts} +2 -2
- package/build/grpc.d.ts +3 -3
- package/build/grpc.js +1 -1
- package/build/http-client.d.ts +3 -3
- package/build/http-client.js +1 -1
- package/build/http.d.ts +1 -1
- package/build/index.d.ts +103 -9
- package/build/index.js +316 -27
- package/build/index.js.map +1 -1
- package/build/{lifecycle-fgYfxrHK.d.ts → lifecycle-CMedxaQd.d.ts} +60 -2
- package/build/{machine-BhTRu3u9.js → machine-DZMb_QEU.js} +23 -7
- package/build/machine-DZMb_QEU.js.map +1 -0
- package/build/mongodb.d.ts +3 -3
- package/build/mongodb.js +1 -1
- package/build/pg.d.ts +2 -2
- package/build/pg.js +1 -1
- package/build/{queue-snRHK3Jm.d.ts → queue-CndiCVaY.d.ts} +2 -2
- package/build/rabbitmq.d.ts +4 -4
- package/build/rabbitmq.js +1 -1
- package/build/redis.d.ts +2 -2
- package/build/redis.js +1 -1
- package/build/testing.d.ts +2 -2
- package/build/testing.js +1 -0
- package/build/testing.js.map +1 -1
- package/build/websocket.d.ts +3 -3
- package/build/websocket.js +1 -1
- package/package.json +1 -1
- package/build/machine-BhTRu3u9.js.map +0 -1
package/README.md
CHANGED
|
@@ -10,13 +10,18 @@ This release has the declaration, its export, the law, the health runtime, the l
|
|
|
10
10
|
- **No defaults.** The runtime has no defaults of its own. Thus `describe()` refuses a service that does not declare its readiness, its liveness, its startup budget, its shutdown phases or its cooperative window. It also refuses a service that does not declare what a repeat signal does. The error tells which. `start()` also refuses a check without its function.
|
|
11
11
|
- **One timing shape.** Each policy has a `Timing`: a debounce of polls, or a window of time. Each converts to the other (`asWindow`, `asDebounce`). `failSpan` and `recoverSpan` give the earliest and the latest time to detect a change. At 3 polls of 5 s ± 20 %, a latch fails in 8–18 s on an error, and in 12–22 s on a 4 s timeout.
|
|
12
12
|
- **Checks.** A check names the step of the connection that it examines (`dial`, `round-trip`, `checkout` and others). It also tells if it uses the connection of the application, and which policy it controls. The policy has no default.
|
|
13
|
+
- **The catalog of a client.** The checks of each client name the steps that they gate: `steps: { "round-trip": "readiness" }`. With `catalog: true`, the client also gives a check for each other step that it has. These checks gate nothing and poll each 30 s. A nominated step that the client does not have then fails the attach. The name of each check is the pair of the component and the step (`db.round-trip`).
|
|
13
14
|
- **Idempotency for each operation.** One dependency has the two kinds of operation. A Redis GET is safe to send again. An INCR that goes again after a timeout counts two times. Thus each operation of a dependency, and each route of a controller, declares if it can go again: `true`, `false`, or keyed.
|
|
14
15
|
- **Keyed operations.** A keyed operation has the window that the server keeps its key for. `mayReissue` answers from the declaration of an operation. An operation without a declaration does not go again.
|
|
15
16
|
- **The law.** `evaluate` and `verdictOf` decide one rule of the timer-ordering law on one binding. A rule is data: linear inequalities over `symbol@hop`, with a margin. A verdict is `holds`, `violated`, `unbounded` (it holds only because a timer is absent) or `depends` (nothing is bound).
|
|
16
17
|
- **The linter.** `lint(description, scenario, rules)` applies the service rules (`SERVICE_RULES`) to a declaration. The declaration binds the symbols of the service: the polls of its checks, the windows of its policies, its drain. The scenario binds the symbols of the platform and of each dependency. A `depends` finding names the symbols that have no bound.
|
|
18
|
+
- **The claims of a scenario.** A default is true only for a version: the keep-alive of Node is 5 s, but 65 s on main. Thus a value of the scenario can be a claim that names its epoch: `{ epoch: "node@22", value }`. Each finding then gives the epoch of each value that its rule reads (`epochs`).
|
|
19
|
+
- **A measured value.** A claim can give a distribution by its statistics: `{ epoch, distribution: { p50, p99 } }`. The law binds the p99. A distribution without a p99 binds nothing, thus each rule that reads it depends.
|
|
17
20
|
- **The scopes of a rule.** A rule about a client applies one time for each dependency. A rule about a consumer, for example O20, applies one time for each consumer and each worker.
|
|
18
21
|
- **The loops of a progress check.** A check of the step `progress` can name the loops that mark it, with its stall time: `marks: { loops, stall }`. Each loop is a check or a worker of the service.
|
|
19
22
|
- **The stall time.** `lint()` compares the stall time with the longest gap between two marks of the slowest loop (`PROGRESS_RULE`). A loop marks at the end of each turn, also a turn that fails. The gap of a check is `interval × (1 + jitter) + timeout`. The gap of a worker is its sleep or its longest backoff, the longer one, plus `unit_processing_time`. At 300 s ± 20 % and a timeout of 10 s, a poll gives 370 s.
|
|
23
|
+
- **The marks of the timers.** A harness that runs a service k times faster scales its timers. Each timer has a mark: `scalable`, `fixed`, `stepped` (only multiples of a step) or `floored` (a peer sets a floor).
|
|
24
|
+
- **The compression of a service.** `compressionOf(description, scenario, rules, k, marks)` gives each rule and scope whose verdict the compression changes. It also names the symbols that have no mark. `PLATFORM_MARKS` marks the timers of Kubernetes. For example, the propagation of the endpoints is `fixed`, thus a compression of the hold of O04 can break O04.
|
|
20
25
|
- **A name that is not a loop.** A name that is not a check or a worker gets a `depends` finding. Without `marks`, a check gets no finding of this rule.
|
|
21
26
|
- **Keyed limiters.** `svc.limiter(name, spec)` declares a rate limit for each key, as data. `keyedLimiter` makes its runtime on a store ([The keyed limiter](#the-keyed-limiter)).
|
|
22
27
|
- **The hold.** The cap of the `fail readiness` phase binds `readiness_hold@process`, and a service without that phase holds for zero. The hold keeps the listener open after the signal, as a preStop sleep does. Thus O04 can compare the sum of the two with the propagation of the endpoints.
|
|
@@ -29,6 +34,7 @@ The format of a description is `mark1russell7.service/1`.
|
|
|
29
34
|
|
|
30
35
|
- **Checks on their own loops.** Each check polls on a fixed delay from the start of each poll, with its jitter. Each poll has a timeout, and the runtime aborts the signal of the check at that timeout. An answer is `"ok"`, `"error"` or `"indeterminate"`. A throw is an error with a flag. An indeterminate poll measured nothing, thus it moves no streak.
|
|
31
36
|
- **A pending use is not started again.** While a use of a check is pending, each later poll fails at once with the same cause. Thus a check that hangs fails a debounce of two polls or more as fast as an error does (`failSpan(timing, poll, "hang")`).
|
|
37
|
+
- **The metrics.** `health.metrics()` gives the counts of the runtime, and starts no check. For each check, it counts each outcome, each throw and each forced failure. Its histogram counts the durations of the polls. The bounds are fractions of the timeout of the poll, and a poll that timed out goes into `timedOut`. Its last 8 episodes of failure each go from the first error to the next pass. The cause of an episode has no user, password or token (`redact`). It also counts each transition of the machines of the runtime.
|
|
32
38
|
- **A latch for each check that gates a policy.** A debounce counts polls in sequence. A window measures time on the monotonic clock from the first failure of a sequence. A readiness latch starts tripped, thus readiness is earned. A liveness latch starts released.
|
|
33
39
|
- **The start.** `start()` makes one warm-up sweep of each check, bounded by each timeout, and then starts the loops. The startup probe fails until the sweep ends. `svc.health` gives the runtime from the start of `start()`, thus the probes can answer during the sweep. The verdict says when the sweep outlasts the startup budget.
|
|
34
40
|
- **The verdicts.** `health.verdict()` gives started, draining, ready, alive, each controller, each dependency and each check. The service is ready when it started, it does not drain, and each readiness latch is released. A controller is ready when its own dependencies are ready. Thus a failed dependency fails only the controllers that need it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as Clock } from "./clock-mVqhXD0b.js";
|
|
2
2
|
import { c as LimiterSpec } from "./policy-G4QJ1ZZq.js";
|
|
3
|
-
import { B as
|
|
3
|
+
import { B as Check, E as CheckFn, G as ExitCodes, H as CooperativeFloor, I as Trace, J as MessageTrigger, P as Outcome, Q as ServiceDescription, St as ProcessTrigger, T as StartOptions, U as Coupling, W as Dependency, Y as Phase, Z as RepeatSignal, d as TransportImpl, gt as ExitTrigger, it as Timing, jt as Operation, n as HealthServer, nt as Poll, o as PhaseWork, q as Gate, r as Lifecycle, s as RunOptions, t as DependencyHandle, ut as OperationOf, x as Health } from "./lifecycle-CMedxaQd.js";
|
|
4
4
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
5
5
|
//#region src/profiles.d.ts
|
|
6
6
|
/**
|
|
@@ -208,4 +208,4 @@ interface ServiceBuilder {
|
|
|
208
208
|
declare const service: (name: string) => ServiceBuilder;
|
|
209
209
|
//#endregion
|
|
210
210
|
export { WatchdogSpec as a, Profile as c, kubernetes as d, localDev as f, Watchdog as i, daemon as l, ServiceBuilder as n, watchdog as o, service as r, PodTiming as s, ControllerBuilder as t, ephemeral as u };
|
|
211
|
-
//# sourceMappingURL=builder-
|
|
211
|
+
//# sourceMappingURL=builder-CsSO4LzB.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Backoff } from "./backoff-B-jGWVDm.js";
|
|
2
2
|
import { n as Clock } from "./clock-mVqhXD0b.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as ServiceBuilder } from "./builder-
|
|
3
|
+
import { $ as Step, B as Check, E as CheckFn, Q as ServiceDescription, W as Dependency, jt as Operation, nt as Poll, q as Gate, t as DependencyHandle, z as Recorder } from "./lifecycle-CMedxaQd.js";
|
|
4
|
+
import { n as ServiceBuilder } from "./builder-CsSO4LzB.js";
|
|
5
5
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
6
6
|
//#region src/client/meets.d.ts
|
|
7
7
|
/** A situation is what the connection did when the failure started: a command in flight, or idle. */
|
|
@@ -89,6 +89,13 @@ interface CheckOptions<S extends Step = ClientStep> {
|
|
|
89
89
|
readonly poll: Poll;
|
|
90
90
|
/** For each step, the policy that its check controls, or null for a check that only reports. A step that is absent has no check. */
|
|
91
91
|
readonly steps: Partial<Record<S, Gate | null>>;
|
|
92
|
+
/**
|
|
93
|
+
* With a catalog, the client gives a check for each step that it has (B19). The steps of `steps` are
|
|
94
|
+
* the nominated checks. Each other step reports only, and polls at the catalog poll. `true` is a poll
|
|
95
|
+
* of 30 s with the jitter and the timeout of `poll`. A nominated step that the client has no check
|
|
96
|
+
* for then fails the attach. Without a catalog, the client gives only the steps of `steps`.
|
|
97
|
+
*/
|
|
98
|
+
readonly catalog?: true | Poll | undefined;
|
|
92
99
|
}
|
|
93
100
|
/**
|
|
94
101
|
* These are the knobs that each client has, by the names of the ordering law. Each driver adds its
|
|
@@ -223,4 +230,4 @@ declare const retryProblems: (name: string, knobs: RetryKnobs) => string[];
|
|
|
223
230
|
declare const STARTING_POLL: Poll;
|
|
224
231
|
//#endregion
|
|
225
232
|
export { MANIFESTATIONS as C, firstDetector as D, Situation as E, unwatched as O, Detector as S, Meeting as T, Sent as _, ClientKnobs as a, retryProblems as b, ClientSpec as c, Factory as d, ReadyWait as f, SendOptions as g, STARTING_POLL as h, ClientJoin as i, ClientStep as l, RetrySchedule as m, CheckOptions as n, ClientOptions as o, RetryKnobs as p, Client as r, ClientSocket as s, Attempt as t, DialFn as u, readyWait as v, Manifestation as w, retrySchedule as x, retryBackoff as y };
|
|
226
|
-
//# sourceMappingURL=core-
|
|
233
|
+
//# sourceMappingURL=core-D8iXeoE4.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./core-
|
|
1
|
+
import "./core-D8iXeoE4.js";
|
|
2
2
|
//#region src/client/dial.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A judge reads the bytes that the server sent so far. It gives null for a good answer, an error for
|
|
@@ -13,4 +13,4 @@ type Judge = (received: Buffer) => Error | null | "more";
|
|
|
13
13
|
declare const statusLineJudge: (accept: (status: number, line: string) => Error | null) => Judge;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { statusLineJudge as n, Judge as t };
|
|
16
|
-
//# sourceMappingURL=dial-
|
|
16
|
+
//# sourceMappingURL=dial-DJolDmOK.d.ts.map
|
package/build/grpc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, b as retryProblems, c as ClientSpec, d as Factory, f as ReadyWait, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, p as RetryKnobs, r as Client, s as ClientSocket, t as Attempt, u as DialFn, v as readyWait, w as Manifestation } from "./core-
|
|
3
|
-
import { t as Judge } from "./dial-
|
|
1
|
+
import { jt as Operation, nt as Poll } from "./lifecycle-CMedxaQd.js";
|
|
2
|
+
import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, b as retryProblems, c as ClientSpec, d as Factory, f as ReadyWait, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, p as RetryKnobs, r as Client, s as ClientSocket, t as Attempt, u as DialFn, v as readyWait, w as Manifestation } from "./core-D8iXeoE4.js";
|
|
3
|
+
import { t as Judge } from "./dial-DJolDmOK.js";
|
|
4
4
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
5
5
|
import { Machine } from "@mark1russell7/algebra";
|
|
6
6
|
//#region src/grpc/connection.d.ts
|
package/build/grpc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { realClock } from "./clock.js";
|
|
2
2
|
import { i as heartbeatDetection } from "./timing-DGRi3XCI.js";
|
|
3
|
-
import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-
|
|
3
|
+
import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-DZMb_QEU.js";
|
|
4
4
|
//#region src/grpc/connection.ts
|
|
5
5
|
/** These states are in the sequence of the enum of grpc-js: the index of a state is its value. */
|
|
6
6
|
const GRPC_STATES = [
|
package/build/http-client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, c as ClientSpec, d as Factory, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, r as Client, s as ClientSocket, t as Attempt, u as DialFn, w as Manifestation } from "./core-
|
|
3
|
-
import { t as Judge } from "./dial-
|
|
1
|
+
import { jt as Operation, nt as Poll } from "./lifecycle-CMedxaQd.js";
|
|
2
|
+
import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, c as ClientSpec, d as Factory, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, r as Client, s as ClientSocket, t as Attempt, u as DialFn, w as Manifestation } from "./core-D8iXeoE4.js";
|
|
3
|
+
import { t as Judge } from "./dial-DJolDmOK.js";
|
|
4
4
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
5
5
|
import { Machine } from "@mark1russell7/algebra";
|
|
6
6
|
//#region src/http-client/connection.d.ts
|
package/build/http-client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { realClock } from "./clock.js";
|
|
2
|
-
import { B as zeroProblems, C as notSent, E as poolProblems, F as timeProblems, G as immediate, I as trackWithTimer, J as keepaliveSilent, K as keepaliveAnswered, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, i as authority, j as roundTripCheck, l as attachClient, m as dialCheck, n as closeTimer, o as statusLineJudge, q as keepaliveReset, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, v as keepaliveOnProblems, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-
|
|
2
|
+
import { B as zeroProblems, C as notSent, E as poolProblems, F as timeProblems, G as immediate, I as trackWithTimer, J as keepaliveSilent, K as keepaliveAnswered, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, i as authority, j as roundTripCheck, l as attachClient, m as dialCheck, n as closeTimer, o as statusLineJudge, q as keepaliveReset, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, v as keepaliveOnProblems, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-DZMb_QEU.js";
|
|
3
3
|
//#region src/http-client/connection.ts
|
|
4
4
|
/**
|
|
5
5
|
* This factory makes an `http.Agent` of Node. It loads node:http only when a client connects.
|
package/build/http.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as Clock } from "./clock-mVqhXD0b.js";
|
|
2
2
|
import { d as Refused } from "./policy-G4QJ1ZZq.js";
|
|
3
|
-
import { d as TransportImpl, m as RequestEnd, n as HealthServer, r as Lifecycle, v as RequestStream, w as ProbeKind, x as Health, y as RequestWork } from "./lifecycle-
|
|
3
|
+
import { d as TransportImpl, m as RequestEnd, n as HealthServer, r as Lifecycle, v as RequestStream, w as ProbeKind, x as Health, y as RequestWork } from "./lifecycle-CMedxaQd.js";
|
|
4
4
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
5
5
|
import { ListenOptions } from "node:net";
|
|
6
6
|
import { IncomingMessage, Server, ServerEventMap, ServerResponse } from "node:http";
|
package/build/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { a as backoffDelay, i as backoffBand, n as DelayBand, o as backoffProblems, r as Jitter, t as Backoff } from "./backoff-B-jGWVDm.js";
|
|
2
2
|
import { a as realClock, i as platformClock, n as Clock, r as PlatformClockOptions, t as Cancel } from "./clock-mVqhXD0b.js";
|
|
3
3
|
import { S as retryAfterSeconds, _ as freeAt, a as LimitRule, b as limiterProblems, c as LimiterSpec, d as Refused, f as SlidingWindow, g as decide, h as TokenBucket, i as LimitPolicy, l as LimiterStoreSpec, m as TakeStep, n as Decision, o as Limiter, p as StoreFailure, r as KeyState, s as LimiterEviction, t as Allowed, u as RefusalCause, v as idleSpan, x as longestRetryAfter, y as limitRule } from "./policy-G4QJ1ZZq.js";
|
|
4
|
-
import { $ as
|
|
5
|
-
import { a as WatchdogSpec, c as Profile, d as kubernetes, f as localDev, i as Watchdog, l as daemon, n as ServiceBuilder, o as watchdog, r as service, s as PodTiming, t as ControllerBuilder, u as ephemeral } from "./builder-
|
|
4
|
+
import { $ as Step, A as EPISODES_KEPT, At as Idempotency, B as Check, C as ProbeAnswer, Ct as embeddedProcess, D as CheckMetrics, Dt as matchesMessage, E as CheckFn, Et as isMessageShape, F as Result, G as ExitCodes, H as CooperativeFloor, J as MessageTrigger, K as FORMAT, L as LifecycleEvent, M as HealthMetrics, Mt as mayReissue, N as redact, O as DURATION_FRACTIONS, Ot as nodeProcess, P as Outcome, Q as ServiceDescription, R as MachineName, S as HealthVerdict, St as ProcessTrigger, T as StartOptions, Tt as isExitSignal, U as Coupling, V as Controller, W as Dependency, X as ProgressMarks, Y as Phase, Z as RepeatSignal, _ as RequestOptions, _t as HostStream, a as PhaseContext, at as asDebounce, b as CheckVerdict, bt as ProcessHost, c as STAGES, ct as heartbeatDetection, d as TransportImpl, dt as RoutePattern, et as Transport, f as cooperativeAbortAt, ft as RouteRequest, g as RequestFn, gt as ExitTrigger, h as RequestEvent, ht as ExitSignal, i as LifecycleState, it as Timing, j as Episode, jt as Operation, k as DurationHistogram, kt as processPortOf, l as ShutdownOptions, lt as recoverSpan, m as RequestEnd, mt as EmbeddedProcess, n as HealthServer, nt as Poll, o as PhaseWork, ot as asWindow, p as stageRank, pt as EXIT_SIGNALS, q as Gate, r as Lifecycle, rt as Span, s as RunOptions, st as failSpan, t as DependencyHandle, tt as FailsBy, u as Stage, ut as OperationOf, v as RequestStream, vt as MessageShape, w as ProbeKind, wt as isExitCode, x as Health, xt as ProcessPort, y as RequestWork, yt as PROCESS_TRIGGERS, z as Recorder } from "./lifecycle-CMedxaQd.js";
|
|
5
|
+
import { a as WatchdogSpec, c as Profile, d as kubernetes, f as localDev, i as Watchdog, l as daemon, n as ServiceBuilder, o as watchdog, r as service, s as PodTiming, t as ControllerBuilder, u as ephemeral } from "./builder-CsSO4LzB.js";
|
|
6
6
|
import { Heartbeat, HeartbeatOptions, detectionTime, heartbeat } from "./heartbeat.js";
|
|
7
7
|
import { a as keyedLimiter, i as TakeRequest, n as LimiterStore, o as memoryStore, r as MemoryStore, t as KeyedLimiter } from "./store-D5HLgBnW.js";
|
|
8
8
|
import { a as limiterStateOf, i as limiterMachine, n as SLIDING_WINDOW_MACHINE, r as TOKEN_BUCKET_MACHINE, t as LimiterState } from "./limiter-B0849Vhp.js";
|
|
9
|
-
import { a as JobSource, c as QueueKnobs, d as queueDrain, f as redeliverOnce, i as JobSettle, l as RedeliveryPolicy, n as JobContext, o as QueueDrain, p as UnitRequest, r as JobFailure, s as QueueDrainOptions, t as JobAction, u as RequeueCause } from "./queue-
|
|
9
|
+
import { a as JobSource, c as QueueKnobs, d as queueDrain, f as redeliverOnce, i as JobSettle, l as RedeliveryPolicy, n as JobContext, o as QueueDrain, p as UnitRequest, r as JobFailure, s as QueueDrainOptions, t as JobAction, u as RequeueCause } from "./queue-CndiCVaY.js";
|
|
10
10
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
11
11
|
import { replay } from "@mark1russell7/algebra/replay";
|
|
12
12
|
import { Machine } from "@mark1russell7/algebra";
|
|
@@ -84,6 +84,55 @@ export declare const evaluate: (rule: Rule, bind: Binding) => Evaluated[];
|
|
|
84
84
|
* applies, the arithmetic cannot decide, and the verdict is "depends".
|
|
85
85
|
*/
|
|
86
86
|
export declare const verdictOf: (rule: Rule, bind: Binding, evaluated: readonly Evaluated[]) => Verdict;
|
|
87
|
+
/**
|
|
88
|
+
* A mark tells how a timer moves when a compression scales time by k (E10). A "scalable" timer
|
|
89
|
+
* becomes k times its value. A "fixed" timer keeps its value. A "stepped" timer takes only
|
|
90
|
+
* multiples of its step, thus it rounds up. A "floored" timer has a floor that a peer sets, for
|
|
91
|
+
* example the minimum retransmission timeout of the kernel. The step and the floor are in seconds.
|
|
92
|
+
*/
|
|
93
|
+
type TimerMark = {
|
|
94
|
+
readonly kind: "scalable";
|
|
95
|
+
} | {
|
|
96
|
+
readonly kind: "fixed";
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: "stepped";
|
|
99
|
+
readonly step: number;
|
|
100
|
+
} | {
|
|
101
|
+
readonly kind: "floored";
|
|
102
|
+
readonly floor: number;
|
|
103
|
+
readonly by: string;
|
|
104
|
+
};
|
|
105
|
+
/** The marks map `symbol@hop` to a mark. A bare symbol marks the symbol at each hop. */
|
|
106
|
+
type TimerMarks = Readonly<Record<string, TimerMark | undefined>>;
|
|
107
|
+
/** A compressed binding, and the symbols that have no mark. */
|
|
108
|
+
interface Compressed {
|
|
109
|
+
readonly bind: Binding;
|
|
110
|
+
/** These symbols have no mark. They keep their values, thus the compression proves nothing about them. */
|
|
111
|
+
readonly unmarked: readonly string[];
|
|
112
|
+
}
|
|
113
|
+
/** A change is a rule whose verdict a compression changes. */
|
|
114
|
+
interface Change {
|
|
115
|
+
readonly rule: string;
|
|
116
|
+
readonly before: Verdict;
|
|
117
|
+
readonly after: Verdict;
|
|
118
|
+
}
|
|
119
|
+
/** The result of a compression: the rules whose verdict it changes, and the symbols of the rules that have no mark. */
|
|
120
|
+
interface Compression {
|
|
121
|
+
readonly changed: readonly Change[];
|
|
122
|
+
readonly unmarked: readonly string[];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* This function scales each timer of a binding by k, by its mark (E10). An absent timer ("inf" or
|
|
126
|
+
* "off") stays absent. A chain scales each value. The margins of the binding and the constants of
|
|
127
|
+
* the rules do not scale: they are tolerances, not timers. A symbol with no mark keeps its value.
|
|
128
|
+
*/
|
|
129
|
+
export declare const compress: (bind: Binding, k: number, marks: TimerMarks) => Compressed;
|
|
130
|
+
/**
|
|
131
|
+
* This function tells which rules a compression by k changes. A compression keeps each ordering
|
|
132
|
+
* when no verdict changes. A change in either direction counts: a violation that the compression
|
|
133
|
+
* hides is as wrong as one that it makes. The unmarked symbols are the symbols that the rules read.
|
|
134
|
+
*/
|
|
135
|
+
export declare const compression: (rules: readonly Rule[], bind: Binding, k: number, marks: TimerMarks) => Compression;
|
|
87
136
|
//#endregion
|
|
88
137
|
//#region src/lint.d.ts
|
|
89
138
|
/**
|
|
@@ -96,10 +145,31 @@ export declare const verdictOf: (rule: Rule, bind: Binding, evaluated: readonly
|
|
|
96
145
|
* A rule about a client applies one time for each dependency. A rule about a consumer applies one
|
|
97
146
|
* time for each consumer and each worker. A rule about a limiter applies one time for each limiter.
|
|
98
147
|
*/
|
|
148
|
+
/** A statistic of a measured distribution. The law binds p99 (`LAW_STATISTIC`). */
|
|
149
|
+
type Statistic = "p50" | "p90" | "p99" | "p999" | "max";
|
|
150
|
+
/** The law binds this statistic of a distribution. */
|
|
151
|
+
export declare const LAW_STATISTIC: Statistic;
|
|
152
|
+
/**
|
|
153
|
+
* A claim is a value of the scenario that names its epoch: the component and the version that give
|
|
154
|
+
* it, for example "node@22" (E2). A default is true only for a version: the keep-alive of Node is
|
|
155
|
+
* 5 s, but 65 s on main. A claim gives a set value, or a measured distribution by its statistics.
|
|
156
|
+
*/
|
|
157
|
+
type Claim = {
|
|
158
|
+
readonly epoch: string;
|
|
159
|
+
readonly value: Extent;
|
|
160
|
+
} | {
|
|
161
|
+
readonly epoch: string;
|
|
162
|
+
readonly distribution: Readonly<Partial<Record<Statistic, Quantity>>>;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* A value of the scenario is an amount, or a claim. An amount names no epoch, thus the finding of
|
|
166
|
+
* each rule that reads it gives null for its epoch.
|
|
167
|
+
*/
|
|
168
|
+
type ScenarioValue = Extent | Claim;
|
|
99
169
|
/** A scenario gives the values of the platform and of each dependency, by the `symbol@hop` of the law. */
|
|
100
170
|
interface Scenario {
|
|
101
171
|
/** These are the values of the platform: prestop_sleep@pod, termination_grace@pod, probe_period@pod, propagation_bound@cluster. */
|
|
102
|
-
readonly platform: Readonly<Record<string,
|
|
172
|
+
readonly platform: Readonly<Record<string, ScenarioValue>>;
|
|
103
173
|
/**
|
|
104
174
|
* These are the probe windows of the kubelet, period × failure threshold. They add to the
|
|
105
175
|
* windows of the declaration. A probe reads the cached verdict, thus detection is the latch,
|
|
@@ -110,16 +180,18 @@ interface Scenario {
|
|
|
110
180
|
readonly liveness: Quantity;
|
|
111
181
|
};
|
|
112
182
|
/** These are the values of each dependency, by its name: failover_time@dependency, server_idle_close@server. */
|
|
113
|
-
readonly dependencies?: Readonly<Record<string, Readonly<Record<string,
|
|
183
|
+
readonly dependencies?: Readonly<Record<string, Readonly<Record<string, ScenarioValue>>>> | undefined;
|
|
114
184
|
/** These are the values of the source of each consumer and worker, by its name and by the `symbol@hop` of the law: lease_duration@broker. */
|
|
115
|
-
readonly transports?: Readonly<Record<string, Readonly<Record<string,
|
|
185
|
+
readonly transports?: Readonly<Record<string, Readonly<Record<string, ScenarioValue>>>> | undefined;
|
|
116
186
|
/**
|
|
117
187
|
* These are the values of the callers of each limiter, by its name and by the `symbol@hop` of the
|
|
118
188
|
* law: client_retry_window@caller, retry_delay@caller. A symbol without a hop binds at `caller`.
|
|
119
189
|
*/
|
|
120
|
-
readonly limiters?: Readonly<Record<string, Readonly<Record<string,
|
|
190
|
+
readonly limiters?: Readonly<Record<string, Readonly<Record<string, ScenarioValue>>>> | undefined;
|
|
121
191
|
}
|
|
122
|
-
/**
|
|
192
|
+
/** The epochs of a scope map each symbol that the scenario binds to the epoch of its value, or null when the value names none. */
|
|
193
|
+
type Epochs = Readonly<Record<string, string | null>>;
|
|
194
|
+
/** A finding is the verdict of one rule for one scope: the service, or the client of a dependency. When a value of the scenario names an epoch, the finding gives the epoch of each value that the rule reads. */
|
|
123
195
|
interface Finding {
|
|
124
196
|
readonly rule: string;
|
|
125
197
|
readonly scope: string;
|
|
@@ -129,6 +201,8 @@ interface Finding {
|
|
|
129
201
|
readonly evaluated: readonly Evaluated[];
|
|
130
202
|
/** These are the symbols that have no bound. A "depends" verdict waits for them. */
|
|
131
203
|
readonly unbound: readonly string[];
|
|
204
|
+
/** These are the epochs of the symbols of the rule that the scenario binds (E2). Thus a finding is true for these versions. */
|
|
205
|
+
readonly epochs?: Epochs | undefined;
|
|
132
206
|
}
|
|
133
207
|
/** These are the identifiers of the rules that each declaration gets. */
|
|
134
208
|
export declare const SERVICE_RULES: readonly string[];
|
|
@@ -150,11 +224,31 @@ export declare const LIMITER_RULES: readonly Rule[];
|
|
|
150
224
|
export declare const serviceBindings: (svc: ServiceDescription, scenario: Scenario) => {
|
|
151
225
|
readonly bind: Record<string, Bound>;
|
|
152
226
|
readonly from: Record<string, string>;
|
|
227
|
+
readonly epochs: Epochs;
|
|
153
228
|
};
|
|
154
229
|
/** This identifier is the rule of the findings about a field that the declaration does not give. */
|
|
155
230
|
export declare const DECLARATION_RULE = "declaration";
|
|
156
231
|
/** This identifier is the rule of the findings about the stall time of a progress check (`Check.marks`). */
|
|
157
232
|
export declare const PROGRESS_RULE = "progress";
|
|
233
|
+
/**
|
|
234
|
+
* These are the marks of the timers of the platform (E10). Kubernetes takes the probe period, the
|
|
235
|
+
* preStop sleep and the termination grace in whole seconds, thus each is stepped by 1 s. The
|
|
236
|
+
* cluster sets the propagation of the endpoints, thus a compression of the service cannot scale it.
|
|
237
|
+
*/
|
|
238
|
+
export declare const PLATFORM_MARKS: TimerMarks;
|
|
239
|
+
/** A change of a compression of a service: a rule and a scope whose verdict the compression changes. */
|
|
240
|
+
interface ScopedChange extends Change {
|
|
241
|
+
readonly scope: string;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* This function tells which findings of `lint` a compression by k changes (E10). It scales the
|
|
245
|
+
* bindings of each scope by the marks. Thus a harness that runs the service k times faster learns
|
|
246
|
+
* the orderings that its run breaks. The unmarked symbols are the symbols of the rules with no mark.
|
|
247
|
+
*/
|
|
248
|
+
export declare const compressionOf: (svc: ServiceDescription, scenario: Scenario, rules: readonly Rule[], k: number, marks: TimerMarks) => {
|
|
249
|
+
readonly changed: readonly ScopedChange[];
|
|
250
|
+
readonly unmarked: readonly string[];
|
|
251
|
+
};
|
|
158
252
|
/**
|
|
159
253
|
* This function applies each service rule to a declaration and a scenario. A rule applies one time
|
|
160
254
|
* for the service, for each client, for each consumer and worker, or for each limiter. The function
|
|
@@ -292,5 +386,5 @@ export declare const drainMachine: (description: ServiceDescription) => Machine;
|
|
|
292
386
|
/** These are the static machines of the runtime, by the name that their events carry. */
|
|
293
387
|
export declare const MACHINES: Readonly<Record<Exclude<MachineName, "drain" | "client">, Machine>>;
|
|
294
388
|
//#endregion
|
|
295
|
-
export { type Allowed, type Backoff, type Binding, type Bound, type Cancel, type Check, type CheckFn, type CheckVerdict, type Clock, type Controller, type ControllerBuilder, type CooperativeFloor, type Coupling, type Decision, type DelayBand, type Dependency, type DependencyHandle, EXIT_SIGNALS, type EmbeddedProcess, type Evaluated, type ExitCodes, type ExitSignal, type ExitTrigger, FORMAT, type FailsBy, type Finding, type Gate, type Health, type HealthServer, type HealthVerdict, type Heartbeat, type HeartbeatOptions, type HostStream, type Idempotency, type Inequality, type IterationContext, type Jitter, type JobAction, type JobContext, type JobFailure, type JobSettle, type JobSource, type KeyState, type KeyedLimiter, type Lifecycle, type LifecycleEvent, type LifecycleState, type LimitPolicy, type LimitRule, type Limiter, type LimiterEviction, type LimiterSpec, type LimiterState, type LimiterStore, type LimiterStoreSpec, type MachineName, type MemoryStore, type MessageShape, type MessageTrigger, type Operation, type OperationOf, type Outcome, PROCESS_TRIGGERS, type Phase, type PhaseContext, type PhaseWork, type PlatformClockOptions, type PodTiming, type Poll, type ProbeAnswer, type ProbeKind, type ProcessHost, type ProcessPort, type ProcessTrigger, type Profile, type ProgressMarks, type QueueDrain, type QueueDrainOptions, type QueueKnobs, type Recorder, type RedeliveryPolicy, type RefusalCause, type Refused, type RepeatSignal, type RequestEnd, type RequestEvent, type RequestFn, type RequestOptions, type RequestStream, type RequestWork, type RequeueCause, type Result, type RoutePattern, type RouteRequest, type Rule, type RunOptions, SLIDING_WINDOW_MACHINE, STAGES, type Scenario, type ServiceBuilder, type ServiceDescription, type ShutdownOptions, type Side, type SlidingWindow, type Span, type Stage, type StartOptions, type Step, type StoreFailure, TOKEN_BUCKET_MACHINE, type TakeRequest, type TakeStep, type Term, type Timing, type TokenBucket, type Transport, type TransportImpl, type UnitRequest, type Verdict, type Watchdog, type WatchdogSpec, type WorkerKnobs, type WorkerLoop, type WorkerLoopOptions, asDebounce, asWindow, backoffBand, backoffDelay, backoffProblems, cooperativeAbortAt, daemon, decide, detectionTime, embeddedProcess, ephemeral, failSpan, freeAt, heartbeat, heartbeatDetection, idleSpan, isExitCode, isExitSignal, isMessageShape, keyedLimiter, kubernetes, limitRule, limiterMachine, limiterProblems, limiterStateOf, localDev, longestRetryAfter, matchesMessage, mayReissue, memoryStore, nodeProcess, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redeliverOnce, replay, retryAfterSeconds, service, stageRank, watchdog };
|
|
389
|
+
export { type Allowed, type Backoff, type Binding, type Bound, type Cancel, type Change, type Check, type CheckFn, type CheckMetrics, type CheckVerdict, type Claim, type Clock, type Compressed, type Compression, type Controller, type ControllerBuilder, type CooperativeFloor, type Coupling, DURATION_FRACTIONS, type Decision, type DelayBand, type Dependency, type DependencyHandle, type DurationHistogram, EPISODES_KEPT, EXIT_SIGNALS, type EmbeddedProcess, type Episode, type Epochs, type Evaluated, type ExitCodes, type ExitSignal, type ExitTrigger, FORMAT, type FailsBy, type Finding, type Gate, type Health, type HealthMetrics, type HealthServer, type HealthVerdict, type Heartbeat, type HeartbeatOptions, type HostStream, type Idempotency, type Inequality, type IterationContext, type Jitter, type JobAction, type JobContext, type JobFailure, type JobSettle, type JobSource, type KeyState, type KeyedLimiter, type Lifecycle, type LifecycleEvent, type LifecycleState, type LimitPolicy, type LimitRule, type Limiter, type LimiterEviction, type LimiterSpec, type LimiterState, type LimiterStore, type LimiterStoreSpec, type MachineName, type MemoryStore, type MessageShape, type MessageTrigger, type Operation, type OperationOf, type Outcome, PROCESS_TRIGGERS, type Phase, type PhaseContext, type PhaseWork, type PlatformClockOptions, type PodTiming, type Poll, type ProbeAnswer, type ProbeKind, type ProcessHost, type ProcessPort, type ProcessTrigger, type Profile, type ProgressMarks, type QueueDrain, type QueueDrainOptions, type QueueKnobs, type Recorder, type RedeliveryPolicy, type RefusalCause, type Refused, type RepeatSignal, type RequestEnd, type RequestEvent, type RequestFn, type RequestOptions, type RequestStream, type RequestWork, type RequeueCause, type Result, type RoutePattern, type RouteRequest, type Rule, type RunOptions, SLIDING_WINDOW_MACHINE, STAGES, type Scenario, type ScenarioValue, type ScopedChange, type ServiceBuilder, type ServiceDescription, type ShutdownOptions, type Side, type SlidingWindow, type Span, type Stage, type StartOptions, type Statistic, type Step, type StoreFailure, TOKEN_BUCKET_MACHINE, type TakeRequest, type TakeStep, type Term, type TimerMark, type TimerMarks, type Timing, type TokenBucket, type Transport, type TransportImpl, type UnitRequest, type Verdict, type Watchdog, type WatchdogSpec, type WorkerKnobs, type WorkerLoop, type WorkerLoopOptions, asDebounce, asWindow, backoffBand, backoffDelay, backoffProblems, cooperativeAbortAt, daemon, decide, detectionTime, embeddedProcess, ephemeral, failSpan, freeAt, heartbeat, heartbeatDetection, idleSpan, isExitCode, isExitSignal, isMessageShape, keyedLimiter, kubernetes, limitRule, limiterMachine, limiterProblems, limiterStateOf, localDev, longestRetryAfter, matchesMessage, mayReissue, memoryStore, nodeProcess, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retryAfterSeconds, service, stageRank, watchdog };
|
|
296
390
|
//# sourceMappingURL=index.d.ts.map
|