@cloudbitmaps/roaring 0.12.0 → 0.14.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 +2 -2
- package/README.md +4 -4
- package/dist/bin/export-segments.js +30 -11
- package/dist/bin/export-segments.js.map +2 -2
- package/dist/index.d.ts +42 -6
- package/dist/index.js +30 -11
- package/dist/index.js.map +2 -2
- package/dist/roaring-codec.d.ts +2 -0
- package/dist/testing/fuzz-codec.d.ts +1 -1
- package/package.json +2 -2
package/PRIVACY.md
CHANGED
|
@@ -125,8 +125,8 @@ after it returns, and re-run any erasure a rollback interrupted.
|
|
|
125
125
|
|
|
126
126
|
Erasure and crypto-shred are **immediate in storage and immediate in the store whose verb performed them**, for
|
|
127
127
|
every read that starts after the verb returns. A read already in progress in that store can still yield an erased id
|
|
128
|
-
from a chunk it had requested before the verb ran: up to
|
|
129
|
-
keys for a combine. They are not immediate in any *other* store, in the same process or another, and this library ships nothing that could
|
|
128
|
+
from a chunk it had requested before the verb ran: up to 32 chunks for `iterate` and `count`, and up to `concurrency`
|
|
129
|
+
keys (32 by default) for a combine. They are not immediate in any *other* store, in the same process or another, and this library ships nothing that could
|
|
130
130
|
make them so — there is no daemon, no bus, and no connection between two stores that happen to point at the same
|
|
131
131
|
bucket.
|
|
132
132
|
|
package/README.md
CHANGED
|
@@ -69,10 +69,10 @@ name.
|
|
|
69
69
|
|
|
70
70
|
## What it costs
|
|
71
71
|
|
|
72
|
-
Measured against real S3 in `us-east-1`, with the pointer in the same bucket as the data: the median cold `intersect`
|
|
73
|
-
of two 500,000-id segments sharing 100 of their 1,999 chunks made
|
|
74
|
-
the shared chunks.
|
|
75
|
-
is **$11.
|
|
72
|
+
Measured against real S3 in `us-east-1`, from inside the region, with the pointer in the same bucket as the data: the median cold `intersect`
|
|
73
|
+
of two 500,000-id segments sharing 100 of their 1,999 chunks made 204 GETs, **$81.60 per million**, requesting only
|
|
74
|
+
the shared chunks, and took 290.06 ms at the median from inside the region (run of 2026-10-04, whose client had 50 sockets; the client this release builds allows 128, and its effect is not measured). A segment's first `store.load()`
|
|
75
|
+
is **$11.60 per million**, pointer included, from its measured requests at list prices. A cold `count()` is one pointer read: it reads no payload and no object.
|
|
76
76
|
|
|
77
77
|
The trade is stated plainly. A membership check that misses the cache costs a ranged GET against object storage,
|
|
78
78
|
where an in-process store costs a memory read. If you need sub-millisecond answers on a working set that fits a
|
|
@@ -449,6 +449,10 @@ var SafeBitmap = class _SafeBitmap {
|
|
|
449
449
|
toArray() {
|
|
450
450
|
return this.bitmap.toArray();
|
|
451
451
|
}
|
|
452
|
+
/** The values as one fresh ascending `Uint32Array`, exported natively. */
|
|
453
|
+
toUint32Array() {
|
|
454
|
+
return this.bitmap.toUint32Array();
|
|
455
|
+
}
|
|
452
456
|
};
|
|
453
457
|
function bitmapAsLoadInput(input) {
|
|
454
458
|
return input instanceof RoaringBitmap32 ? { bitmap: input } : input;
|
|
@@ -1668,9 +1672,14 @@ var CloudRoaring = class _CloudRoaring {
|
|
|
1668
1672
|
return estimateCost(input);
|
|
1669
1673
|
}
|
|
1670
1674
|
};
|
|
1671
|
-
var
|
|
1672
|
-
|
|
1673
|
-
});
|
|
1675
|
+
var withBatches = (gen, batches) => Object.assign(gen, { batches });
|
|
1676
|
+
var failing = (err) => {
|
|
1677
|
+
const rejecting = () => ({ next: () => Promise.reject(err) });
|
|
1678
|
+
return {
|
|
1679
|
+
[Symbol.asyncIterator]: rejecting,
|
|
1680
|
+
batches: () => ({ [Symbol.asyncIterator]: rejecting })
|
|
1681
|
+
};
|
|
1682
|
+
};
|
|
1674
1683
|
var samePin = (a, b) => a === void 0 || b === void 0 ? a === b : a.generation === b.generation && a.fingerprint === b.fingerprint;
|
|
1675
1684
|
var twoPins = (a, b) => {
|
|
1676
1685
|
const one = (p) => p === void 0 ? "live" : `pinned at generation ${p.generation ?? "none"}`;
|
|
@@ -1689,6 +1698,8 @@ var readOptions = (options) => ({
|
|
|
1689
1698
|
var NO_SEGMENTS = [];
|
|
1690
1699
|
var EMPTY_IDS = {
|
|
1691
1700
|
async *[Symbol.asyncIterator]() {
|
|
1701
|
+
},
|
|
1702
|
+
async *batches() {
|
|
1692
1703
|
}
|
|
1693
1704
|
};
|
|
1694
1705
|
var KEEP_EVERY_GENERATION = Number.MAX_SAFE_INTEGER;
|
|
@@ -1944,7 +1955,9 @@ var Segment = class _Segment {
|
|
|
1944
1955
|
if (this.expired()) return EMPTY_IDS;
|
|
1945
1956
|
const range = options == null ? void 0 : rangeOf(options);
|
|
1946
1957
|
const none = range === void 0 || range.after === void 0 && range.through === void 0;
|
|
1947
|
-
|
|
1958
|
+
const { engine, ref } = this;
|
|
1959
|
+
const bounds = none ? void 0 : range;
|
|
1960
|
+
return withBatches(engine.iterate(ref, bounds), () => engine.iterateBatches(ref, bounds));
|
|
1948
1961
|
}
|
|
1949
1962
|
/**
|
|
1950
1963
|
* The options a combine hands the engine, read once, when it is called ({@link readOptions}), with the `exclude`
|
|
@@ -1981,7 +1994,7 @@ var Segment = class _Segment {
|
|
|
1981
1994
|
* Chunk-skipping intersection: stream the ids in **this** segment AND every segment in `others`, ascending.
|
|
1982
1995
|
* Fetches only the Storage chunks present in *all* operands (a key absent from any operand contributes nothing
|
|
1983
1996
|
* and is never downloaded), streaming under a bounded in-flight window — so the Storage footprint stays small
|
|
1984
|
-
* (Lambda-friendly) regardless of segment size. Pass `concurrency` to tune that window (a positive integer).
|
|
1997
|
+
* (Lambda-friendly) regardless of segment size. Pass `concurrency` to tune that window (a positive integer, 32 by default).
|
|
1985
1998
|
* AND is commutative, so `a.intersect([b])` and `b.intersect([a])` yield the same ids. Pass `budget` to
|
|
1986
1999
|
* override the store's per-op denial-of-wallet budget for this call (or `false` to lift it).
|
|
1987
2000
|
*/
|
|
@@ -1994,7 +2007,9 @@ var Segment = class _Segment {
|
|
|
1994
2007
|
} catch (err) {
|
|
1995
2008
|
return failing(err);
|
|
1996
2009
|
}
|
|
1997
|
-
|
|
2010
|
+
const refs = [this.ref, ...others.map((o) => o.ref)];
|
|
2011
|
+
const opts = this.refsIn(options, exclude);
|
|
2012
|
+
return withBatches(engine.intersect(refs, opts), () => engine.intersectBatches(refs, opts));
|
|
1998
2013
|
}
|
|
1999
2014
|
/**
|
|
2000
2015
|
* Materialize `this ∩ others…` (minus `exclude`) as a **new generation of `dest`** — `dest`'s previous contents
|
|
@@ -2052,7 +2067,9 @@ var Segment = class _Segment {
|
|
|
2052
2067
|
} catch (err) {
|
|
2053
2068
|
return failing(err);
|
|
2054
2069
|
}
|
|
2055
|
-
|
|
2070
|
+
const refs = [this.ref, ...others.map((o) => o.ref)];
|
|
2071
|
+
const opts = this.refsIn(options, exclude);
|
|
2072
|
+
return withBatches(engine.union(refs, opts), () => engine.unionBatches(refs, opts));
|
|
2056
2073
|
}
|
|
2057
2074
|
/** Materialize `this ∪ others…` (minus `exclude`) as a **new generation of `dest`** — see {@link intersectInto}. */
|
|
2058
2075
|
async unionInto(dest, others, options) {
|
|
@@ -2091,10 +2108,12 @@ var Segment = class _Segment {
|
|
|
2091
2108
|
} catch (err) {
|
|
2092
2109
|
return failing(err);
|
|
2093
2110
|
}
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2111
|
+
const base = this.ref;
|
|
2112
|
+
const refs = excludes.map((o) => o.ref);
|
|
2113
|
+
const opts = options == null ? void 0 : readOptions(options);
|
|
2114
|
+
return withBatches(
|
|
2115
|
+
engine.andNot(base, refs, opts),
|
|
2116
|
+
() => engine.andNotBatches(base, refs, opts)
|
|
2098
2117
|
);
|
|
2099
2118
|
}
|
|
2100
2119
|
/** Materialize `this \ (excludes…)` as a **new generation of `dest`** — see {@link intersectInto}. */
|