@mark1russell7/service 0.5.11 → 0.5.13

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.
@@ -0,0 +1,150 @@
1
+ import { n as Clock } from "./clock-mVqhXD0b.js";
2
+ import { G as ServiceDescription, d as TransportImpl, r as Lifecycle } from "./lifecycle-fgYfxrHK.js";
3
+ import { Extent, Quantity } from "@mark1russell7/quantity";
4
+ //#region src/units.d.ts
5
+ /**
6
+ * A unit request names the route of each unit of work in the request tracking of the service. Then
7
+ * the service admits, counts, drains and cuts each unit as it does each request (`life.request`).
8
+ * The controller declares the route, thus its idempotency tells if a cut unit can go again.
9
+ */
10
+ interface UnitRequest<U> {
11
+ /** This name is the controller that declares the route. */
12
+ readonly controller: string;
13
+ /** This name is the route of each unit, or a function that gives it from the unit. A route can match a route pattern. */
14
+ readonly route: string | ((unit: U) => string);
15
+ /** This function gives the detail of a unit, for the function of a route pattern. */
16
+ readonly detail?: ((unit: U) => unknown) | undefined;
17
+ }
18
+ //#endregion
19
+ //#region src/queue.d.ts
20
+ /**
21
+ * These are the knobs of a queue drain, by the names of the ordering law where the law has them.
22
+ * The drain has no defaults, thus each knob is necessary. A bound that nobody gives is "infinite".
23
+ */
24
+ interface QueueKnobs {
25
+ /** This time is the wait after a take that gives no job, before the next take. A time without a bound waits for `wake()`. */
26
+ readonly queue_poll_interval: Extent;
27
+ /**
28
+ * This time is the most that one job can take. At it, the drain aborts the signal of the job, and
29
+ * a throw after it is a failure. The law reads it as `unit_processing_time@consumer` (O20).
30
+ */
31
+ readonly unit_processing_time: Extent;
32
+ /** This time is the delay after the first failed take in sequence, or after a refusal of the service. The delay is two times longer after each one. */
33
+ readonly retry_base: Quantity;
34
+ /** This time is the most that one delay can be, before its jitter. */
35
+ readonly retry_cap: Quantity;
36
+ /** This time bounds the close: the end of the jobs after their abort, and then the close of the source. */
37
+ readonly close_bound: Quantity;
38
+ /** This count (the unit `count`) is the most jobs in flight at one time. A count without a bound takes each job that comes. */
39
+ readonly concurrency: Extent;
40
+ /** The other knobs go to the declaration, for example `lease_duration@broker`. The drain does not read them. */
41
+ readonly [knob: string]: Extent;
42
+ }
43
+ /**
44
+ * A job source gives the jobs of a queue drain:
45
+ * - A function takes the next job, or gives null when no job is ready. Its signal aborts when the intake stops.
46
+ * - An async iterable gives the jobs in sequence. The drain asks for the next job only when it has a free slot.
47
+ * At the stop of the intake, the drain ends the iterator through `return()`.
48
+ */
49
+ type JobSource<J> = ((signal: AbortSignal) => J | null | undefined | PromiseLike<J | null | undefined>) | AsyncIterable<J>;
50
+ /**
51
+ * A job action is what the drain does with a job that failed:
52
+ * - `requeue`: the job goes back on the queue.
53
+ * - `reject`: the job leaves the queue without a success, for example to the dead-letter route of the queue.
54
+ * - `ack`: the job leaves the queue, as a poison message does.
55
+ */
56
+ type JobAction = "requeue" | "reject" | "ack";
57
+ /** A job failure is a job whose handler failed, with the count of its deliveries, 1 at the first. */
58
+ interface JobFailure<J> {
59
+ readonly job: J;
60
+ readonly error: unknown;
61
+ readonly delivery: number;
62
+ }
63
+ /** A redelivery policy gives the action for a job that failed. The queue declares it, and it has no default (S6 A11). */
64
+ type RedeliveryPolicy<J> = (failure: JobFailure<J>) => JobAction;
65
+ /**
66
+ * A requeue cause tells why a job goes back on the queue:
67
+ * - `failed`: the redelivery policy sent it back after a failure.
68
+ * - `unstarted`: the drain took the job and did not start it, because its intake stopped or the service refused it.
69
+ * - `cut`: the shutdown cut the job, and its route declares that it can go again.
70
+ */
71
+ type RequeueCause = "failed" | "unstarted" | "cut";
72
+ /** A job settle is how the drain tells the queue the end of each job. Each function can give a promise. */
73
+ interface JobSettle<J> {
74
+ /** This function removes the job from the queue: a success, or the action `ack`. */
75
+ ack(job: J): void | PromiseLike<void>;
76
+ /** This function puts the job back on the queue, or hands it back to the queue at the stop. */
77
+ requeue(job: J, cause: RequeueCause): void | PromiseLike<void>;
78
+ /** This function removes the job from the queue without a success: the action `reject`, or a cut job that cannot go again. */
79
+ reject(job: J, error: unknown): void | PromiseLike<void>;
80
+ /**
81
+ * This function gives the count of deliveries of a job from the queue, 1 at the first. The queue
82
+ * knows it, for example `x-delivery-count` of RabbitMQ or `ApproximateReceiveCount` of SQS. A
83
+ * queue in memory counts for itself. The drain has no default, because a broker gives a new object at each delivery.
84
+ */
85
+ delivery(job: J): number;
86
+ }
87
+ /** A job context is what the drain gives the handler of each job. */
88
+ interface JobContext {
89
+ /** This signal aborts at the cooperative abort of the drain, at the bound of the job, and at the close. */
90
+ readonly signal: AbortSignal;
91
+ /** This signal aborts when the intake stops. */
92
+ readonly intake: AbortSignal;
93
+ /** This count is the delivery of the job, 1 at the first. */
94
+ readonly delivery: number;
95
+ /** This lifecycle is the lifecycle that the drain got at its start. */
96
+ readonly life: Lifecycle;
97
+ }
98
+ /** These options make a queue drain. Each function can give a promise. */
99
+ interface QueueDrainOptions<J> {
100
+ readonly source: JobSource<J>;
101
+ /** This function does one job. A throw is a failure, and the redelivery policy then gives its action. */
102
+ readonly handle: (job: J, context: JobContext) => unknown;
103
+ readonly settle: JobSettle<J>;
104
+ /** This policy gives the action for each failed job. `redeliverOnce` gives the policy of S6 A11. */
105
+ readonly redelivery: RedeliveryPolicy<J>;
106
+ /** This function closes the source at the close, after the jobs end: for example, it closes a channel. */
107
+ readonly close?: (() => void | PromiseLike<void>) | undefined;
108
+ /** This clock is the clock of the lifecycle. The polls, the backoffs and the bounds use it. The default is `realClock`. */
109
+ readonly clock?: Clock | undefined;
110
+ /** This function gives the random numbers of the jitter, from 0 up to 1. The default is `Math.random`. */
111
+ readonly random?: (() => number) | undefined;
112
+ /**
113
+ * This route puts each job through `life.request`: the service then admits it, counts it, drains
114
+ * it and can cut it. The idempotency of the route tells if a cut job goes back on the queue.
115
+ */
116
+ readonly request?: UnitRequest<J> | undefined;
117
+ /**
118
+ * This function receives each failure: of a take, of a job, of a settle and of a policy. It also
119
+ * receives the end of a source while the intake is open. The job is undefined for a take and for that end.
120
+ */
121
+ readonly onError?: ((error: unknown, job: J | undefined) => void) | undefined;
122
+ }
123
+ /** A queue drain is a transport of the lifecycle whose work is the jobs of a queue (S6 A11). */
124
+ interface QueueDrain extends TransportImpl {
125
+ /** These knobs go to the declaration of the consumer: `svc.consumer(name, drain.knobs, drain)`. */
126
+ readonly knobs: QueueKnobs;
127
+ /** This method ends the wait of a poll at once, for example when a job comes. It gives false after the intake stops. */
128
+ wake(): boolean;
129
+ /** This method gives the problems of the knobs in a declaration: the close bound and the bound of a job against the caps. */
130
+ problems(description: ServiceDescription): string[];
131
+ }
132
+ /**
133
+ * This function gives the redelivery policy of S6 A11. A poison message gets `ack`. Each other job
134
+ * goes back on the queue after its first failure, one time. After a later failure, `then` gives the
135
+ * action: the declared policy of the queue.
136
+ */
137
+ declare const redeliverOnce: <J>(then: JobAction | RedeliveryPolicy<J>, poison?: (error: unknown, job: J) => boolean) => RedeliveryPolicy<J>;
138
+ /**
139
+ * This function makes a queue drain as a transport (S6 A11). One taker takes the jobs from the
140
+ * source while a slot is free, and each job operates in its slot.
141
+ * - A success gets `ack`. A failure gets the action of the redelivery policy.
142
+ * - `stopIntake` takes no new job, and a job that the drain took and did not start goes back (`requeue`, `unstarted`).
143
+ * - `drain` waits for each job in flight until the deadline, and gives it the cooperative abort.
144
+ * - `close` aborts each job, waits for its end, and closes the source, all in `close_bound`. A job
145
+ * that does not end in the bound gets `reject`.
146
+ */
147
+ declare const queueDrain: <J>(knobs: QueueKnobs, options: QueueDrainOptions<J>) => QueueDrain;
148
+ //#endregion
149
+ export { JobSource as a, QueueKnobs as c, queueDrain as d, redeliverOnce as f, JobSettle as i, RedeliveryPolicy as l, JobContext as n, QueueDrain as o, UnitRequest as p, JobFailure as r, QueueDrainOptions as s, JobAction as t, RequeueCause as u };
150
+ //# sourceMappingURL=queue-snRHK3Jm.d.ts.map
@@ -0,0 +1,294 @@
1
+ import { Y as Poll } from "./lifecycle-fgYfxrHK.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, y as retryBackoff } from "./core-BPLRDcUJ.js";
3
+ import { t as Judge } from "./dial-DA8vJfh2.js";
4
+ import { i as JobSettle } from "./queue-snRHK3Jm.js";
5
+ import { Extent, Quantity } from "@mark1russell7/quantity";
6
+ import { Machine } from "@mark1russell7/algebra";
7
+ //#region src/rabbitmq/connection.d.ts
8
+ /** A message is a message of the broker, as amqplib gives it from `get`. The wrapper reads only these fields. */
9
+ interface RabbitMessage {
10
+ readonly content: Buffer;
11
+ readonly fields: {
12
+ readonly deliveryTag: number;
13
+ readonly redelivered: boolean;
14
+ readonly exchange: string;
15
+ readonly routingKey: string;
16
+ /** This count is the number of messages that stay on the queue after this one. */
17
+ readonly messageCount?: number | undefined;
18
+ };
19
+ readonly properties: {
20
+ readonly headers?: Readonly<Record<string, unknown>> | undefined;
21
+ readonly [property: string]: unknown;
22
+ };
23
+ }
24
+ /** These are the properties of a publish that amqplib takes, for example `persistent`, `messageId` and `headers`. */
25
+ type RabbitPublishOptions = Readonly<Record<string, unknown>>;
26
+ /** These are the events of a channel that the wrapper listens to. */
27
+ type RabbitChannelEvent = "error" | "close";
28
+ /**
29
+ * A channel is the part of a `ConfirmChannel` of amqplib 2 that the wrapper uses. A confirm channel
30
+ * gives one result to the callback of each publish. The result is null for a `basic.ack`. It is an
31
+ * error for a `basic.nack` and for the end of the channel.
32
+ */
33
+ interface RabbitChannel {
34
+ /** This method writes one message. It throws when the channel is closed or closing. */
35
+ publish(exchange: string, routingKey: string, content: Buffer, options: RabbitPublishOptions, callback: (error: Error | null) => void): boolean;
36
+ /** This method takes one message (`basic.get`), or gives false when the queue is empty. It has no timer of its own. */
37
+ get(queue: string, options?: {
38
+ readonly noAck?: boolean | undefined;
39
+ }): Promise<RabbitMessage | false>;
40
+ /** This method declares an exchange in passive mode: an RPC that changes nothing. The round-trip check uses it. */
41
+ checkExchange(exchange: string): Promise<unknown>;
42
+ /** This method acknowledges one message. It is one frame, with no reply. */
43
+ ack(message: RabbitMessage): void;
44
+ /** This method gives one message back to the broker, to the queue or to its dead-letter route. It is one frame, with no reply. */
45
+ nack(message: RabbitMessage, allUpTo?: boolean, requeue?: boolean): void;
46
+ close(): Promise<void>;
47
+ on(event: RabbitChannelEvent, listener: (error?: Error) => void): unknown;
48
+ off(event: RabbitChannelEvent, listener: (error?: Error) => void): unknown;
49
+ }
50
+ /** These are the events of a connection that the wrapper listens to. The event `blocked` gives the reason of the broker. */
51
+ type RabbitConnectionEvent = "error" | "close" | "blocked" | "unblocked";
52
+ /**
53
+ * A connection is the part of a `ChannelModel` of amqplib 2 that the wrapper uses. A `ChannelModel`
54
+ * has each part. A fake for tests has them too. Thus the package depends on no type of amqplib.
55
+ */
56
+ interface RabbitConnection {
57
+ /** This method opens a channel with confirms (`confirm.select`). */
58
+ createConfirmChannel(): Promise<RabbitChannel>;
59
+ /** This method sends `connection.close`, and waits for `connection.close-ok`. Behind a black hole, it waits with no bound. */
60
+ close(): Promise<void>;
61
+ on(event: RabbitConnectionEvent, listener: (detail?: unknown) => void): unknown;
62
+ off(event: RabbitConnectionEvent, listener: (detail?: unknown) => void): unknown;
63
+ /** This field holds the socket. The join reads its addresses, and the bounded close destroys it. */
64
+ readonly connection: {
65
+ readonly stream?: ClientSocket | undefined;
66
+ };
67
+ }
68
+ /**
69
+ * These are the socket options that the wrapper gives amqplib. Each one comes from the declaration.
70
+ * At its defaults, amqplib sets no connect timeout, no keepalive and no TCP_NODELAY.
71
+ */
72
+ interface RabbitSocketOptions {
73
+ /** This time bounds the TCP connect and the handshake. The timer stops when the connection opens. A time of 0 is no bound. */
74
+ readonly timeout: number;
75
+ /** The library turns Nagle off only when the caller asks. A confirm and a reply then do not wait for a delayed ACK. */
76
+ readonly noDelay: true;
77
+ readonly keepAlive: boolean;
78
+ /** This time is the idle time of TCP keepalive, in milliseconds. Node truncates it to whole seconds. */
79
+ readonly keepAliveDelay?: number | undefined;
80
+ /** The broker shows `connection_name` in its management view and its log, thus the prober can join on it too. */
81
+ readonly clientProperties: {
82
+ readonly connection_name: string;
83
+ };
84
+ }
85
+ /** These are the arguments of `connect(url, socketOptions)`. The URL gives the host, the vhost, the user and the heartbeat. */
86
+ interface RabbitConnectOptions {
87
+ readonly url: string;
88
+ readonly socketOptions: RabbitSocketOptions;
89
+ }
90
+ /** A connection factory makes one connection of amqplib from its options. A failure to open rejects. */
91
+ type RabbitFactory = Factory<RabbitConnectOptions, RabbitConnection>;
92
+ /**
93
+ * This factory opens a connection of amqplib. It loads amqplib only when a client connects, thus a
94
+ * service that does not use RabbitMQ does not need it. The specifier is a value, thus the package
95
+ * needs no types of amqplib. The built-in recovery of amqplib stays off, because the wrapper connects again by itself.
96
+ */
97
+ export declare const nodeAmqp: RabbitFactory;
98
+ //#endregion
99
+ //#region src/rabbitmq/client.d.ts
100
+ /**
101
+ * These are the knobs of the client, each a time, by the names of the ordering law where the law
102
+ * has them. The runtime has no defaults, thus each knob is necessary. A bound that nobody gives is
103
+ * "infinite", not zero. The constant `RABBIT_STARTING_KNOBS` gives a declaration from the cells of R3. The knobs
104
+ * that each client has come from the core.
105
+ */
106
+ interface RabbitKnobs extends ClientKnobs, RetryKnobs {
107
+ /**
108
+ * This time bounds the TCP connect and the handshake (`socketOptions.timeout`). The client also
109
+ * bounds the open of its channel with it. The timer of amqplib stops when the connection opens.
110
+ */
111
+ readonly connect_bound: Quantity;
112
+ /** This time bounds each call: a publish until its confirm, and an RPC until its reply. The wrapper has this timer, because amqplib has none. */
113
+ readonly request_timeout: Quantity;
114
+ /**
115
+ * This time is the heartbeat that the client asks for (`heartbeat` in the URL), in whole seconds.
116
+ * The connection uses the smaller of this value and the value of the broker. The value "infinite" asks for no heartbeat.
117
+ */
118
+ readonly heartbeat_interval: Extent;
119
+ /** This time is the first delay before a new try to connect. The delay doubles after each try. */
120
+ readonly retry_base: Quantity;
121
+ /** This time is the most that one delay can be, before its jitter. */
122
+ readonly retry_cap: Quantity;
123
+ /** This time is the idle time of TCP keepalive (`keepAliveDelay`), in whole seconds. The value "infinite" turns keepalive off, as amqplib does by default. */
124
+ readonly keepalive_idle: Extent;
125
+ /** The client does not replace its connection at an age, thus this knob must be "infinite". */
126
+ readonly max_connection_age: Extent;
127
+ /** This time bounds the close of the client at the shutdown: `connection.close`, then a destroy of the socket. */
128
+ readonly close_bound: Quantity;
129
+ }
130
+ /** A seed is one more node of the cluster. The client connects to the next node after each failure, in sequence. */
131
+ interface RabbitSeed {
132
+ readonly host: string;
133
+ readonly port: number;
134
+ }
135
+ /** A RabbitMQ client spec is the declaration of one RabbitMQ client: where it connects, and its knobs. */
136
+ interface RabbitClientSpec extends ClientSpec<RabbitKnobs> {
137
+ /** This name is the virtual host. The default of the broker is "/". */
138
+ readonly vhost?: string | undefined;
139
+ /** This name is the user. Without it, amqplib connects as the user "guest". */
140
+ readonly username?: string | undefined;
141
+ /** These nodes are more nodes of the cluster, after `host` and `port`. */
142
+ readonly seeds?: readonly RabbitSeed[] | undefined;
143
+ /**
144
+ * These operations are the calls of the service, by name, with their idempotency. A message does
145
+ * not tell if a consumer removes its duplicates. Thus the client sends again only a call that this table names.
146
+ */
147
+ readonly operations?: ClientSpec<RabbitKnobs>["operations"];
148
+ }
149
+ /** These options make a client. Without them, it uses amqplib, the real clock, `Math.random`, and a dial with the protocol header. */
150
+ interface RabbitClientOptions extends ClientOptions<RabbitFactory> {
151
+ readonly random?: (() => number) | undefined;
152
+ }
153
+ /**
154
+ * A join is one generation of the client: one connection and its channel, when the channel is open
155
+ * (D1, D2). The prober joins its kernel records to the view of the broker through it.
156
+ */
157
+ interface RabbitJoin extends ClientJoin {
158
+ /** This text is the node of the connection, as `host:port`. */
159
+ readonly address: string;
160
+ /** This text is the name of the connection in the broker, `local:port -> remote:port`, or null when the socket gives no addresses. */
161
+ readonly connectionName: string | null;
162
+ }
163
+ /** A publish is one message to an exchange. A string content goes as UTF-8. */
164
+ interface RabbitPublish {
165
+ readonly exchange: string;
166
+ readonly routingKey: string;
167
+ readonly content: Buffer | string;
168
+ /** These properties go to amqplib, for example `persistent`, `messageId` and `headers`. */
169
+ readonly properties?: RabbitPublishOptions | undefined;
170
+ }
171
+ /** A delivery is one message that the client took from a queue. It stays on the channel of its generation until a settle. */
172
+ interface RabbitDelivery {
173
+ readonly message: RabbitMessage;
174
+ /** This number is the generation of the channel that holds the message. */
175
+ readonly generation: number;
176
+ /** This count is the delivery of the message, 1 at the first, from `x-delivery-count` or `redelivered`. */
177
+ readonly delivery: number;
178
+ }
179
+ /** These are the source and the settle of a queue drain on one queue: `queueDrain({ source, settle, ... })`. */
180
+ interface RabbitJobs {
181
+ /** This function takes one job, or gives null when the queue is empty. It is a `JobSource` of the drain. */
182
+ readonly source: (signal: AbortSignal) => Promise<RabbitDelivery | null>;
183
+ readonly settle: JobSettle<RabbitDelivery>;
184
+ }
185
+ /** A RabbitMQ client is a dependency of a service: its declaration, its handle, its checks and its calls. */
186
+ interface RabbitClient extends Client<ClientStep, RabbitJoin> {
187
+ /** This text is the state of the client, as `RABBIT_CLIENT_MACHINE` names it. */
188
+ readonly status: string;
189
+ /**
190
+ * This method publishes one message, and waits for its confirm. An ack is `ok`. The client sends
191
+ * again only an idempotent operation, one time at most, after an outcome that is not certain.
192
+ */
193
+ publish(operation: string, message: RabbitPublish, options?: SendOptions): Promise<Sent<void>>;
194
+ /** This method takes one message from a queue (`basic.get`), or gives null when the queue is empty. */
195
+ get(operation: string, queue: string, options?: SendOptions): Promise<Sent<RabbitDelivery | null>>;
196
+ /** This method gives the source and the settle of a queue drain. The source takes each job with `get`. */
197
+ jobs(operation: string, queue: string): RabbitJobs;
198
+ }
199
+ /** This function gives the problems of a spec: the knobs that the client cannot use. */
200
+ export declare const specProblems: (name: string, spec: RabbitClientSpec) => string[];
201
+ /**
202
+ * This function gives the arguments of `connect` for one node of a spec. Each timer of amqplib
203
+ * comes from the declaration. The heartbeat goes in the URL, and "infinite" is 0, no heartbeat.
204
+ */
205
+ export declare const rabbitOptions: (name: string, spec: RabbitClientSpec, index?: number) => RabbitConnectOptions;
206
+ /** The bytes of the protocol header of AMQP 0-9-1. A broker answers it with `connection.start`, before the authentication. */
207
+ export declare const AMQP_HEADER: Uint8Array;
208
+ /**
209
+ * This judge reads the answer to the protocol header. A broker that takes the version sends a method
210
+ * frame on channel 0: `connection.start`, class 10 and method 10. A broker that refuses the version
211
+ * sends its own protocol header, and closes the socket.
212
+ */
213
+ export declare const startJudge: Judge;
214
+ /** This dial function opens a TCP connection, sends the protocol header, and waits for `connection.start`. It needs no password. */
215
+ export declare const amqpDial: DialFn;
216
+ /**
217
+ * This function gives the outcome of a failure of amqplib. The library names few classes of error.
218
+ * Thus the wrapper reads the fields:
219
+ * - A throw before the write (`IllegalOperationError`: the channel is closed or closing) is certain: the call did not leave the client.
220
+ * - A reply code of the broker, from the close of the channel, is certain. The broker refused the call, or a call before it.
221
+ * - A nack, and an end of the channel before the reply or the confirm, are not certain.
222
+ */
223
+ export declare const failureOutcome: (error: unknown) => Attempt<never>;
224
+ /** This function gives the count of deliveries of a message, 1 at the first. A quorum queue counts in `x-delivery-count`. */
225
+ export declare const deliveryCount: (message: RabbitMessage) => number;
226
+ /**
227
+ * This function makes a RabbitMQ client, a dependency of a service over amqplib 2.
228
+ * - It has one connection and one confirm channel, as one generation. The end of either one ends
229
+ * the generation. The client then connects again by itself, to the next node, after a backoff.
230
+ * - It sets each timer of amqplib from the declaration. The built-in recovery of amqplib stays off.
231
+ * - Its call is a confirmed publish, or an RPC with a reply. Each call has a timer of the wrapper, because amqplib has none.
232
+ * - It tells the outcome of a call in three values, and it settles each call in flight at the end of its generation (C8, C10).
233
+ * - It records the node and the name of each connection at the open of its channel (D1).
234
+ *
235
+ * These parts come from the core of the clients: the outcomes, the second try, the wait for a ready client and the backoff.
236
+ * The calls in flight, the bounded close and the checks also come from the core. This entry gives what amqplib does in its own way.
237
+ */
238
+ export declare const rabbitClient: (name: string, spec: RabbitClientSpec, options?: RabbitClientOptions) => RabbitClient;
239
+ //#endregion
240
+ //#region src/rabbitmq/machine.d.ts
241
+ /**
242
+ * The RabbitMQ client of the service as a `mark1russell7.machine/1` document. It is one generation
243
+ * at a time: one connection of amqplib and its confirm channel. The machines `amqplib` and
244
+ * `rabbitmq-connection` of `@mark1russell7/machines` give the connection and its heartbeat. The states:
245
+ * - `ready`: the channel is open, and the client sends each call.
246
+ * - `blocked`: a resource alarm of the broker blocked the connection. Each call is not sent until the unblock.
247
+ * - `failing`: no generation is open. The client tries the next node after its backoff.
248
+ *
249
+ * The end of the channel or of the connection ends the generation. A test records the transitions
250
+ * of the client and replays them against this document.
251
+ */
252
+ export declare const RABBIT_CLIENT_MACHINE: Machine;
253
+ //#endregion
254
+ //#region src/rabbitmq/meets.d.ts
255
+ /**
256
+ * This function gives the manifestations that a RabbitMQ client can meet, and the detectors of each,
257
+ * from its knobs. The cells of R3 measured them on amqplib 2.2.0 against RabbitMQ 4.3.6:
258
+ * - The heartbeat ends a silent connection 2 to 3 heartbeats after the last data. The cells measured
259
+ * 180.009 s at 60 s, and 45.009 s at 15 s (O17). It finds a silent broker in flight and idle.
260
+ * - A stopped broker resets each client at once, because each socket of RabbitMQ has linger 0.
261
+ * - At `tcp_retries2 = 7`, the kernel gave up at 53.016 s.
262
+ * - A broker with a resource alarm blocks each connection that publishes, and it still sends its heartbeats.
263
+ */
264
+ export declare const rabbitMeetings: (name: string, knobs: RabbitKnobs) => Meeting[];
265
+ //#endregion
266
+ //#region src/rabbitmq/starting.d.ts
267
+ /**
268
+ * This poll is the poll of the checks that `RABBIT_STARTING_KNOBS` fits. It is `STARTING_POLL` of
269
+ * the core: each 5 s with a jitter of 20 %, and a timeout of 4 s (B6, O12). The poll does not depend on the driver.
270
+ */
271
+ export declare const RABBIT_STARTING_POLL: Poll;
272
+ /**
273
+ * These knobs are a declaration to start from, from what the cells of R3 measured on amqplib 2.2.0
274
+ * against RabbitMQ 4.3.6. The runtime has no defaults: a service gives these knobs, or its own.
275
+ * Each value holds the borders that the cells measured:
276
+ * - `connect_bound` 5 s: the connect timeout of DP44. The timer stops when the connection opens.
277
+ * Thus it does not change a fault with a call in flight. At its defaults, amqplib has no connect timeout.
278
+ * - `request_timeout` 9.5 s: in the slowest poll of 10 s (O13). After a loss of the leader of a quorum
279
+ * queue, the first confirm came at 6.61 s, 6.68 s and 8.05 s (T11). A later confirm is indeterminate, not lost.
280
+ * - `heartbeat_interval` 15 s: the heartbeat ended a silent connection 45.009 s after the last data,
281
+ * before the kernel gave up at 53.016 s (O17). The frames each 7.5 s keep a flow through a router
282
+ * that forgets it at 30 s (O03). At the 60 s of the broker, the heartbeat came at 180.009 s.
283
+ * - `retry_base` 1 s: the cells connected to the next node 1 s after the end of a connection.
284
+ * - `retry_cap` 8 s: no cell measured it. With its jitter of 1 s, the most delay is 9 s, in the slowest poll of 10 s.
285
+ * - `keepalive_idle` "infinite": amqplib sets no keepalive, and the heartbeat refreshes an idle flow.
286
+ * Linux sends no keepalive probe while data is in flight.
287
+ * - `max_connection_age` "infinite": the client does not replace its connection at an age.
288
+ * - `close_bound` 2 s: behind a black hole, `connection.close` waits for its close-ok with no bound.
289
+ * - `retrans_giveup_time` 924.6 s: the give-up of Linux at `tcp_retries2 = 15`.
290
+ */
291
+ export declare const RABBIT_STARTING_KNOBS: RabbitKnobs;
292
+ //#endregion
293
+ export { type Attempt, type CheckOptions, type Client, type ClientJoin, type ClientKnobs, type ClientOptions, type ClientSocket, type ClientSpec, type ClientStep, type Detector, type DialFn, type Factory, MANIFESTATIONS, type Manifestation, type Meeting, type RabbitChannel, type RabbitChannelEvent, type RabbitClient, type RabbitClientOptions, type RabbitClientSpec, type RabbitConnectOptions, type RabbitConnection, type RabbitConnectionEvent, type RabbitDelivery, type RabbitFactory, type RabbitJobs, type RabbitJoin, type RabbitKnobs, type RabbitMessage, type RabbitPublish, type RabbitPublishOptions, type RabbitSeed, type RabbitSocketOptions, type ReadyWait, type RetryKnobs, STARTING_POLL, type SendOptions, type Sent, type Situation, firstDetector, readyWait, retryBackoff, retryProblems, unwatched };
294
+ //# sourceMappingURL=rabbitmq.d.ts.map