@cloudbitmaps/roaring 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/PRIVACY.md +84 -43
- package/README.md +4 -2
- package/dist/bin/export-segments.d.ts +5 -1
- package/dist/bin/export-segments.js +579 -549
- package/dist/bin/export-segments.js.map +4 -4
- package/dist/index.d.ts +220 -111
- package/dist/index.js +554 -545
- package/dist/index.js.map +4 -4
- package/dist/lease-guards.d.ts +25 -13
- package/dist/open-charging-storage.d.ts +7 -4
- package/dist/options.d.ts +30 -0
- package/dist/portable/decode.d.ts +2 -1
- package/dist/portable/layout.d.ts +3 -2
- package/dist/testing/conformance.d.ts +15 -10
- package/dist/wire-store.d.ts +38 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* `checkConsistency`, `exportSegments` — reuse the store's own drivers, so you never re-pass them (they need the
|
|
24
24
|
* store built with a backend). See the README and the getting-started guide.
|
|
25
25
|
*/
|
|
26
|
-
import type { BudgetOption, GenerationEntry, GenerationMetadata, LoadGuard, LoadInput, LoadOptions, LoadRefusal, LoadResult, RollbackResult, Clock, StorageChunkSource, ConsistencyReport,
|
|
26
|
+
import type { BudgetOption, GenerationEntry, GenerationMetadata, LoadGuard, LoadInput, LoadOptions, LoadRefusal, LoadResult, RollbackResult, Clock, StorageChunkSource, ConsistencyReport, DropResult, ExportManifest, ExportOptions, ExportSink, IAuditSink, IStorageDriver, IKeystore, IMetricsSink, StorageBackend, RetentionPolicy, RetireExpiredOptions, RetireExpiredResult, RetryPolicy, Rng, SetRetentionResult, PinnedAt, IdRange, SegmentRef } from '@cloudbitmaps/core';
|
|
27
27
|
import type { SegmentInfo } from '@cloudbitmaps/core';
|
|
28
28
|
import type { CombineExpr, CombineManyFeedRecord, CombineManyOperandStats, CombineManyOutputStats, CombineManyStats } from '@cloudbitmaps/core';
|
|
29
29
|
import { deserializePortable } from './roaring-codec.js';
|
|
@@ -78,7 +78,7 @@ export interface CloudRoaringOptions {
|
|
|
78
78
|
* lands and then loses its response would, replayed blindly, report its own write as a conflict. A write is
|
|
79
79
|
* retried only where that is safe: a load's registry write that gets no answer is settled by reading the row,
|
|
80
80
|
* and a throttled write-once object is sent again by the S3 and GCS drivers. Pass a partial policy to tune it — anything you leave out keeps its
|
|
81
|
-
* default — or `false` to turn the read retry off (e.g. if your injected client already retries). A GCS download is retried by
|
|
81
|
+
* default, except an omitted `maxDelayMs`, which is `baseDelayMs` when that is larger than 2000 ms — or `false` to turn the read retry off (e.g. if your injected client already retries). A GCS download is retried by
|
|
82
82
|
* the GCS driver whatever this says.
|
|
83
83
|
* Deterministic errors (`ValidationError`/`IntegrityError`/`WriteConflictError`/…) are never retried by this
|
|
84
84
|
* layer.
|
|
@@ -117,13 +117,15 @@ export interface CacheOptions {
|
|
|
117
117
|
* How long (ms) the store trusts a segment's resolved `currentGen` before re-resolving it on the next read
|
|
118
118
|
* (default 2000) — the bound on read staleness after a load publishes a new generation. Applies when
|
|
119
119
|
* `storage` is a **backend**, whose registry supplies the cheap `currentGen` read the refresh needs. Lazy — no
|
|
120
|
-
* timer; ≤ one registry read per segment per window, opening a new reader only when the
|
|
121
|
-
*
|
|
120
|
+
* timer; ≤ one registry read per segment per window, opening a new reader only when the row's pointer was
|
|
121
|
+
* renewed (a publish, a rollback, an erasure's rewrite, a status or key change); a lease or retention write does not.
|
|
122
122
|
*
|
|
123
123
|
* **While the registry cannot be read, the bound stretches.** A refresh that fails with a
|
|
124
|
-
* {@link TransientError} keeps serving the generation the reader
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
* {@link TransientError} keeps serving the generation of a segment still in the reader cache, and the key its reader
|
|
125
|
+
* unwrapped (a read that needs the key, where none was unwrapped before it, unwraps it from that segment's row as
|
|
126
|
+
* resolved before the outage), and is tried again 500 ms later (or after this TTL, if shorter), so the store converges
|
|
127
|
+
* within one retry of the registry answering. A segment the reader cache has let go is not served past its resolution's TTL: once that
|
|
128
|
+
* lapses, a read of it fails with the fault, as a cold read does. A refresh that fails with anything else, an access denial or a row that will not parse, is not
|
|
127
129
|
* ridden out: the read that meets it throws that error, and the reader is dropped.
|
|
128
130
|
*
|
|
129
131
|
* `0` turns this timed refresh off, and so does wiring a bare `IStorageDriver`, which has no registry. That is
|
|
@@ -138,7 +140,13 @@ export interface CacheOptions {
|
|
|
138
140
|
/**
|
|
139
141
|
* Ceiling on how many segments' `.crbm` readers (each holding a parsed index) the store keeps open at once
|
|
140
142
|
* (default 1024) — the steady-state memory bound for a long-running server that reads across many segments.
|
|
141
|
-
* Past it the least-recently-used segment's reader is evicted; re-opening it later is one cheap tail GET.
|
|
143
|
+
* Past it the least-recently-used segment's reader is evicted; re-opening it later is one cheap tail GET. With a
|
|
144
|
+
* timed refresh ({@link CacheOptions.genTtlMs} above 0, and a backend) the store also keeps up to 8 times this many
|
|
145
|
+
* segments' resolutions (what it read of each segment's row: never an unwrapped key, though the wrapped keys are in
|
|
146
|
+
* it) for `genTtlMs`, apart from their readers. An evicted segment is then reopened with no registry read, on the
|
|
147
|
+
* generation it had resolved, when a read needs its index or a chunk the chunk cache does not hold: `iterate` and the
|
|
148
|
+
* combines always do, and a `has()` of a cached chunk, a `count()` and a `stat()` do not, where the row has a summary
|
|
149
|
+
* the store can use. A reader of a small generation, one whose whole object came with its tail read,
|
|
142
150
|
* also holds its chunk bytes, so a read of it makes no chunk request until the reader is evicted or the pointer refresh
|
|
143
151
|
* moves it on; a store with no timed refresh (`genTtlMs: 0`, or no registry) keeps none.
|
|
144
152
|
* Applies whenever the store builds its own read path — a backend or a bare `IStorageDriver`. A pre-built
|
|
@@ -146,14 +154,15 @@ export interface CacheOptions {
|
|
|
146
154
|
*/
|
|
147
155
|
readonly readerMax?: number;
|
|
148
156
|
/**
|
|
149
|
-
* Aggregate byte ceiling on what the open readers hold
|
|
150
|
-
* generation carries, and the chunk bytes a reader keeps when its tail read returned a whole object whose chunks
|
|
157
|
+
* Aggregate byte ceiling on what the open readers hold: their parsed `.crbm` indices, the metadata a
|
|
158
|
+
* generation carries, a fixed 3.75 KiB for the objects each open reader holds around its index, and the chunk bytes a reader keeps when its tail read returned a whole object whose chunks
|
|
151
159
|
* total at most this ceiling divided by {@link CacheOptions.readerMax} (default 64 MiB) — the byte half
|
|
152
160
|
* of the memory bound, complementing the {@link CacheOptions.readerMax} *count* bound. A wide/dense segment's
|
|
153
161
|
* parsed index can reach about 1.3 MB, so a count-only bound could let the open readers pin over a GB and blow a small
|
|
154
|
-
* heap (e.g. a 128 MB Lambda); this evicts the least-recently-used reader once the summed
|
|
155
|
-
* would exceed the ceiling — whichever of the count/byte bounds binds first.
|
|
156
|
-
*
|
|
162
|
+
* heap (e.g. a 128 MB Lambda); this evicts the least-recently-used reader once the summed weight
|
|
163
|
+
* would exceed the ceiling — whichever of the count/byte bounds binds first. A sixteenth of it (4 MiB by default)
|
|
164
|
+
* bounds the segments' resolutions a store with a timed refresh keeps besides. Lower it for memory-tight
|
|
165
|
+
* deployments that read across wide segments. A ceiling below two readers' weight (about 7.7 KB for tiny ones) keeps one reader open at a time. Applies whenever the store builds its own read path.
|
|
157
166
|
*/
|
|
158
167
|
readonly readerMaxBytes?: number;
|
|
159
168
|
}
|
|
@@ -181,7 +190,8 @@ export interface EncryptionOptions {
|
|
|
181
190
|
* {@link CloudRoaringOptions.retry} — a partial {@link RetryPolicy} plus the retry callback.
|
|
182
191
|
*
|
|
183
192
|
* Partial on purpose, so tuning one field does not mean restating all five. Anything omitted here keeps its
|
|
184
|
-
* {@link DEFAULT_RETRY_POLICY} value
|
|
193
|
+
* {@link DEFAULT_RETRY_POLICY} value, except that an omitted `maxDelayMs` is the `baseDelayMs` when that is larger
|
|
194
|
+
* than the default cap.
|
|
185
195
|
*/
|
|
186
196
|
export interface RetryOptions extends Partial<RetryPolicy> {
|
|
187
197
|
/**
|
|
@@ -242,8 +252,9 @@ export interface SubjectErasureEntry {
|
|
|
242
252
|
/** The generation written without the id (present whenever one was written). */
|
|
243
253
|
readonly generation?: number;
|
|
244
254
|
/**
|
|
245
|
-
* Why the id was NOT erased from this segment, when `erased` is false. `'superseded'` —
|
|
246
|
-
*
|
|
255
|
+
* Why the id was NOT erased from this segment, when `erased` is false. `'superseded'` — another writer (a load,
|
|
256
|
+
* another erasure or a rollback) moved the pointer, or replaced an object the call meant to delete, while the call
|
|
257
|
+
* was in flight, so **this call** did not erase the id;
|
|
247
258
|
* re-run against the new generation, which erases it if it is still there and reports nothing for the segment
|
|
248
259
|
* if the racing writer already removed it. `` `error: <message>` `` — an isolated per-segment fault
|
|
249
260
|
* (per-segment faults are recorded so one segment can't discard the whole ledger); re-run after fixing the
|
|
@@ -455,7 +466,8 @@ export interface MaterializeManyDryRun {
|
|
|
455
466
|
export interface MaterializeResult {
|
|
456
467
|
/**
|
|
457
468
|
* The generation written. Present even when refused: the refusal deleted that object, unless the destination's
|
|
458
|
-
* row changed while it was writing, which leaves it in the bucket
|
|
469
|
+
* row changed while it was writing, which leaves it in the bucket, an orphan a later load's collection takes; until
|
|
470
|
+
* then a rollback onto it needs `allowUnknown`.
|
|
459
471
|
*/
|
|
460
472
|
readonly generation: number;
|
|
461
473
|
/**
|
|
@@ -474,8 +486,9 @@ export interface MaterializeResult {
|
|
|
474
486
|
* What the destination held when the guard judged it — `null` when it had no current generation, **or when
|
|
475
487
|
* no bound needed it**. It is taken only when a bound will use it: `allowEmpty: true` with neither
|
|
476
488
|
* `guard.minRetained` nor `guard.maxGrowth` skips it, and this is `null` even though `dest` was non-empty. When the destination's row
|
|
477
|
-
* carries a summary of its current generation the count comes from the row and the object is not read; a row
|
|
478
|
-
*
|
|
489
|
+
* carries a summary of its current generation the count comes from the row and the object is not read; a row with
|
|
490
|
+
* none (one a rollback left when it could not open the key, one a registry of your own stores without one, or one this store cannot use) costs
|
|
491
|
+
* one object-header fetch.
|
|
479
492
|
*/
|
|
480
493
|
readonly cardinalityBefore: number | null;
|
|
481
494
|
/** Non-empty chunks in the generation. */
|
|
@@ -533,10 +546,11 @@ export declare class CloudRoaring {
|
|
|
533
546
|
private lifecycleDeps;
|
|
534
547
|
/**
|
|
535
548
|
* Get a handle to a segment. Validates the name (non-empty, well-formed, within the encoded-length cap). The options
|
|
536
|
-
* are `{ namespace }` and nothing else:
|
|
537
|
-
* misspelt `namespace` would otherwise address the default namespace
|
|
538
|
-
*
|
|
539
|
-
* `undefined` is read as absent, so a
|
|
549
|
+
* are a plain object holding `{ namespace }` and nothing else: any other own key, enumerable or not, is refused with
|
|
550
|
+
* {@link ValidationError}, by name, since a misspelt `namespace` would otherwise address the default namespace, and a
|
|
551
|
+
* deadline such as `expiresAt` would be left unread. A class instance, or an object built on another, is refused too,
|
|
552
|
+
* since it can carry an option no scan of its own keys sees. A key whose value is `undefined` is read as absent, so a
|
|
553
|
+
* spread of options keeps working.
|
|
540
554
|
*/
|
|
541
555
|
segment(name: string, options?: SegmentOptions): Segment;
|
|
542
556
|
/**
|
|
@@ -551,13 +565,20 @@ export declare class CloudRoaring {
|
|
|
551
565
|
* of it. A materialisation is a load whose ids happen to come from a combine instead of from upstream, so
|
|
552
566
|
* everything `load()` learned the hard way applies unchanged: the generation is written UNPUBLISHED, the
|
|
553
567
|
* guard runs while the old generation is still authoritative, the publish is fenced as above, and a refused
|
|
554
|
-
* object is reclaimed only when a re-read finds the row unchanged (the same token
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
* the
|
|
560
|
-
*
|
|
568
|
+
* object is reclaimed only when a re-read finds the row unchanged (the same token, or one that differs only in
|
|
569
|
+
* its leases), `destroyed`, or gone, or finds key material on it when the load wrote cleartext; under any other
|
|
570
|
+
* row it is kept (hard invariant 1: deleting it after a purge-and-recreate would put a live row over a missing
|
|
571
|
+
* generation).
|
|
572
|
+
*
|
|
573
|
+
* Where the row is gone, or keyed over a cleartext write, the object's footer must match what the load wrote, and
|
|
574
|
+
* the delete passes the version that read reported, so on a storage driver that reports `conditionalDelete` an
|
|
575
|
+
* object put under the number since is kept. Where the row is unchanged or `destroyed`, the check narrows the
|
|
576
|
+
* window rather than closing it: the row read and the delete are two round trips, and the delete is by number,
|
|
577
|
+
* since the write reports no version of the object it made. The other deletes a load leads to are by number too: its
|
|
578
|
+
* collection deletes what a listing, or the row's list of kept generations, names below the pointer, and a drop's
|
|
579
|
+
* sweep and a tombstoned segment's collection delete what a listing names under a `destroyed` row. The failure the
|
|
580
|
+
* checks leave when they refuse is an orphan object, which costs storage until something collects it —
|
|
581
|
+
* deliberately the cheaper side of the trade.
|
|
561
582
|
*
|
|
562
583
|
* Written and published in one step, with no guard, an empty combine — a typo'd operand, an `exclude` that
|
|
563
584
|
* swallowed everything, an operand that had not loaded yet — would silently replace `dest` with an empty
|
|
@@ -746,10 +767,14 @@ export declare class CloudRoaring {
|
|
|
746
767
|
* can still hold it, and so can one above the pointer after a {@link CloudRoaring.rollback}, which the rollback
|
|
747
768
|
* could make current again. Each holder is deleted — below the pointer by a `keep: 0` collection, above it one
|
|
748
769
|
* by one, re-proved against the row first — and the generations above the pointer that never held the id stay
|
|
749
|
-
* as rollback targets
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
770
|
+
* as rollback targets, but for any object no read of the segment can open, which goes whatever the id. An entry
|
|
771
|
+
* says `erased: true` only once the call has listed the bucket and read what is left: **no generation of the
|
|
772
|
+
* segment holds the id**. The returned per-segment record is your **erasure ledger** —
|
|
773
|
+
* persist it / route it to your audit sink as the proof of deletion (when you pass `audit`, an audit event is also
|
|
774
|
+
* emitted per segment erased: `segment.rewrite` for a rewrite, `segment.collect` where only other generations held
|
|
775
|
+
* the id and nothing was rewritten). A segment where the erasure deleted only objects no read of it can open (a first
|
|
776
|
+
* load's sealed under a key no row holds) found the id in none, so the ledger does not list it; the audit sink gets
|
|
777
|
+
* `segment.collect` for it with no `fromGeneration`, which is the only record of that deletion.
|
|
753
778
|
*
|
|
754
779
|
* Uses the backend's **own** two halves, so the membership check and the rewrite provably run
|
|
755
780
|
* over the same generation. Requires the store built with a **backend** (throws
|
|
@@ -771,13 +796,21 @@ export declare class CloudRoaring {
|
|
|
771
796
|
* an error, read off the row: a moved pointer is a `'superseded'` entry, which a re-run settles, and a segment
|
|
772
797
|
* that a concurrent `dropSegment` tombstoned or a retention sweep purged is left out of the ledger. A tombstoned
|
|
773
798
|
* segment is still searched: a cleartext object left under it that holds the id is deleted, with everything under
|
|
774
|
-
* the tombstone, and the entry reads `erased: true`.
|
|
799
|
+
* the tombstone, and the entry reads `erased: true`. So is a segment whose row names no generation yet (a retention
|
|
800
|
+
* policy set before its first load): a first load's object that holds the id is deleted, once the row's `pointerId`
|
|
801
|
+
* is renewed so that the load, if still running, is refused at its publish, and the entry reads `erased: true`. An
|
|
802
|
+
* encrypted first load's object there cannot be searched, so it is deleted whatever the id: on an encrypted store,
|
|
803
|
+
* an erasure of any id refuses an encrypted first load in flight that has written its object onto a segment made
|
|
804
|
+
* ahead of its data. Each such delete, and each of a holder above the pointer, names the object the erasure read:
|
|
805
|
+
* on a storage driver that reports `conditionalDelete`, another erasure of the id that deletes it first, followed by
|
|
806
|
+
* a load that takes the number freed and publishes, does not lose that load's generation to this erasure's delete,
|
|
807
|
+
* which is refused, and the entry says what the row says; on one that does not, it can.
|
|
775
808
|
*
|
|
776
809
|
* **Read `note` on any `erased: false` entry — the two reasons mean different things.** `'superseded'` means
|
|
777
|
-
* another writer (a load, another erasure, or a rollback) moved the pointer
|
|
778
|
-
* erase the id. Re-run: it erases the id if it is still there, and lists
|
|
779
|
-
* erasure of the same id already removed it. Do not read `'superseded'` as
|
|
780
|
-
* read it as "not done by this call, and the re-run settles it".
|
|
810
|
+
* another writer (a load, another erasure, or a rollback) moved the pointer, or replaced an object the call meant to
|
|
811
|
+
* delete, mid-call, so **this call** did not erase the id. Re-run: it erases the id if it is still there, and lists
|
|
812
|
+
* nothing for the segment if a racing erasure of the same id already removed it. Do not read `'superseded'` as
|
|
813
|
+
* "the id is still present" — read it as "not done by this call, and the re-run settles it".
|
|
781
814
|
* `` `error: …` `` is a per-segment fault (caught so one segment can't discard the whole ledger) and it can land
|
|
782
815
|
* on either side of the publish: if the rewrite had not published, the id is still there and a re-run erases
|
|
783
816
|
* it; if the publish succeeded and only the **collection** of the old generation failed, the id is already
|
|
@@ -812,6 +845,8 @@ export declare class CloudRoaring {
|
|
|
812
845
|
* What the bucket holds, not what the segment has ever been — collection deletes superseded objects, so this is
|
|
813
846
|
* the grace window plus whatever has not been collected yet. It is the set {@link CloudRoaring.rollback} can
|
|
814
847
|
* choose from, which is the reason to look at it. One registry read and one listing; it does not open the objects.
|
|
848
|
+
* Each entry says whether the row knows the generation (`known`): a known generation needs no `allowUnknown`; an unknown
|
|
849
|
+
* one does, except below a row's pointer when the row has no usable record or the target is older than a full one reaches.
|
|
815
850
|
*
|
|
816
851
|
* Needs a backend.
|
|
817
852
|
*/
|
|
@@ -884,35 +919,58 @@ export declare class CloudRoaring {
|
|
|
884
919
|
* (`segment.rollback`), because every other pointer move can be reconstructed from "a load happened" and this
|
|
885
920
|
* one cannot.
|
|
886
921
|
*
|
|
887
|
-
* It refuses rather than guesses
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
922
|
+
* It refuses rather than guesses. The row records, in `knownGens`, the generations its loads and rollbacks made
|
|
923
|
+
* current, each with the footer checksum of its object, and a rollback moves only onto one of those: a generation the
|
|
924
|
+
* row does not know (a load that wrote its object and died before the publish, a refused load's object, an object
|
|
925
|
+
* sealed under a key no row holds, a load published after the point a registry was restored to) throws
|
|
926
|
+
* {@link ValidationError} before any request to storage, and a known one whose object carries another checksum than
|
|
927
|
+
* the recorded one throws {@link IntegrityError}, with or without a keystore, since the footer is in the clear. A
|
|
928
|
+
* generation not in the bucket (collected, or never written) throws `NotFoundError` naming what *is* available, a
|
|
929
|
+
* crypto-shredded segment throws {@link ValidationError} because every generation of it is unreadable, and a target
|
|
930
|
+
* that is cleartext under an encrypted segment, or encrypted under a cleartext one, throws {@link IntegrityError} from
|
|
931
|
+
* one tail read of it, because every read would refuse it. Rolling to the generation already current is a no-op that
|
|
932
|
+
* reports itself, once one footer read finds its object in the bucket (and the one the row recorded); when the object is
|
|
933
|
+
* gone it throws `NotFoundError` naming what is.
|
|
892
934
|
*
|
|
893
935
|
* The same tail read (and a range read when the target's index is longer than it) gives the target's id count and
|
|
894
936
|
* metadata, which the rollback writes into the row with the pointer, so a reader that sees the target as current sees
|
|
895
937
|
* what describes it. The store's keystore opens an encrypted target for this; without it, or when it cannot open the
|
|
896
|
-
* key
|
|
938
|
+
* key (it holds none of the key's KEKs, one it holds does not unwrap it, or it throws `TransientError` or times out
|
|
939
|
+
* as `AbortSignal.timeout()` and the AWS SDK report a timeout), a rollback onto a known generation still happens,
|
|
940
|
+
* opening nothing, and the row carries no summary of the target. Any other failure of the keystore is
|
|
941
|
+
* thrown. A swap of the pointer that gets no answer is settled by reading the row: one that landed, the row being the
|
|
942
|
+
* one the swap leaves, is checked as any is, and otherwise its `TransientError` is thrown. After the swap the target's
|
|
943
|
+
* footer is read once more, and the pointer put back if the object is gone or is another.
|
|
897
944
|
*
|
|
898
945
|
* It deletes nothing. The generations above the new pointer stay put — which is what makes this reversible —
|
|
899
|
-
* and are then *above* `currentGen`, where collection never looks
|
|
900
|
-
*
|
|
901
|
-
* below its pointer
|
|
902
|
-
*
|
|
903
|
-
*
|
|
946
|
+
* and are then *above* `currentGen`, where collection never looks, and still known to the row, so rolling forward onto
|
|
947
|
+
* one needs no flag. They remain until loads pass them (the first load whose
|
|
948
|
+
* number one of them holds numbers above them all, and collection then keeps `keep` of what is below its pointer, the
|
|
949
|
+
* generation that load superseded first), {@link CloudRoaring.dropSegment}
|
|
950
|
+
* deletes them, or {@link CloudRoaring.eraseSubject} does: all of those present when it rewrites, and, when the
|
|
951
|
+
* current generation does not hold the id, only those holding it and any no read of the segment can open, whatever
|
|
952
|
+
* the id. An operator who has just undone a bad load should not have the
|
|
904
953
|
* evidence collected out from under them, while a rollback target that still holds erased data would make the
|
|
905
954
|
* erasure undoable.
|
|
906
955
|
*
|
|
907
|
-
*
|
|
908
|
-
*
|
|
909
|
-
*
|
|
956
|
+
* `{ allowUnknown: true }` moves onto a present object the row does not vouch for, or one whose checksum differs from
|
|
957
|
+
* the recorded one, as long as it is the segment's kind of object, opens, and names the generation, and records it as
|
|
958
|
+
* known (over a usable record; a row with none stays without one). On an encrypted segment, outside the two cases the pointer alone decides (below), it also needs the key: with no keystore, or one that holds none of the key's KEKs or
|
|
959
|
+
* one that does not unwrap it, it is refused with `KeyUnavailableError` before the target is read, since an object
|
|
960
|
+
* sealed under a key no row holds passes every check that needs no key, and a key service that did not answer in
|
|
961
|
+
* time is thrown as `TransientError`, to retry. Every move the row did not vouch for is audited with `unknown: true`.
|
|
962
|
+
* Two cases are decided by the pointer alone: a target below it needs no flag, no key and no checksum check, and the
|
|
963
|
+
* move is audited the same way. They are a row with no usable `knownGens` (a registry that drops the field, or a pointer
|
|
964
|
+
* moved by hand), and a target numbered below the bound of a full record (128 entries or more, leased ones included),
|
|
965
|
+
* which is its least recently current entry that no lease names (an `*Into` destination keeps every generation in the
|
|
966
|
+
* bucket and names only the newest 128). A generation a publish with a smaller `keep` no longer names but that stays in
|
|
967
|
+
* the bucket (a lease spared it, or its delete failed) needs `allowUnknown` until a later listing collects it.
|
|
910
968
|
*
|
|
911
969
|
* Needs a backend.
|
|
912
970
|
*/
|
|
913
971
|
rollback(ref: SegmentRef, toGeneration: number, options?: {
|
|
914
972
|
audit?: IAuditSink;
|
|
915
|
-
|
|
973
|
+
allowUnknown?: boolean;
|
|
916
974
|
}): Promise<RollbackResult>;
|
|
917
975
|
/**
|
|
918
976
|
* **Replace this segment's contents** with `input`, as one new immutable generation, and make it current.
|
|
@@ -962,10 +1020,16 @@ export declare class CloudRoaring {
|
|
|
962
1020
|
* published, a retention change, a rollback or an erasure wrote the row, or the row was deleted.
|
|
963
1021
|
*
|
|
964
1022
|
* A refused load deletes the object it wrote before returning — it sits above `currentGen`, where generation
|
|
965
|
-
* collection deliberately never looks — but only while the segment's registry row is unchanged or
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
*
|
|
1023
|
+
* collection deliberately never looks — but only while the segment's registry row is unchanged (or differs only in
|
|
1024
|
+
* its leases), `destroyed` or gone, or has key material when the load wrote cleartext, which has no place in an
|
|
1025
|
+
* encrypted segment's bucket. Under a row that is gone or keyed, one read of the object's footer must match what the
|
|
1026
|
+
* load wrote first. Once another write has otherwise changed the row, the generation number it holds may name another
|
|
1027
|
+
* writer's object, and a footer names bytes, not the load that wrote them, so it leaves the orphan rather than risk
|
|
1028
|
+
* deleting live data. A publish never adds the orphan to the row's list, and a load's listing deletes it once a
|
|
1029
|
+
* generation above it is current, unless the row's list names it; where the row records none (after a rollback, or
|
|
1030
|
+
* with a `keep` above 64), that listing's window can keep it and, at a `keep` up to 64, record it, and the publishes
|
|
1031
|
+
* after carry it until the window pushes it out. Until it goes, a rollback onto it is refused unless `allowUnknown` is passed, since the list never names it (a list seeded
|
|
1032
|
+
* over a row with none can); with the override it publishes what no load published.
|
|
969
1033
|
*
|
|
970
1034
|
* **Collection is by name at any `keep` up to 64.** The segment's row records the generations a load keeps, so a load
|
|
971
1035
|
* that found nothing above the pointer deletes the generations its publish pushed out of the window and lists
|
|
@@ -1139,8 +1203,8 @@ export declare class CloudRoaring {
|
|
|
1139
1203
|
* Pass `purgeTombstones: false` to keep every tombstone, that row included. On a backend whose registry reports
|
|
1140
1204
|
* `conditionalDelete` (AWS S3, Azure Blob, the local filesystem and memory, by default; GCS when you set `conditionalDelete: true`)
|
|
1141
1205
|
* the purge removes the row from the bucket for good, by a delete the store applies only to the version it judged,
|
|
1142
|
-
* so a full sweep reads what is live or inside its grace rather than every name a namespace ever held; elsewhere
|
|
1143
|
-
*
|
|
1206
|
+
* so a full sweep reads what is live or inside its grace rather than every name a namespace ever held; elsewhere it
|
|
1207
|
+
* leaves a tombstone. Each retirement files a pointer in the due index
|
|
1144
1208
|
* under the day its tombstone's grace ends, so `scan: 'index'` purges as well as retires.
|
|
1145
1209
|
*
|
|
1146
1210
|
* Needs the store built with a **backend** (throws {@link UnsupportedError} otherwise),
|
|
@@ -1173,7 +1237,10 @@ export declare class CloudRoaring {
|
|
|
1173
1237
|
* reader converging, you need to signal them — this is the call to make when your own fan-out delivers.
|
|
1174
1238
|
*
|
|
1175
1239
|
* It also forgets any replacement this store found of a pin's object, so once it is called after a restore puts that
|
|
1176
|
-
* object back, the pin reads it again.
|
|
1240
|
+
* object back, the pin reads it again. A read of the segment already running on this store, a pin's and a combine's
|
|
1241
|
+
* with a pinned operand included, caches nothing more of what it began reading before the call, and a pinned one
|
|
1242
|
+
* opens its object again before its next chunk, failing with `NotFoundError` if the object is gone or replaced, or
|
|
1243
|
+
* its row is gone or destroyed.
|
|
1177
1244
|
*
|
|
1178
1245
|
* Synchronous, best-effort, and safe to call for a segment this store has never read.
|
|
1179
1246
|
*
|
|
@@ -1189,7 +1256,8 @@ export declare class CloudRoaring {
|
|
|
1189
1256
|
*
|
|
1190
1257
|
* The pinned handle gets its own engine but **shares the store's chunk cache**, under keys of its own: the
|
|
1191
1258
|
* pinned view reports the version captured at pin time, marked as a pin's, so its decoded chunks are never
|
|
1192
|
-
* those of a live read that fetched across a publish (see {@link PinnedStorageChunkSource.currentVersion}).
|
|
1259
|
+
* those of a live read that fetched across a publish (see {@link PinnedStorageChunkSource.currentVersion}). It
|
|
1260
|
+
* shares the store engine's invalidations too, so the store's writes reach a pinned read already running.
|
|
1193
1261
|
*/
|
|
1194
1262
|
private pinSegment;
|
|
1195
1263
|
/** 16 hex digits from the store's `Rng`, which names the holder of one lease: unique, not secret. */
|
|
@@ -1198,7 +1266,8 @@ export declare class CloudRoaring {
|
|
|
1198
1266
|
* An engine reading every segment in `pins` at its pinned generation and everything else live, with the store's
|
|
1199
1267
|
* retries, so a transient fault on a pinned read is retried as it would be on a live one.
|
|
1200
1268
|
*
|
|
1201
|
-
* It **shares the store's chunk cache and its memory bound**, under keys of its own for each pinned segment
|
|
1269
|
+
* It **shares the store's chunk cache and its memory bound**, under keys of its own for each pinned segment, and the
|
|
1270
|
+
* store engine's invalidations, so an invalidation of a pinned segment reaches a read of the pin already running.
|
|
1202
1271
|
*/
|
|
1203
1272
|
private engineWithPins;
|
|
1204
1273
|
/**
|
|
@@ -1232,10 +1301,17 @@ export declare class CloudRoaring {
|
|
|
1232
1301
|
* A segment whose pointer names a missing object is the torn restore this reports; a cold `count()` of it still
|
|
1233
1302
|
* answers the number its row records, while a read of the object throws, so the count alone never shows it. With
|
|
1234
1303
|
* `summaries: true` it also opens each segment's current object (one tail read each) and reports a segment whose
|
|
1235
|
-
* row's summary says another id count or metadata than the object holds
|
|
1304
|
+
* row's summary names another object by its fingerprint, or says another id count or metadata than the object holds,
|
|
1305
|
+
* as `summary-mismatch`, which is what a
|
|
1236
1306
|
* restore of the registry from another point than the bucket leaves a count to answer. A sealed summary is held
|
|
1237
1307
|
* against its object when this store has the key, and counted in `summariesUnchecked` when it does not.
|
|
1238
1308
|
*
|
|
1309
|
+
* With `generations: true` it also holds every generation a row's ledger of known generations names, the current one
|
|
1310
|
+
* included, against its object: one footer read each (104 bytes, no key, not retried), reporting
|
|
1311
|
+
* `known-generation-mismatch` with the `generation` where the object under that number is not the one the row
|
|
1312
|
+
* recorded. A named generation that is not in the bucket is not reported. A row with a pointer whose ledger cannot
|
|
1313
|
+
* be used is counted in `generationsUnchecked`, and none of its objects is read.
|
|
1314
|
+
*
|
|
1239
1315
|
* It holds the registry rows it enumerates resident, at most 250,000 of them, and throws
|
|
1240
1316
|
* `BudgetExceededError` past that rather than report a partial scan as a whole one. This method takes no
|
|
1241
1317
|
* ceiling of its own: narrow the scan with `namespace`, or call `runConsistencyCheck` over the backend's
|
|
@@ -1245,6 +1321,7 @@ export declare class CloudRoaring {
|
|
|
1245
1321
|
namespace?: string;
|
|
1246
1322
|
concurrency?: number;
|
|
1247
1323
|
summaries?: boolean;
|
|
1324
|
+
generations?: boolean;
|
|
1248
1325
|
}): Promise<ConsistencyReport>;
|
|
1249
1326
|
/**
|
|
1250
1327
|
* **Export ("eject") every registered segment's current generation** through the injected `sink`, using only
|
|
@@ -1259,13 +1336,6 @@ export declare class CloudRoaring {
|
|
|
1259
1336
|
* CLI wraps this with a filesystem sink.
|
|
1260
1337
|
*/
|
|
1261
1338
|
exportSegments(sink: ExportSink, options?: ExportOptions): Promise<ExportManifest>;
|
|
1262
|
-
/**
|
|
1263
|
-
* Planning cost estimate — pure, no instance/data needed: sizing, sales, what-if. For a real, grounded report
|
|
1264
|
-
* from live segment sizes, use `store.segment(name).costReport()`. See {@link CostReport}.
|
|
1265
|
-
* @deprecated Moves to `@cloudbitmaps/tools`, a package of its own, with a `size` on `stat()` so a grounded report
|
|
1266
|
-
* needs nothing internal. It is a planning tool, and its price list is as old as the release that ships it.
|
|
1267
|
-
*/
|
|
1268
|
-
static estimateCost(input: EstimateInput): CostReport;
|
|
1269
1339
|
}
|
|
1270
1340
|
/**
|
|
1271
1341
|
* Options common to every chunk-aligned combine (`intersect` / `union` / `andNot`), and the `*Into` verbs.
|
|
@@ -1282,7 +1352,7 @@ export interface BaseCombineOptions extends IdRange {
|
|
|
1282
1352
|
* is larger), about `concurrency × operands` MiB are held, whatever the segment's size. The stream opens 4 ranges wide
|
|
1283
1353
|
* (or `concurrency`, if lower) and widens as ranges are taken, so a read that stops early has asked for little past
|
|
1284
1354
|
* where it stopped, and a read that fits one range makes one request however many chunks it needs. A source that
|
|
1285
|
-
* reads chunk by chunk (a custom one) is read
|
|
1355
|
+
* reads chunk by chunk (a custom one) is read `concurrency` chunk keys at once, opening 8 wide. A running
|
|
1286
1356
|
* stream holds its operand's reader outside the reader cache's bounds until it ends or the segment moves on.
|
|
1287
1357
|
*/
|
|
1288
1358
|
readonly concurrency?: number;
|
|
@@ -1368,18 +1438,32 @@ export interface MaterializeOptions extends CombineOptions {
|
|
|
1368
1438
|
*/
|
|
1369
1439
|
readonly keep?: number;
|
|
1370
1440
|
}
|
|
1441
|
+
/**
|
|
1442
|
+
* An id stream as an iterator: the ids ascending, driven by `for await` or by hand with `next()`, `return()` and
|
|
1443
|
+
* `throw()`, as a generator is, on a handle that holds a lease as on one that does not. It is its own iterator and
|
|
1444
|
+
* single-use. {@link Segment.everyNth} returns this; the streams of {@link IdStream} add `batches()`.
|
|
1445
|
+
*/
|
|
1446
|
+
export interface IdIterator extends AsyncIterableIterator<number> {
|
|
1447
|
+
/** Ends the read, as a generator's `return` does, and resolves done with `value`. */
|
|
1448
|
+
return(value?: unknown): Promise<IteratorResult<number, unknown>>;
|
|
1449
|
+
/** Throws `err` into the read, as a generator's `throw` does: it rejects with `err` unless the read handles it. */
|
|
1450
|
+
throw(err: unknown): Promise<IteratorResult<number, unknown>>;
|
|
1451
|
+
}
|
|
1371
1452
|
/**
|
|
1372
1453
|
* What a streaming read returns: the ids, ascending, one at a time under `for await`, or one chunk at a time from
|
|
1373
1454
|
* {@link IdStream.batches}.
|
|
1374
1455
|
*
|
|
1375
|
-
* It is an `AsyncIterable<number>`, so every consumer of an id stream takes it as
|
|
1456
|
+
* It is an `AsyncIterable<number>`, so every consumer of an id stream takes it as an async iterable, and an
|
|
1457
|
+
* {@link IdIterator}, so `next()`, `return()` and `throw()` are typed. A live read is the
|
|
1376
1458
|
* engine's async generator itself, with `batches` attached: `for await` it, or drive it with `next()`, `return()` and
|
|
1377
|
-
* `throw()`,
|
|
1459
|
+
* `throw()`, and it is single-use (a second `for await` over it yields nothing). A handle that holds a lease returns a
|
|
1460
|
+
* stream of the same shape, which checks the lease as it reads. `batches()` is a
|
|
1378
1461
|
* separate, new read: it starts when called, fetches its chunks afresh and charges the per-op budget again, whether or
|
|
1379
1462
|
* not the per-id stream was read, and reading both is two reads (invariant 3 applies to each separately). Nothing is
|
|
1380
|
-
* fetched until a read is first pulled.
|
|
1463
|
+
* fetched until a read is first pulled. A stream pulled with `next()` and dropped without `return()` is held by nothing
|
|
1464
|
+
* in the store, so it is garbage once the caller lets it go.
|
|
1381
1465
|
*/
|
|
1382
|
-
export interface IdStream extends
|
|
1466
|
+
export interface IdStream extends IdIterator {
|
|
1383
1467
|
/**
|
|
1384
1468
|
* The same ids as the per-id stream, in the same order, one `Uint32Array` per chunk: each array ascending, holding
|
|
1385
1469
|
* every id of one chunk the read yields (a range trimmed at its edges exactly as the per-id stream trims it), and
|
|
@@ -1432,13 +1516,22 @@ export interface PinAt {
|
|
|
1432
1516
|
/** The fingerprint of that generation's object, from the earlier pin's `pinnedAt.fingerprint`. */
|
|
1433
1517
|
readonly fingerprint: string;
|
|
1434
1518
|
}
|
|
1435
|
-
/**
|
|
1519
|
+
/**
|
|
1520
|
+
* What {@link Segment.stat} answers: the generation a handle reads, its id count, its metadata and the size of its
|
|
1521
|
+
* object.
|
|
1522
|
+
*/
|
|
1436
1523
|
export interface SegmentStat {
|
|
1437
1524
|
/** The generation read, or `null` when the segment has none. */
|
|
1438
1525
|
readonly generation: number | null;
|
|
1439
1526
|
readonly cardinality: number;
|
|
1440
1527
|
/** The metadata the generation was loaded with; absent when it has none. */
|
|
1441
1528
|
readonly metadata?: GenerationMetadata;
|
|
1529
|
+
/**
|
|
1530
|
+
* The generation's object in storage, in bytes: what the segment stores. From the registry row's summary, which
|
|
1531
|
+
* records the object's size with its checksum, or from the object's footer when the row has no summary to use.
|
|
1532
|
+
* `null` when the segment has no generation, or when the store's source cannot report a size.
|
|
1533
|
+
*/
|
|
1534
|
+
readonly sizeBytes: number | null;
|
|
1442
1535
|
}
|
|
1443
1536
|
/**
|
|
1444
1537
|
* A handle bound to one segment — the read verbs, plus the three `*Into` verbs that write a **new generation**
|
|
@@ -1529,11 +1622,16 @@ export declare class Segment {
|
|
|
1529
1622
|
* - `eraseSubject` invalidates a pin of each segment it scans that is not already destroyed.
|
|
1530
1623
|
*
|
|
1531
1624
|
* An invalidated pin opens its object again, and fails if that object is gone or replaced, or its row is gone or
|
|
1532
|
-
* destroyed.
|
|
1625
|
+
* destroyed. A read of the pin already running when the invalidation comes, a combine on this store with the pin as
|
|
1626
|
+
* an operand included, looks the pin up again before it hands out its next chunk: it carries on with what it holds
|
|
1627
|
+
* where the object is still there, and fails with `NotFoundError` where it is gone. It caches nothing more of what it
|
|
1628
|
+
* began reading before the invalidation, so the pin's next read opens the object again too.
|
|
1533
1629
|
* Anything else leaves the pin as it is: after a `destroySegment` beside this store, or an erasure, a drop or a
|
|
1534
1630
|
* retirement through another store, in this process or another, the pin answers from what it holds until this
|
|
1535
1631
|
* store's reader cache evicts the pin's reader and its chunk cache evicts the chunks the pin decoded, or
|
|
1536
|
-
* {@link CloudRoaring.invalidate} is called on this store.
|
|
1632
|
+
* {@link CloudRoaring.invalidate} is called on this store. A combine on another store that takes the pin as an
|
|
1633
|
+
* operand reads it through that store's reader and chunk cache, which only that store's own writes and its
|
|
1634
|
+
* `invalidate` reach. Where the
|
|
1537
1635
|
* object the pin reads has been deleted, by an erasure, a drop or a sweep, a chunk the pin has not cached fails at
|
|
1538
1636
|
* once. No timed refresh bounds any of that, as none bounds anything else a pin holds.
|
|
1539
1637
|
*
|
|
@@ -1586,6 +1684,8 @@ export declare class Segment {
|
|
|
1586
1684
|
* the engine, so no operand, exclude or cached reader can answer past a lease.
|
|
1587
1685
|
*/
|
|
1588
1686
|
private assertLeases;
|
|
1687
|
+
/** Throw this handle's lease error, if it has one. The calls that return a value instead of throwing use {@link leaseError}. */
|
|
1688
|
+
private assertLease;
|
|
1589
1689
|
/**
|
|
1590
1690
|
* Reopen a generation a pin named earlier, as a pinned handle like the one {@link Segment.pin} returns, held at
|
|
1591
1691
|
* `at.generation` instead of the current one. Pass what the earlier pin recorded, `{ generation, fingerprint }`
|
|
@@ -1629,18 +1729,23 @@ export declare class Segment {
|
|
|
1629
1729
|
/** `result` as is, or, when a handle of the call holds a lease, checking that lease each time it reads a chunk. */
|
|
1630
1730
|
private guarded;
|
|
1631
1731
|
/**
|
|
1632
|
-
* Time an op with the injected clock and emit an `op` metric on completion (success or throw).
|
|
1633
|
-
*
|
|
1732
|
+
* Time an op with the injected clock and emit an `op` metric on completion (success or throw). With no sink wired it
|
|
1733
|
+
* reads no clock and emits nothing, but a call still passes through this async frame; `has()` and `count()` return the
|
|
1734
|
+
* engine's promise directly instead.
|
|
1634
1735
|
*/
|
|
1635
1736
|
private timed;
|
|
1636
|
-
/**
|
|
1737
|
+
/**
|
|
1738
|
+
* Membership: one chunk. A cold resolution of the segment is one registry read and a warm one none; then a cached
|
|
1739
|
+
* chunk answers with no request, and an uncached one is one range read, after a tail read when no reader of the
|
|
1740
|
+
* generation is open, unless that tail carried the chunk. Throws {@link ValidationError} on a bad id.
|
|
1741
|
+
*/
|
|
1637
1742
|
has(id: number): Promise<boolean>;
|
|
1638
1743
|
/**
|
|
1639
1744
|
* Cardinality of the generation this handle reads: **one registry read when cold, none when warm, and no read of the
|
|
1640
1745
|
* object**, with **zero payload reads**. The registry row records the id count of the generation it names, written
|
|
1641
1746
|
* by the write that made it current, and a count answers from that. A row with no summary it can use (one written
|
|
1642
|
-
*
|
|
1643
|
-
* `.crbm` index, summed with a tail read of the object. A segment whose pointer names a missing object (a torn
|
|
1747
|
+
* without it, as a registry of your own may, one that names another generation, a sealed one that does not open)
|
|
1748
|
+
* sends the count to the `.crbm` index, summed with a tail read of the object. A segment whose pointer names a missing object (a torn
|
|
1644
1749
|
* restore) still counts the row's number, while a read of the object throws; `checkConsistency` is what finds it.
|
|
1645
1750
|
*
|
|
1646
1751
|
* What this trusts: the row's summary, or the index's sum, and no payload is decoded to confirm it. The summary is
|
|
@@ -1655,17 +1760,30 @@ export declare class Segment {
|
|
|
1655
1760
|
*/
|
|
1656
1761
|
count(): Promise<number>;
|
|
1657
1762
|
/**
|
|
1658
|
-
* What the generation this handle reads is, from one resolution: its number, its id count
|
|
1659
|
-
*
|
|
1660
|
-
*
|
|
1661
|
-
*
|
|
1662
|
-
*
|
|
1663
|
-
*
|
|
1664
|
-
*
|
|
1665
|
-
*
|
|
1763
|
+
* What the generation this handle reads is, from one resolution: its number, its id count, the metadata it was
|
|
1764
|
+
* loaded with (absent when it has none), and `sizeBytes`, its object's bytes in storage. All four come from the
|
|
1765
|
+
* registry row when it has a summary this store can use, as `count()`'s do: the summary records the object's
|
|
1766
|
+
* fingerprint, its size with its checksum. That is **one registry read when cold, none when warm, and no read of the
|
|
1767
|
+
* object**. With no summary it can use, they come from the generation's object, opened once: its footer and index,
|
|
1768
|
+
* with no payload read, which is a tail read of the object more when cold (and a range read for an index longer than
|
|
1769
|
+
* the tail) and keeps the generation in the reader cache as a read does. On a pinned handle it answers for the
|
|
1770
|
+
* generation it pinned, from the pinned object. A segment with no generation answers
|
|
1771
|
+
* `{ generation: null, cardinality: 0, sizeBytes: null }`, and a store whose source cannot report a size answers
|
|
1772
|
+
* `sizeBytes: null`. A pointer that names a missing object (a torn restore) still answers from the row's summary, as
|
|
1773
|
+
* `count()` does, while a read of the object throws `NotFoundError`; with no summary to use, `stat()` throws it too.
|
|
1774
|
+
* `checkConsistency` is what finds such a row.
|
|
1775
|
+
*
|
|
1776
|
+
* Trust is as for `count()`: what the row's summary says is believed until the object is next opened. Every open of
|
|
1777
|
+
* the generation holds the object to the fingerprint the summary records, so another object under the number is
|
|
1778
|
+
* refused when it is opened, and holds its count against the summary's; a disagreement in count makes this process
|
|
1779
|
+
* stop using that summary, so `stat()` then answers from the object, whose index is checked for internal consistency
|
|
1780
|
+
* and whose count is the index's sum. A reader already open is not checked again until the row changes, it is
|
|
1781
|
+
* evicted or it is invalidated.
|
|
1782
|
+
*
|
|
1783
|
+
* `sizeBytes` is what `groundedReport` in `@cloudbitmaps/tools` prices storage from.
|
|
1666
1784
|
*
|
|
1667
1785
|
* ```ts
|
|
1668
|
-
* const { generation, cardinality, metadata } = await store.segment('active-30d').stat();
|
|
1786
|
+
* const { generation, cardinality, metadata, sizeBytes } = await store.segment('active-30d').stat();
|
|
1669
1787
|
* ```
|
|
1670
1788
|
*/
|
|
1671
1789
|
stat(): Promise<SegmentStat>;
|
|
@@ -1714,7 +1832,7 @@ export declare class Segment {
|
|
|
1714
1832
|
* for await (const id of audience.everyNth(1_000)) ends.push(id); // the end of each window of 1,000
|
|
1715
1833
|
* ```
|
|
1716
1834
|
*/
|
|
1717
|
-
everyNth(n: number, options?: IdRange):
|
|
1835
|
+
everyNth(n: number, options?: IdRange): IdIterator;
|
|
1718
1836
|
/**
|
|
1719
1837
|
* The options a combine hands the engine, read once, when it is called ({@link readOptions}), with the `exclude`
|
|
1720
1838
|
* it was given ({@link excludesOf}) and mapped down to the plain refs
|
|
@@ -1741,7 +1859,6 @@ export declare class Segment {
|
|
|
1741
1859
|
* override the store's per-op denial-of-wallet budget for this call (or `false` to lift it).
|
|
1742
1860
|
*/
|
|
1743
1861
|
intersect(others: Segment[], options?: CombineOptions): IdStream;
|
|
1744
|
-
private intersectAs;
|
|
1745
1862
|
/**
|
|
1746
1863
|
* Materialize `this ∩ others…` (minus `exclude`) as a **new generation of `dest`** — `dest`'s previous contents
|
|
1747
1864
|
* are superseded, not added to. Streaming + bounded-memory; the result is one immutable object published
|
|
@@ -1774,7 +1891,6 @@ export declare class Segment {
|
|
|
1774
1891
|
* segment once (`unionInto`, or a load) is the cheaper shape.
|
|
1775
1892
|
*/
|
|
1776
1893
|
union(others: Segment[], options?: CombineOptions): IdStream;
|
|
1777
|
-
private unionAs;
|
|
1778
1894
|
/** Materialize `this ∪ others…` (minus `exclude`) as a **new generation of `dest`** — see {@link intersectInto}. */
|
|
1779
1895
|
unionInto(dest: Segment, others: Segment[], options?: MaterializeOptions): Promise<MaterializeResult>;
|
|
1780
1896
|
/**
|
|
@@ -1789,23 +1905,16 @@ export declare class Segment {
|
|
|
1789
1905
|
* the suppression folds into the same pass rather than materializing an intermediate segment first.
|
|
1790
1906
|
*/
|
|
1791
1907
|
andNot(excludes: Segment[], options?: BaseCombineOptions): IdStream;
|
|
1792
|
-
private andNotAs;
|
|
1793
1908
|
/** Materialize `this \ (excludes…)` as a **new generation of `dest`** — see {@link intersectInto}. */
|
|
1794
1909
|
andNotInto(dest: Segment, excludes: Segment[], options?: AndNotIntoOptions): Promise<MaterializeResult>;
|
|
1795
1910
|
/**
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
* needs nothing internal. It is a planning tool, and its price list is as old as the release that ships it.
|
|
1803
|
-
*/
|
|
1804
|
-
costReport(options?: {
|
|
1805
|
-
pricing?: PricingProfile;
|
|
1806
|
-
workload?: Workload;
|
|
1807
|
-
}): Promise<CostReport>;
|
|
1911
|
+
* The one body of the three combines, read as ids or as chunks. `operands` is `others` for `intersect` and
|
|
1912
|
+
* `union`, and `excludes` for `andNot`, which takes no `exclude` option.
|
|
1913
|
+
*/
|
|
1914
|
+
private combineAs;
|
|
1915
|
+
/** The one body of the three `*Into` verbs, after each has checked its own options. */
|
|
1916
|
+
private combineInto;
|
|
1808
1917
|
}
|
|
1809
1918
|
export { deserializePortable };
|
|
1810
|
-
export { MemoryStorage, LocalFsStorage, CrbmStorageChunkSource, destroySegment, eraseNamespace, excludingReservedRows, readRetentionPolicy, MIN_EXPIRES_AT_MS, LEASE_SKEW_MS, MAX_LEASE_MS, MAX_LEASES_PER_SEGMENT, InProcessKeystore, NodeAead, aadFor, CloudRoaringError, ValidationError, WriteConflictError, IntegrityError, NotFoundError, UnsupportedError, CapabilityError, TransientError, KeyUnavailableError, BudgetExceededError, LeaseExpiredError, LeaseLimitError, StaleOperandError, isCloudRoaringError, isWriteConflictError, isTransientError, isNotFoundError, isIntegrityError, isValidationError, isLeaseExpiredError, isLeaseLimitError, isStaleOperandError, isUnsupportedError, isCapabilityError, isBudgetExceededError, isKeyUnavailableError, CrbmReader, BufferReader, CountingMetricsSink, RecordingAuditSink, DEFAULT_RETRY_POLICY,
|
|
1811
|
-
export type { Aead, AeadSealed, AuditEvent, BlobReader, BlobSink, Budget, BudgetOption, ChunkRef, Clock, CodecBitmap, CodecInterface, ConsistencyErrorEntry, ConsistencyIssue, ConsistencyReport,
|
|
1919
|
+
export { MemoryStorage, LocalFsStorage, CrbmStorageChunkSource, destroySegment, eraseNamespace, excludingReservedRows, readRetentionPolicy, MIN_EXPIRES_AT_MS, LEASE_SKEW_MS, MAX_LEASE_MS, MAX_LEASES_PER_SEGMENT, InProcessKeystore, NodeAead, aadFor, CloudRoaringError, ValidationError, WriteConflictError, IntegrityError, NotFoundError, UnsupportedError, CapabilityError, TransientError, KeyUnavailableError, BudgetExceededError, LeaseExpiredError, LeaseLimitError, StaleOperandError, isCloudRoaringError, isWriteConflictError, isTransientError, isNotFoundError, isIntegrityError, isValidationError, isLeaseExpiredError, isLeaseLimitError, isStaleOperandError, isUnsupportedError, isCapabilityError, isBudgetExceededError, isKeyUnavailableError, CrbmReader, BufferReader, CountingMetricsSink, RecordingAuditSink, DEFAULT_RETRY_POLICY, } from '@cloudbitmaps/core';
|
|
1920
|
+
export type { Aead, AeadSealed, AuditEvent, BlobReader, BlobSink, Budget, BudgetOption, ChunkRef, Clock, CodecBitmap, CodecInterface, ConsistencyErrorEntry, ConsistencyIssue, ConsistencyReport, CrbmCrypto, CrbmReaderOptions, CrbmStorageChunkSourceOptions, DestroyResult, ClearRegistrySummary, DropResult, EncodedChunk, EraseDeps, ExportFailure, ExportFormat, ExportManifest, ExportOptions, ExportSink, ExportSkipped, ExportWriter, ExportedSegment, GenKey, GenerationEntry, GenerationMetadata, GovernanceMeta, IAuditSink, IKeystore, IMetricsSink, IRegistryDriver, IStorageDriver, IdRange, InProcessKeystoreOptions, LoadGuard, LoadInput, LoadOptions, LoadRefusal, LoadResult, LocalFsStorageOptions, MemoryStorageOptions, MetricEvent, MetricOpName, MetricsSnapshot, NewRegistryRecord, PinnedAt, PinnedObject, PortableBitmap, RegCaps, RegistryPatch, RegistryRecord, RegistryStatus, RegistrySummary, RegistryWriteOptions, KnownGeneration, LeaseEntry, RetentionPolicy, RetireEntry, RetireExpiredOptions, RetireExpiredResult, RetryPolicy, Rng, RollbackResult, SealedRegistrySummary, SegmentInfo, SegmentRef, SegmentSize, SetRetentionResult, StorageBackend, StorageCaps, StorageChunkSource, StorageDeleteOptions, TailRead, Token, WrappedDek, } from '@cloudbitmaps/core';
|