@cloudbitmaps/core 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/dist/{chunk-RSLVTRJY.js → chunk-IGLIZBR7.js} +982 -281
- package/dist/chunk-IGLIZBR7.js.map +7 -0
- package/dist/core/absent-operands.d.ts +8 -0
- package/dist/core/audit.d.ts +67 -4
- package/dist/core/bit-route.d.ts +2 -1
- package/dist/core/blob.d.ts +12 -1
- package/dist/core/bulk-load.d.ts +148 -0
- package/dist/core/cas-retry.d.ts +27 -0
- package/dist/core/check.d.ts +22 -0
- package/dist/core/chunk-checks.d.ts +6 -1
- package/dist/core/chunk-window.d.ts +11 -4
- package/dist/core/combine-expr.d.ts +1 -3
- package/dist/core/combine-feed.d.ts +2 -16
- package/dist/core/combine-many.d.ts +21 -15
- package/dist/core/concurrency.d.ts +8 -0
- package/dist/core/consistency.d.ts +76 -18
- package/dist/core/crbm/fingerprint.d.ts +23 -0
- package/dist/core/crbm/format.d.ts +2 -5
- package/dist/core/crbm/frame.d.ts +10 -0
- package/dist/core/crbm/plan-reads.d.ts +9 -3
- package/dist/core/crbm/reader.d.ts +51 -12
- package/dist/core/crbm/varint.d.ts +2 -1
- package/dist/core/crbm/writer.d.ts +5 -1
- package/dist/core/crbm-open.d.ts +154 -0
- package/dist/core/crbm-storage-source.d.ts +243 -490
- package/dist/core/crbm-write.d.ts +75 -0
- package/dist/core/crypto.d.ts +6 -1
- package/dist/core/engine.d.ts +239 -47
- package/dist/core/erase-id.d.ts +97 -27
- package/dist/core/erasure.d.ts +4 -3
- package/dist/core/errors.d.ts +8 -2
- package/dist/core/generation-gc.d.ts +131 -16
- package/dist/core/generation-list.d.ts +11 -0
- package/dist/core/id-window.d.ts +46 -0
- package/dist/core/invalidation-scope.d.ts +77 -0
- package/dist/core/known-generations-shape.d.ts +13 -0
- package/dist/core/known-generations.d.ts +147 -0
- package/dist/core/leases.d.ts +9 -1
- package/dist/core/ledger-seed.d.ts +17 -0
- package/dist/core/load.d.ts +17 -36
- package/dist/core/lru.d.ts +2 -15
- package/dist/core/metrics.d.ts +9 -7
- package/dist/core/order.d.ts +2 -0
- package/dist/core/pinned-storage-source.d.ts +7 -7
- package/dist/core/pointer-id.d.ts +19 -0
- package/dist/core/ports.d.ts +210 -45
- package/dist/core/publish.d.ts +207 -0
- package/dist/core/reader-defaults.d.ts +14 -3
- package/dist/core/registry-scan.d.ts +0 -2
- package/dist/core/retention-sweep.d.ts +69 -65
- package/dist/core/retention.d.ts +1 -1
- package/dist/core/retry.d.ts +12 -19
- package/dist/core/rollback.d.ts +62 -32
- package/dist/core/summary.d.ts +74 -25
- package/dist/core/token.d.ts +13 -8
- package/dist/core/validate.d.ts +2 -0
- package/dist/driver-kit.d.ts +6 -1
- package/dist/driver-kit.js +90 -10
- package/dist/driver-kit.js.map +3 -3
- package/dist/drivers/_shared/bytes.d.ts +6 -0
- package/dist/drivers/_shared/faults.d.ts +15 -0
- package/dist/drivers/_shared/object-keys.d.ts +18 -0
- package/dist/drivers/_shared/object-registry-keys.d.ts +0 -2
- package/dist/drivers/_shared/object-registry.d.ts +3 -1
- package/dist/drivers/_shared/options.d.ts +19 -0
- package/dist/drivers/_shared/registry.d.ts +31 -19
- package/dist/drivers/localfs/exact-case.d.ts +0 -3
- package/dist/drivers/localfs/fs-util.d.ts +22 -0
- package/dist/drivers/localfs/registry.d.ts +10 -4
- package/dist/drivers/localfs/storage.d.ts +16 -8
- package/dist/drivers/memory.d.ts +14 -9
- package/dist/drivers/retry/retrying-chunk-source.d.ts +1 -5
- package/dist/export/index.d.ts +16 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.js +4303 -2938
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/chunk-RSLVTRJY.js.map +0 -7
- package/dist/core/cost.d.ts +0 -351
- package/dist/core/kept-generations.d.ts +0 -40
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws {@link ValidationError} naming every one of `candidates` whose segment does not exist, asking `exists` of
|
|
3
|
+
* each, at most `limit` at once, in their order. A streamed combine asks only after operands that hold no chunk at all;
|
|
4
|
+
* the batch combine also asks after every operand it did not index (one no output names, or every operand when the range
|
|
5
|
+
* is empty). `op` begins the message (`intersect`, `materializeMany`); `nameOf` is how the caller's operands are named
|
|
6
|
+
* in it, each in double quotes. The first `exists` to reject rejects the call at once; none is asked after that.
|
|
7
|
+
*/
|
|
8
|
+
export declare function refuseAbsent<T>(op: string, candidates: readonly T[], limit: number, exists: (candidate: T) => Promise<boolean>, nameOf: (candidate: T) => string): Promise<void>;
|
package/dist/core/audit.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* from the metrics sink (`IMetricsSink`). Different audience (an audit log / SIEM, not a dashboard), different
|
|
4
4
|
* retention, and only the compliance-relevant *state changes* — never routine reads/writes (that's the metrics
|
|
5
5
|
* sink). It doubles as the GDPR Art. 30 "record of processing" surface: publishes, refused loads, rollbacks,
|
|
6
|
-
* rewrites,
|
|
6
|
+
* rewrites, an erasure's deletion of the generations holding an id, crypto-shreds and disposals.
|
|
7
7
|
*
|
|
8
8
|
* Like `Clock`/`Rng`/`IMetricsSink`, it's injected (into the operations that emit — a load, the `*Into`
|
|
9
9
|
* verbs, a rollback, the erasure rewrite, crypto-shred, disposal and the retention sweep) and wrapped
|
|
@@ -16,17 +16,29 @@
|
|
|
16
16
|
* wrappings, no data re-encryption), so there is no library call to hook. A future `rewrapSegment()` op would
|
|
17
17
|
* add a `kek.rotate` variant; until then, audit key changes at your keystore-config layer.
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* A security/compliance-relevant state change. Vendor-neutral; the sink adds its own timestamp/actor.
|
|
21
|
+
*
|
|
22
|
+
* Every event about a segment carries `incarnation`: the id of the registry row's incarnation the operation acted on.
|
|
23
|
+
* A segment's name can be purged and created again, and its generations then start again at `0`; the incarnation
|
|
24
|
+
* tells those lives of the name apart, and every write of a row keeps it. It does not make a generation number name
|
|
25
|
+
* one object for good: within one incarnation, a number whose object was deleted (a refused load's object, or a
|
|
26
|
+
* generation an erasure deleted above the pointer) can be taken again by a later load. It is absent when the row's
|
|
27
|
+
* token carries no incarnation id, for example from a registry of the caller's own that issues tokens in another
|
|
28
|
+
* form, and on a `segment.load-refused` from a load that found no row.
|
|
29
|
+
*/
|
|
20
30
|
export type AuditEvent = {
|
|
21
31
|
/** A new immutable Storage generation *became the segment's current generation*, by a load's publish. */
|
|
22
32
|
readonly kind: 'segment.publish';
|
|
23
33
|
readonly namespace?: string;
|
|
24
34
|
readonly segment: string;
|
|
35
|
+
/** The incarnation of the row whose pointer the publish moved. */
|
|
36
|
+
readonly incarnation?: string;
|
|
25
37
|
readonly generation: number;
|
|
26
38
|
} | {
|
|
27
39
|
/**
|
|
28
40
|
* A segment's pointer was moved by a rollback to a generation still in the bucket that the caller named:
|
|
29
|
-
* **backwards**, or forward
|
|
41
|
+
* **backwards**, or forward onto a generation a rollback left above the pointer, which undoes an earlier rollback.
|
|
30
42
|
*
|
|
31
43
|
* The only non-forward-only pointer move in the library, and the only one no automatic path can perform —
|
|
32
44
|
* a human decided the current generation was wrong and named the one they wanted. Every other pointer move
|
|
@@ -38,8 +50,18 @@ export type AuditEvent = {
|
|
|
38
50
|
readonly kind: 'segment.rollback';
|
|
39
51
|
readonly namespace?: string;
|
|
40
52
|
readonly segment: string;
|
|
53
|
+
/** The incarnation of the row whose pointer the rollback moved. */
|
|
54
|
+
readonly incarnation?: string;
|
|
41
55
|
readonly fromGeneration: number | null;
|
|
42
56
|
readonly generation: number;
|
|
57
|
+
/**
|
|
58
|
+
* Present, and `true`, when the row did not vouch for the target: the call passed `allowUnknown` for a generation the
|
|
59
|
+
* row does not know or whose object is not the one it recorded, or the row has no usable record of its generations
|
|
60
|
+
* (a registry that drops the field, or a pointer moved by hand) or the target is below a full record's bound, where the
|
|
61
|
+
* pointer alone decides for a target below it. Absent when the move was
|
|
62
|
+
* checked against the row's record.
|
|
63
|
+
*/
|
|
64
|
+
readonly unknown?: true;
|
|
43
65
|
} | {
|
|
44
66
|
/**
|
|
45
67
|
* A load was **refused**: it did not publish, because its result failed a guard or another writer got there
|
|
@@ -59,6 +81,8 @@ export type AuditEvent = {
|
|
|
59
81
|
readonly kind: 'segment.load-refused';
|
|
60
82
|
readonly namespace?: string;
|
|
61
83
|
readonly segment: string;
|
|
84
|
+
/** The incarnation of the row the load read before it wrote; absent when it found no row. */
|
|
85
|
+
readonly incarnation?: string;
|
|
62
86
|
readonly generation: number;
|
|
63
87
|
readonly reason: 'empty' | 'min-cardinality' | 'min-retained' | 'max-growth' | 'superseded';
|
|
64
88
|
readonly cardinality: number;
|
|
@@ -69,13 +93,48 @@ export type AuditEvent = {
|
|
|
69
93
|
* place. Today the one emitter is `eraseIdFromSegment` (a subject erasure clearing one id), and the event is
|
|
70
94
|
* emitted at the publish — before the superseded generation is collected — so the record exists the moment
|
|
71
95
|
* the generation without the id is authoritative. A `segment.publish` is NOT also emitted for a rewrite: a
|
|
72
|
-
* rewrite derives its content from the segment itself, a publish brings content in from outside.
|
|
96
|
+
* rewrite derives its content from the segment itself, a publish brings content in from outside. An erasure
|
|
97
|
+
* that finds the id only outside the current generation, or deletes only objects no read of the segment can
|
|
98
|
+
* open, rewrites nothing and emits `segment.collect`.
|
|
73
99
|
*/
|
|
74
100
|
readonly kind: 'segment.rewrite';
|
|
75
101
|
readonly namespace?: string;
|
|
76
102
|
readonly segment: string;
|
|
103
|
+
/** The incarnation of the row the rewrite read `fromGeneration` from and published on. */
|
|
104
|
+
readonly incarnation?: string;
|
|
77
105
|
readonly fromGeneration: number;
|
|
78
106
|
readonly generation: number;
|
|
107
|
+
} | {
|
|
108
|
+
/**
|
|
109
|
+
* An erasure of one id **deleted objects** no reader resolves, and rewrote none. It found the id only in such
|
|
110
|
+
* objects, or deleted only objects no read of the segment can open, which it cannot search and deletes whatever
|
|
111
|
+
* the id. The cases: an id that only generations other than the current one hold (someone who left the segment,
|
|
112
|
+
* whose bit the reader grace window or a rollback target keeps); objects left under a tombstone (a cleartext
|
|
113
|
+
* destroy, or a drop whose sweep left one); a first load's object on a segment with no generation yet (its load
|
|
114
|
+
* still running, or one that crashed before its publish); and an object sealed under a key the segment's row does
|
|
115
|
+
* not hold, or an encrypted one under a cleartext row (a first load's that lost the race, or crashed). The one
|
|
116
|
+
* emitter is `eraseIdFromSegment`, once a listing of the bucket shows nothing left holding the id, so the record
|
|
117
|
+
* exists only for a finished erasure. A call that ends otherwise throws or reports `erased: false` with another
|
|
118
|
+
* reason and emits nothing, even when it had deleted a holder; its re-run emits when it finishes, and reports
|
|
119
|
+
* `'not-member'` with no event when another collection deleted the last holder meanwhile, as its ledger entry
|
|
120
|
+
* does. One finished erasure emits it and then throws `NotFoundError`: one that found, after its deletes, the
|
|
121
|
+
* segment's pointer on a generation it had deleted (a rollback moved it there meanwhile), so the deletion is on
|
|
122
|
+
* the record although the call cannot answer.
|
|
123
|
+
*
|
|
124
|
+
* `fromGeneration` is the newest generation the call found holding the id, and is absent when it found the id in
|
|
125
|
+
* none and deleted only objects it could not search: then the ledger lists no entry for the segment, and this
|
|
126
|
+
* event is the record of the deletion. `collected` is every generation the call deleted, ascending, and the same
|
|
127
|
+
* list as its result's: below the pointer, when a searched generation held the id, that is every generation,
|
|
128
|
+
* holder or not, since the deletion takes them all; above it, and wherever none did, only the holders and the
|
|
129
|
+
* objects it could not search. A holder another collection deleted first is not in it, so the list can be empty.
|
|
130
|
+
*/
|
|
131
|
+
readonly kind: 'segment.collect';
|
|
132
|
+
readonly namespace?: string;
|
|
133
|
+
readonly segment: string;
|
|
134
|
+
/** The incarnation of the row the erasure read: the active row, or the tombstone. */
|
|
135
|
+
readonly incarnation?: string;
|
|
136
|
+
readonly fromGeneration?: number;
|
|
137
|
+
readonly collected: readonly number[];
|
|
79
138
|
} | {
|
|
80
139
|
/**
|
|
81
140
|
* A segment was **crypto-shredded** — its wrapped DEK(s) are gone, so its at-rest Storage bytes are now
|
|
@@ -85,6 +144,8 @@ export type AuditEvent = {
|
|
|
85
144
|
readonly kind: 'segment.erase';
|
|
86
145
|
readonly namespace?: string;
|
|
87
146
|
readonly segment: string;
|
|
147
|
+
/** The incarnation of the row the shred turned into a tombstone. */
|
|
148
|
+
readonly incarnation?: string;
|
|
88
149
|
} | {
|
|
89
150
|
/**
|
|
90
151
|
* A segment was **disposed of** — tombstoned and its storage reclaimed (its Storage generations deleted) by
|
|
@@ -106,6 +167,8 @@ export type AuditEvent = {
|
|
|
106
167
|
readonly kind: 'segment.dispose';
|
|
107
168
|
readonly namespace?: string;
|
|
108
169
|
readonly segment: string;
|
|
170
|
+
/** The incarnation of the tombstone the drop wrote or found. */
|
|
171
|
+
readonly incarnation?: string;
|
|
109
172
|
readonly generationsDeleted: number;
|
|
110
173
|
} | {
|
|
111
174
|
/** A namespace erasure was executed. `segmentsShredded` is the count actually crypto-shredded (may be 0). */
|
package/dist/core/bit-route.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const U32_MAX = 4294967295;
|
|
2
2
|
export declare const CHUNK_COUNT = 65536;
|
|
3
|
-
|
|
3
|
+
interface BitRoute {
|
|
4
4
|
/** Top 16 bits — the chunk key (0..65535). */
|
|
5
5
|
readonly chunkKey: number;
|
|
6
6
|
/** Bottom 16 bits — the value within the chunk (0..65535). */
|
|
@@ -19,3 +19,4 @@ export declare const MAX_REMAINDER: number;
|
|
|
19
19
|
* invariant 5); `remainder` is masked to 16 bits.
|
|
20
20
|
*/
|
|
21
21
|
export declare function joinId(chunkKey: number, remainder: number): number;
|
|
22
|
+
export {};
|
package/dist/core/blob.d.ts
CHANGED
|
@@ -12,12 +12,23 @@ export interface BlobSink {
|
|
|
12
12
|
export interface BlobReader {
|
|
13
13
|
/** Exactly `length` bytes starting at `offset`. Out-of-range is a `ValidationError`, never a short read. */
|
|
14
14
|
getRange(offset: number, length: number): Promise<Uint8Array>;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The last `min(maxBytes, size)` bytes plus the total size — the one-GET footer+index path. `maxBytes` is a safe
|
|
17
|
+
* integer, zero or less for an empty tail; any other length is refused with `ValidationError`.
|
|
18
|
+
*/
|
|
16
19
|
getTail(maxBytes: number): Promise<{
|
|
17
20
|
bytes: Uint8Array;
|
|
18
21
|
size: number;
|
|
19
22
|
}>;
|
|
20
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Check the length a tail read asks for, the one rule every tail read holds to (each storage driver's `getTail` and
|
|
26
|
+
* {@link BufferReader.getTail}): a safe integer. Zero or less answers an empty tail with the size, and a length past
|
|
27
|
+
* the object's size answers the whole object. Anything else is refused with `ValidationError` before anything is read:
|
|
28
|
+
* `NaN`, a fraction (a negative one too), an infinity of either sign, and a whole number past the safe range (2^53 or
|
|
29
|
+
* more, or -2^53 or less), so no reader takes one for some other length.
|
|
30
|
+
*/
|
|
31
|
+
export declare function checkTailLength(maxBytes: number): void;
|
|
21
32
|
/** In-memory `BlobSink` that accumulates written bytes; `bytes()` returns the concatenation. */
|
|
22
33
|
export declare class BufferSink implements BlobSink {
|
|
23
34
|
private readonly chunks;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The loader `load()` is built on: ids, a decoded bitmap or a combine's chunks in, one generation written, and published
|
|
3
|
+
* when a registry is wired and the caller does not defer it, as `load()` does to publish after its guard.
|
|
4
|
+
*/
|
|
5
|
+
import { type IAuditSink } from './audit.js';
|
|
6
|
+
import { ValidationError } from './errors.js';
|
|
7
|
+
import type { Clock } from './determinism.js';
|
|
8
|
+
import type { Aead, IKeystore, WrappedDek } from './crypto.js';
|
|
9
|
+
import type { GenerationMetadata, GenKey, IStorageDriver, IRegistryDriver, RegistryRecord, RegistrySummary, SegmentRef } from './ports.js';
|
|
10
|
+
import type { CodecInterface } from './codec.js';
|
|
11
|
+
import { ChunkLoadInput, DecodedLoadInput } from './load-input.js';
|
|
12
|
+
/** What a bulk-load wrote — the driver's `{ size, sha256 }` plus a summary of the built generation. */
|
|
13
|
+
export interface BulkLoadResult {
|
|
14
|
+
/** Bytes written to the Storage object. */
|
|
15
|
+
readonly size: number;
|
|
16
|
+
/** The driver's content hash of the object. */
|
|
17
|
+
readonly sha256: string;
|
|
18
|
+
/** Distinct non-empty chunks written (≤ 65536). */
|
|
19
|
+
readonly chunkCount: number;
|
|
20
|
+
/**
|
|
21
|
+
* The DEK freshly minted for this generation, wrapped — present only when the segment is encrypted AND this
|
|
22
|
+
* call minted one (an existing segment reuses its key, which is already on the row).
|
|
23
|
+
*
|
|
24
|
+
* Returned so a caller that deliberately does **not** pass `registry` here — writing now and publishing later,
|
|
25
|
+
* which is how a load applies a guard while the old generation is still authoritative — can carry the key onto
|
|
26
|
+
* its own `publishGeneration`. Without it that publish stores no DEK and the generation it makes current is
|
|
27
|
+
* unreadable: the bytes are encrypted with a key nothing recorded.
|
|
28
|
+
*/
|
|
29
|
+
readonly wrappedDeks?: readonly WrappedDek[];
|
|
30
|
+
/** Whether the object was written encrypted: under the segment's key, or under one this call minted. */
|
|
31
|
+
readonly encrypted: boolean;
|
|
32
|
+
/** The written object's fingerprint, which tells it from an object stored later under the same key. */
|
|
33
|
+
readonly fingerprint: string;
|
|
34
|
+
/** Total distinct ids in the generation (post-dedup). */
|
|
35
|
+
readonly cardinality: number;
|
|
36
|
+
/**
|
|
37
|
+
* The summary of what was written, for the write that makes it current: its id count and metadata, sealed under the
|
|
38
|
+
* segment's key when the object was written with one. A caller that defers the publish (`publish: false`) passes it
|
|
39
|
+
* to {@link publishGeneration}.
|
|
40
|
+
*/
|
|
41
|
+
readonly summary: RegistrySummary;
|
|
42
|
+
/**
|
|
43
|
+
* Whether this generation is now the segment's **current** one — `undefined` when no `registry` was wired, so
|
|
44
|
+
* there is no pointer and no publish step to report on.
|
|
45
|
+
*
|
|
46
|
+
* `false` means the object is durable but a **concurrent writer published a higher generation first**, so this
|
|
47
|
+
* one is an orphan that no reader will ever resolve. The write succeeded and the *load* did not: whatever this
|
|
48
|
+
* call was asked to make the segment contain, the segment does not contain. That is not a detail a caller can
|
|
49
|
+
* be left to infer — a `*Into` materialisation that reported the generation it wrote as "the destination's new
|
|
50
|
+
* current generation" on this path would state a plain untruth — so the flag is on the result and the verbs that
|
|
51
|
+
* promise a published generation check it.
|
|
52
|
+
*/
|
|
53
|
+
readonly becameCurrent?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* **Bulk-load** a whole immutable generation from a flat id source — the batch "seed/rebuild" entry point.
|
|
57
|
+
* Unlike {@link writeCrbmGeneration} (which takes pre-grouped bitmaps), this
|
|
58
|
+
* consumes an arbitrary, **unsorted** stream of u32 ids (sync or async) and routes each into its chunk's
|
|
59
|
+
* Roaring bitmap as it goes. The input is consumed lazily and ids dedup on insert, so memory is bounded by
|
|
60
|
+
* the **built generation** — the in-memory Roaring representation of the *distinct* set (≤ one bitmap per
|
|
61
|
+
* non-empty chunk) — not by the input length: you can stream a billion duplicate-heavy ids and hold only the
|
|
62
|
+
* distinct result. Note this is `O(distinct set)`, **not** window-bounded like {@link SegmentEngine.intersect}:
|
|
63
|
+
* bulk-load holds the whole generation in RAM, which suits batch seed/rebuild jobs but not an
|
|
64
|
+
* unbounded-cardinality stream (a segment larger than RAM needs external-merge / pre-sorted input — later phase).
|
|
65
|
+
*
|
|
66
|
+
* Each id must be an integer in `[0, 2³²)` ({@link splitId} throws {@link ValidationError} otherwise) — the
|
|
67
|
+
* source is consumed lazily, so a bad id aborts mid-stream without writing a partial object (the driver
|
|
68
|
+
* commits only after the callback resolves). An empty source writes a valid empty generation.
|
|
69
|
+
*
|
|
70
|
+
* Writes a fresh full snapshot of a segment. The caller picks the generation number in `key` — `nextGeneration`
|
|
71
|
+
* computes one from the registry and the bucket, as `nextLoadGeneration` does for a load — and re-using an existing
|
|
72
|
+
* generation throws
|
|
73
|
+
* {@link WriteConflictError} (write-once). Without a registry a `StorageChunkSource` serves the **highest**
|
|
74
|
+
* generation present, so a too-high number silently shadows real data; with one, `publishGeneration` decides.
|
|
75
|
+
*/
|
|
76
|
+
export declare function bulkLoadCrbmGeneration(driver: IStorageDriver, key: GenKey, ids: Iterable<number> | AsyncIterable<number> | DecodedLoadInput | ChunkLoadInput, options?: {
|
|
77
|
+
registry?: IRegistryDriver;
|
|
78
|
+
keystore?: IKeystore;
|
|
79
|
+
requireEncryption?: boolean;
|
|
80
|
+
audit?: IAuditSink;
|
|
81
|
+
/** Bitmap codec. Optional in the type; a **flavor** package binds it ({@link requireCodec}). */
|
|
82
|
+
codec?: CodecInterface;
|
|
83
|
+
/**
|
|
84
|
+
* Injected clock. Supplying one makes bulk-load **cooperative**: it yields the event loop periodically so a
|
|
85
|
+
* long load does not stall everything else on the process. Without it the load still completes, just
|
|
86
|
+
* without yielding — which is the pre-existing behaviour, kept so this is purely additive.
|
|
87
|
+
*
|
|
88
|
+
* `@cloudbitmaps/roaring` supplies a real clock by default, so flavor users get cooperative behaviour with
|
|
89
|
+
* no wiring. `core/` cannot default it: it is timer-free by lint, which is exactly why waiting goes through
|
|
90
|
+
* this seam rather than `setTimeout`.
|
|
91
|
+
*/
|
|
92
|
+
clock?: Clock;
|
|
93
|
+
/**
|
|
94
|
+
* Write the object but do **not** advance the pointer (default: publish when a `registry` is wired).
|
|
95
|
+
*
|
|
96
|
+
* For a caller that has to inspect what it wrote before deciding whether it should become current — a
|
|
97
|
+
* guarded {@link loadSegment} is the one in-tree case — because the check is only meaningful while the old
|
|
98
|
+
* generation is still authoritative. The `registry` is still required for an encrypted segment and still
|
|
99
|
+
* consulted: it is where an existing segment's DEK lives, and reusing that key is not optional. The wrapped
|
|
100
|
+
* DEK comes back on the result so the deferred publish can store it.
|
|
101
|
+
*
|
|
102
|
+
* A caller that defers the publish owns what it wrote: an unpublished object sits ABOVE `currentGen`, where
|
|
103
|
+
* generation collection deliberately never looks, so nothing reclaims it until a later generation above it is
|
|
104
|
+
* current.
|
|
105
|
+
*/
|
|
106
|
+
publish?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The generation's metadata (see {@link GenerationMetadata}), written into the object and carried in the summary.
|
|
109
|
+
* The caller has checked it against the metadata rules; the writer checks it again, and refuses a record that breaks
|
|
110
|
+
* one before a byte is written.
|
|
111
|
+
*/
|
|
112
|
+
metadata?: GenerationMetadata;
|
|
113
|
+
/**
|
|
114
|
+
* The segment's row as the caller already read it (`null`: it found none), for a caller that defers the
|
|
115
|
+
* publish (`publish: false`) and fences it on that same row. A present cleartext row is then used as read,
|
|
116
|
+
* rather than read again: a row that changes in between (a publish, a drop, a purge and re-create) makes the
|
|
117
|
+
* fenced publish lose, so the object is never published on the strength of the stale read. A row read as
|
|
118
|
+
* absent, or one carrying key material, is read again after the ids, as with no row passed: a first load must
|
|
119
|
+
* see a row another writer created meanwhile, and an encrypted segment's key is unwrapped only from a row read
|
|
120
|
+
* after the ids, so a segment shredded while they streamed is refused before its key is used.
|
|
121
|
+
*/
|
|
122
|
+
row?: RegistryRecord | null;
|
|
123
|
+
}): Promise<BulkLoadResult>;
|
|
124
|
+
/**
|
|
125
|
+
* What a load has already started when it calls {@link bulkLoadAhead}: its number, and the segment's data key, each
|
|
126
|
+
* still in flight so their round trips overlap the encoding. Both are joined where the write needs them, and neither
|
|
127
|
+
* may be left to reject unobserved.
|
|
128
|
+
*/
|
|
129
|
+
interface LoadAhead {
|
|
130
|
+
/** The number the generation takes (see {@link nextLoadGeneration}); joined just before the object is written. */
|
|
131
|
+
readonly generation: PromiseLike<number>;
|
|
132
|
+
/**
|
|
133
|
+
* The key a caller already asked the keystore to unwrap, with the wrappings it asked about. Used only when the
|
|
134
|
+
* row the write reads after the ids carries exactly these wrappings; otherwise the write unwraps for itself.
|
|
135
|
+
*/
|
|
136
|
+
readonly unwrapped?: {
|
|
137
|
+
readonly wrapped: readonly WrappedDek[];
|
|
138
|
+
readonly aead: PromiseLike<Aead>;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** What a load with `requireEncryption` meets on a segment that already has a cleartext generation. */
|
|
142
|
+
export declare function cleartextUnderRequiredEncryption(ref: SegmentRef, currentGen: number): ValidationError;
|
|
143
|
+
/**
|
|
144
|
+
* {@link bulkLoadCrbmGeneration} for a load whose number, and perhaps its key, are still being fetched: the same
|
|
145
|
+
* options, with the same meaning, and the same writes. The number is joined only where the object is written.
|
|
146
|
+
*/
|
|
147
|
+
export declare function bulkLoadAhead(driver: IStorageDriver, ref: SegmentRef, ahead: LoadAhead, ids: Parameters<typeof bulkLoadCrbmGeneration>[2], options?: NonNullable<Parameters<typeof bulkLoadCrbmGeneration>[3]>): Promise<BulkLoadResult>;
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { WriteConflictError } from './errors.js';
|
|
2
|
+
import { type ChurnDeps } from './leases.js';
|
|
3
|
+
import type { IRegistryDriver, RegistryRecord, SegmentRef } from './ports.js';
|
|
4
|
+
/** What `casRetry` needs: the registry, and the clock and rng that spread a wait out. */
|
|
5
|
+
type CasRetryDeps = ChurnDeps & {
|
|
6
|
+
readonly registry: IRegistryDriver;
|
|
7
|
+
};
|
|
8
|
+
/** How many attempts a caller gets, and the error it throws once they are spent. */
|
|
9
|
+
interface CasRetryPlan {
|
|
10
|
+
/** Attempts that count; a wait out of lease churn does not use one. */
|
|
11
|
+
readonly attempts: number;
|
|
12
|
+
/** The error thrown when every attempt lost. */
|
|
13
|
+
readonly contention: () => WriteConflictError;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Read a segment's row, run `step` on it, and run it again on a fresh read when `step` throws a write conflict.
|
|
17
|
+
*
|
|
18
|
+
* Every lost race uses one of `plan.attempts`, except one lost by a run that followed a wait. When the row read after a
|
|
19
|
+
* lost race differs from the one `step` was given only in its leases, the loop waits the churn out (up to the churn
|
|
20
|
+
* bound), reads the row again and runs `step` against that without using an attempt. A race lost on the last attempt
|
|
21
|
+
* is not waited out. `step` returns the caller's result, or throws: a write conflict retries, anything else leaves
|
|
22
|
+
* `casRetry` untouched.
|
|
23
|
+
*
|
|
24
|
+
* Exhausting `attempts` throws `plan.contention()`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function casRetry<T>(deps: CasRetryDeps, ref: SegmentRef, plan: CasRetryPlan, step: (row: RegistryRecord | null) => Promise<T>): Promise<T>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `value` if it is a safe integer from `min` to `max` (inclusive; `max` defaults to the largest safe integer), else a
|
|
3
|
+
* `ValidationError` naming `what`: `<what> must be an integer from <min> to <max>; got <value>`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function requireInteger(value: unknown, bounds: {
|
|
6
|
+
readonly min: number;
|
|
7
|
+
readonly max?: number;
|
|
8
|
+
readonly what: string;
|
|
9
|
+
readonly note?: string;
|
|
10
|
+
}): number;
|
|
11
|
+
/** `value` if it is a safe integer of 1 or more, else a `ValidationError` naming `what`. */
|
|
12
|
+
export declare function requirePositiveInteger(value: unknown, what: string): number;
|
|
13
|
+
/**
|
|
14
|
+
* `value` if it is a finite number within the optional `min` and `max` (inclusive), else a `ValidationError` naming
|
|
15
|
+
* `what`: `<what> must be a finite number from <min> to <max>; got <value>`. `NaN` and the infinities are refused.
|
|
16
|
+
*/
|
|
17
|
+
export declare function requireFiniteNumber(value: unknown, bounds: {
|
|
18
|
+
readonly min?: number;
|
|
19
|
+
readonly max?: number;
|
|
20
|
+
readonly what: string;
|
|
21
|
+
readonly note?: string;
|
|
22
|
+
}): number;
|
|
@@ -6,7 +6,12 @@ import type { CodecBitmap, CodecInterface } from './codec.js';
|
|
|
6
6
|
export declare function assertChunkKeyInRange(k: number): void;
|
|
7
7
|
/** A chunk holds at least one id and at most {@link CHUNK_COUNT}; a count outside that came from a corrupt tier. */
|
|
8
8
|
export declare function assertChunkCardinalityInRange(c: number): void;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* A segment's chunk keys, ascending — a shape read off the index, no payload. Keys are untrusted (invariant 5): each is
|
|
11
|
+
* an integer in `[0, CHUNK_COUNT)` and none repeats. One pass range-checks every key and notes whether the list is
|
|
12
|
+
* already strictly ascending, which an index read off a `.crbm` always is; only a list that is not is sorted and scanned
|
|
13
|
+
* for a repeat. The caller gets a list of its own.
|
|
14
|
+
*/
|
|
10
15
|
export declare function checkedChunkKeys(listed: Iterable<number>): number[];
|
|
11
16
|
/**
|
|
12
17
|
* The other half of invariant 5: a chunk payload holds **remainders** — 16-bit offsets within one chunk — so
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
* With `ramp`, the window opens 1, 2, 4 … wide (or at `rampStart`, then doubling) up to `max` instead of `max` at once, so a consumer that stops
|
|
4
4
|
* after a few chunks has fetched a handful, not a full window.
|
|
5
5
|
*
|
|
6
|
-
* `T` is whatever one read yields (a decoded chunk, or the raw bytes of one)
|
|
6
|
+
* `T` is whatever one read yields (a decoded chunk, or the raw bytes of one), and `K` what names a read to launch: a
|
|
7
|
+
* chunk key, or a planned range. The reads to launch are a list, or an iterator pulled from only as the window opens
|
|
8
|
+
* a read, so a long plan is never made ahead of what the window can hold. Each read is wrapped to resolve and
|
|
7
9
|
* never reject, so a read nobody consumes (the consumer stopped, or an earlier chunk failed) cannot raise an
|
|
8
10
|
* unhandled rejection; its error surfaces from {@link take} only if the consumer reaches that chunk. Memory is
|
|
9
11
|
* bounded by the window: at most `max` results are held ahead.
|
|
10
12
|
*
|
|
11
13
|
* Internal to core: not exported from any entry point.
|
|
12
14
|
*/
|
|
13
|
-
export declare class ChunkWindow<T> {
|
|
14
|
-
private readonly keys;
|
|
15
|
+
export declare class ChunkWindow<T, K = number> {
|
|
15
16
|
private readonly fetch;
|
|
16
17
|
private readonly max;
|
|
17
18
|
private readonly ramp;
|
|
@@ -20,9 +21,15 @@ export declare class ChunkWindow<T> {
|
|
|
20
21
|
private readonly open;
|
|
21
22
|
private launched;
|
|
22
23
|
private taken;
|
|
23
|
-
|
|
24
|
+
private readonly list;
|
|
25
|
+
private readonly source;
|
|
26
|
+
/** What the source threw, so a later {@link take} throws it again rather than reading the spent source as done. */
|
|
27
|
+
private failure;
|
|
28
|
+
constructor(keys: readonly K[] | Iterator<K>, fetch: (key: K) => Promise<T>, max: number, ramp: boolean,
|
|
24
29
|
/** With `ramp`, the width the window opens at (default 1). */
|
|
25
30
|
rampStart?: number);
|
|
31
|
+
/** The next read to launch, or {@link DONE} when there is none. */
|
|
32
|
+
private nextKey;
|
|
26
33
|
/** Resolves once every read launched and not yet taken has settled; it never rejects, as the reads never do. */
|
|
27
34
|
settle(): Promise<void>;
|
|
28
35
|
/** The next read's result in key order, or the error that read raised. */
|
|
@@ -21,7 +21,7 @@ export type ExprNode = {
|
|
|
21
21
|
readonly kids: readonly ExprNode[];
|
|
22
22
|
};
|
|
23
23
|
/** How many nodes one {@link compileExpr} call may still allocate; shared across the expressions of one output. */
|
|
24
|
-
|
|
24
|
+
interface NodeBudget {
|
|
25
25
|
remaining: number;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -38,8 +38,6 @@ export interface KeyBounds {
|
|
|
38
38
|
readonly keys: Uint16Array;
|
|
39
39
|
readonly card: Uint32Array;
|
|
40
40
|
}
|
|
41
|
-
/** The keys of an operand the plan cannot know (a fed one): every key. Compared by identity, never by content. */
|
|
42
|
-
export declare const ANY_KEYS: Uint16Array;
|
|
43
41
|
/** The bounds of an operand the plan cannot know. */
|
|
44
42
|
export declare const ANY_BOUNDS: KeyBounds;
|
|
45
43
|
/** What {@link planKeys} keeps of each operator node: the keys it can be non-empty at. */
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The chunk-ordered feed of a batch combine: operands that arrive as records, one chunk key at a time, and are checked
|
|
3
|
-
* and converted as they arrive. Pure: it reads through the iterable it is given and knows no store, clock or storage.
|
|
4
|
-
*
|
|
5
|
-
* ```
|
|
6
|
-
* record { key, operands: { name: Uint32Array } }
|
|
7
|
-
* check key in range and not below the last; every name declared; every value a real Uint32Array; ids strictly
|
|
8
|
-
* ascending and inside the key; each operand at most once per key (a refusal, never a repair)
|
|
9
|
-
* convert each operand's ids into one compressed bitmap, charged to the ledger as it is built
|
|
10
|
-
* group the records of one key, held until a record with a higher key arrives or the feed ends
|
|
11
|
-
* end of feed counts equal what was seen; a declared operand that never appeared is refused unless allowed
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* Nothing here ever reads a bad feed as fewer members: every check is a refusal, and a refusal ends the feed.
|
|
15
|
-
*/
|
|
16
1
|
import type { CodecBitmap, CodecInterface } from './codec.js';
|
|
17
2
|
/** One record of a feed: the ids each named operand holds at one chunk key. */
|
|
18
3
|
export interface CombineManyFeedRecord {
|
|
@@ -56,7 +41,7 @@ export declare class FeedClosed extends Error {
|
|
|
56
41
|
export declare class FeedStale extends Error {
|
|
57
42
|
}
|
|
58
43
|
/** What a {@link FeedCursor} needs from the pass that runs it. */
|
|
59
|
-
|
|
44
|
+
interface FeedCursorDeps {
|
|
60
45
|
readonly feed: CheckedFeed;
|
|
61
46
|
readonly codec: CodecInterface;
|
|
62
47
|
/** The index the first fed operand has among the call's operands. */
|
|
@@ -136,3 +121,4 @@ export declare class FeedCursor {
|
|
|
136
121
|
/** The counts and the empty rule, run once, after the iterator has ended and before anything is published. */
|
|
137
122
|
private finish;
|
|
138
123
|
}
|
|
124
|
+
export {};
|
|
@@ -11,8 +11,6 @@ export { MAX_EXPR_DEPTH, MAX_EXPR_NODES } from './combine-expr.js';
|
|
|
11
11
|
export type { CombineManyFeed, CombineManyFeedRecord } from './combine-feed.js';
|
|
12
12
|
/** The range requests a pass keeps in flight at once across all its operands, inside a client's socket pool. */
|
|
13
13
|
export declare const MAX_RANGES_IN_FLIGHT = 64;
|
|
14
|
-
/** The largest `publishConcurrency` and `concurrency` a call may ask for. */
|
|
15
|
-
export declare const MAX_BATCH_PARALLELISM = 1024;
|
|
16
14
|
/** One named stored operand, as the pass reads it. */
|
|
17
15
|
export interface CombineManyOperand {
|
|
18
16
|
readonly name: string;
|
|
@@ -26,16 +24,19 @@ export interface CombineManyOperand {
|
|
|
26
24
|
/** The generation the operand is pinned to: `null` when pinned to a segment with none, `undefined` when not pinned. */
|
|
27
25
|
readonly pinnedGeneration?: number | null;
|
|
28
26
|
/**
|
|
29
|
-
* The pin's version: the generation and the registry row's
|
|
30
|
-
* the generation where there is no row. It is what tells a name deleted and created again, which restarts at
|
|
27
|
+
* The pin's version: the generation and the registry row's `pointerId` it was taken under (`<generation>:<pointerId>`),
|
|
28
|
+
* or just the generation where there is no row. It is what tells a name deleted and created again, which restarts at
|
|
31
29
|
* generation 0, from the one that was pinned.
|
|
32
30
|
*/
|
|
33
31
|
readonly pinnedVersion?: string | null;
|
|
34
32
|
/** The fingerprint of the object the pin holds: the identity of the generation's bytes, where a number can be taken again. */
|
|
35
33
|
readonly pinnedFingerprint?: string | null;
|
|
36
34
|
/**
|
|
37
|
-
* A fresh read of the segment's registry row: its current generation and token
|
|
38
|
-
*
|
|
35
|
+
* A fresh read of the segment's registry row: its current generation and, as `token`, its `pointerId` (the token of the
|
|
36
|
+
* last write that named a field a read resolves through, so a lease or a policy write does not change it), or `null`
|
|
37
|
+
* when it
|
|
38
|
+
* has no row. Read for every subtracted pinned operand just before the publishes, and once more at the end of the call
|
|
39
|
+
* for the rest.
|
|
39
40
|
*/
|
|
40
41
|
readonly current?: (options?: {
|
|
41
42
|
readonly fingerprint?: boolean;
|
|
@@ -243,8 +244,6 @@ export interface CombineManyRun<R> {
|
|
|
243
244
|
export interface CompiledCombineMany<R> {
|
|
244
245
|
readonly request: CombineManyRequest<R>;
|
|
245
246
|
}
|
|
246
|
-
/** The most nodes the expressions of one call may hold in all, so that a thousand large outputs cannot be planned at once. */
|
|
247
|
-
export declare const MAX_CALL_NODES = 200000;
|
|
248
247
|
/**
|
|
249
248
|
* Check a request: every expression, option and number, before any request is made. Throws {@link ValidationError}
|
|
250
249
|
* naming the output index and the path. Pure.
|
|
@@ -256,7 +255,7 @@ export declare function compileCombineMany<R>(request: CombineManyRequest<R>): C
|
|
|
256
255
|
*/
|
|
257
256
|
export declare function rebindCombineMany<R>(compiled: CompiledCombineMany<R>, operands: readonly CombineManyOperand[]): CompiledCombineMany<R>;
|
|
258
257
|
/** What {@link GroupCost} reads of an output. */
|
|
259
|
-
|
|
258
|
+
interface GroupCostItem {
|
|
260
259
|
readonly bound: number;
|
|
261
260
|
readonly serializedBound: number;
|
|
262
261
|
readonly rootKeys: Uint16Array;
|
|
@@ -267,14 +266,15 @@ export interface GroupCostItem {
|
|
|
267
266
|
}
|
|
268
267
|
/**
|
|
269
268
|
* Work counters of the planner, for the tests that hold it to its cost: how many times a group was priced, how many
|
|
270
|
-
* operands those prices walked, and how many group plans were built.
|
|
269
|
+
* operands those prices walked, and how many group plans were built. A call counts into the one it is given
|
|
270
|
+
* ({@link runCombineManyCounted}), and into none otherwise; the planner never reads them.
|
|
271
271
|
*/
|
|
272
|
-
export
|
|
272
|
+
export interface PlanWork {
|
|
273
273
|
adds: number;
|
|
274
274
|
withs: number;
|
|
275
275
|
operandSteps: number;
|
|
276
276
|
planBuilds: number;
|
|
277
|
-
}
|
|
277
|
+
}
|
|
278
278
|
/**
|
|
279
279
|
* The resident bytes a group needs, kept as outputs are added so that one is priced in work proportional to its own
|
|
280
280
|
* operands, not to the group's size: its buffered outputs, its operand streams, the chunks being evaluated, the objects
|
|
@@ -283,6 +283,8 @@ export declare const combineWork: {
|
|
|
283
283
|
export declare class GroupCost {
|
|
284
284
|
private readonly streamBytes;
|
|
285
285
|
private readonly publishConcurrency;
|
|
286
|
+
/** Where this pricing is counted, when it is. */
|
|
287
|
+
private readonly work?;
|
|
286
288
|
private outputs;
|
|
287
289
|
private depth;
|
|
288
290
|
/** The serialized bounds of the largest outputs, descending: at most `publishConcurrency` of them are written at once. */
|
|
@@ -291,7 +293,9 @@ export declare class GroupCost {
|
|
|
291
293
|
private streams;
|
|
292
294
|
private planWork;
|
|
293
295
|
private readonly operands;
|
|
294
|
-
constructor(streamBytes: (operand: number) => number, publishConcurrency: number
|
|
296
|
+
constructor(streamBytes: (operand: number) => number, publishConcurrency: number,
|
|
297
|
+
/** Where this pricing is counted, when it is. */
|
|
298
|
+
work?: PlanWork | undefined);
|
|
295
299
|
/** The cost of the group with `o` added. */
|
|
296
300
|
with(o: GroupCostItem): number;
|
|
297
301
|
add(o: GroupCostItem): void;
|
|
@@ -310,9 +314,11 @@ export declare class GroupCost {
|
|
|
310
314
|
* budget, both before any chunk is read.
|
|
311
315
|
*/
|
|
312
316
|
export declare function runCombineMany<R>(compiled: CompiledCombineMany<R>, deps: CombineManyDeps): Promise<CombineManyRun<R>>;
|
|
317
|
+
/** {@link runCombineMany}, counting the planner's work into `work`. Not exported from the package. */
|
|
318
|
+
export declare function runCombineManyCounted<R>(compiled: CompiledCombineMany<R>, deps: CombineManyDeps, work: PlanWork): Promise<CombineManyRun<R>>;
|
|
313
319
|
/**
|
|
314
|
-
* The
|
|
315
|
-
* row. A live version from the `.crbm` source ends with the opened object's fingerprint: read it through
|
|
320
|
+
* The `pointerId` of a row's version (`<generation>:<pointerId>`, as a pin holds it), or `undefined` where the version
|
|
321
|
+
* names no row. A live version from the `.crbm` source ends with the opened object's fingerprint: read it through
|
|
316
322
|
* `rowVersionOf` first.
|
|
317
323
|
*/
|
|
318
324
|
export declare function tokenOfVersion(version: string | null | undefined): string | undefined;
|
|
@@ -13,3 +13,11 @@
|
|
|
13
13
|
* S3 page, chunk map), so an array keeps the pool trivial and race-free (no shared-iterator hazard).
|
|
14
14
|
*/
|
|
15
15
|
export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
16
|
+
/**
|
|
17
|
+
* `Promise.all` over `items` with at most `limit` calls of `fn` in flight: the results in input order, or the first
|
|
18
|
+
* failure, at once. Unlike {@link mapWithConcurrency} it does not wait for the calls still in flight before it rejects,
|
|
19
|
+
* as `Promise.all` does not; it starts no call after a failure, and what the calls in flight answer is dropped. For reads
|
|
20
|
+
* a caller abandons on the first fault, never for work that must finish or be accounted for once begun. When every item
|
|
21
|
+
* fits under `limit` it is `Promise.all` itself, so a small fan-out costs and interleaves exactly as `Promise.all` does.
|
|
22
|
+
*/
|
|
23
|
+
export declare function boundedAll<T, R>(items: readonly T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]>;
|