@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,443 @@
|
|
|
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
|
+
* Beast2 v5 byte geometry — carve and splice over canonical segments.
|
|
7
|
+
*
|
|
8
|
+
* A segmented v5 blob is `header · tag frame · segment frames · terminator
|
|
9
|
+
* frame · index · footer`, and canonical Set/Dict segments are disjoint
|
|
10
|
+
* ascending ranges, so:
|
|
11
|
+
*
|
|
12
|
+
* - a run of segment frames is a valid sub-collection ({@link carveBeast2}),
|
|
13
|
+
* - a sequence of runs is a valid merge ({@link spliceBeast2}),
|
|
14
|
+
*
|
|
15
|
+
* both by byte copy — no value is decoded. {@link rebuildBeast2} re-encodes
|
|
16
|
+
* decoded batches under an existing blob's exact header bytes, so a partially
|
|
17
|
+
* carved segment (split mid-range at a key boundary) can be rebuilt into a
|
|
18
|
+
* blob that splices cleanly against byte-copied runs of the same source.
|
|
19
|
+
*
|
|
20
|
+
* These are the primitives under partitioned dataflow execution: an
|
|
21
|
+
* orchestrator carves a huge collection dataset into key-range partition
|
|
22
|
+
* slices, runs each slice independently, and splices the output shards.
|
|
23
|
+
*/
|
|
24
|
+
import {} from "../../../type_of_type.js";
|
|
25
|
+
import { BufferReader, BufferWriter } from "../../binary-utils.js";
|
|
26
|
+
import { readTypeSection } from "./type-section.js";
|
|
27
|
+
import { MAGIC_BYTES_V5, FOOTER_MAGIC_V5, INDEX_FLAG_SELF_CONTAINED, readIndex, writeIndexAndFooter, readSourceMapSectionV5, isSegmentedRoot, } from "./codec.js";
|
|
28
|
+
import { Beast2Writer } from "./stream.js";
|
|
29
|
+
/** The exact bytes of the root NEW tag frame and of the terminator frame:
|
|
30
|
+
* codec `none`, one logical byte, payload `0x00`. */
|
|
31
|
+
const TAG_OR_TERMINATOR_FRAME = new Uint8Array([0x00, 0x01, 0x01, 0x00]);
|
|
32
|
+
/** Reads the little-endian u64 index offset from the footer. */
|
|
33
|
+
function readFooterIndexOffset(data) {
|
|
34
|
+
const footerStart = data.length - 16;
|
|
35
|
+
let indexOffset = 0n;
|
|
36
|
+
for (let i = 7; i >= 0; i--) {
|
|
37
|
+
indexOffset = (indexOffset << 8n) | BigInt(data[footerStart + i]);
|
|
38
|
+
}
|
|
39
|
+
return Number(indexOffset);
|
|
40
|
+
}
|
|
41
|
+
/** Whether the 4 bytes at `offset` are a tag/terminator frame. */
|
|
42
|
+
function isTagOrTerminatorFrame(data, offset) {
|
|
43
|
+
if (offset + 4 > data.length)
|
|
44
|
+
return false;
|
|
45
|
+
for (let i = 0; i < 4; i++) {
|
|
46
|
+
if (data[offset + i] !== TAG_OR_TERMINATOR_FRAME[i])
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Reads the byte geometry of a segmented, indexed v5 collection blob.
|
|
53
|
+
*
|
|
54
|
+
* Validates the parts of the container that carve and splice rely on: the v5
|
|
55
|
+
* magic, a collection root, a well-formed trailing index, the root tag frame
|
|
56
|
+
* directly after the header sections, segment frames contiguous from there,
|
|
57
|
+
* and the terminator frame directly before the index.
|
|
58
|
+
*
|
|
59
|
+
* @param data - the whole blob
|
|
60
|
+
* @returns the blob's {@link Beast2Extents}
|
|
61
|
+
* @throws {Error} When the blob is not a v5 container, its root is not a
|
|
62
|
+
* collection, it carries no index, or the frame geometry is malformed.
|
|
63
|
+
*/
|
|
64
|
+
export function readBeast2Extents(data) {
|
|
65
|
+
if (data.length < 8) {
|
|
66
|
+
throw new Error(`Data too short for Beast2 format: ${data.length} bytes`);
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0; i < 8; i++) {
|
|
69
|
+
if (data[i] !== MAGIC_BYTES_V5[i]) {
|
|
70
|
+
if (i === 7 && data[i] === 0x04) {
|
|
71
|
+
throw new Error(`beast2 v5: carve/splice need v5 blobs; this is a v4 container (re-encode with version 5)`);
|
|
72
|
+
}
|
|
73
|
+
throw new Error(`beast2 v5: not a beast2 v5 container`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const reader = new BufferReader(data, MAGIC_BYTES_V5.length);
|
|
77
|
+
const { rootType } = readTypeSection(reader);
|
|
78
|
+
if (!isSegmentedRoot(rootType)) {
|
|
79
|
+
throw new Error(`beast2 v5: carve/splice address Array, Set or Dict roots, not ${rootType.type}`);
|
|
80
|
+
}
|
|
81
|
+
const sourceMap = readSourceMapSectionV5(reader);
|
|
82
|
+
const frameOffset = reader.offset;
|
|
83
|
+
const index = readIndex(data);
|
|
84
|
+
if (!index) {
|
|
85
|
+
throw new Error(`beast2 v5: blob carries no index — carve/splice need one (write with the index enabled, the default)`);
|
|
86
|
+
}
|
|
87
|
+
if (!isTagOrTerminatorFrame(data, frameOffset)) {
|
|
88
|
+
throw new Error(`beast2 v5: root tag frame not found where expected (offset ${frameOffset})`);
|
|
89
|
+
}
|
|
90
|
+
const prefixEnd = frameOffset + 4;
|
|
91
|
+
if (index.offsets.length > 0 && index.offsets[0] !== prefixEnd) {
|
|
92
|
+
throw new Error(`beast2 v5: segments not contiguous with the header (first segment at ${index.offsets[0]}, header ends at ${prefixEnd})`);
|
|
93
|
+
}
|
|
94
|
+
const indexOffset = readFooterIndexOffset(data);
|
|
95
|
+
const segmentsEnd = indexOffset - TAG_OR_TERMINATOR_FRAME.length;
|
|
96
|
+
if (segmentsEnd < prefixEnd || !isTagOrTerminatorFrame(data, segmentsEnd)) {
|
|
97
|
+
throw new Error(`beast2 v5: terminator frame not found where expected (offset ${segmentsEnd})`);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
prefixEnd,
|
|
101
|
+
segmentsEnd,
|
|
102
|
+
indexOffset,
|
|
103
|
+
offsets: index.offsets,
|
|
104
|
+
counts: index.counts,
|
|
105
|
+
elementCount: index.totalCount,
|
|
106
|
+
selfContained: index.selfContained,
|
|
107
|
+
sourceMapEmpty: sourceMap.size <= 1n,
|
|
108
|
+
typeValue: rootType,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** The end offset of segment `i`'s frame. */
|
|
112
|
+
function segmentEnd(extents, i) {
|
|
113
|
+
return i + 1 < extents.offsets.length ? extents.offsets[i + 1] : extents.segmentsEnd;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Carves a run of segments out of a blob into a standalone blob, by byte
|
|
117
|
+
* copy.
|
|
118
|
+
*
|
|
119
|
+
* The result keeps the source's header bytes (type section and source map)
|
|
120
|
+
* verbatim, copies the segment frames of `[fromSegment, toSegment)`
|
|
121
|
+
* untouched, and appends a fresh terminator, index and footer. For Set/Dict
|
|
122
|
+
* roots the canonical-segment contract makes any run of segments a valid
|
|
123
|
+
* sub-collection; for Array roots the run is the corresponding row range.
|
|
124
|
+
*
|
|
125
|
+
* @param data - the source blob
|
|
126
|
+
* @param fromSegment - zero-based index of the first segment to keep
|
|
127
|
+
* @param toSegment - zero-based index after the last segment to keep
|
|
128
|
+
* @param extents - the source's extents, when already read
|
|
129
|
+
* @returns a standalone v5 blob holding exactly those segments
|
|
130
|
+
* @throws {Error} When the segment range is invalid or the source is not
|
|
131
|
+
* self-contained (its segments cannot be reinterpreted independently).
|
|
132
|
+
*/
|
|
133
|
+
export function carveBeast2(data, fromSegment, toSegment, extents) {
|
|
134
|
+
const ext = extents ?? readBeast2Extents(data);
|
|
135
|
+
const n = ext.offsets.length;
|
|
136
|
+
if (!Number.isInteger(fromSegment) || !Number.isInteger(toSegment) || fromSegment < 0 || toSegment < fromSegment || toSegment > n) {
|
|
137
|
+
throw new Error(`beast2 v5: carve range [${fromSegment}, ${toSegment}) invalid (${n} segments)`);
|
|
138
|
+
}
|
|
139
|
+
if (!ext.selfContained) {
|
|
140
|
+
throw new Error(`beast2 v5: blob has cross-segment aliasing — carve needs self-contained segments`);
|
|
141
|
+
}
|
|
142
|
+
const writer = new BufferWriter();
|
|
143
|
+
writer.writeBytes(data.subarray(0, ext.prefixEnd));
|
|
144
|
+
const segments = [];
|
|
145
|
+
if (toSegment > fromSegment) {
|
|
146
|
+
const start = ext.offsets[fromSegment];
|
|
147
|
+
const end = segmentEnd(ext, toSegment - 1);
|
|
148
|
+
const shift = ext.prefixEnd - start;
|
|
149
|
+
for (let i = fromSegment; i < toSegment; i++) {
|
|
150
|
+
segments.push({ offset: ext.offsets[i] + shift, count: ext.counts[i] });
|
|
151
|
+
}
|
|
152
|
+
writer.writeBytes(data.subarray(start, end));
|
|
153
|
+
}
|
|
154
|
+
writer.writeBytes(TAG_OR_TERMINATOR_FRAME);
|
|
155
|
+
writeIndexAndFooter(writer, segments, true);
|
|
156
|
+
return writer.toUint8Array();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Splices segmented blobs into one blob, by byte copy.
|
|
160
|
+
*
|
|
161
|
+
* The parts must share byte-identical header prefixes (same wire type
|
|
162
|
+
* section and source-map section — carved and {@link rebuildBeast2}-rebuilt
|
|
163
|
+
* blobs of one source qualify by construction) and be self-contained. The
|
|
164
|
+
* result keeps the first part's header, concatenates every part's segment
|
|
165
|
+
* frames untouched, and appends a fresh terminator, index and footer.
|
|
166
|
+
*
|
|
167
|
+
* For Set/Dict roots the parts' key ranges must ascend disjointly in part
|
|
168
|
+
* order — that is the canonical-segment contract, and readers of the spliced
|
|
169
|
+
* blob reject violations as corrupt. The splice itself never decodes a
|
|
170
|
+
* value, so it cannot check the ordering; callers validate it from the parts'
|
|
171
|
+
* fences when the parts are not carved from one canonical source.
|
|
172
|
+
*
|
|
173
|
+
* @param parts - the blobs to splice, in order
|
|
174
|
+
* @returns one v5 blob holding every part's segments in part order
|
|
175
|
+
* @throws {Error} When no parts are given, a part is malformed or not
|
|
176
|
+
* self-contained, or the parts' header prefixes differ.
|
|
177
|
+
*/
|
|
178
|
+
export function spliceBeast2(parts) {
|
|
179
|
+
if (parts.length === 0) {
|
|
180
|
+
throw new Error(`beast2 v5: splice needs at least one part`);
|
|
181
|
+
}
|
|
182
|
+
const extents = parts.map((part) => readBeast2Extents(part));
|
|
183
|
+
const first = parts[0];
|
|
184
|
+
const firstExt = extents[0];
|
|
185
|
+
const writer = new BufferWriter();
|
|
186
|
+
writer.writeBytes(first.subarray(0, firstExt.prefixEnd));
|
|
187
|
+
const segments = [];
|
|
188
|
+
for (let p = 0; p < parts.length; p++) {
|
|
189
|
+
const part = parts[p];
|
|
190
|
+
const ext = extents[p];
|
|
191
|
+
if (!ext.selfContained) {
|
|
192
|
+
throw new Error(`beast2 v5: splice part ${p} has cross-segment aliasing — splice needs self-contained segments`);
|
|
193
|
+
}
|
|
194
|
+
if (ext.prefixEnd !== firstExt.prefixEnd || !bytesEqual(part, first, firstExt.prefixEnd)) {
|
|
195
|
+
throw new Error(`beast2 v5: splice part ${p} has differing header sections — parts must share one wire type and source map`);
|
|
196
|
+
}
|
|
197
|
+
const shift = writer.size - ext.prefixEnd;
|
|
198
|
+
for (let i = 0; i < ext.offsets.length; i++) {
|
|
199
|
+
segments.push({ offset: ext.offsets[i] + shift, count: ext.counts[i] });
|
|
200
|
+
}
|
|
201
|
+
writer.writeBytes(part.subarray(ext.prefixEnd, ext.segmentsEnd));
|
|
202
|
+
}
|
|
203
|
+
writer.writeBytes(TAG_OR_TERMINATOR_FRAME);
|
|
204
|
+
writeIndexAndFooter(writer, segments, true);
|
|
205
|
+
return writer.toUint8Array();
|
|
206
|
+
}
|
|
207
|
+
/** Parses the u64 little-endian index offset from 8 bytes at `at`. */
|
|
208
|
+
function readU64LE(data, at) {
|
|
209
|
+
let value = 0n;
|
|
210
|
+
for (let i = 7; i >= 0; i--) {
|
|
211
|
+
value = (value << 8n) | BigInt(data[at + i]);
|
|
212
|
+
}
|
|
213
|
+
return Number(value);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Reads the byte geometry of a segmented, indexed v5 collection blob through
|
|
217
|
+
* ranged access — the footer and index from a tail read, the header sections
|
|
218
|
+
* from a head read — without ever buffering the blob whole.
|
|
219
|
+
*
|
|
220
|
+
* The result carries everything {@link carveBeast2Ranged} needs to assemble
|
|
221
|
+
* a standalone blob for any segment span whose frame bytes are then the only
|
|
222
|
+
* further reads: total I/O for a window is O(header + index + window), not
|
|
223
|
+
* O(blob).
|
|
224
|
+
*
|
|
225
|
+
* @param reader - ranged access to the blob
|
|
226
|
+
* @param options - tail-probe tuning
|
|
227
|
+
* @returns the blob's {@link Beast2RangedExtents}
|
|
228
|
+
* @throws {Error} When the blob is not a v5 container, its root is not a
|
|
229
|
+
* collection, it carries no index, or the frame geometry is malformed —
|
|
230
|
+
* the same conditions {@link readBeast2Extents} rejects.
|
|
231
|
+
*/
|
|
232
|
+
export async function readBeast2ExtentsRanged(reader, options) {
|
|
233
|
+
const size = reader.size;
|
|
234
|
+
if (size < MAGIC_BYTES_V5.length + 16) {
|
|
235
|
+
throw new Error(`Data too short for Beast2 format: ${size} bytes`);
|
|
236
|
+
}
|
|
237
|
+
// Tail: footer first, then the index section (one further read when the
|
|
238
|
+
// probe missed its start).
|
|
239
|
+
const probe = Math.min(size, Math.max(options?.tailProbeBytes ?? 64 * 1024, 16));
|
|
240
|
+
let tailStart = size - probe;
|
|
241
|
+
let tail = await reader.read(tailStart, size - tailStart);
|
|
242
|
+
const footerStart = size - 16;
|
|
243
|
+
for (let i = 0; i < 8; i++) {
|
|
244
|
+
if (tail[footerStart + 8 + i - tailStart] !== FOOTER_MAGIC_V5[i]) {
|
|
245
|
+
throw new Error(`beast2 v5: blob carries no index — ranged reads need one (write with the index enabled, the default)`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const indexOffset = readU64LE(tail, footerStart - tailStart);
|
|
249
|
+
if (indexOffset < MAGIC_BYTES_V5.length || indexOffset >= footerStart) {
|
|
250
|
+
throw new Error(`beast2 v5: footer index offset ${indexOffset} out of range`);
|
|
251
|
+
}
|
|
252
|
+
const segmentsEnd = indexOffset - TAG_OR_TERMINATOR_FRAME.length;
|
|
253
|
+
if (segmentsEnd < tailStart) {
|
|
254
|
+
tailStart = segmentsEnd;
|
|
255
|
+
tail = await reader.read(tailStart, size - tailStart);
|
|
256
|
+
}
|
|
257
|
+
// Index section — the same wire shape readIndex parses from a whole blob.
|
|
258
|
+
const indexReader = new BufferReader(tail, indexOffset - tailStart);
|
|
259
|
+
const flags = indexReader.readVarint();
|
|
260
|
+
if ((flags & ~INDEX_FLAG_SELF_CONTAINED) !== 0) {
|
|
261
|
+
throw new Error(`beast2 v5: unknown index flags 0x${flags.toString(16)}`);
|
|
262
|
+
}
|
|
263
|
+
const segmentCount = indexReader.readVarint();
|
|
264
|
+
const offsets = new Array(segmentCount);
|
|
265
|
+
const counts = new Array(segmentCount);
|
|
266
|
+
let prev = 0;
|
|
267
|
+
let elementCount = 0;
|
|
268
|
+
for (let i = 0; i < segmentCount; i++) {
|
|
269
|
+
prev += indexReader.readVarint();
|
|
270
|
+
offsets[i] = prev;
|
|
271
|
+
counts[i] = indexReader.readVarint();
|
|
272
|
+
elementCount += counts[i];
|
|
273
|
+
if (prev >= indexOffset) {
|
|
274
|
+
throw new Error(`beast2 v5: index segment offset ${prev} overlaps the index section`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (indexReader.offset !== footerStart - tailStart) {
|
|
278
|
+
throw new Error(`beast2 v5: index section size mismatch (ends at ${indexReader.offset + tailStart}, footer at ${footerStart})`);
|
|
279
|
+
}
|
|
280
|
+
if (!isTagOrTerminatorFrame(tail, segmentsEnd - tailStart)) {
|
|
281
|
+
throw new Error(`beast2 v5: terminator frame not found where expected (offset ${segmentsEnd})`);
|
|
282
|
+
}
|
|
283
|
+
// Head: header sections + root tag frame, ending exactly where the first
|
|
284
|
+
// segment starts (or at the terminator, for an empty blob).
|
|
285
|
+
const prefixEnd = segmentCount > 0 ? offsets[0] : segmentsEnd;
|
|
286
|
+
const head = await reader.read(0, prefixEnd);
|
|
287
|
+
for (let i = 0; i < 8; i++) {
|
|
288
|
+
if (head[i] !== MAGIC_BYTES_V5[i]) {
|
|
289
|
+
if (i === 7 && head[i] === 0x04) {
|
|
290
|
+
throw new Error(`beast2 v5: ranged reads need v5 blobs; this is a v4 container (re-encode with version 5)`);
|
|
291
|
+
}
|
|
292
|
+
throw new Error(`beast2 v5: not a beast2 v5 container`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const headReader = new BufferReader(head, MAGIC_BYTES_V5.length);
|
|
296
|
+
const { rootType } = readTypeSection(headReader);
|
|
297
|
+
if (!isSegmentedRoot(rootType)) {
|
|
298
|
+
throw new Error(`beast2 v5: ranged reads address Array, Set or Dict roots, not ${rootType.type}`);
|
|
299
|
+
}
|
|
300
|
+
const sourceMap = readSourceMapSectionV5(headReader);
|
|
301
|
+
const frameOffset = headReader.offset;
|
|
302
|
+
if (frameOffset + 4 !== prefixEnd || !isTagOrTerminatorFrame(head, frameOffset)) {
|
|
303
|
+
throw new Error(`beast2 v5: root tag frame not found where expected (offset ${frameOffset})`);
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
prefixEnd,
|
|
307
|
+
segmentsEnd,
|
|
308
|
+
indexOffset,
|
|
309
|
+
offsets,
|
|
310
|
+
counts,
|
|
311
|
+
elementCount,
|
|
312
|
+
selfContained: (flags & INDEX_FLAG_SELF_CONTAINED) !== 0,
|
|
313
|
+
sourceMapEmpty: sourceMap.size <= 1n,
|
|
314
|
+
typeValue: rootType,
|
|
315
|
+
size,
|
|
316
|
+
head,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Assembles a standalone blob for a run of segments from ranged parts — the
|
|
321
|
+
* ranged counterpart of {@link carveBeast2}, producing byte-identical output
|
|
322
|
+
* for the same span.
|
|
323
|
+
*
|
|
324
|
+
* The caller reads exactly the span's frame bytes
|
|
325
|
+
* (`[extents.offsets[fromSegment], end of segment toSegment - 1)`) through
|
|
326
|
+
* its {@link Beast2RangeReader} and passes them here; the result keeps the
|
|
327
|
+
* extents' header bytes verbatim and appends a fresh terminator, index and
|
|
328
|
+
* footer, so it decodes and pages like any carved blob.
|
|
329
|
+
*
|
|
330
|
+
* @param extents - the blob's ranged extents ({@link readBeast2ExtentsRanged})
|
|
331
|
+
* @param frames - the span's segment frame bytes, exactly as stored
|
|
332
|
+
* @param fromSegment - zero-based index of the first segment in `frames`
|
|
333
|
+
* @param toSegment - zero-based index after the last segment in `frames`
|
|
334
|
+
* @returns a standalone v5 blob holding exactly those segments
|
|
335
|
+
* @throws {Error} When the segment range is invalid, the source is not
|
|
336
|
+
* self-contained, or `frames` does not match the span's byte length.
|
|
337
|
+
*/
|
|
338
|
+
export function carveBeast2Ranged(extents, frames, fromSegment, toSegment) {
|
|
339
|
+
const n = extents.offsets.length;
|
|
340
|
+
if (!Number.isInteger(fromSegment) || !Number.isInteger(toSegment) || fromSegment < 0 || toSegment < fromSegment || toSegment > n) {
|
|
341
|
+
throw new Error(`beast2 v5: carve range [${fromSegment}, ${toSegment}) invalid (${n} segments)`);
|
|
342
|
+
}
|
|
343
|
+
if (!extents.selfContained) {
|
|
344
|
+
throw new Error(`beast2 v5: blob has cross-segment aliasing — carve needs self-contained segments`);
|
|
345
|
+
}
|
|
346
|
+
const start = toSegment > fromSegment ? extents.offsets[fromSegment] : 0;
|
|
347
|
+
const end = toSegment > fromSegment ? segmentEnd(extents, toSegment - 1) : 0;
|
|
348
|
+
if (frames.byteLength !== end - start) {
|
|
349
|
+
throw new Error(`beast2 v5: segment span [${fromSegment}, ${toSegment}) is ${end - start} bytes, got ${frames.byteLength}`);
|
|
350
|
+
}
|
|
351
|
+
const writer = new BufferWriter();
|
|
352
|
+
writer.writeBytes(extents.head);
|
|
353
|
+
const segments = [];
|
|
354
|
+
if (toSegment > fromSegment) {
|
|
355
|
+
const shift = extents.prefixEnd - start;
|
|
356
|
+
for (let i = fromSegment; i < toSegment; i++) {
|
|
357
|
+
segments.push({ offset: extents.offsets[i] + shift, count: extents.counts[i] });
|
|
358
|
+
}
|
|
359
|
+
writer.writeBytes(frames);
|
|
360
|
+
}
|
|
361
|
+
writer.writeBytes(TAG_OR_TERMINATOR_FRAME);
|
|
362
|
+
writeIndexAndFooter(writer, segments, true);
|
|
363
|
+
return writer.toUint8Array();
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* The bytes that terminate a spliced or carved stream: the terminator frame
|
|
367
|
+
* plus a self-contained index and footer for the given segment table — the
|
|
368
|
+
* TypeScript mirror of the C runtime's `east_beast2_splice_tail`.
|
|
369
|
+
*
|
|
370
|
+
* With this, a blob can be *streamed* instead of assembled: emit a header
|
|
371
|
+
* (`Beast2RangedExtents.head` or any part's `[0, prefixEnd)` bytes), then the
|
|
372
|
+
* segment frame bytes (tracking their shifted absolute offsets), then this
|
|
373
|
+
* tail — byte-identical to what {@link carveBeast2} / {@link spliceBeast2}
|
|
374
|
+
* build in memory for the same content.
|
|
375
|
+
*
|
|
376
|
+
* @param segments - per-segment absolute (shifted) frame offsets and counts
|
|
377
|
+
* @param streamEnd - the absolute wire offset where the segment frames end
|
|
378
|
+
* (header bytes plus frame bytes emitted so far)
|
|
379
|
+
* @returns the terminator + index + footer bytes
|
|
380
|
+
*/
|
|
381
|
+
export function spliceBeast2Tail(segments, streamEnd) {
|
|
382
|
+
const writer = new BufferWriter();
|
|
383
|
+
writer.writeBytes(TAG_OR_TERMINATOR_FRAME);
|
|
384
|
+
writeIndexAndFooter(writer, [...segments], true, streamEnd + TAG_OR_TERMINATOR_FRAME.length);
|
|
385
|
+
return writer.toUint8Array();
|
|
386
|
+
}
|
|
387
|
+
/** Whether the first `length` bytes of `a` and `b` are identical. */
|
|
388
|
+
function bytesEqual(a, b, length) {
|
|
389
|
+
if (a.length < length || b.length < length)
|
|
390
|
+
return false;
|
|
391
|
+
for (let i = 0; i < length; i++) {
|
|
392
|
+
if (a[i] !== b[i])
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Re-encodes decoded batches into a blob under an existing blob's exact
|
|
399
|
+
* header bytes.
|
|
400
|
+
*
|
|
401
|
+
* Splice requires byte-identical header prefixes, and type sections are not
|
|
402
|
+
* guaranteed byte-identical across independently-built encoders — so when a
|
|
403
|
+
* segment must be split mid-range (a partition boundary landing inside it),
|
|
404
|
+
* the split halves are rebuilt with this function against the source blob
|
|
405
|
+
* itself, and the results splice cleanly with byte-copied runs of the same
|
|
406
|
+
* source.
|
|
407
|
+
*
|
|
408
|
+
* Set/Dict batches must be internally ascending and mutually disjoint in
|
|
409
|
+
* order, as for {@link Beast2Writer}; empty batches are skipped.
|
|
410
|
+
*
|
|
411
|
+
* @param headerSource - the blob whose header bytes (and wire type) to reuse
|
|
412
|
+
* @param batches - collection values, one per segment
|
|
413
|
+
* @param options - codec and pre-read extents
|
|
414
|
+
* @returns a standalone v5 blob with one segment per non-empty batch
|
|
415
|
+
* @throws {Error} When the header source is malformed, or a Set/Dict batch
|
|
416
|
+
* violates strict ascending (key) order.
|
|
417
|
+
*/
|
|
418
|
+
export function rebuildBeast2(headerSource, batches, options) {
|
|
419
|
+
const ext = options?.extents ?? readBeast2Extents(headerSource);
|
|
420
|
+
// Re-parse the header's source map so re-encoded function values resolve
|
|
421
|
+
// their stacks against the header section the result carries verbatim.
|
|
422
|
+
const reader = new BufferReader(headerSource, MAGIC_BYTES_V5.length);
|
|
423
|
+
readTypeSection(reader);
|
|
424
|
+
const sourceMap = readSourceMapSectionV5(reader);
|
|
425
|
+
const chunks = [];
|
|
426
|
+
let total = 0;
|
|
427
|
+
const writer = new Beast2Writer(ext.typeValue, (b) => { chunks.push(b); total += b.length; }, {
|
|
428
|
+
headerPrefix: headerSource.subarray(0, ext.prefixEnd),
|
|
429
|
+
sourceMap,
|
|
430
|
+
...(options?.codec !== undefined && { codec: options.codec }),
|
|
431
|
+
});
|
|
432
|
+
for (const batch of batches)
|
|
433
|
+
writer.write(batch);
|
|
434
|
+
writer.finish();
|
|
435
|
+
const out = new Uint8Array(total);
|
|
436
|
+
let pos = 0;
|
|
437
|
+
for (const c of chunks) {
|
|
438
|
+
out.set(c, pos);
|
|
439
|
+
pos += c.length;
|
|
440
|
+
}
|
|
441
|
+
return out;
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/geometry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;sDACsD;AACtD,MAAM,uBAAuB,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAkCzE,gEAAgE;AAChE,SAAS,qBAAqB,CAAC,IAAgB;IAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrC,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,WAAW,GAAG,CAAC,WAAW,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