@elaraai/east 1.0.79 → 1.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/comparison.d.ts.map +1 -1
- package/dist/src/comparison.js +4 -5
- package/dist/src/comparison.js.map +1 -1
- package/dist/src/compile/builtins/array.d.ts +59 -0
- package/dist/src/compile/builtins/array.d.ts.map +1 -0
- package/dist/src/compile/builtins/array.js +656 -0
- package/dist/src/compile/builtins/array.js.map +1 -0
- package/dist/src/compile/builtins/blob.d.ts +18 -0
- package/dist/src/compile/builtins/blob.d.ts.map +1 -0
- package/dist/src/compile/builtins/blob.js +150 -0
- package/dist/src/compile/builtins/blob.js.map +1 -0
- package/dist/src/compile/builtins/compare.d.ts +18 -0
- package/dist/src/compile/builtins/compare.d.ts.map +1 -0
- package/dist/src/compile/builtins/compare.js +52 -0
- package/dist/src/compile/builtins/compare.js.map +1 -0
- package/dist/src/compile/builtins/datetime.d.ts +21 -0
- package/dist/src/compile/builtins/datetime.d.ts.map +1 -0
- package/dist/src/compile/builtins/datetime.js +46 -0
- package/dist/src/compile/builtins/datetime.js.map +1 -0
- package/dist/src/compile/builtins/dict.d.ts +46 -0
- package/dist/src/compile/builtins/dict.d.ts.map +1 -0
- package/dist/src/compile/builtins/dict.js +551 -0
- package/dist/src/compile/builtins/dict.js.map +1 -0
- package/dist/src/compile/builtins/index.d.ts +9 -0
- package/dist/src/compile/builtins/index.d.ts.map +1 -0
- package/dist/src/compile/builtins/index.js +28 -0
- package/dist/src/compile/builtins/index.js.map +1 -0
- package/dist/src/compile/builtins/matrix.d.ts +31 -0
- package/dist/src/compile/builtins/matrix.d.ts.map +1 -0
- package/dist/src/compile/builtins/matrix.js +310 -0
- package/dist/src/compile/builtins/matrix.js.map +1 -0
- package/dist/src/compile/builtins/primitives.d.ts +36 -0
- package/dist/src/compile/builtins/primitives.d.ts.map +1 -0
- package/dist/src/compile/builtins/primitives.js +67 -0
- package/dist/src/compile/builtins/primitives.js.map +1 -0
- package/dist/src/compile/builtins/ref.d.ts +11 -0
- package/dist/src/compile/builtins/ref.d.ts.map +1 -0
- package/dist/src/compile/builtins/ref.js +30 -0
- package/dist/src/compile/builtins/ref.js.map +1 -0
- package/dist/src/compile/builtins/set.d.ts +41 -0
- package/dist/src/compile/builtins/set.d.ts.map +1 -0
- package/dist/src/compile/builtins/set.js +385 -0
- package/dist/src/compile/builtins/set.js.map +1 -0
- package/dist/src/compile/builtins/sparse.d.ts +19 -0
- package/dist/src/compile/builtins/sparse.d.ts.map +1 -0
- package/dist/src/compile/builtins/sparse.js +143 -0
- package/dist/src/compile/builtins/sparse.js.map +1 -0
- package/dist/src/compile/builtins/string.d.ts +34 -0
- package/dist/src/compile/builtins/string.d.ts.map +1 -0
- package/dist/src/compile/builtins/string.js +238 -0
- package/dist/src/compile/builtins/string.js.map +1 -0
- package/dist/src/compile/builtins/vector.d.ts +44 -0
- package/dist/src/compile/builtins/vector.d.ts.map +1 -0
- package/dist/src/compile/builtins/vector.js +463 -0
- package/dist/src/compile/builtins/vector.js.map +1 -0
- package/dist/src/compile/constructors.d.ts +13 -0
- package/dist/src/compile/constructors.d.ts.map +1 -0
- package/dist/src/compile/constructors.js +179 -0
- package/dist/src/compile/constructors.js.map +1 -0
- package/dist/src/compile/control.d.ts +13 -0
- package/dist/src/compile/control.d.ts.map +1 -0
- package/dist/src/compile/control.js +513 -0
- package/dist/src/compile/control.js.map +1 -0
- package/dist/src/compile/functions.d.ts +13 -0
- package/dist/src/compile/functions.d.ts.map +1 -0
- package/dist/src/compile/functions.js +492 -0
- package/dist/src/compile/functions.js.map +1 -0
- package/dist/src/compile/ir.d.ts +19 -0
- package/dist/src/compile/ir.d.ts.map +1 -0
- package/dist/src/compile/ir.js +193 -0
- package/dist/src/compile/ir.js.map +1 -0
- package/dist/src/compile/runtime.d.ts +78 -0
- package/dist/src/compile/runtime.d.ts.map +1 -0
- package/dist/src/compile/runtime.js +111 -0
- package/dist/src/compile/runtime.js.map +1 -0
- package/dist/src/compile/type_parameters.d.ts +4 -0
- package/dist/src/compile/type_parameters.d.ts.map +1 -0
- package/dist/src/compile/type_parameters.js +55 -0
- package/dist/src/compile/type_parameters.js.map +1 -0
- package/dist/src/compile/typed_arrays.d.ts +28 -0
- package/dist/src/compile/typed_arrays.d.ts.map +1 -0
- package/dist/src/compile/typed_arrays.js +77 -0
- package/dist/src/compile/typed_arrays.js.map +1 -0
- package/dist/src/compile.d.ts +6 -41
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +8 -4415
- package/dist/src/compile.js.map +1 -1
- package/dist/src/compile.open_beast.spec.js +5 -4
- package/dist/src/compile.open_beast.spec.js.map +1 -1
- package/dist/src/containers/sortedmap.d.ts +2 -1
- package/dist/src/containers/sortedmap.d.ts.map +1 -1
- package/dist/src/containers/sortedmap.js +4 -2
- package/dist/src/containers/sortedmap.js.map +1 -1
- package/dist/src/containers/sortedset.d.ts +2 -1
- package/dist/src/containers/sortedset.d.ts.map +1 -1
- package/dist/src/containers/sortedset.js +4 -2
- package/dist/src/containers/sortedset.js.map +1 -1
- package/dist/src/error.d.ts +15 -0
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +16 -0
- package/dist/src/error.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/patch/index.d.ts +1 -1
- package/dist/src/patch/index.d.ts.map +1 -1
- package/dist/src/patch/index.js +1 -1
- package/dist/src/patch/index.js.map +1 -1
- package/dist/src/patch/type_of_patch.d.ts +25 -1
- package/dist/src/patch/type_of_patch.d.ts.map +1 -1
- package/dist/src/patch/type_of_patch.js +33 -10
- package/dist/src/patch/type_of_patch.js.map +1 -1
- package/dist/src/platform.spec.js +19 -1
- package/dist/src/platform.spec.js.map +1 -1
- package/dist/src/runner_protocol.d.ts +316 -0
- package/dist/src/runner_protocol.d.ts.map +1 -0
- package/dist/src/runner_protocol.js +135 -0
- package/dist/src/runner_protocol.js.map +1 -0
- package/dist/src/serialization/beast2/index.d.ts +21 -5
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +12 -2
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/index.spec.js +84 -3
- package/dist/src/serialization/beast2/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/shared.d.ts +32 -3
- package/dist/src/serialization/beast2/shared.d.ts.map +1 -1
- package/dist/src/serialization/beast2/shared.js +135 -10
- package/dist/src/serialization/beast2/shared.js.map +1 -1
- package/dist/src/serialization/beast2/v4/container.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v4/container.js +5 -3
- package/dist/src/serialization/beast2/v4/container.js.map +1 -1
- package/dist/src/serialization/beast2/v5/aliasing.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/aliasing.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/aliasing.spec.js +75 -0
- package/dist/src/serialization/beast2/v5/aliasing.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.d.ts +176 -0
- package/dist/src/serialization/beast2/v5/boundary.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.js +297 -0
- package/dist/src/serialization/beast2/v5/boundary.js.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.js +479 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/codec.d.ts +6 -5
- package/dist/src/serialization/beast2/v5/codec.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/codec.js +18 -3
- package/dist/src/serialization/beast2/v5/codec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/deflate.d.ts +24 -2
- package/dist/src/serialization/beast2/v5/deflate.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/deflate.js +47 -12
- package/dist/src/serialization/beast2/v5/deflate.js.map +1 -1
- package/dist/src/serialization/beast2/v5/deflate.spec.js +15 -1
- package/dist/src/serialization/beast2/v5/deflate.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/elements.d.ts +64 -0
- package/dist/src/serialization/beast2/v5/elements.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.js +320 -0
- package/dist/src/serialization/beast2/v5/elements.js.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/elements.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.spec.js +161 -0
- package/dist/src/serialization/beast2/v5/elements.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/frame-pool.d.ts +62 -21
- package/dist/src/serialization/beast2/v5/frame-pool.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frame-pool.js +138 -27
- package/dist/src/serialization/beast2/v5/frame-pool.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frame-pool.spec.js +198 -71
- package/dist/src/serialization/beast2/v5/frame-pool.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frame-worker.js +25 -15
- package/dist/src/serialization/beast2/v5/frame-worker.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.d.ts +22 -12
- package/dist/src/serialization/beast2/v5/frames.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.js +52 -27
- package/dist/src/serialization/beast2/v5/frames.js.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.d.ts +38 -1
- package/dist/src/serialization/beast2/v5/geometry.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.js +73 -1
- package/dist/src/serialization/beast2/v5/geometry.js.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.spec.js +34 -23
- package/dist/src/serialization/beast2/v5/geometry.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/index.spec.js +32 -28
- package/dist/src/serialization/beast2/v5/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +42 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.js +143 -28
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.spec.js +102 -24
- package/dist/src/serialization/beast2/v5/lazy.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/manifest-writer.d.ts +110 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.js +118 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.js.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.js +207 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest.d.ts +241 -0
- package/dist/src/serialization/beast2/v5/manifest.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest.js +233 -0
- package/dist/src/serialization/beast2/v5/manifest.js.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.d.ts +93 -0
- package/dist/src/serialization/beast2/v5/merge.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.js +202 -0
- package/dist/src/serialization/beast2/v5/merge.js.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/merge.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.spec.js +118 -0
- package/dist/src/serialization/beast2/v5/merge.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.d.ts +143 -0
- package/dist/src/serialization/beast2/v5/recut.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.js +365 -0
- package/dist/src/serialization/beast2/v5/recut.js.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/recut.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.spec.js +215 -0
- package/dist/src/serialization/beast2/v5/recut.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.d.ts +148 -0
- package/dist/src/serialization/beast2/v5/runs.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.js +260 -0
- package/dist/src/serialization/beast2/v5/runs.js.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/runs.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.spec.js +182 -0
- package/dist/src/serialization/beast2/v5/runs.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.d.ts +19 -0
- package/dist/src/serialization/beast2/v5/sha256.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.js +103 -0
- package/dist/src/serialization/beast2/v5/sha256.js.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.js +42 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/stream.d.ts +273 -86
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +576 -244
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/beast2/v5/sync-reader.spec.js +24 -10
- package/dist/src/serialization/beast2/v5/sync-reader.spec.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/dist/src/serialization/json.d.ts +28 -0
- package/dist/src/serialization/json.d.ts.map +1 -1
- package/dist/src/serialization/json.js +141 -30
- package/dist/src/serialization/json.js.map +1 -1
- package/dist/src/serialization/json.spec.js +47 -2
- package/dist/src/serialization/json.spec.js.map +1 -1
- package/dist/src/serialization/json_schema.d.ts +15 -11
- package/dist/src/serialization/json_schema.d.ts.map +1 -1
- package/dist/src/serialization/json_schema.js +21 -36
- package/dist/src/serialization/json_schema.js.map +1 -1
- package/dist/src/serialization/json_schema.spec.js +26 -32
- package/dist/src/serialization/json_schema.spec.js.map +1 -1
- package/dist/src/serialization/json_schema_to_type.d.ts +10 -5
- package/dist/src/serialization/json_schema_to_type.d.ts.map +1 -1
- package/dist/src/serialization/json_schema_to_type.js +13 -6
- package/dist/src/serialization/json_schema_to_type.js.map +1 -1
- package/dist/src/serialization/json_schema_to_type.spec.js +19 -0
- package/dist/src/serialization/json_schema_to_type.spec.js.map +1 -1
- package/dist/src/string_order.d.ts +36 -0
- package/dist/src/string_order.d.ts.map +1 -0
- package/dist/src/string_order.js +64 -0
- package/dist/src/string_order.js.map +1 -0
- package/dist/src/string_order.spec.d.ts +6 -0
- package/dist/src/string_order.spec.d.ts.map +1 -0
- package/dist/src/string_order.spec.js +79 -0
- package/dist/src/string_order.spec.js.map +1 -0
- package/dist/src/type_of_type.d.ts +17 -0
- package/dist/src/type_of_type.d.ts.map +1 -1
- package/dist/src/type_of_type.js +66 -0
- package/dist/src/type_of_type.js.map +1 -1
- package/dist/src/type_of_type.to_etv.spec.js +69 -1
- package/dist/src/type_of_type.to_etv.spec.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
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
|
+
* The segment manifest: a collection held as N standalone segment blobs plus
|
|
7
|
+
* a small object naming them in order.
|
|
8
|
+
*
|
|
9
|
+
* A v5 collection blob is already `header · tag · segment frames · terminator ·
|
|
10
|
+
* index · footer`, and each segment frame is a self-contained piece of the
|
|
11
|
+
* canonical value. A manifest takes the last step and lets each segment be its
|
|
12
|
+
* own blob, so a store can address them individually: equal values then name
|
|
13
|
+
* equal segments, a one-row edit re-cuts one of them, and two values diff by
|
|
14
|
+
* comparing hashes rather than by decoding anything.
|
|
15
|
+
*
|
|
16
|
+
* This type lives here, beside the container it describes, because **every
|
|
17
|
+
* runtime must read it**. A task input staged as a manifest is one file naming
|
|
18
|
+
* sibling segment files, and a body that iterates it, or reads one key from it,
|
|
19
|
+
* pays for the segments it touches rather than for a splice of the whole value
|
|
20
|
+
* — which is the difference between a 2 GB input costing 2 GB and costing the
|
|
21
|
+
* rows it reads. {@link Beast2ManifestSource} is what a reader hands
|
|
22
|
+
* {@link Beast2Pages} to get that.
|
|
23
|
+
*
|
|
24
|
+
* Nothing about the manifest changes what a segment is, so any reader in any
|
|
25
|
+
* runtime still opens a segment blob on its own, and splicing the segments
|
|
26
|
+
* back under their shared header reproduces the single-blob form exactly.
|
|
27
|
+
*/
|
|
28
|
+
import { ArrayType, BlobType, IntegerType, StringType, StructType, } from "../../../types.js";
|
|
29
|
+
import { EastTypeType, canonicalTypeValue, toEastTypeValue } from "../../../type_of_type.js";
|
|
30
|
+
import { readTypeSection } from "./type-section.js";
|
|
31
|
+
import { BufferReader } from "../../binary-utils.js";
|
|
32
|
+
import { MAGIC_BYTES_V5, encodeBeast2V5For, decodeBeast2V5For } from "./codec.js";
|
|
33
|
+
import { isBeast2SyncRangeReader, readExact } from "./range.js";
|
|
34
|
+
/** The `kind` tag every segment manifest carries — what tells a reader that an
|
|
35
|
+
* object naming other objects describes a collection, and the handle a
|
|
36
|
+
* garbage collector recognizes it by. */
|
|
37
|
+
export const COLLECTION_MANIFEST_KIND = "$segments";
|
|
38
|
+
/** One entry of a {@link CollectionManifestType}: a segment blob at level 0, a
|
|
39
|
+
* child manifest above it. */
|
|
40
|
+
export const CollectionManifestEntryType = StructType({
|
|
41
|
+
/** The segment (or child manifest) object's content hash. */
|
|
42
|
+
hash: StringType,
|
|
43
|
+
/** The entry's first key, in the canonical bare encoding
|
|
44
|
+
* `encodeBeast2FenceFor` produces; empty for an Array root, which has no
|
|
45
|
+
* key order to bisect. */
|
|
46
|
+
fence: BlobType,
|
|
47
|
+
/** Elements (pairs, for a Dict root) in the segment or subtree. */
|
|
48
|
+
count: IntegerType,
|
|
49
|
+
/** The object's size in bytes, so a reader budgets without a stat. */
|
|
50
|
+
bytes: IntegerType,
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* A collection's manifest: the value an object holds in place of the blob when
|
|
54
|
+
* the collection is stored as segment objects.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* `level` and the nesting it allows are carried from the first version on
|
|
58
|
+
* purpose. Struct encoding is positional, so a field appended later is another
|
|
59
|
+
* dual-decode tier on every reader in three runtimes — and a second index
|
|
60
|
+
* level is exactly what a manifest too large to hold whole would need. The
|
|
61
|
+
* byte is paid now.
|
|
62
|
+
*/
|
|
63
|
+
export const CollectionManifestType = StructType({
|
|
64
|
+
/** Always {@link COLLECTION_MANIFEST_KIND}. */
|
|
65
|
+
kind: StringType,
|
|
66
|
+
/** `0` when entries name segment blobs; `n` when they name level `n - 1`
|
|
67
|
+
* manifests. */
|
|
68
|
+
level: IntegerType,
|
|
69
|
+
/** The root collection type — the manifest is self-describing about what it
|
|
70
|
+
* holds, exactly as a blob's type section is. */
|
|
71
|
+
type: EastTypeType,
|
|
72
|
+
/** The boundary-rule id the segments were cut under (`segmentRuleFor`), so a
|
|
73
|
+
* reader knows whether they are cut the way this build cuts. */
|
|
74
|
+
rule: StringType,
|
|
75
|
+
/** Hash of the canonical header bytes every segment is written under — what
|
|
76
|
+
* makes the segments spliceable into one blob. */
|
|
77
|
+
header: StringType,
|
|
78
|
+
/** The segments, in canonical order. */
|
|
79
|
+
entries: ArrayType(CollectionManifestEntryType),
|
|
80
|
+
});
|
|
81
|
+
/** The manifest type's field names, in wire order — read from the type itself
|
|
82
|
+
* so the recognizer and the type cannot drift. */
|
|
83
|
+
const MANIFEST_FIELDS = toEastTypeValue(CollectionManifestType).value.map((f) => f.name);
|
|
84
|
+
/**
|
|
85
|
+
* Whether a decoded object's root type is a {@link CollectionManifestType}.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Matched on the **exact** field set. Arbitrary user values flow through the
|
|
89
|
+
* same dispatch — a record's state is any struct the author chose — and a
|
|
90
|
+
* name-subset match would classify one as a manifest and read its fields as
|
|
91
|
+
* object hashes. The `kind` field is checked separately, after a decode, by
|
|
92
|
+
* {@link isCollectionManifest}.
|
|
93
|
+
*
|
|
94
|
+
* @param typeValue - the object's decoded root type
|
|
95
|
+
* @returns whether the type is exactly the manifest struct
|
|
96
|
+
*/
|
|
97
|
+
export function isCollectionManifestType(typeValue) {
|
|
98
|
+
if (typeValue.type !== "Struct")
|
|
99
|
+
return false;
|
|
100
|
+
const fields = typeValue.value;
|
|
101
|
+
return fields.length === MANIFEST_FIELDS.length
|
|
102
|
+
&& fields.every((f, i) => f.name === MANIFEST_FIELDS[i]);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether a decoded value is a segment manifest — its type is the manifest
|
|
106
|
+
* struct and its `kind` is {@link COLLECTION_MANIFEST_KIND}.
|
|
107
|
+
*
|
|
108
|
+
* @param typeValue - the object's decoded root type
|
|
109
|
+
* @param value - the decoded value
|
|
110
|
+
* @returns whether the object is a manifest
|
|
111
|
+
*/
|
|
112
|
+
export function isCollectionManifest(typeValue, value) {
|
|
113
|
+
return isCollectionManifestType(typeValue)
|
|
114
|
+
&& value?.kind === COLLECTION_MANIFEST_KIND;
|
|
115
|
+
}
|
|
116
|
+
/** The manifest's codec, built on first use.
|
|
117
|
+
*
|
|
118
|
+
* Built lazily rather than at module scope because building an encoder writes
|
|
119
|
+
* a type section, and this module sits inside the beast2 import cycle — an
|
|
120
|
+
* eager build runs while a module it reaches through that cycle is still
|
|
121
|
+
* initializing, and dies on a binding that does not exist yet. Nothing else
|
|
122
|
+
* about it is lazy: the codec is built once and kept. */
|
|
123
|
+
let manifestCodec = null;
|
|
124
|
+
function codec() {
|
|
125
|
+
manifestCodec ??= {
|
|
126
|
+
encode: encodeBeast2V5For(CollectionManifestType),
|
|
127
|
+
decode: decodeBeast2V5For(CollectionManifestType),
|
|
128
|
+
};
|
|
129
|
+
return manifestCodec;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Encodes a segment manifest.
|
|
133
|
+
*
|
|
134
|
+
* @param manifest - the manifest
|
|
135
|
+
* @returns the beast2 bytes
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* The collection type is written with its recursive types renamed
|
|
139
|
+
* canonically ({@link canonicalTypeValue}): the ids a runtime gives them are
|
|
140
|
+
* its own, and a manifest's hash names the collection in a store, so one
|
|
141
|
+
* collection must have one manifest whichever runtime writes it.
|
|
142
|
+
*/
|
|
143
|
+
export function encodeCollectionManifest(manifest) {
|
|
144
|
+
return codec().encode({ ...manifest, type: canonicalTypeValue(manifest.type) });
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Decodes a segment manifest.
|
|
148
|
+
*
|
|
149
|
+
* @param data - the stored bytes
|
|
150
|
+
* @returns the manifest
|
|
151
|
+
* @throws {Error} When the bytes are not a manifest, or its `kind` is not
|
|
152
|
+
* {@link COLLECTION_MANIFEST_KIND} — a struct of the right shape carrying
|
|
153
|
+
* another tag is a different object that must not be read as segments.
|
|
154
|
+
*/
|
|
155
|
+
export function decodeCollectionManifest(data) {
|
|
156
|
+
const manifest = codec().decode(data);
|
|
157
|
+
if (manifest.kind !== COLLECTION_MANIFEST_KIND) {
|
|
158
|
+
throw new Error(`beast2 v5: unknown manifest kind '${manifest.kind}' (expected '${COLLECTION_MANIFEST_KIND}')`);
|
|
159
|
+
}
|
|
160
|
+
return manifest;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The total element (pair) count a manifest describes.
|
|
164
|
+
*
|
|
165
|
+
* @param manifest - the manifest
|
|
166
|
+
* @returns the sum of its entries' counts
|
|
167
|
+
*/
|
|
168
|
+
export function manifestElementCount(manifest) {
|
|
169
|
+
let total = 0;
|
|
170
|
+
for (const entry of manifest.entries)
|
|
171
|
+
total += Number(entry.count);
|
|
172
|
+
return total;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The total byte size of the segment objects a manifest names.
|
|
176
|
+
*
|
|
177
|
+
* @param manifest - the manifest
|
|
178
|
+
* @returns the sum of its entries' byte sizes
|
|
179
|
+
*/
|
|
180
|
+
export function manifestByteSize(manifest) {
|
|
181
|
+
let total = 0;
|
|
182
|
+
for (const entry of manifest.entries)
|
|
183
|
+
total += Number(entry.bytes);
|
|
184
|
+
return total;
|
|
185
|
+
}
|
|
186
|
+
/** The head read {@link readBeast2Manifest} probes with — a manifest's own
|
|
187
|
+
* type section is a few hundred bytes, and so is every plausible blob's. */
|
|
188
|
+
const MANIFEST_PROBE_BYTES = 64 * 1024;
|
|
189
|
+
/**
|
|
190
|
+
* The manifest a blob holds, or `null` when it holds something else.
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
193
|
+
* Costs one head read through a ranged source: a blob declares its root type up
|
|
194
|
+
* front, and a manifest is recognized by that type's exact field set, so
|
|
195
|
+
* nothing more is read for a blob that turns out to be a value.
|
|
196
|
+
*
|
|
197
|
+
* @param source - the blob, or ranged access to it
|
|
198
|
+
* @returns the decoded manifest, or `null`
|
|
199
|
+
*/
|
|
200
|
+
export function readBeast2Manifest(source) {
|
|
201
|
+
const reader = isBeast2SyncRangeReader(source) ? source : null;
|
|
202
|
+
const size = reader === null ? source.length : reader.size;
|
|
203
|
+
const head = reader === null
|
|
204
|
+
? source
|
|
205
|
+
: readExact(reader, 0, Math.min(size, MANIFEST_PROBE_BYTES));
|
|
206
|
+
if (head.length < MAGIC_BYTES_V5.length)
|
|
207
|
+
return null;
|
|
208
|
+
for (let i = 0; i < MAGIC_BYTES_V5.length; i++) {
|
|
209
|
+
if (head[i] !== MAGIC_BYTES_V5[i])
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
let typeValue;
|
|
213
|
+
try {
|
|
214
|
+
typeValue = readTypeSection(new BufferReader(head, MAGIC_BYTES_V5.length)).rootType;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
if (!isCollectionManifestType(typeValue))
|
|
220
|
+
return null;
|
|
221
|
+
const data = reader === null ? head : readExact(reader, 0, size);
|
|
222
|
+
const manifest = codec().decode(data);
|
|
223
|
+
return manifest.kind === COLLECTION_MANIFEST_KIND ? manifest : null;
|
|
224
|
+
}
|
|
225
|
+
/** Whether `source` is a {@link Beast2ManifestSource} rather than a blob or a
|
|
226
|
+
* range reader — judged by shape, since a value from another realm fails
|
|
227
|
+
* `instanceof`. */
|
|
228
|
+
export function isBeast2ManifestSource(source) {
|
|
229
|
+
const s = source;
|
|
230
|
+
return s !== null && typeof s === "object" && typeof s.segment === "function"
|
|
231
|
+
&& typeof s.manifest?.kind === "string";
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/manifest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,GAEX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAsB,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,M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,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IACtF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,MAAM,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAkCD;;oBAEoB;AACpB,MAAM,UAAU,sBAAsB,CAAC,MAAe;IACpD,MAAM,CAAC,GAAG,MAA0D,CAAC;IACrE,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU;WACxE,OAAQ,CAAC,CAAC,QAA2C,EAAE,IAAI,KAAK,QAAQ,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
* The merge of sorted collections — k canonical Set or Dict collections in, one
|
|
7
|
+
* canonical blob, or one manifest directory, out.
|
|
8
|
+
*
|
|
9
|
+
* The inputs are read segment by segment and their current keys held in a heap
|
|
10
|
+
* ordered by key and then by input, so a key that several inputs hold leaves
|
|
11
|
+
* the heap once per input, in input order, and folds there. The merged entries
|
|
12
|
+
* go out through the element writer, so the output is the canonical blob of
|
|
13
|
+
* the merged value — the bytes any writer of that value writes, whoever wrote
|
|
14
|
+
* the inputs and however their segments fell. Memory is one decoded segment per
|
|
15
|
+
* input plus one open output segment.
|
|
16
|
+
*
|
|
17
|
+
* With a key range only the keys in `[from, to)` merge: each input starts at
|
|
18
|
+
* the segment owning `from`, found through its fences, and stops at the first
|
|
19
|
+
* key at or past `to`, so merging one range of a large output reads that
|
|
20
|
+
* range's share of each input, plus at most one segment.
|
|
21
|
+
*/
|
|
22
|
+
import { type EastTypeValue } from "../../../type_of_type.js";
|
|
23
|
+
import type { EastType } from "../../../types.js";
|
|
24
|
+
import { type Beast2ElementWriterOptions } from "./stream.js";
|
|
25
|
+
import { type Beast2SyncRangeReader } from "./range.js";
|
|
26
|
+
import { type Beast2ManifestSource } from "./manifest.js";
|
|
27
|
+
import { type Beast2ManifestSink } from "./manifest-writer.js";
|
|
28
|
+
/** One input to a merge: a canonical collection blob, synchronous ranged access
|
|
29
|
+
* to one, or a manifest naming its segments. */
|
|
30
|
+
export type Beast2MergeSource = Uint8Array | Beast2SyncRangeReader | Beast2ManifestSource;
|
|
31
|
+
/** Options accepted by {@link mergeBeast2For}. */
|
|
32
|
+
export type Beast2MergeOptions = Omit<Beast2ElementWriterOptions, "headerPrefix"> & {
|
|
33
|
+
/**
|
|
34
|
+
* Dict inputs: how a key several inputs hold folds, `acc = merge(key, acc,
|
|
35
|
+
* value)`, in input order. Without it such a key is refused. Must be
|
|
36
|
+
* associative when the inputs are runs or partials of one value: their
|
|
37
|
+
* values folded in groups before they reach the merge.
|
|
38
|
+
*/
|
|
39
|
+
merge?: (key: any, acc: any, value: any) => any;
|
|
40
|
+
/** Set inputs: an element several inputs hold is kept once. Without it such
|
|
41
|
+
* an element is refused. */
|
|
42
|
+
union?: boolean;
|
|
43
|
+
/** Merge only the keys at or above this one. East values are never
|
|
44
|
+
* `undefined`, which leaves the range open below. */
|
|
45
|
+
from?: unknown;
|
|
46
|
+
/** Merge only the keys below this one; `undefined` leaves it open above. */
|
|
47
|
+
to?: unknown;
|
|
48
|
+
/** Names each input in error messages, beside its position — a path, say. */
|
|
49
|
+
labels?: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
/** What a merge came to. */
|
|
52
|
+
export type Beast2MergeStats = {
|
|
53
|
+
/** Inputs merged. */
|
|
54
|
+
inputs: number;
|
|
55
|
+
/** Entries written. */
|
|
56
|
+
entries: number;
|
|
57
|
+
/** Entries that folded into, or collapsed into, an equal key's entry. */
|
|
58
|
+
folds: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Builds a merge of sorted Set or Dict collections of one type into one
|
|
62
|
+
* canonical collection: `merge(sources, sink)`.
|
|
63
|
+
*
|
|
64
|
+
* @param type - the collection type every input holds (Set or Dict)
|
|
65
|
+
* @param options - the fold, the key range, input labels, and the output's
|
|
66
|
+
* codec, source map and parallel framing
|
|
67
|
+
* @returns a function merging its sources, in the order equal keys fold, into
|
|
68
|
+
* `sink` — the blob's bytes as they are produced, or, given a
|
|
69
|
+
* {@link Beast2ManifestSink}, a manifest directory — and returning what it
|
|
70
|
+
* came to
|
|
71
|
+
* @throws {TypeError} When `type` is not a Set or Dict type, or the fold does
|
|
72
|
+
* not fit it: a merge function folds a Dict, union a Set.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* The returned function throws, before writing anything, when no source is
|
|
76
|
+
* given or a source is not a canonical collection of `type`; while merging,
|
|
77
|
+
* when an input's keys do not ascend, a key repeats without a fold, or the
|
|
78
|
+
* merge function throws. A failed merge leaves its output without the
|
|
79
|
+
* terminator and index, or a manifest directory without its manifest, so
|
|
80
|
+
* nothing reads it as complete. Messages name the input:
|
|
81
|
+
* `merge: input 2 (<label>): …`.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const type = SetType(IntegerType);
|
|
86
|
+
* const blob = (xs: bigint[]) => encodeBeast2PagedFor(type)(new Set(xs));
|
|
87
|
+
* const chunks: Uint8Array[] = [];
|
|
88
|
+
* mergeBeast2For(type, { union: true })([blob([1n, 3n]), blob([2n, 3n])], (b) => chunks.push(b));
|
|
89
|
+
* decodeBeast2For(type)(Buffer.concat(chunks)); // Set { 1n, 2n, 3n }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function mergeBeast2For<T extends EastType>(type: T | EastTypeValue, options?: Beast2MergeOptions): (sources: readonly Beast2MergeSource[], sink: ((bytes: Uint8Array) => void) | Beast2ManifestSink) => Beast2MergeStats;
|
|
93
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/merge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAuC,MAAM,0BAA0B,CAAC;AACnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAMlD,OAAO,EAAuB,KAAK,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAGnF,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,YAAY,CAAC;AACjF,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErF;iDACiD;AACjD,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAE1F,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,0BAA0B,EAAE,cAAc,CAAC,GAAG;IAClF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAChD;iCAC6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;0DACsD;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4EAA4E;IAC5E,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,6EAA6E;IAC7E,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,4BAA4B;AAC5B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,kBAAkB,KAAK,gBAAgB,CAgI/N"}
|
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
* The merge of sorted collections — k canonical Set or Dict collections in, one
|
|
7
|
+
* canonical blob, or one manifest directory, out.
|
|
8
|
+
*
|
|
9
|
+
* The inputs are read segment by segment and their current keys held in a heap
|
|
10
|
+
* ordered by key and then by input, so a key that several inputs hold leaves
|
|
11
|
+
* the heap once per input, in input order, and folds there. The merged entries
|
|
12
|
+
* go out through the element writer, so the output is the canonical blob of
|
|
13
|
+
* the merged value — the bytes any writer of that value writes, whoever wrote
|
|
14
|
+
* the inputs and however their segments fell. Memory is one decoded segment per
|
|
15
|
+
* input plus one open output segment.
|
|
16
|
+
*
|
|
17
|
+
* With a key range only the keys in `[from, to)` merge: each input starts at
|
|
18
|
+
* the segment owning `from`, found through its fences, and stops at the first
|
|
19
|
+
* key at or past `to`, so merging one range of a large output reads that
|
|
20
|
+
* range's share of each input, plus at most one segment.
|
|
21
|
+
*/
|
|
22
|
+
import { EastTypeValueType, isTypeValueEqual } from "../../../type_of_type.js";
|
|
23
|
+
import { printFor } from "../../east.js";
|
|
24
|
+
import { compareFor } from "../../../comparison.js";
|
|
25
|
+
import { asTypeValue } from "./type-section.js";
|
|
26
|
+
import { Beast2ElementWriter } from "./stream.js";
|
|
27
|
+
import { openBeast2LazyFor } from "./lazy.js";
|
|
28
|
+
import { readBeast2Extents } from "./geometry.js";
|
|
29
|
+
import { isBeast2SyncRangeReader } from "./range.js";
|
|
30
|
+
import { isBeast2ManifestSource } from "./manifest.js";
|
|
31
|
+
import { Beast2ManifestWriter } from "./manifest-writer.js";
|
|
32
|
+
/**
|
|
33
|
+
* Builds a merge of sorted Set or Dict collections of one type into one
|
|
34
|
+
* canonical collection: `merge(sources, sink)`.
|
|
35
|
+
*
|
|
36
|
+
* @param type - the collection type every input holds (Set or Dict)
|
|
37
|
+
* @param options - the fold, the key range, input labels, and the output's
|
|
38
|
+
* codec, source map and parallel framing
|
|
39
|
+
* @returns a function merging its sources, in the order equal keys fold, into
|
|
40
|
+
* `sink` — the blob's bytes as they are produced, or, given a
|
|
41
|
+
* {@link Beast2ManifestSink}, a manifest directory — and returning what it
|
|
42
|
+
* came to
|
|
43
|
+
* @throws {TypeError} When `type` is not a Set or Dict type, or the fold does
|
|
44
|
+
* not fit it: a merge function folds a Dict, union a Set.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* The returned function throws, before writing anything, when no source is
|
|
48
|
+
* given or a source is not a canonical collection of `type`; while merging,
|
|
49
|
+
* when an input's keys do not ascend, a key repeats without a fold, or the
|
|
50
|
+
* merge function throws. A failed merge leaves its output without the
|
|
51
|
+
* terminator and index, or a manifest directory without its manifest, so
|
|
52
|
+
* nothing reads it as complete. Messages name the input:
|
|
53
|
+
* `merge: input 2 (<label>): …`.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const type = SetType(IntegerType);
|
|
58
|
+
* const blob = (xs: bigint[]) => encodeBeast2PagedFor(type)(new Set(xs));
|
|
59
|
+
* const chunks: Uint8Array[] = [];
|
|
60
|
+
* mergeBeast2For(type, { union: true })([blob([1n, 3n]), blob([2n, 3n])], (b) => chunks.push(b));
|
|
61
|
+
* decodeBeast2For(type)(Buffer.concat(chunks)); // Set { 1n, 2n, 3n }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function mergeBeast2For(type, options) {
|
|
65
|
+
const typeValue = asTypeValue(type);
|
|
66
|
+
if (typeValue.type !== "Set" && typeValue.type !== "Dict") {
|
|
67
|
+
throw new TypeError(`merge: inputs must be Set or Dict blobs, got ${typeValue.type}`);
|
|
68
|
+
}
|
|
69
|
+
const { merge, union, from, to, labels, ...writerOptions } = options ?? {};
|
|
70
|
+
if (merge !== undefined && typeValue.type !== "Dict") {
|
|
71
|
+
throw new TypeError(`beast2 v5: a merge function folds a Dict's values; a Set's equal elements collapse under union`);
|
|
72
|
+
}
|
|
73
|
+
if (union && typeValue.type !== "Set") {
|
|
74
|
+
throw new TypeError(`beast2 v5: union collapses a Set's equal elements; a Dict's values fold with a merge function`);
|
|
75
|
+
}
|
|
76
|
+
const dict = typeValue.type === "Dict";
|
|
77
|
+
const keyType = dict
|
|
78
|
+
? typeValue.value.key
|
|
79
|
+
: typeValue.value;
|
|
80
|
+
const cmp = compareFor(keyType);
|
|
81
|
+
const printKey = printFor(keyType);
|
|
82
|
+
const printType = printFor(EastTypeValueType);
|
|
83
|
+
const open = openBeast2LazyFor(typeValue, { frozen: true });
|
|
84
|
+
return (sources, sink) => {
|
|
85
|
+
if (sources.length === 0)
|
|
86
|
+
throw new Error("merge: at least one input is needed");
|
|
87
|
+
const named = (i) => (labels?.[i] !== undefined ? `merge: input ${i} (${labels[i]})` : `merge: input ${i}`);
|
|
88
|
+
const failed = (i, err) => new Error(`${named(i)}: ${err.message ?? String(err)}`);
|
|
89
|
+
// Every input is opened before anything is written, so an input that is
|
|
90
|
+
// not a collection of the type refuses the merge rather than truncating it.
|
|
91
|
+
const iterators = sources.map((source, i) => {
|
|
92
|
+
let wire;
|
|
93
|
+
try {
|
|
94
|
+
wire = isBeast2ManifestSource(source)
|
|
95
|
+
? source.manifest.type
|
|
96
|
+
: (isBeast2SyncRangeReader(source) ? readBeast2Extents(source) : readBeast2Extents(source)).typeValue;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
throw failed(i, err);
|
|
100
|
+
}
|
|
101
|
+
if (!isTypeValueEqual(wire, typeValue)) {
|
|
102
|
+
throw new Error(`${named(i)} has type ${printType(wire)}, expected ${printType(typeValue)}`);
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const lazy = open(source);
|
|
106
|
+
return dict ? lazy.entries(from) : lazy.keys(from);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
throw failed(i, err);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const heads = new Array(iterators.length).fill(null);
|
|
113
|
+
const advance = (i) => {
|
|
114
|
+
let next;
|
|
115
|
+
try {
|
|
116
|
+
next = iterators[i].next();
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
throw failed(i, err);
|
|
120
|
+
}
|
|
121
|
+
if (next.done) {
|
|
122
|
+
heads[i] = null;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const [key, value] = dict ? next.value : [next.value, undefined];
|
|
126
|
+
heads[i] = to !== undefined && cmp(key, to) >= 0 ? null : { key, value };
|
|
127
|
+
};
|
|
128
|
+
for (let i = 0; i < iterators.length; i++)
|
|
129
|
+
advance(i);
|
|
130
|
+
// A binary min-heap over the inputs' current keys, ordered by (key,
|
|
131
|
+
// input), so equal keys leave in input order.
|
|
132
|
+
const heap = [];
|
|
133
|
+
for (let i = 0; i < heads.length; i++)
|
|
134
|
+
if (heads[i] !== null)
|
|
135
|
+
heap.push(i);
|
|
136
|
+
const before = (a, b) => {
|
|
137
|
+
const order = cmp(heads[a].key, heads[b].key);
|
|
138
|
+
return order < 0 || (order === 0 && a < b);
|
|
139
|
+
};
|
|
140
|
+
const siftDown = (at) => {
|
|
141
|
+
for (;;) {
|
|
142
|
+
const l = 2 * at + 1;
|
|
143
|
+
const r = l + 1;
|
|
144
|
+
let least = at;
|
|
145
|
+
if (l < heap.length && before(heap[l], heap[least]))
|
|
146
|
+
least = l;
|
|
147
|
+
if (r < heap.length && before(heap[r], heap[least]))
|
|
148
|
+
least = r;
|
|
149
|
+
if (least === at)
|
|
150
|
+
return;
|
|
151
|
+
[heap[at], heap[least]] = [heap[least], heap[at]];
|
|
152
|
+
at = least;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
for (let i = (heap.length >> 1) - 1; i >= 0; i--)
|
|
156
|
+
siftDown(i);
|
|
157
|
+
const writer = typeof sink === "function"
|
|
158
|
+
? new Beast2ElementWriter(typeValue, sink, writerOptions)
|
|
159
|
+
: new Beast2ManifestWriter(typeValue, sink, writerOptions);
|
|
160
|
+
let entries = 0;
|
|
161
|
+
let folds = 0;
|
|
162
|
+
// The current key's entry is held until a greater key arrives, so every
|
|
163
|
+
// equal key folds into it before it is written.
|
|
164
|
+
let held = null;
|
|
165
|
+
while (heap.length > 0) {
|
|
166
|
+
const i = heap[0];
|
|
167
|
+
const { key, value } = heads[i];
|
|
168
|
+
if (held !== null && cmp(held.key, key) === 0) {
|
|
169
|
+
if (merge !== undefined) {
|
|
170
|
+
held.value = merge(key, held.value, value);
|
|
171
|
+
}
|
|
172
|
+
else if (!union) {
|
|
173
|
+
const noun = dict ? "Dict" : "Set";
|
|
174
|
+
const part = dict ? "key" : "element";
|
|
175
|
+
throw new Error(`beast2 v5: duplicate ${noun} ${part} emitted: ${printKey(key)} — ${noun} ${part}s must be unique`);
|
|
176
|
+
}
|
|
177
|
+
folds++;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
if (held !== null) {
|
|
181
|
+
writer.add(dict ? [held.key, held.value] : held.key);
|
|
182
|
+
entries++;
|
|
183
|
+
}
|
|
184
|
+
held = { key, value };
|
|
185
|
+
}
|
|
186
|
+
advance(i);
|
|
187
|
+
if (heads[i] === null) {
|
|
188
|
+
heap[0] = heap[heap.length - 1];
|
|
189
|
+
heap.pop();
|
|
190
|
+
}
|
|
191
|
+
if (heap.length > 0)
|
|
192
|
+
siftDown(0);
|
|
193
|
+
}
|
|
194
|
+
if (held !== null) {
|
|
195
|
+
writer.add(dict ? [held.key, held.value] : held.key);
|
|
196
|
+
entries++;
|
|
197
|
+
}
|
|
198
|
+
writer.finish();
|
|
199
|
+
return { inputs: iterators.length, entries, folds };
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/merge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAsB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEnG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAmC,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAA8B,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAA6B,MAAM,eAAe,CAAC;A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