@elaraai/east 1.0.57 → 1.0.59
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/dist/src/serialization/beast2/index.d.ts +12 -1
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +20 -1
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/v5/codec.d.ts +4 -1
- package/dist/src/serialization/beast2/v5/codec.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/codec.js +5 -2
- package/dist/src/serialization/beast2/v5/codec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.d.ts +241 -0
- package/dist/src/serialization/beast2/v5/geometry.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/geometry.js +443 -0
- package/dist/src/serialization/beast2/v5/geometry.js.map +1 -0
- package/dist/src/serialization/beast2/v5/geometry.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/geometry.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/geometry.spec.js +283 -0
- package/dist/src/serialization/beast2/v5/geometry.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/index.spec.js +18 -1
- package/dist/src/serialization/beast2/v5/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +79 -0
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/lazy.js +520 -0
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -0
- package/dist/src/serialization/beast2/v5/lazy.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/lazy.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/lazy.spec.js +239 -0
- package/dist/src/serialization/beast2/v5/lazy.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/stream.d.ts +43 -3
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +103 -10
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/index.d.ts +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +1 -1
- package/dist/src/serialization/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Lazy pager-backed collection values.
|
|
7
|
+
*
|
|
8
|
+
* {@link openBeast2LazyFor} opens an indexed v5 collection blob as an
|
|
9
|
+
* ordinary East runtime value — a `SortedMap`, `SortedSet`, or array — whose
|
|
10
|
+
* cheap operations are served from the blob's segment index without decoding
|
|
11
|
+
* the whole collection:
|
|
12
|
+
*
|
|
13
|
+
* - `size` / `length` come from the index (O(1)),
|
|
14
|
+
* - iteration streams one decoded segment at a time (O(segment) memory),
|
|
15
|
+
* - keyed lookups (`get` / `has`, Array index reads) decode one segment via
|
|
16
|
+
* the fence index,
|
|
17
|
+
*
|
|
18
|
+
* and every other operation — mutation, set algebra, range iteration —
|
|
19
|
+
* transparently hydrates the container (the whole-decode that would have
|
|
20
|
+
* happened anyway) and then behaves exactly like the eager value. Object
|
|
21
|
+
* identity is stable across hydration, so host-side iteration locks and
|
|
22
|
+
* freezes keyed on the value keep working.
|
|
23
|
+
*
|
|
24
|
+
* This is what lets a task runner open a huge collection input lazily: a
|
|
25
|
+
* body that only iterates it once, or reads a few keys, never pays the whole
|
|
26
|
+
* decode — while a body that does anything else gets the eager value's exact
|
|
27
|
+
* semantics.
|
|
28
|
+
*/
|
|
29
|
+
import { type EastTypeValue } from "../../../type_of_type.js";
|
|
30
|
+
import type { EastType, ValueTypeOf } from "../../../types.js";
|
|
31
|
+
import { type Beast2DecodeOptions } from "../shared.js";
|
|
32
|
+
/**
|
|
33
|
+
* Builds a curried lazy opener: `open(data)` returns an ordinary collection
|
|
34
|
+
* value — a `SortedMap`, `SortedSet`, or array — backed by the blob's
|
|
35
|
+
* segment index instead of a whole decode.
|
|
36
|
+
*
|
|
37
|
+
* Size, single-pass iteration, and keyed reads are served lazily with
|
|
38
|
+
* O(segment) decoded memory; every other operation transparently hydrates
|
|
39
|
+
* the value (equivalent to the whole decode) and proceeds with eager
|
|
40
|
+
* semantics, so the lazy value is observationally identical to
|
|
41
|
+
* `decodeBeast2For(type)(data)`.
|
|
42
|
+
*
|
|
43
|
+
* @param type - the collection type (Array/Set/Dict)
|
|
44
|
+
* @param options - decode options (platform functions for decoded functions)
|
|
45
|
+
* @returns a function opening a blob as a lazy collection value
|
|
46
|
+
* @throws {TypeError} When `type` is not an Array, Set or Dict type.
|
|
47
|
+
*/
|
|
48
|
+
export declare function openBeast2LazyFor<T extends EastType>(type: T | EastTypeValue, options?: Beast2DecodeOptions): (data: Uint8Array) => ValueTypeOf<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Decides whether a collection type may be opened lazily
|
|
51
|
+
* ({@link openBeast2LazyFor}) with eager-equivalent semantics.
|
|
52
|
+
*
|
|
53
|
+
* A lazy value serves element reads as fresh decodes from the blob, and
|
|
54
|
+
* East's runtime is reference-semantic for nested containers — so an element
|
|
55
|
+
* shape that East can mutate in place (transitively containing an Array, Set,
|
|
56
|
+
* Dict or Ref) must be decoded eagerly, or writes through a read-out element
|
|
57
|
+
* would be silently dropped. Vector/Matrix and function elements are also
|
|
58
|
+
* excluded: `is()` compares them by object identity, which fresh decodes
|
|
59
|
+
* (and hydration) would change, and a decoded closure re-creates any mutable
|
|
60
|
+
* state it captured. Scalar, struct and variant element shapes are safe —
|
|
61
|
+
* they compare by value and have no in-place mutation builtins.
|
|
62
|
+
*
|
|
63
|
+
* Runners consult this before opening a large input lazily; an unsafe shape
|
|
64
|
+
* falls back to the eager whole decode (always correct, just not O(segment)).
|
|
65
|
+
*
|
|
66
|
+
* @param type - the candidate input type
|
|
67
|
+
* @returns `true` when the type is an Array, Set or Dict whose element (and
|
|
68
|
+
* key) shapes make lazy opening observationally equivalent to the eager
|
|
69
|
+
* decode; `false` otherwise, including for non-collection roots
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* isBeast2LazySafe(DictType(IntegerType, StructType({ id: IntegerType }))); // true
|
|
74
|
+
* isBeast2LazySafe(DictType(IntegerType, StructType({ xs: ArrayType(IntegerType) }))); // false — nested mutation
|
|
75
|
+
* isBeast2LazySafe(StringType); // false — not a collection root
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function isBeast2LazySafe(type: EastType | EastTypeValue): boolean;
|
|
79
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/lazy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAuYxD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,CAiBlJ;AAkCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,OAAO,CAQxE"}
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Lazy pager-backed collection values.
|
|
7
|
+
*
|
|
8
|
+
* {@link openBeast2LazyFor} opens an indexed v5 collection blob as an
|
|
9
|
+
* ordinary East runtime value — a `SortedMap`, `SortedSet`, or array — whose
|
|
10
|
+
* cheap operations are served from the blob's segment index without decoding
|
|
11
|
+
* the whole collection:
|
|
12
|
+
*
|
|
13
|
+
* - `size` / `length` come from the index (O(1)),
|
|
14
|
+
* - iteration streams one decoded segment at a time (O(segment) memory),
|
|
15
|
+
* - keyed lookups (`get` / `has`, Array index reads) decode one segment via
|
|
16
|
+
* the fence index,
|
|
17
|
+
*
|
|
18
|
+
* and every other operation — mutation, set algebra, range iteration —
|
|
19
|
+
* transparently hydrates the container (the whole-decode that would have
|
|
20
|
+
* happened anyway) and then behaves exactly like the eager value. Object
|
|
21
|
+
* identity is stable across hydration, so host-side iteration locks and
|
|
22
|
+
* freezes keyed on the value keep working.
|
|
23
|
+
*
|
|
24
|
+
* This is what lets a task runner open a huge collection input lazily: a
|
|
25
|
+
* body that only iterates it once, or reads a few keys, never pays the whole
|
|
26
|
+
* decode — while a body that does anything else gets the eager value's exact
|
|
27
|
+
* semantics.
|
|
28
|
+
*/
|
|
29
|
+
import {} from "../../../type_of_type.js";
|
|
30
|
+
import { compareFor } from "../../../comparison.js";
|
|
31
|
+
import { SortedMap } from "../../../containers/sortedmap.js";
|
|
32
|
+
import { SortedSet } from "../../../containers/sortedset.js";
|
|
33
|
+
import {} from "../shared.js";
|
|
34
|
+
import { asTypeValue } from "./type-section.js";
|
|
35
|
+
import { isSegmentedRoot } from "./codec.js";
|
|
36
|
+
import { Beast2Pages } from "./stream.js";
|
|
37
|
+
/** The canonical-order violation error, matching the eager decoders. */
|
|
38
|
+
function disjointError(kind, i) {
|
|
39
|
+
return new Error(`beast2 v5: segments ${i - 1} and ${i} are not disjoint ascending ${kind === "Dict" ? "key" : "element"} ranges — the wire must hold the canonical value (corrupt or pre-contract blob)`);
|
|
40
|
+
}
|
|
41
|
+
/** Streams a Dict blob's entries segment by segment in canonical order,
|
|
42
|
+
* validating the cross-segment ascent the eager decoder enforces. */
|
|
43
|
+
function* lazyDictEntries(pages, cmp) {
|
|
44
|
+
let prev;
|
|
45
|
+
let has = false;
|
|
46
|
+
for (let i = 0; i < pages.segmentCount; i++) {
|
|
47
|
+
const segment = pages.segment(i);
|
|
48
|
+
for (const [k, v] of segment) {
|
|
49
|
+
if (has && cmp(prev, k) >= 0)
|
|
50
|
+
throw disjointError("Dict", i);
|
|
51
|
+
prev = k;
|
|
52
|
+
has = true;
|
|
53
|
+
yield [k, v];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Streams a Set blob's elements segment by segment in canonical order,
|
|
58
|
+
* validating the cross-segment ascent the eager decoder enforces. */
|
|
59
|
+
function* lazySetKeys(pages, cmp) {
|
|
60
|
+
let prev;
|
|
61
|
+
let has = false;
|
|
62
|
+
for (let i = 0; i < pages.segmentCount; i++) {
|
|
63
|
+
const segment = pages.segment(i);
|
|
64
|
+
for (const k of segment) {
|
|
65
|
+
if (has && cmp(prev, k) >= 0)
|
|
66
|
+
throw disjointError("Set", i);
|
|
67
|
+
prev = k;
|
|
68
|
+
has = true;
|
|
69
|
+
yield k;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A {@link SortedMap} served lazily from an indexed blob.
|
|
75
|
+
*
|
|
76
|
+
* Reads (`size`, `get`, `has`, whole-collection iteration, `minKey`,
|
|
77
|
+
* `maxKey`) are answered from the pager; anything else hydrates first. Not
|
|
78
|
+
* constructed directly — see {@link openBeast2LazyFor}.
|
|
79
|
+
*/
|
|
80
|
+
class LazySortedMap extends SortedMap {
|
|
81
|
+
pages;
|
|
82
|
+
cmp;
|
|
83
|
+
hydrated = false;
|
|
84
|
+
constructor(pages, cmp) {
|
|
85
|
+
super(undefined, cmp);
|
|
86
|
+
this.pages = pages;
|
|
87
|
+
this.cmp = cmp;
|
|
88
|
+
}
|
|
89
|
+
/** Decodes every segment into the underlying B-tree once. */
|
|
90
|
+
hydrate() {
|
|
91
|
+
if (this.hydrated)
|
|
92
|
+
return;
|
|
93
|
+
this.hydrated = true;
|
|
94
|
+
for (const [k, v] of lazyDictEntries(this.pages, this.cmp)) {
|
|
95
|
+
super.set(k, v);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
get size() {
|
|
99
|
+
return this.hydrated ? super.size : this.pages.elementCount;
|
|
100
|
+
}
|
|
101
|
+
get(key) {
|
|
102
|
+
if (this.hydrated)
|
|
103
|
+
return super.get(key);
|
|
104
|
+
if (this.pages.elementCount === 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
return this.pages.get(key);
|
|
107
|
+
}
|
|
108
|
+
has(key) {
|
|
109
|
+
return this.hydrated ? super.has(key) : this.get(key) !== undefined;
|
|
110
|
+
}
|
|
111
|
+
set(key, value) {
|
|
112
|
+
this.hydrate();
|
|
113
|
+
return super.set(key, value);
|
|
114
|
+
}
|
|
115
|
+
delete(key) {
|
|
116
|
+
this.hydrate();
|
|
117
|
+
return super.delete(key);
|
|
118
|
+
}
|
|
119
|
+
clear() {
|
|
120
|
+
// Skip decoding just to discard it — an empty tree plus the hydrated
|
|
121
|
+
// flag IS the cleared state.
|
|
122
|
+
if (Object.isFrozen(this)) {
|
|
123
|
+
throw new TypeError("Cannot modify frozen SortedMap");
|
|
124
|
+
}
|
|
125
|
+
this.hydrated = true;
|
|
126
|
+
super.clear();
|
|
127
|
+
}
|
|
128
|
+
forEach(callbackfn, thisArg) {
|
|
129
|
+
if (this.hydrated) {
|
|
130
|
+
super.forEach(callbackfn, thisArg);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
for (const [k, v] of lazyDictEntries(this.pages, this.cmp)) {
|
|
134
|
+
callbackfn.call(thisArg, v, k, this);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
minKey() {
|
|
138
|
+
if (this.hydrated)
|
|
139
|
+
return super.minKey();
|
|
140
|
+
if (this.pages.elementCount === 0)
|
|
141
|
+
return undefined;
|
|
142
|
+
return this.pages.fence(0);
|
|
143
|
+
}
|
|
144
|
+
maxKey() {
|
|
145
|
+
if (this.hydrated)
|
|
146
|
+
return super.maxKey();
|
|
147
|
+
const n = this.pages.segmentCount;
|
|
148
|
+
if (n === 0)
|
|
149
|
+
return undefined;
|
|
150
|
+
let last;
|
|
151
|
+
for (const k of this.pages.segment(n - 1).keys())
|
|
152
|
+
last = k;
|
|
153
|
+
return last;
|
|
154
|
+
}
|
|
155
|
+
keys(firstKey) {
|
|
156
|
+
if (!this.hydrated && firstKey === undefined) {
|
|
157
|
+
const pages = this.pages;
|
|
158
|
+
const cmp = this.cmp;
|
|
159
|
+
return Iterator.from((function* () {
|
|
160
|
+
for (const [k] of lazyDictEntries(pages, cmp))
|
|
161
|
+
yield k;
|
|
162
|
+
})());
|
|
163
|
+
}
|
|
164
|
+
this.hydrate();
|
|
165
|
+
return super.keys(firstKey);
|
|
166
|
+
}
|
|
167
|
+
values(firstKey) {
|
|
168
|
+
if (!this.hydrated && firstKey === undefined) {
|
|
169
|
+
const pages = this.pages;
|
|
170
|
+
const cmp = this.cmp;
|
|
171
|
+
return Iterator.from((function* () {
|
|
172
|
+
for (const [, v] of lazyDictEntries(pages, cmp))
|
|
173
|
+
yield v;
|
|
174
|
+
})());
|
|
175
|
+
}
|
|
176
|
+
this.hydrate();
|
|
177
|
+
return super.values(firstKey);
|
|
178
|
+
}
|
|
179
|
+
entries(firstKey) {
|
|
180
|
+
if (!this.hydrated && firstKey === undefined) {
|
|
181
|
+
return Iterator.from(lazyDictEntries(this.pages, this.cmp));
|
|
182
|
+
}
|
|
183
|
+
this.hydrate();
|
|
184
|
+
return super.entries(firstKey);
|
|
185
|
+
}
|
|
186
|
+
[Symbol.iterator]() {
|
|
187
|
+
return this.entries();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* A {@link SortedSet} served lazily from an indexed blob.
|
|
192
|
+
*
|
|
193
|
+
* Reads (`size`, `has`, whole-collection iteration, `minKey`, `maxKey`) are
|
|
194
|
+
* answered from the pager; anything else — including the set-algebra methods,
|
|
195
|
+
* which walk the underlying B-tree directly — hydrates first. Not
|
|
196
|
+
* constructed directly — see {@link openBeast2LazyFor}.
|
|
197
|
+
*/
|
|
198
|
+
class LazySortedSet extends SortedSet {
|
|
199
|
+
pages;
|
|
200
|
+
cmp;
|
|
201
|
+
hydrated = false;
|
|
202
|
+
constructor(pages, cmp) {
|
|
203
|
+
super(undefined, cmp);
|
|
204
|
+
this.pages = pages;
|
|
205
|
+
this.cmp = cmp;
|
|
206
|
+
}
|
|
207
|
+
/** Decodes every segment into the underlying B-tree once. */
|
|
208
|
+
hydrate() {
|
|
209
|
+
if (this.hydrated)
|
|
210
|
+
return;
|
|
211
|
+
this.hydrated = true;
|
|
212
|
+
for (const k of lazySetKeys(this.pages, this.cmp)) {
|
|
213
|
+
super.add(k);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
get size() {
|
|
217
|
+
return this.hydrated ? super.size : this.pages.elementCount;
|
|
218
|
+
}
|
|
219
|
+
has(key) {
|
|
220
|
+
if (this.hydrated)
|
|
221
|
+
return super.has(key);
|
|
222
|
+
if (this.pages.elementCount === 0)
|
|
223
|
+
return false;
|
|
224
|
+
return this.pages.get(key) !== undefined;
|
|
225
|
+
}
|
|
226
|
+
add(key) {
|
|
227
|
+
this.hydrate();
|
|
228
|
+
return super.add(key);
|
|
229
|
+
}
|
|
230
|
+
delete(key) {
|
|
231
|
+
this.hydrate();
|
|
232
|
+
return super.delete(key);
|
|
233
|
+
}
|
|
234
|
+
clear() {
|
|
235
|
+
// Skip decoding just to discard it — an empty tree plus the hydrated
|
|
236
|
+
// flag IS the cleared state.
|
|
237
|
+
if (Object.isFrozen(this)) {
|
|
238
|
+
throw new TypeError("Cannot modify frozen SortedSet");
|
|
239
|
+
}
|
|
240
|
+
this.hydrated = true;
|
|
241
|
+
super.clear();
|
|
242
|
+
}
|
|
243
|
+
forEach(callbackfn, thisArg) {
|
|
244
|
+
if (this.hydrated) {
|
|
245
|
+
super.forEach(callbackfn, thisArg);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
for (const k of lazySetKeys(this.pages, this.cmp)) {
|
|
249
|
+
callbackfn.call(thisArg, k, k, this);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
union(other) {
|
|
253
|
+
this.hydrate();
|
|
254
|
+
return super.union(other);
|
|
255
|
+
}
|
|
256
|
+
intersection(other) {
|
|
257
|
+
this.hydrate();
|
|
258
|
+
return super.intersection(other);
|
|
259
|
+
}
|
|
260
|
+
difference(other) {
|
|
261
|
+
this.hydrate();
|
|
262
|
+
return super.difference(other);
|
|
263
|
+
}
|
|
264
|
+
symmetricDifference(other) {
|
|
265
|
+
this.hydrate();
|
|
266
|
+
return super.symmetricDifference(other);
|
|
267
|
+
}
|
|
268
|
+
isSubsetOf(other) {
|
|
269
|
+
this.hydrate();
|
|
270
|
+
return super.isSubsetOf(other);
|
|
271
|
+
}
|
|
272
|
+
isSupersetOf(other) {
|
|
273
|
+
this.hydrate();
|
|
274
|
+
return super.isSupersetOf(other);
|
|
275
|
+
}
|
|
276
|
+
isDisjointFrom(other) {
|
|
277
|
+
this.hydrate();
|
|
278
|
+
return super.isDisjointFrom(other);
|
|
279
|
+
}
|
|
280
|
+
minKey() {
|
|
281
|
+
if (this.hydrated)
|
|
282
|
+
return super.minKey();
|
|
283
|
+
if (this.pages.elementCount === 0)
|
|
284
|
+
return undefined;
|
|
285
|
+
return this.pages.fence(0);
|
|
286
|
+
}
|
|
287
|
+
maxKey() {
|
|
288
|
+
if (this.hydrated)
|
|
289
|
+
return super.maxKey();
|
|
290
|
+
const n = this.pages.segmentCount;
|
|
291
|
+
if (n === 0)
|
|
292
|
+
return undefined;
|
|
293
|
+
let last;
|
|
294
|
+
for (const k of this.pages.segment(n - 1))
|
|
295
|
+
last = k;
|
|
296
|
+
return last;
|
|
297
|
+
}
|
|
298
|
+
keys(firstKey) {
|
|
299
|
+
if (!this.hydrated && firstKey === undefined) {
|
|
300
|
+
return Iterator.from(lazySetKeys(this.pages, this.cmp));
|
|
301
|
+
}
|
|
302
|
+
this.hydrate();
|
|
303
|
+
return super.keys(firstKey);
|
|
304
|
+
}
|
|
305
|
+
values(firstKey) {
|
|
306
|
+
return this.keys(firstKey);
|
|
307
|
+
}
|
|
308
|
+
entries(firstKey) {
|
|
309
|
+
if (!this.hydrated && firstKey === undefined) {
|
|
310
|
+
const pages = this.pages;
|
|
311
|
+
const cmp = this.cmp;
|
|
312
|
+
return Iterator.from((function* () {
|
|
313
|
+
for (const k of lazySetKeys(pages, cmp))
|
|
314
|
+
yield [k, k];
|
|
315
|
+
})());
|
|
316
|
+
}
|
|
317
|
+
this.hydrate();
|
|
318
|
+
return super.entries(firstKey);
|
|
319
|
+
}
|
|
320
|
+
[Symbol.iterator]() {
|
|
321
|
+
return this.keys();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/** Array method names that stream from the pager without hydrating. */
|
|
325
|
+
const LAZY_ARRAY_READS = new Set(["entries", "keys", "values", "forEach", Symbol.iterator]);
|
|
326
|
+
/** Builds a lazy Array value as a proxy over a real (initially empty)
|
|
327
|
+
* array: `length`, index reads and single-pass iteration are served from
|
|
328
|
+
* the pager; any other access hydrates the target array in place. The
|
|
329
|
+
* proxy IS the value, so identity-keyed host state (iteration locks,
|
|
330
|
+
* freezes) survives hydration. */
|
|
331
|
+
function lazyArray(pages) {
|
|
332
|
+
const target = [];
|
|
333
|
+
let hydrated = false;
|
|
334
|
+
const hydrate = () => {
|
|
335
|
+
if (hydrated)
|
|
336
|
+
return;
|
|
337
|
+
hydrated = true;
|
|
338
|
+
for (let i = 0; i < pages.segmentCount; i++) {
|
|
339
|
+
// Element-by-element append — a spread (`push(...segment)`) passes the
|
|
340
|
+
// segment as arguments and overflows the engine's argument limit on
|
|
341
|
+
// ~100k+-element segments.
|
|
342
|
+
for (const item of pages.segment(i))
|
|
343
|
+
target.push(item);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
function* elements() {
|
|
347
|
+
for (let i = 0; i < pages.segmentCount; i++) {
|
|
348
|
+
yield* pages.segment(i);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const lazyReads = {
|
|
352
|
+
[Symbol.iterator]: function* () { yield* elements(); },
|
|
353
|
+
entries: function* () {
|
|
354
|
+
let i = 0;
|
|
355
|
+
for (const v of elements())
|
|
356
|
+
yield [i++, v];
|
|
357
|
+
},
|
|
358
|
+
keys: function* () {
|
|
359
|
+
for (let i = 0; i < pages.elementCount; i++)
|
|
360
|
+
yield i;
|
|
361
|
+
},
|
|
362
|
+
values: function* () { yield* elements(); },
|
|
363
|
+
forEach: (callbackfn, thisArg) => {
|
|
364
|
+
let i = 0;
|
|
365
|
+
for (const v of elements())
|
|
366
|
+
callbackfn.call(thisArg, v, i++, proxy);
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
const proxy = new Proxy(target, {
|
|
370
|
+
get(t, prop, receiver) {
|
|
371
|
+
if (!hydrated) {
|
|
372
|
+
if (prop === "length")
|
|
373
|
+
return pages.elementCount;
|
|
374
|
+
if (LAZY_ARRAY_READS.has(prop))
|
|
375
|
+
return lazyReads[prop];
|
|
376
|
+
if (typeof prop === "string") {
|
|
377
|
+
// Only canonical index strings are element reads — `""`, `"01"`,
|
|
378
|
+
// `" 2"` or `"1e2"` are ordinary (absent) properties on an eager
|
|
379
|
+
// array, and must stay so here.
|
|
380
|
+
const row = Number(prop);
|
|
381
|
+
if (Number.isInteger(row) && row >= 0 && String(row) === prop) {
|
|
382
|
+
return row < pages.elementCount ? pages.element(row) : undefined;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
hydrate();
|
|
386
|
+
}
|
|
387
|
+
return Reflect.get(t, prop, receiver);
|
|
388
|
+
},
|
|
389
|
+
set(t, prop, value, receiver) {
|
|
390
|
+
hydrate();
|
|
391
|
+
return Reflect.set(t, prop, value, receiver);
|
|
392
|
+
},
|
|
393
|
+
has(t, prop) {
|
|
394
|
+
hydrate();
|
|
395
|
+
return Reflect.has(t, prop);
|
|
396
|
+
},
|
|
397
|
+
ownKeys(t) {
|
|
398
|
+
hydrate();
|
|
399
|
+
return Reflect.ownKeys(t);
|
|
400
|
+
},
|
|
401
|
+
getOwnPropertyDescriptor(t, prop) {
|
|
402
|
+
hydrate();
|
|
403
|
+
return Reflect.getOwnPropertyDescriptor(t, prop);
|
|
404
|
+
},
|
|
405
|
+
defineProperty(t, prop, attributes) {
|
|
406
|
+
hydrate();
|
|
407
|
+
return Reflect.defineProperty(t, prop, attributes);
|
|
408
|
+
},
|
|
409
|
+
deleteProperty(t, prop) {
|
|
410
|
+
hydrate();
|
|
411
|
+
return Reflect.deleteProperty(t, prop);
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
return proxy;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Builds a curried lazy opener: `open(data)` returns an ordinary collection
|
|
418
|
+
* value — a `SortedMap`, `SortedSet`, or array — backed by the blob's
|
|
419
|
+
* segment index instead of a whole decode.
|
|
420
|
+
*
|
|
421
|
+
* Size, single-pass iteration, and keyed reads are served lazily with
|
|
422
|
+
* O(segment) decoded memory; every other operation transparently hydrates
|
|
423
|
+
* the value (equivalent to the whole decode) and proceeds with eager
|
|
424
|
+
* semantics, so the lazy value is observationally identical to
|
|
425
|
+
* `decodeBeast2For(type)(data)`.
|
|
426
|
+
*
|
|
427
|
+
* @param type - the collection type (Array/Set/Dict)
|
|
428
|
+
* @param options - decode options (platform functions for decoded functions)
|
|
429
|
+
* @returns a function opening a blob as a lazy collection value
|
|
430
|
+
* @throws {TypeError} When `type` is not an Array, Set or Dict type.
|
|
431
|
+
*/
|
|
432
|
+
export function openBeast2LazyFor(type, options) {
|
|
433
|
+
const typeValue = asTypeValue(type);
|
|
434
|
+
if (!isSegmentedRoot(typeValue)) {
|
|
435
|
+
throw new TypeError(`beast2 v5 lazy values hold Array, Set or Dict roots, not ${typeValue.type}`);
|
|
436
|
+
}
|
|
437
|
+
return (data) => {
|
|
438
|
+
const pages = new Beast2Pages(data, typeValue, options);
|
|
439
|
+
if (typeValue.type === "Array") {
|
|
440
|
+
return lazyArray(pages);
|
|
441
|
+
}
|
|
442
|
+
if (typeValue.type === "Set") {
|
|
443
|
+
const cmp = compareFor(typeValue.value);
|
|
444
|
+
return new LazySortedSet(pages, cmp);
|
|
445
|
+
}
|
|
446
|
+
const cmp = compareFor(typeValue.value.key);
|
|
447
|
+
return new LazySortedMap(pages, cmp);
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
/** Whether every value of `type` is value-semantic under the lazy contract:
|
|
451
|
+
* no East-mutable container (Array/Set/Dict/Ref) and no identity-compared
|
|
452
|
+
* or state-carrying kind (Vector/Matrix, whose `is()` is object identity;
|
|
453
|
+
* functions, whose captured environment can hold mutable state).
|
|
454
|
+
* Structs/variants/scalars compare by value and have no in-place mutation
|
|
455
|
+
* builtins, so a fresh pager-served decode of them is unobservable. */
|
|
456
|
+
function isLazySafeElement(type) {
|
|
457
|
+
switch (type.type) {
|
|
458
|
+
case "Never":
|
|
459
|
+
case "Null":
|
|
460
|
+
case "Boolean":
|
|
461
|
+
case "Integer":
|
|
462
|
+
case "Float":
|
|
463
|
+
case "String":
|
|
464
|
+
case "DateTime":
|
|
465
|
+
case "Blob":
|
|
466
|
+
return true;
|
|
467
|
+
case "Struct":
|
|
468
|
+
case "Variant":
|
|
469
|
+
return type.value.every((f) => isLazySafeElement(f.type));
|
|
470
|
+
case "Recursive":
|
|
471
|
+
// A wrapper's content is checked once; a back-reference re-enters a
|
|
472
|
+
// level already on the checked path, so it adds nothing new.
|
|
473
|
+
return type.value.type === "wrapper" ? isLazySafeElement(type.value.value.inner) : true;
|
|
474
|
+
default:
|
|
475
|
+
// Array/Set/Dict/Ref (mutation through a read-out element would be
|
|
476
|
+
// dropped), Vector/Matrix (`is()` observes decode identity),
|
|
477
|
+
// Function/AsyncFunction (captured mutable state) — eager only.
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Decides whether a collection type may be opened lazily
|
|
483
|
+
* ({@link openBeast2LazyFor}) with eager-equivalent semantics.
|
|
484
|
+
*
|
|
485
|
+
* A lazy value serves element reads as fresh decodes from the blob, and
|
|
486
|
+
* East's runtime is reference-semantic for nested containers — so an element
|
|
487
|
+
* shape that East can mutate in place (transitively containing an Array, Set,
|
|
488
|
+
* Dict or Ref) must be decoded eagerly, or writes through a read-out element
|
|
489
|
+
* would be silently dropped. Vector/Matrix and function elements are also
|
|
490
|
+
* excluded: `is()` compares them by object identity, which fresh decodes
|
|
491
|
+
* (and hydration) would change, and a decoded closure re-creates any mutable
|
|
492
|
+
* state it captured. Scalar, struct and variant element shapes are safe —
|
|
493
|
+
* they compare by value and have no in-place mutation builtins.
|
|
494
|
+
*
|
|
495
|
+
* Runners consult this before opening a large input lazily; an unsafe shape
|
|
496
|
+
* falls back to the eager whole decode (always correct, just not O(segment)).
|
|
497
|
+
*
|
|
498
|
+
* @param type - the candidate input type
|
|
499
|
+
* @returns `true` when the type is an Array, Set or Dict whose element (and
|
|
500
|
+
* key) shapes make lazy opening observationally equivalent to the eager
|
|
501
|
+
* decode; `false` otherwise, including for non-collection roots
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* isBeast2LazySafe(DictType(IntegerType, StructType({ id: IntegerType }))); // true
|
|
506
|
+
* isBeast2LazySafe(DictType(IntegerType, StructType({ xs: ArrayType(IntegerType) }))); // false — nested mutation
|
|
507
|
+
* isBeast2LazySafe(StringType); // false — not a collection root
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
export function isBeast2LazySafe(type) {
|
|
511
|
+
const typeValue = asTypeValue(type);
|
|
512
|
+
if (!isSegmentedRoot(typeValue))
|
|
513
|
+
return false;
|
|
514
|
+
if (typeValue.type === "Dict") {
|
|
515
|
+
const dict = typeValue.value;
|
|
516
|
+
return isLazySafeElement(dict.key) && isLazySafeElement(dict.value);
|
|
517
|
+
}
|
|
518
|
+
return isLazySafeElement(typeValue.value);
|
|
519
|
+
}
|
|
520
|
+
//# sourceMappingURL=lazy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/lazy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAsB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAA4B,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,wEAAwE;AACxE,SAAS,aAAa,CAAC,IAAoB,EAAE,CAAS;IACpD,OAAO,IAAI,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAC,QAAQ,CAAC,+BAA+B,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,iFAAiF,CAAC,CAAC;AAC7M,CAAC;AAED;sEACsE;AACtE,QAAQ,CAAC,CAAC,eAAe,CAAO,KAAkB,EAAE,GAA2B;IAC7E,IAAI,IAAmB,CAA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