@nimbus-sh/platform 0.7.1 → 0.8.1
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 +1 -1
- package/dist/heavy-alloc-coord.d.ts +5 -0
- package/dist/heavy-alloc-coord.d.ts.map +1 -1
- package/dist/heavy-alloc-coord.js +12 -1
- package/dist/limits.d.ts +3 -8
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +9 -8
- package/dist/lost-call.d.ts +62 -0
- package/dist/lost-call.d.ts.map +1 -0
- package/dist/lost-call.js +67 -0
- package/dist/module-source.d.ts +31 -0
- package/dist/module-source.d.ts.map +1 -0
- package/dist/module-source.js +52 -0
- package/dist/oom-classify.d.ts +14 -0
- package/dist/oom-classify.d.ts.map +1 -1
- package/dist/oom-classify.js +30 -0
- package/dist/retry.d.ts +49 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +59 -0
- package/dist/utf8.d.ts +11 -0
- package/dist/utf8.d.ts.map +1 -0
- package/dist/utf8.js +35 -0
- package/dist/w7-frame.d.ts +278 -6
- package/dist/w7-frame.d.ts.map +1 -1
- package/dist/w7-frame.js +657 -134
- package/dist/wave-writer.d.ts +392 -0
- package/dist/wave-writer.d.ts.map +1 -0
- package/dist/wave-writer.js +921 -0
- package/package.json +1 -1
- package/src/heavy-alloc-coord.ts +15 -1
- package/src/limits.ts +10 -9
- package/src/lost-call.ts +80 -0
- package/src/module-source.ts +57 -0
- package/src/oom-classify.ts +32 -0
- package/src/retry.ts +74 -0
- package/src/utf8.ts +31 -0
- package/src/w7-frame.ts +780 -149
- package/src/wave-writer.ts +1108 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wave-writer.ts — a producer's writes into the session, as W7 waves.
|
|
3
|
+
*
|
|
4
|
+
* The one W7 producer: git's network facet (a clone's files, fetch and
|
|
5
|
+
* pull's objects and refs), npm's install facet (package files), and the
|
|
6
|
+
* session's own bulk writes (npm bin shims, the clang sysroot). Each write
|
|
7
|
+
* is a record: a file, a link, a directory, or a removal. The writer buffers
|
|
8
|
+
* records into a wave and publishes the wave through one writeBatchStream()
|
|
9
|
+
* call. A wave closes before it would pass W7's owned-path bounds (count and
|
|
10
|
+
* bytes: files, removals and the directories above them, up to the root) or
|
|
11
|
+
* its byte budget; a file larger than the budget travels in a wave of its
|
|
12
|
+
* own, and one streamed from a source is never held whole.
|
|
13
|
+
*
|
|
14
|
+
* Pipelining: one wave is in flight while the next one buffers. A wave
|
|
15
|
+
* starts only once its predecessor has published, so a producer waits only
|
|
16
|
+
* when it fills a second wave, and a failed wave is the last this writer
|
|
17
|
+
* sends: the failure names its wave, and every later call rejects with it.
|
|
18
|
+
* Waves publish in order, so a record written after another is durable only
|
|
19
|
+
* if that one is: a completion marker written last proves what came before.
|
|
20
|
+
*
|
|
21
|
+
* Lost transport (lost-call.ts, the one policy for it): a wave whose call
|
|
22
|
+
* failed before the session answered (isLostFencedCall), or that nothing
|
|
23
|
+
* read for LOST_STREAM_STALL_MS before its end, or that stayed unanswered
|
|
24
|
+
* LOST_STREAM_ANSWER_MS after it, is sent again after a backoff, at most
|
|
25
|
+
* LOST_CALL_RESEND_BACKOFF_MS.length times. The abandoned attempt's stream
|
|
26
|
+
* is errored so it reads nothing more, and every attempt carries its fence
|
|
27
|
+
* (writer, wave, attempt): the session refuses an attempt older than one it
|
|
28
|
+
* has seen, so a late original never applies over its re-send.
|
|
29
|
+
* Re-sending is safe: a wave is the same paths and bytes, replacing. A shed
|
|
30
|
+
* wave never ran; the platform's advice is not to retry an overloaded
|
|
31
|
+
* object, but these waves are few and backed off, and npm measured the
|
|
32
|
+
* re-send recover a 119-package install that otherwise lost 31 packages to
|
|
33
|
+
* one shed. A wave the session answered (ok: false) is its verdict and is
|
|
34
|
+
* never retried, nor is a wave with a streamed source (its source is spent).
|
|
35
|
+
*
|
|
36
|
+
* Fault domains: with `failPerOwner`, a record's `meta` is its owner (an
|
|
37
|
+
* npm package), and a failed wave whose records all have owners fails those
|
|
38
|
+
* owners (their later records reject, their buffered ones are not sent)
|
|
39
|
+
* while the writer goes on for the rest. Otherwise, and for a failed wave
|
|
40
|
+
* carrying anything unowned (a directory or removal record, the pin, a
|
|
41
|
+
* record without meta), the failed wave is the last one sent. A write that
|
|
42
|
+
* supersedes a buffered record (the same path, written again before a cut)
|
|
43
|
+
* settles it: the wave carrying the later write publishes or fails the
|
|
44
|
+
* owners of both. An owner is published once every wave that carried its
|
|
45
|
+
* writes has (`published`).
|
|
46
|
+
*
|
|
47
|
+
* Admitting a record costs its own new directories, never a recount of the
|
|
48
|
+
* wave: the owned set grows as records arrive, and a directory chain walk
|
|
49
|
+
* stops at the first directory already owned (whose chain is owned).
|
|
50
|
+
* Records may be written concurrently (an install writes several packages
|
|
51
|
+
* at once): each is admitted and buffered in call order.
|
|
52
|
+
*
|
|
53
|
+
* Several writers may publish into one session at once (a clone's parallel
|
|
54
|
+
* producers); each is its own stream, and the session takes them
|
|
55
|
+
* concurrently.
|
|
56
|
+
*/
|
|
57
|
+
/** Paths a wave holds back from W7's bound, for its pinned marker and the marker's directories. */
|
|
58
|
+
export declare const WAVE_PATHS: number;
|
|
59
|
+
export declare const WAVE_PATH_BYTES: number;
|
|
60
|
+
/** Buffered content bytes that close a wave. */
|
|
61
|
+
export declare const WAVE_BYTES: number;
|
|
62
|
+
/**
|
|
63
|
+
* Which attempt of which wave under which writer epoch a stream is. The
|
|
64
|
+
* session issued the epoch (openWaveWriter) and refuses, by default, an
|
|
65
|
+
* attempt under an epoch it does not hold open, or older than one it has
|
|
66
|
+
* admitted under it: an attempt the writer gave up on never applies after
|
|
67
|
+
* its re-send, however late it arrives.
|
|
68
|
+
*/
|
|
69
|
+
export interface WaveFence {
|
|
70
|
+
writer: string;
|
|
71
|
+
wave: number;
|
|
72
|
+
attempt: number;
|
|
73
|
+
/**
|
|
74
|
+
* A sequenced writer's wave (a process's filesystem client): the number of
|
|
75
|
+
* its first op, each op after it the next, and the highest cursor the
|
|
76
|
+
* writer has had answered. The session keeps the writer's cursor with its
|
|
77
|
+
* commits, so an op a re-send carries again is answered, not applied twice.
|
|
78
|
+
*/
|
|
79
|
+
seq?: number;
|
|
80
|
+
ack?: number;
|
|
81
|
+
}
|
|
82
|
+
/** The supervisor surface a writer publishes through. */
|
|
83
|
+
export interface WaveSupervisor {
|
|
84
|
+
/**
|
|
85
|
+
* `fence` is absent when the supervisor issued no epoch: the session
|
|
86
|
+
* fences nothing. `owner`: the delegation the wave is written under, when
|
|
87
|
+
* it is not the one the binding was made with.
|
|
88
|
+
*/
|
|
89
|
+
writeBatchStream(stream: ReadableStream<Uint8Array>, fence?: WaveFence, owner?: string): Promise<unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* A writer epoch from the session, the only identity it admits fenced
|
|
92
|
+
* waves under, or null when it fences nothing. Absent on a supervisor
|
|
93
|
+
* that is the session itself (nothing between them can lose a call).
|
|
94
|
+
*/
|
|
95
|
+
openWaveWriter?(): Promise<string | null>;
|
|
96
|
+
}
|
|
97
|
+
/** A published file as the session will stat it: what a warm index entry needs. */
|
|
98
|
+
export interface WaveFileReceipt {
|
|
99
|
+
path: string;
|
|
100
|
+
ino: number;
|
|
101
|
+
mode: number;
|
|
102
|
+
size: number;
|
|
103
|
+
mtimeMs: number;
|
|
104
|
+
ctimeMs: number;
|
|
105
|
+
uid: number;
|
|
106
|
+
gid: number;
|
|
107
|
+
dev: number;
|
|
108
|
+
}
|
|
109
|
+
export interface WaveReport {
|
|
110
|
+
wave: number;
|
|
111
|
+
files: number;
|
|
112
|
+
bytes: number;
|
|
113
|
+
rpcWallMs: number;
|
|
114
|
+
receipts: WaveFileReceipt[];
|
|
115
|
+
}
|
|
116
|
+
/** What one wave carried, for the caller's own view of the paths it published. */
|
|
117
|
+
export interface WaveCut<Meta> {
|
|
118
|
+
wave: number;
|
|
119
|
+
mtimeMs: number;
|
|
120
|
+
/** Each file and link, with what its caller attached to the record. */
|
|
121
|
+
files: {
|
|
122
|
+
path: string;
|
|
123
|
+
meta: Meta | undefined;
|
|
124
|
+
}[];
|
|
125
|
+
directories: string[];
|
|
126
|
+
}
|
|
127
|
+
export interface WaveWriterOptions<Meta = undefined> {
|
|
128
|
+
supervisor: WaveSupervisor;
|
|
129
|
+
/**
|
|
130
|
+
* The directory a wave publishes up to, inclusive: a record's directories
|
|
131
|
+
* above it are not the writer's. Null publishes every ancestor.
|
|
132
|
+
*/
|
|
133
|
+
root: string | null;
|
|
134
|
+
/** An existing worktree: only directories strictly below it are published. */
|
|
135
|
+
worktreeRoot?: string | null;
|
|
136
|
+
/** Record paths are relative to it (joined with '/'); omitted, they are VFS paths. */
|
|
137
|
+
base?: string;
|
|
138
|
+
/** Wall-clock time (ms) after which no new wave starts. */
|
|
139
|
+
deadline?: number | null;
|
|
140
|
+
/** Every inode's mtime; omitted, each wave stamps the time it was cut. */
|
|
141
|
+
mtimeMs?: number;
|
|
142
|
+
/** A directory's mode, as the caller knows it; omitted or undefined, 0o755. */
|
|
143
|
+
directoryMode?: (path: string) => number | undefined;
|
|
144
|
+
/** Called synchronously as a wave is cut, before it is sent. */
|
|
145
|
+
onCut?: (cut: WaveCut<Meta>) => void;
|
|
146
|
+
/** Called once per published wave, in order. */
|
|
147
|
+
onWave?: (report: WaveReport) => void;
|
|
148
|
+
/** A record's `meta` names its owner, and a failed wave fails only the owners it carried. */
|
|
149
|
+
failPerOwner?: boolean;
|
|
150
|
+
/** The lost-call policy's timings (lost-call.ts); tests shorten them. */
|
|
151
|
+
retry?: {
|
|
152
|
+
backoffMs: readonly number[];
|
|
153
|
+
stallMs: number;
|
|
154
|
+
answerDeadlineMs: number;
|
|
155
|
+
};
|
|
156
|
+
/** Called before each re-send of a lost wave, with its lost-call attributes (lost-call.ts). */
|
|
157
|
+
onResend?: (lost: Record<string, string | number>) => void;
|
|
158
|
+
}
|
|
159
|
+
export interface WaveStats {
|
|
160
|
+
waves: number;
|
|
161
|
+
files: number;
|
|
162
|
+
bytes: number;
|
|
163
|
+
rpcWallMs: number;
|
|
164
|
+
maxRpcWallMs: number;
|
|
165
|
+
producerWaitMs: number;
|
|
166
|
+
/** Paths probed by ownership accounting: linear in records, never wave × records. */
|
|
167
|
+
ownershipVisits: number;
|
|
168
|
+
maxWavePaths: number;
|
|
169
|
+
maxWaveBytes: number;
|
|
170
|
+
/** Waves sent again after their transport was lost. */
|
|
171
|
+
retries: number;
|
|
172
|
+
/** Waves encoded whole before they were sent (the rest streamed as encoded). */
|
|
173
|
+
wholeWaves: number;
|
|
174
|
+
}
|
|
175
|
+
export declare class WaveFailure extends Error {
|
|
176
|
+
readonly wave: number;
|
|
177
|
+
constructor(wave: number, cause: unknown);
|
|
178
|
+
}
|
|
179
|
+
export declare class WaveWriter<Meta = undefined> {
|
|
180
|
+
private readonly options;
|
|
181
|
+
private readonly records;
|
|
182
|
+
private readonly directories;
|
|
183
|
+
private readonly deletes;
|
|
184
|
+
private bufferedBytes;
|
|
185
|
+
private symlinks;
|
|
186
|
+
/** Links in the wave in flight: sent, not yet published. */
|
|
187
|
+
private inFlightSymlinks;
|
|
188
|
+
/** Every path the buffered wave publishes; a superset once a buffered record is removed. */
|
|
189
|
+
private readonly owned;
|
|
190
|
+
/** The upward-closed part of `owned`: each one's chain, to the root, is owned too. */
|
|
191
|
+
private readonly ownedDirectories;
|
|
192
|
+
private ownedPathBytes;
|
|
193
|
+
private pin;
|
|
194
|
+
private inFlight;
|
|
195
|
+
private cutQueue;
|
|
196
|
+
private sequence;
|
|
197
|
+
private failure;
|
|
198
|
+
/** Owners (records' `meta`) whose records a failed wave carried. */
|
|
199
|
+
private readonly failedOwners;
|
|
200
|
+
/** With `failPerOwner`: owners with a write in the buffered wave, superseded ones included. */
|
|
201
|
+
private readonly bufferedOwners;
|
|
202
|
+
/** With `failPerOwner`: the last wave that carried each owner's writes. */
|
|
203
|
+
private readonly ownerWaves;
|
|
204
|
+
/** Waves publish in order: every wave up to this one has settled, this one published. */
|
|
205
|
+
private lastPublishedWave;
|
|
206
|
+
private readonly counters;
|
|
207
|
+
/** The session's epoch for this writer, and when it was opened (null: unfenced). */
|
|
208
|
+
private epoch;
|
|
209
|
+
/** Mutations run one at a time, in call order: concurrent writers interleave by record. */
|
|
210
|
+
private mutations;
|
|
211
|
+
constructor(options: WaveWriterOptions<Meta>);
|
|
212
|
+
/** Run `mutate` once every mutation called before it has finished. */
|
|
213
|
+
private exclusive;
|
|
214
|
+
/**
|
|
215
|
+
* A regular file, with its permission bits as given (`mode & 0o7777`). The
|
|
216
|
+
* writer takes `bytes`; a view sharing its buffer is copied. `meta` rides
|
|
217
|
+
* with the record, back to the caller as it is cut.
|
|
218
|
+
*/
|
|
219
|
+
file(path: string, mode: number, bytes: Uint8Array, meta?: Meta): Promise<void>;
|
|
220
|
+
/** A symbolic link to `target`. */
|
|
221
|
+
symlink(path: string, target: string, meta?: Meta): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* A regular file of `size` bytes read from `chunks` as its wave drains:
|
|
224
|
+
* the buffered wave is sent first, then this file travels alone, and the
|
|
225
|
+
* call resolves once its source is consumed.
|
|
226
|
+
*/
|
|
227
|
+
fileChunks(path: string, mode: number, size: number, chunks: AsyncIterable<Uint8Array>, meta?: Meta): Promise<void>;
|
|
228
|
+
/** A directory (an empty one, a gitlink): files' directories need no record. */
|
|
229
|
+
directory(path: string): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Remove what stands at `path`, its subtree included. A buffered record at
|
|
232
|
+
* the path is dropped; with `directory`, a buffered mkdir of it too.
|
|
233
|
+
*/
|
|
234
|
+
remove(path: string, directory?: boolean): Promise<void>;
|
|
235
|
+
/**
|
|
236
|
+
* A file every wave re-asserts until a wave carrying it publishes (a
|
|
237
|
+
* clone's ownership marker): parent directories publish independently of
|
|
238
|
+
* files, so each wave leaves the marker's proof in place. `durable` says
|
|
239
|
+
* these bytes are already published.
|
|
240
|
+
*/
|
|
241
|
+
setPin(path: string, text: string, durable?: boolean): void;
|
|
242
|
+
clearPin(path: string): void;
|
|
243
|
+
/** The bytes buffered at `path`, if a file or link is. */
|
|
244
|
+
buffered(path: string): Uint8Array | undefined;
|
|
245
|
+
/** The buffered file or link at `path`: its kind, size and the caller's `meta`. */
|
|
246
|
+
bufferedRecord(path: string): {
|
|
247
|
+
kind: 'file' | 'symlink';
|
|
248
|
+
size: number;
|
|
249
|
+
meta: Meta | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
isBufferedDirectory(path: string): boolean;
|
|
252
|
+
isBufferedDelete(path: string): boolean;
|
|
253
|
+
bufferedPaths(): {
|
|
254
|
+
files: Iterable<string>;
|
|
255
|
+
directories: Iterable<string>;
|
|
256
|
+
deletes: Iterable<string>;
|
|
257
|
+
};
|
|
258
|
+
/** Whether a link is buffered or in flight: written, not yet published. */
|
|
259
|
+
get hasUnpublishedSymlinks(): boolean;
|
|
260
|
+
/** Every record written before this call is durable; rejects with the first failed wave. */
|
|
261
|
+
flush(): Promise<void>;
|
|
262
|
+
/** The wave in flight has settled; nothing new is cut. */
|
|
263
|
+
settled(): Promise<void>;
|
|
264
|
+
assertHealthy(): void;
|
|
265
|
+
/** The failure of the wave that carried `owner`'s records, if one failed. */
|
|
266
|
+
failureOf(owner: Meta): WaveFailure | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Whether every record written with `owner` (as `meta`, under
|
|
269
|
+
* `failPerOwner`) is durable: each wave that carried it, or a write
|
|
270
|
+
* superseding it, published.
|
|
271
|
+
*/
|
|
272
|
+
published(owner: Meta): boolean;
|
|
273
|
+
private assertOwnerHealthy;
|
|
274
|
+
get failed(): WaveFailure | null;
|
|
275
|
+
stats(): WaveStats;
|
|
276
|
+
private key;
|
|
277
|
+
private tally;
|
|
278
|
+
private hasBuffered;
|
|
279
|
+
private ownPath;
|
|
280
|
+
/** collectDirectoryPaths' chain from `path` upward, to the first directory already owned. */
|
|
281
|
+
private walkChain;
|
|
282
|
+
/**
|
|
283
|
+
* Send what is buffered when a removal of `path` is pending in it: a wave
|
|
284
|
+
* names a path once, and what is made there must land after the removal,
|
|
285
|
+
* as rm then create does (the directory's permission decides, not the old
|
|
286
|
+
* file's mode).
|
|
287
|
+
*/
|
|
288
|
+
private afterRemoval;
|
|
289
|
+
/** Cut waves until `path` (with its chain) and `bytes` fit beside what is buffered. */
|
|
290
|
+
private admit;
|
|
291
|
+
private buffer;
|
|
292
|
+
private drop;
|
|
293
|
+
private cutIfFull;
|
|
294
|
+
/**
|
|
295
|
+
* Send the buffered wave once the one in flight has published. Cuts are
|
|
296
|
+
* serialised, so at most one wave is in flight and one buffers.
|
|
297
|
+
*/
|
|
298
|
+
private cut;
|
|
299
|
+
private cutNow;
|
|
300
|
+
/**
|
|
301
|
+
* How a wave of `bytes` content crosses: an attempt's stream, made anew
|
|
302
|
+
* for each attempt.
|
|
303
|
+
*
|
|
304
|
+
* Across a transport (a supervisor that opens epochs), a wave held in
|
|
305
|
+
* memory is encoded whole before it is sent, and the transport takes it in
|
|
306
|
+
* SEND_SLICE_BYTES pieces, never waiting on the encoder. A re-send sends
|
|
307
|
+
* the same bytes, and the wave's records are let go once it is encoded.
|
|
308
|
+
* Measured, eight producers into one session, Markflow's file sizes: the
|
|
309
|
+
* encoder's stream, pulled through the watchdog as the transport read it,
|
|
310
|
+
* took 1,002 files/s; the wave encoded first, 1,374 (re-chunking that
|
|
311
|
+
* stream to 64 KiB or 1 MiB gained nothing). A wave with a streamed
|
|
312
|
+
* source is never held whole, nor is a lone file larger than a wave, and a
|
|
313
|
+
* session's own writer has no transport to wait on: they stream as the
|
|
314
|
+
* encoder makes them.
|
|
315
|
+
*/
|
|
316
|
+
private open;
|
|
317
|
+
/** Send one wave (sendWaveAttempts) under this writer's epoch. */
|
|
318
|
+
private sendAttempts;
|
|
319
|
+
/**
|
|
320
|
+
* The epoch this writer's waves are fenced under: opened before its first
|
|
321
|
+
* wave, and again once half of WAVE_EPOCH_TTL_MS has passed, so a wave is
|
|
322
|
+
* never sent under an epoch about to close. Opened under the lost-call
|
|
323
|
+
* policy (openWaveEpoch); an open that failed even so is not the writer's
|
|
324
|
+
* epoch, and the next wave opens again.
|
|
325
|
+
*/
|
|
326
|
+
private currentEpoch;
|
|
327
|
+
/** The directories the buffered records publish, shallowest first. */
|
|
328
|
+
private publishedDirectories;
|
|
329
|
+
private bufferPin;
|
|
330
|
+
}
|
|
331
|
+
/** An attempt the session never read or never answered: its call did not arrive, or its answer was lost. */
|
|
332
|
+
/** One wave's attempts (sendWaveAttempts). */
|
|
333
|
+
export interface WaveAttempts {
|
|
334
|
+
supervisor: WaveSupervisor;
|
|
335
|
+
/** The epoch each attempt is fenced under, asked before each one (null: unfenced). */
|
|
336
|
+
writer: () => Promise<string | null>;
|
|
337
|
+
/** A fresh stream of the wave's bytes for each attempt. */
|
|
338
|
+
open: () => ReadableStream<Uint8Array>;
|
|
339
|
+
/** A wave with a streamed source is sent once: its source is spent. */
|
|
340
|
+
streamed: boolean;
|
|
341
|
+
wave: number;
|
|
342
|
+
/** A sequenced writer's numbering, on every attempt's fence (WaveFence `seq`, `ack`). */
|
|
343
|
+
sequence?: {
|
|
344
|
+
seq: number;
|
|
345
|
+
ack: number;
|
|
346
|
+
};
|
|
347
|
+
/** The delegation the wave is written under (WaveSupervisor.writeBatchStream's `owner`). */
|
|
348
|
+
owner?: string;
|
|
349
|
+
/** The lost-call policy's timings (lost-call.ts); tests shorten them. */
|
|
350
|
+
retry?: {
|
|
351
|
+
backoffMs: readonly number[];
|
|
352
|
+
stallMs: number;
|
|
353
|
+
answerDeadlineMs: number;
|
|
354
|
+
};
|
|
355
|
+
/** Told before each re-send, with its lost-call attributes. */
|
|
356
|
+
resent?: (lost: Record<string, string | number>) => void;
|
|
357
|
+
/** The timers the watch and the backoff run on: a program's own may be its shims'. */
|
|
358
|
+
timers?: WaveTimers;
|
|
359
|
+
}
|
|
360
|
+
/** setTimeout and clearTimeout, as a caller captured them. */
|
|
361
|
+
export interface WaveTimers {
|
|
362
|
+
setTimeout(callback: () => void, ms: number): unknown;
|
|
363
|
+
clearTimeout(timer: unknown): void;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Send one wave, again while its transport is lost (see the module's
|
|
367
|
+
* comment), and answer with what the session answered. The one way every
|
|
368
|
+
* W7 producer sends: the wave writer, and a process's filesystem client.
|
|
369
|
+
*/
|
|
370
|
+
export declare function sendWaveAttempts(options: WaveAttempts): Promise<unknown>;
|
|
371
|
+
/**
|
|
372
|
+
* Open a writer epoch (`open`: the supervisor's openWaveWriter, or a
|
|
373
|
+
* process's openWriter), again while the call is lost or shed, under a
|
|
374
|
+
* wave's lost-call policy and budget (isLostFencedCall,
|
|
375
|
+
* LOST_CALL_RESEND_BACKOFF_MS). Re-opening is safe: an open the session
|
|
376
|
+
* never ran issued nothing, and one whose answer was lost issued an epoch
|
|
377
|
+
* nothing is sent under, which closes at WAVE_EPOCH_TTL_MS. Anything else
|
|
378
|
+
* it answered is its verdict. A shed open would otherwise fail every write
|
|
379
|
+
* the epoch was for, unsent: measured, create-next-app lost 31 of 42
|
|
380
|
+
* packages to one.
|
|
381
|
+
*/
|
|
382
|
+
export declare function openWaveEpoch(open: () => Promise<string | null>, options?: {
|
|
383
|
+
retry?: {
|
|
384
|
+
backoffMs: readonly number[];
|
|
385
|
+
};
|
|
386
|
+
resent?: (lost: Record<string, string | number>) => void;
|
|
387
|
+
timers?: WaveTimers;
|
|
388
|
+
}): Promise<string | null>;
|
|
389
|
+
/** A wave's encoded bytes as each attempt's stream (in SEND_SLICE_BYTES pieces, each a copy). */
|
|
390
|
+
export declare function waveAttemptsOf(bytes: Uint8Array): () => ReadableStream<Uint8Array>;
|
|
391
|
+
export declare function createWaveWriter<Meta = undefined>(options: WaveWriterOptions<Meta>): WaveWriter<Meta>;
|
|
392
|
+
//# sourceMappingURL=wave-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wave-writer.d.ts","sourceRoot":"","sources":["../src/wave-writer.ts"],"names":[],"mappings":"AAAA;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