@elaraai/east 1.0.84 → 1.0.86
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/analyze.d.ts.map +1 -1
- package/dist/src/analyze.js +48 -0
- package/dist/src/analyze.js.map +1 -1
- package/dist/src/ast_to_ir.coerce_to.spec.js +4 -4
- package/dist/src/ast_to_ir.coerce_to.spec.js.map +1 -1
- package/dist/src/ast_to_ir.d.ts +6 -1
- package/dist/src/ast_to_ir.d.ts.map +1 -1
- package/dist/src/ast_to_ir.js +20 -7
- package/dist/src/ast_to_ir.js.map +1 -1
- package/dist/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +52 -0
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/codegen/canonical.d.ts +37 -0
- package/dist/src/codegen/canonical.d.ts.map +1 -0
- package/dist/src/codegen/canonical.js +208 -0
- package/dist/src/codegen/canonical.js.map +1 -0
- package/dist/src/codegen/codegen.spec.js +132 -201
- package/dist/src/codegen/codegen.spec.js.map +1 -1
- package/dist/src/codegen/printer.d.ts.map +1 -1
- package/dist/src/codegen/printer.js +142 -24
- package/dist/src/codegen/printer.js.map +1 -1
- package/dist/src/codegen/spellings.d.ts +4 -1
- package/dist/src/codegen/spellings.d.ts.map +1 -1
- package/dist/src/codegen/spellings.js +5 -1
- package/dist/src/codegen/spellings.js.map +1 -1
- package/dist/src/compile/builtins/index.d.ts.map +1 -1
- package/dist/src/compile/builtins/index.js +2 -0
- package/dist/src/compile/builtins/index.js.map +1 -1
- package/dist/src/compile/builtins/primitives.d.ts.map +1 -1
- package/dist/src/compile/builtins/primitives.js +2 -1
- package/dist/src/compile/builtins/primitives.js.map +1 -1
- package/dist/src/compile/builtins/query.d.ts +10 -0
- package/dist/src/compile/builtins/query.d.ts.map +1 -0
- package/dist/src/compile/builtins/query.js +5 -0
- package/dist/src/compile/builtins/query.js.map +1 -0
- package/dist/src/expr/block.d.ts.map +1 -1
- package/dist/src/expr/block.js +2 -1
- package/dist/src/expr/block.js.map +1 -1
- package/dist/src/expr/index.d.ts +75 -47
- package/dist/src/expr/index.d.ts.map +1 -1
- package/dist/src/expr/index.js +31 -0
- package/dist/src/expr/index.js.map +1 -1
- package/dist/src/expr/libs/datetime.d.ts +20 -20
- package/dist/src/expr/libs/datetime.d.ts.map +1 -1
- package/dist/src/expr/libs/datetime.js +208 -167
- package/dist/src/expr/libs/datetime.js.map +1 -1
- package/dist/src/expr/libs/float.d.ts +15 -15
- package/dist/src/expr/libs/float.d.ts.map +1 -1
- package/dist/src/expr/libs/float.js +298 -267
- package/dist/src/expr/libs/float.js.map +1 -1
- package/dist/src/expr/libs/integer.d.ts +12 -12
- package/dist/src/expr/libs/integer.d.ts.map +1 -1
- package/dist/src/expr/libs/integer.js +219 -194
- package/dist/src/expr/libs/integer.js.map +1 -1
- package/dist/src/expr/libs/lazy.d.ts +28 -0
- package/dist/src/expr/libs/lazy.d.ts.map +1 -0
- package/dist/src/expr/libs/lazy.js +55 -0
- package/dist/src/expr/libs/lazy.js.map +1 -0
- package/dist/src/expr/libs/lazy.spec.d.ts +6 -0
- package/dist/src/expr/libs/lazy.spec.d.ts.map +1 -0
- package/dist/src/expr/libs/lazy.spec.js +102 -0
- package/dist/src/expr/libs/lazy.spec.js.map +1 -0
- package/dist/src/expr/query.d.ts +60 -0
- package/dist/src/expr/query.d.ts.map +1 -0
- package/dist/src/expr/query.js +84 -0
- package/dist/src/expr/query.js.map +1 -0
- package/dist/src/functions.crossimport.spec.js +8 -0
- package/dist/src/functions.crossimport.spec.js.map +1 -1
- package/dist/src/functions.d.ts +45 -8
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +138 -28
- package/dist/src/functions.js.map +1 -1
- package/dist/src/functions.spec.js +60 -2
- package/dist/src/functions.spec.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +4 -0
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +9 -0
- package/dist/src/internal.js.map +1 -1
- package/dist/src/location.d.ts +22 -0
- package/dist/src/location.d.ts.map +1 -1
- package/dist/src/location.js +31 -0
- package/dist/src/location.js.map +1 -1
- package/dist/src/naming.d.ts +5 -3
- package/dist/src/naming.d.ts.map +1 -1
- package/dist/src/naming.js.map +1 -1
- package/dist/src/portable.spec.d.ts +6 -0
- package/dist/src/portable.spec.d.ts.map +1 -0
- package/dist/src/portable.spec.js +181 -0
- package/dist/src/portable.spec.js.map +1 -0
- package/dist/src/query/evaluate.d.ts +98 -0
- package/dist/src/query/evaluate.d.ts.map +1 -0
- package/dist/src/query/evaluate.js +193 -0
- package/dist/src/query/evaluate.js.map +1 -0
- package/dist/src/query/index.d.ts +17 -0
- package/dist/src/query/index.d.ts.map +1 -0
- package/dist/src/query/index.js +17 -0
- package/dist/src/query/index.js.map +1 -0
- package/dist/src/query/jq/catalog.d.ts +174 -0
- package/dist/src/query/jq/catalog.d.ts.map +1 -0
- package/dist/src/query/jq/catalog.js +1740 -0
- package/dist/src/query/jq/catalog.js.map +1 -0
- package/dist/src/query/jq/check.d.ts +210 -0
- package/dist/src/query/jq/check.d.ts.map +1 -0
- package/dist/src/query/jq/check.js +2261 -0
- package/dist/src/query/jq/check.js.map +1 -0
- package/dist/src/query/jq/complete.d.ts +89 -0
- package/dist/src/query/jq/complete.d.ts.map +1 -0
- package/dist/src/query/jq/complete.js +320 -0
- package/dist/src/query/jq/complete.js.map +1 -0
- package/dist/src/query/jq/describe.d.ts +53 -0
- package/dist/src/query/jq/describe.d.ts.map +1 -0
- package/dist/src/query/jq/describe.js +149 -0
- package/dist/src/query/jq/describe.js.map +1 -0
- package/dist/src/query/jq/lex.d.ts +118 -0
- package/dist/src/query/jq/lex.d.ts.map +1 -0
- package/dist/src/query/jq/lex.js +371 -0
- package/dist/src/query/jq/lex.js.map +1 -0
- package/dist/src/query/jq/literals.d.ts +49 -0
- package/dist/src/query/jq/literals.d.ts.map +1 -0
- package/dist/src/query/jq/literals.js +78 -0
- package/dist/src/query/jq/literals.js.map +1 -0
- package/dist/src/query/jq/messages.d.ts +126 -0
- package/dist/src/query/jq/messages.d.ts.map +1 -0
- package/dist/src/query/jq/messages.js +172 -0
- package/dist/src/query/jq/messages.js.map +1 -0
- package/dist/src/query/jq/parse.d.ts +70 -0
- package/dist/src/query/jq/parse.d.ts.map +1 -0
- package/dist/src/query/jq/parse.js +1013 -0
- package/dist/src/query/jq/parse.js.map +1 -0
- package/dist/src/query/jq/print.d.ts +59 -0
- package/dist/src/query/jq/print.d.ts.map +1 -0
- package/dist/src/query/jq/print.js +587 -0
- package/dist/src/query/jq/print.js.map +1 -0
- package/dist/src/query/jq/shapes.d.ts +345 -0
- package/dist/src/query/jq/shapes.d.ts.map +1 -0
- package/dist/src/query/jq/shapes.js +584 -0
- package/dist/src/query/jq/shapes.js.map +1 -0
- package/dist/src/query/jq/spans.d.ts +133 -0
- package/dist/src/query/jq/spans.d.ts.map +1 -0
- package/dist/src/query/jq/spans.js +195 -0
- package/dist/src/query/jq/spans.js.map +1 -0
- package/dist/src/query/jq/split.d.ts +334 -0
- package/dist/src/query/jq/split.d.ts.map +1 -0
- package/dist/src/query/jq/split.js +2108 -0
- package/dist/src/query/jq/split.js.map +1 -0
- package/dist/src/query/jq/strftime.d.ts +20 -0
- package/dist/src/query/jq/strftime.d.ts.map +1 -0
- package/dist/src/query/jq/strftime.js +65 -0
- package/dist/src/query/jq/strftime.js.map +1 -0
- package/dist/src/query/jq/summary.d.ts +139 -0
- package/dist/src/query/jq/summary.d.ts.map +1 -0
- package/dist/src/query/jq/summary.js +222 -0
- package/dist/src/query/jq/summary.js.map +1 -0
- package/dist/src/query/jq/translate-builtins.d.ts +21 -0
- package/dist/src/query/jq/translate-builtins.d.ts.map +1 -0
- package/dist/src/query/jq/translate-builtins.js +1873 -0
- package/dist/src/query/jq/translate-builtins.js.map +1 -0
- package/dist/src/query/jq/translate.d.ts +627 -0
- package/dist/src/query/jq/translate.d.ts.map +1 -0
- package/dist/src/query/jq/translate.js +3364 -0
- package/dist/src/query/jq/translate.js.map +1 -0
- package/dist/src/query/types.d.ts +505 -0
- package/dist/src/query/types.d.ts.map +1 -0
- package/dist/src/query/types.js +231 -0
- package/dist/src/query/types.js.map +1 -0
- package/dist/src/runner_exec.d.ts +134 -0
- package/dist/src/runner_exec.d.ts.map +1 -0
- package/dist/src/runner_exec.js +371 -0
- package/dist/src/runner_exec.js.map +1 -0
- package/dist/src/runner_exec.spec.d.ts +6 -0
- package/dist/src/runner_exec.spec.d.ts.map +1 -0
- package/dist/src/runner_exec.spec.js +198 -0
- package/dist/src/runner_exec.spec.js.map +1 -0
- package/dist/src/runner_io.d.ts +370 -0
- package/dist/src/runner_io.d.ts.map +1 -0
- package/dist/src/runner_io.js +563 -0
- package/dist/src/runner_io.js.map +1 -0
- package/dist/src/runner_io.spec.d.ts +6 -0
- package/dist/src/runner_io.spec.d.ts.map +1 -0
- package/dist/src/runner_io.spec.js +224 -0
- package/dist/src/runner_io.spec.js.map +1 -0
- package/dist/src/runner_merge.d.ts +95 -0
- package/dist/src/runner_merge.d.ts.map +1 -0
- package/dist/src/runner_merge.js +238 -0
- package/dist/src/runner_merge.js.map +1 -0
- package/dist/src/runner_protocol.d.ts +11 -4
- package/dist/src/runner_protocol.d.ts.map +1 -1
- package/dist/src/runner_protocol.js +11 -4
- package/dist/src/runner_protocol.js.map +1 -1
- package/dist/src/serialization/beast2/index.d.ts +1 -1
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.d.ts +10 -6
- package/dist/src/serialization/beast2/v5/frames.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.js +10 -6
- package/dist/src/serialization/beast2/v5/frames.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/frames.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/frames.spec.js +42 -0
- package/dist/src/serialization/beast2/v5/frames.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/index.spec.js +108 -0
- package/dist/src/serialization/beast2/v5/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +12 -7
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.js +16 -6
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.spec.js +159 -18
- package/dist/src/serialization/beast2/v5/lazy.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.d.ts +110 -21
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +153 -42
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/beast2/v5/weight.d.ts +36 -0
- package/dist/src/serialization/beast2/v5/weight.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/weight.js +238 -0
- package/dist/src/serialization/beast2/v5/weight.js.map +1 -0
- package/dist/src/serialization/crc32.d.ts +38 -0
- package/dist/src/serialization/crc32.d.ts.map +1 -0
- package/dist/src/serialization/crc32.js +70 -0
- package/dist/src/serialization/crc32.js.map +1 -0
- package/dist/src/serialization/crc32.spec.d.ts +6 -0
- package/dist/src/serialization/crc32.spec.d.ts.map +1 -0
- package/dist/src/serialization/crc32.spec.js +92 -0
- package/dist/src/serialization/crc32.spec.js.map +1 -0
- package/dist/src/serialization/east-inferred.spec.js +4 -0
- package/dist/src/serialization/east-inferred.spec.js.map +1 -1
- package/dist/src/serialization/east.d.ts.map +1 -1
- package/dist/src/serialization/east.js +134 -110
- package/dist/src/serialization/east.js.map +1 -1
- package/dist/src/serialization/east.spec.js +185 -4
- package/dist/src/serialization/east.spec.js.map +1 -1
- package/dist/src/serialization/east_text.d.ts +25 -0
- package/dist/src/serialization/east_text.d.ts.map +1 -0
- package/dist/src/serialization/east_text.js +29 -0
- package/dist/src/serialization/east_text.js.map +1 -0
- package/dist/src/serialization/index.d.ts +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +7 -6
- package/dist/src/types.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
* What a unit's work reads and writes through: the in-memory `UnitIO` a
|
|
7
|
+
* browser runs units over, the paths a unit names resolved as east-c's
|
|
8
|
+
* `east_unit_read` resolves them, and the readers of a unit's program and
|
|
9
|
+
* inputs.
|
|
10
|
+
*/
|
|
11
|
+
import { describe, it } from "node:test";
|
|
12
|
+
import assert from "node:assert/strict";
|
|
13
|
+
import { AsyncEastIR, EastIR, InMemoryUnitIO, UnitType, DictType, IntegerType, StringType, IRType, East, SortedMap, beast2LazyStats, compareFor, encodeBeast2For, encodeBeast2PagedFor, encodeEastIR, encodeEastFor, encodeJSONFor, equalFor, isFrozenValue, none, printFor, some, toEastTypeValue, variant, Beast2ManifestWriter, decodeCollectionManifest, } from "./index.js";
|
|
14
|
+
import { lazyInputBytesRead, loadUnitInput, loadUnitProgram, openUnitInputLazy, openUnitInputs, resolveUnitPaths, unitFileFormat, unitInputBytes, } from "./internal.js";
|
|
15
|
+
const bytes = (...values) => new Uint8Array(values);
|
|
16
|
+
describe("InMemoryUnitIO", () => {
|
|
17
|
+
it("reads what it holds, whole, by size and by range, a range fewer bytes only where the file ends", () => {
|
|
18
|
+
const io = new InMemoryUnitIO([["dir/a.beast2", bytes(1, 2, 3, 4, 5)]]);
|
|
19
|
+
assert.deepEqual(io.read("dir/a.beast2"), bytes(1, 2, 3, 4, 5));
|
|
20
|
+
assert.equal(io.size("dir/a.beast2"), 5);
|
|
21
|
+
assert.deepEqual(io.readRange("dir/a.beast2", 1, 3), bytes(2, 3, 4));
|
|
22
|
+
assert.deepEqual(io.readRange("dir/a.beast2", 3, 10), bytes(4, 5));
|
|
23
|
+
assert.throws(() => io.read("dir/b.beast2"), { message: "no such file: dir/b.beast2" });
|
|
24
|
+
assert.throws(() => io.size("dir"), { message: "no such file: dir" }, "a directory has no size");
|
|
25
|
+
});
|
|
26
|
+
it("holds one file by one path, however the unit writes it", () => {
|
|
27
|
+
const io = new InMemoryUnitIO([["./a/../b//c.beast2", bytes(7)], ["/abs/d.beast2", bytes(8)]]);
|
|
28
|
+
assert.deepEqual([...io.files.keys()], ["b/c.beast2", "/abs/d.beast2"]);
|
|
29
|
+
assert.deepEqual(io.read("b/./c.beast2"), bytes(7));
|
|
30
|
+
assert.deepEqual(io.read("/abs/../abs/d.beast2"), bytes(8));
|
|
31
|
+
assert.deepEqual(io.list("."), ["b"], "the relative root lists relative paths");
|
|
32
|
+
assert.deepEqual(io.list("/"), ["abs"]);
|
|
33
|
+
});
|
|
34
|
+
it("writes into a directory that is there, and keeps its own copy of the bytes", () => {
|
|
35
|
+
const io = new InMemoryUnitIO([["unit.beast2", bytes(0)]]);
|
|
36
|
+
const out = bytes(1, 2);
|
|
37
|
+
io.write("out.beast2", out);
|
|
38
|
+
out[0] = 9;
|
|
39
|
+
assert.deepEqual(io.read("out.beast2"), bytes(1, 2), "a write copies what it is given");
|
|
40
|
+
io.write("out.beast2", bytes(3));
|
|
41
|
+
assert.deepEqual(io.read("out.beast2"), bytes(3), "a write replaces the file");
|
|
42
|
+
assert.throws(() => io.write("runs/0.beast2", bytes(1)), { message: "no such directory: runs" });
|
|
43
|
+
io.makeDirectory("runs/0.beast2.segments");
|
|
44
|
+
io.write("runs/0.beast2.segments/h.beast2", bytes(4));
|
|
45
|
+
assert.deepEqual(io.list("runs"), ["0.beast2.segments"], "a directory made with its parents");
|
|
46
|
+
assert.deepEqual(io.list("runs/0.beast2.segments"), ["h.beast2"]);
|
|
47
|
+
assert.throws(() => io.write("runs", bytes(1)), { message: "is a directory: runs" });
|
|
48
|
+
});
|
|
49
|
+
it("lists what a directory holds, files and directories, and refuses a file or nothing", () => {
|
|
50
|
+
const io = new InMemoryUnitIO([["in.beast2", bytes(1)], ["in.beast2.segments/x.beast2", bytes(2)]]);
|
|
51
|
+
io.makeDirectory("out");
|
|
52
|
+
assert.deepEqual(io.list(""), ["in.beast2", "in.beast2.segments", "out"]);
|
|
53
|
+
assert.deepEqual(io.list("out"), [], "a directory made and still empty");
|
|
54
|
+
io.makeDirectory("out");
|
|
55
|
+
assert.throws(() => io.list("in.beast2"), { message: "not a directory: in.beast2" });
|
|
56
|
+
assert.throws(() => io.list("missing"), { message: "no such directory: missing" });
|
|
57
|
+
assert.throws(() => io.makeDirectory("in.beast2/sub"), { message: "not a directory: in.beast2" });
|
|
58
|
+
});
|
|
59
|
+
it("never asks a host for a segment: every file it reads is held, and one not held is absent", () => {
|
|
60
|
+
const io = new InMemoryUnitIO([["in.beast2.segments/x.beast2", bytes(1)]]);
|
|
61
|
+
io.segment("in.beast2.segments/x.beast2", true);
|
|
62
|
+
io.segment("in.beast2.segments/y.beast2", true);
|
|
63
|
+
assert.deepEqual([...io.files.keys()], ["in.beast2.segments/x.beast2"], "asking wrote nothing");
|
|
64
|
+
assert.throws(() => io.read("in.beast2.segments/y.beast2"), { message: "no such file: in.beast2.segments/y.beast2" });
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe("resolveUnitPaths", () => {
|
|
68
|
+
const at = (path) => `/staged/${path}`;
|
|
69
|
+
const given = { platforms: ["@elaraai/east-node-std"], threads: 4n, fetch: true, result: "result.beast2" };
|
|
70
|
+
const resolved = { ...given, result: "/staged/result.beast2" };
|
|
71
|
+
const cases = [
|
|
72
|
+
["a run unit's program, inputs and dict output with its merge", {
|
|
73
|
+
...given,
|
|
74
|
+
work: variant("run", { program: "p.beast2", inputs: ["a.beast2", "b.beast2"], output: variant("dict", { dir: "out", merge: some("sum.beast2") }), decode: variant("whole", null) }),
|
|
75
|
+
}, {
|
|
76
|
+
...resolved,
|
|
77
|
+
work: variant("run", { program: "/staged/p.beast2", inputs: ["/staged/a.beast2", "/staged/b.beast2"], output: variant("dict", { dir: "/staged/out", merge: some("/staged/sum.beast2") }), decode: variant("whole", null) }),
|
|
78
|
+
}],
|
|
79
|
+
["a merge unit's parts, range and fold", {
|
|
80
|
+
...given,
|
|
81
|
+
work: variant("merge", { parts: ["p0.beast2"], range: some("range.beast2"), output: variant("fold", { path: "t.beast2", zero: "z.beast2", combine: "c.beast2" }) }),
|
|
82
|
+
}, {
|
|
83
|
+
...resolved,
|
|
84
|
+
work: variant("merge", { parts: ["/staged/p0.beast2"], range: some("/staged/range.beast2"), output: variant("fold", { path: "/staged/t.beast2", zero: "/staged/z.beast2", combine: "/staged/c.beast2" }) }),
|
|
85
|
+
}],
|
|
86
|
+
["an intake unit's delivery, type and output, its piece kept", {
|
|
87
|
+
...given,
|
|
88
|
+
work: variant("intake", { input: "d.beast2", type: "type.beast2", segments: some({ from: 1n, to: 3n }), output: "o.beast2" }),
|
|
89
|
+
}, {
|
|
90
|
+
...resolved,
|
|
91
|
+
work: variant("intake", { input: "/staged/d.beast2", type: "/staged/type.beast2", segments: some({ from: 1n, to: 3n }), output: "/staged/o.beast2" }),
|
|
92
|
+
}],
|
|
93
|
+
["a dict output with no merge, and no range", {
|
|
94
|
+
...given,
|
|
95
|
+
work: variant("merge", { parts: [], range: none, output: variant("dict", { dir: "runs", merge: none }) }),
|
|
96
|
+
}, {
|
|
97
|
+
...resolved,
|
|
98
|
+
work: variant("merge", { parts: [], range: none, output: variant("dict", { dir: "/staged/runs", merge: none }) }),
|
|
99
|
+
}],
|
|
100
|
+
...["value", "array", "set"].map((kind) => [`${kind === "array" ? "an" : "a"} ${kind} output`, {
|
|
101
|
+
...given,
|
|
102
|
+
work: variant("run", { program: "p.beast2", inputs: [], output: variant(kind, "o"), decode: variant("lazy", null) }),
|
|
103
|
+
}, {
|
|
104
|
+
...resolved,
|
|
105
|
+
work: variant("run", { program: "/staged/p.beast2", inputs: [], output: variant(kind, "/staged/o"), decode: variant("lazy", null) }),
|
|
106
|
+
}]),
|
|
107
|
+
];
|
|
108
|
+
const equalUnit = equalFor(UnitType);
|
|
109
|
+
const printUnit = printFor(UnitType);
|
|
110
|
+
for (const [name, unit, expected] of cases) {
|
|
111
|
+
it(`resolves ${name}`, () => {
|
|
112
|
+
const got = resolveUnitPaths(unit, at);
|
|
113
|
+
assert.ok(equalUnit(got, expected), `resolved to ${printUnit(got)}`);
|
|
114
|
+
// What it resolves to is a unit, as its encoding says.
|
|
115
|
+
assert.deepEqual(encodeBeast2For(UnitType)(got), encodeBeast2For(UnitType)(expected));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
describe("reading a unit's program and inputs", () => {
|
|
120
|
+
const DT = DictType(IntegerType, StringType);
|
|
121
|
+
const rows = (n) => new SortedMap(Array.from({ length: n }, (_, i) => [BigInt(i), `row-${i}`]), compareFor(IntegerType));
|
|
122
|
+
/** A Dict staged as e3 stages one: its manifest, and every object it names
|
|
123
|
+
* beside it. */
|
|
124
|
+
function staged(value) {
|
|
125
|
+
const files = new Map();
|
|
126
|
+
const writer = new Beast2ManifestWriter(DT, {
|
|
127
|
+
object: (hash, blob) => { files.set(`table.beast2.segments/${hash}.beast2`, blob.slice()); },
|
|
128
|
+
manifest: (blob) => { files.set("table.beast2", blob.slice()); },
|
|
129
|
+
});
|
|
130
|
+
for (const entry of value)
|
|
131
|
+
writer.add(entry);
|
|
132
|
+
writer.finish();
|
|
133
|
+
return files;
|
|
134
|
+
}
|
|
135
|
+
it("tells a file's encoding by its extension, and names one it cannot read", () => {
|
|
136
|
+
assert.equal(unitFileFormat("x.beast2"), "beast2");
|
|
137
|
+
assert.equal(unitFileFormat("dir.d/X.BEAST"), "beast2");
|
|
138
|
+
assert.equal(unitFileFormat("x.east"), "east");
|
|
139
|
+
assert.equal(unitFileFormat("x.json"), "json");
|
|
140
|
+
assert.throws(() => unitFileFormat("x.csv"), { message: 'Unsupported file extension ".csv". Supported extensions: .beast2, .beast, .east, .json' });
|
|
141
|
+
assert.throws(() => unitFileFormat(".beast2"), { message: 'Unsupported file extension "". Supported extensions: .beast2, .beast, .east, .json' });
|
|
142
|
+
});
|
|
143
|
+
it("loads a program in every encoding a unit may name it in, sync or async, and refuses IR that is no function", () => {
|
|
144
|
+
const sync = East.function([IntegerType], IntegerType, ($, x) => x.add(1n)).toIR();
|
|
145
|
+
const constant = variant("Value", { type: variant("Integer", null), loc_id: 0n, value: variant("Integer", 1n) });
|
|
146
|
+
const io = new InMemoryUnitIO([
|
|
147
|
+
["sync.beast2", encodeEastIR(sync)],
|
|
148
|
+
["async.beast2", encodeEastIR(East.asyncFunction([IntegerType], IntegerType, ($, x) => x.add(2n)).toIR())],
|
|
149
|
+
["sync.json", encodeJSONFor(IRType)(sync.ir)],
|
|
150
|
+
["sync.east", encodeEastFor(IRType)(sync.ir)],
|
|
151
|
+
["constant.beast2", encodeBeast2For(IRType)(constant)],
|
|
152
|
+
["constant.json", encodeJSONFor(IRType)(constant)],
|
|
153
|
+
]);
|
|
154
|
+
for (const path of ["sync.beast2", "sync.json", "sync.east"]) {
|
|
155
|
+
const program = loadUnitProgram(io, path);
|
|
156
|
+
assert.ok(program instanceof EastIR, path);
|
|
157
|
+
assert.equal(program.compile([])(1n), 2n, path);
|
|
158
|
+
}
|
|
159
|
+
assert.ok(loadUnitProgram(io, "async.beast2") instanceof AsyncEastIR);
|
|
160
|
+
for (const path of ["constant.beast2", "constant.json"]) {
|
|
161
|
+
assert.throws(() => loadUnitProgram(io, path), { message: 'IR file must contain a function or async function, got "Value"' }, path);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
it("opens a staged manifest lazily, frozen, reading only the segments a read reaches", () => {
|
|
165
|
+
const table = rows(20_000);
|
|
166
|
+
const io = new InMemoryUnitIO(staged(table));
|
|
167
|
+
const segments = decodeCollectionManifest(io.read("table.beast2")).entries.length;
|
|
168
|
+
assert.ok(segments > 2, `several segments, got ${segments}`);
|
|
169
|
+
const lazy = openUnitInputLazy(io, "table.beast2", { fetch: false });
|
|
170
|
+
assert.ok(isFrozenValue(lazy), "an input opens frozen");
|
|
171
|
+
assert.equal(lazy.size, 20_000, "the size is the manifest's");
|
|
172
|
+
const before = lazyInputBytesRead(lazy);
|
|
173
|
+
assert.equal(lazy.get(12345n), "row-12345");
|
|
174
|
+
assert.ok(lazyInputBytesRead(lazy) > before, "the read reached a segment");
|
|
175
|
+
const stats = beast2LazyStats(lazy);
|
|
176
|
+
assert.deepEqual([stats.segmentsDecoded, stats.hydrated], [1, false], "one segment decoded, and the input not read whole");
|
|
177
|
+
assert.ok(equalFor(DT)(lazy, table), "it is the collection the manifest names");
|
|
178
|
+
});
|
|
179
|
+
it("decodes a staged manifest whole to the collection it names, and weighs it by that collection", () => {
|
|
180
|
+
const table = rows(5_000);
|
|
181
|
+
const files = staged(table);
|
|
182
|
+
const io = new InMemoryUnitIO(files);
|
|
183
|
+
const whole = loadUnitInput(io, "table.beast2", toEastTypeValue(DT), false);
|
|
184
|
+
assert.ok(equalFor(DT)(whole, table));
|
|
185
|
+
const manifest = decodeCollectionManifest(files.get("table.beast2"));
|
|
186
|
+
const segmentBytes = manifest.entries.reduce((sum, entry) => sum + files.get(`table.beast2.segments/${entry.hash}.beast2`).length, 0);
|
|
187
|
+
assert.equal(unitInputBytes(io, "table.beast2"), files.get("table.beast2").length + segmentBytes, "the manifest and every segment it names");
|
|
188
|
+
const blob = new InMemoryUnitIO([["blob.beast2", encodeBeast2PagedFor(DT)(table)]]);
|
|
189
|
+
assert.equal(unitInputBytes(blob, "blob.beast2"), blob.size("blob.beast2"), "a blob is its own file");
|
|
190
|
+
});
|
|
191
|
+
it("refuses a lazy open over a segment not held, and its whole decode fails naming the segment", () => {
|
|
192
|
+
const files = staged(rows(5_000));
|
|
193
|
+
const gone = `table.beast2.segments/${decodeCollectionManifest(files.get("table.beast2")).entries[0].hash}.beast2`;
|
|
194
|
+
files.delete(gone);
|
|
195
|
+
const io = new InMemoryUnitIO(files);
|
|
196
|
+
assert.equal(openUnitInputLazy(io, "table.beast2", { fetch: false }), undefined);
|
|
197
|
+
assert.throws(() => loadUnitInput(io, "table.beast2", toEastTypeValue(DT), false), { message: `no such file: ${gone}` });
|
|
198
|
+
});
|
|
199
|
+
it("opens each input as the unit's decode says, and says how each opened", () => {
|
|
200
|
+
const table = rows(2_000);
|
|
201
|
+
const io = new InMemoryUnitIO([...staged(table), ["x.beast2", encodeBeast2For(IntegerType)(7n)]]);
|
|
202
|
+
const heard = [];
|
|
203
|
+
const report = {
|
|
204
|
+
openedLazily: (i) => { heard.push(`${i} lazily`); },
|
|
205
|
+
decodedWhole: (i, grown) => { heard.push(`${i} whole +${grown}`); },
|
|
206
|
+
};
|
|
207
|
+
let gauge = 100;
|
|
208
|
+
const resident = () => (gauge += 50);
|
|
209
|
+
const paths = ["table.beast2", "x.beast2"];
|
|
210
|
+
const types = [toEastTypeValue(DT), toEastTypeValue(IntegerType)];
|
|
211
|
+
const lazy = openUnitInputs(io, paths, types, variant("lazy", null), { fetch: false, resident, report });
|
|
212
|
+
assert.deepEqual(heard, ["0 lazily", "1 whole +50"], "a collection opens lazily, and a value is decoded whole, weighed by the gauge");
|
|
213
|
+
assert.notEqual(lazyInputBytesRead(lazy[0]), undefined);
|
|
214
|
+
assert.equal(lazy[1], 7n);
|
|
215
|
+
heard.length = 0;
|
|
216
|
+
const whole = openUnitInputs(io, paths, types, variant("whole", null), { fetch: false, report });
|
|
217
|
+
assert.deepEqual(heard, ["0 whole +0", "1 whole +0"], "whole decodes every input, and without a gauge weighs nothing");
|
|
218
|
+
assert.equal(lazyInputBytesRead(whole[0]), undefined);
|
|
219
|
+
assert.ok(equalFor(DT)(whole[0], table));
|
|
220
|
+
assert.ok(isFrozenValue(whole[0]), "an input decoded whole is frozen too");
|
|
221
|
+
assert.throws(() => whole[0].set(1n, "x"), { message: "Cannot modify frozen SortedMap" });
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
//# sourceMappingURL=runner_io.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner_io.spec.js","sourceRoot":"","sources":["../../src/runner_io.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAC7C,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EACzC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAC/H,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EACvE,oBAAoB,EAAE,wBAAwB,GAE/C,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,GACxI,MAAM,eAAe,CAAC;AAEvB,MAAM,KAAK,GAAG,CAAC,GAAG,MAAgB,EAAc,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAE1E,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,gGAAgG,EAAE,GAAG,EAAE;QACxG,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,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AM,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,sCAAsC,CAAC,CAAC;QAC3E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAE,KAAK,CAAC,CAAC,CAA+B,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC,CAAC;IAC3H,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 a merge unit's parts (issue #770), over a {@link UnitIO}.
|
|
7
|
+
*
|
|
8
|
+
* Canonical Set or Dict collections of one type in — sorted, indexed beast2 v5
|
|
9
|
+
* blobs, or manifest directories, as a unit's parts are staged — and one
|
|
10
|
+
* canonical collection out, merged by `mergeBeast2For`: every part is read
|
|
11
|
+
* segment by segment through ranged reads, and the output is written through
|
|
12
|
+
* the canonical element writer, so it is byte-identical to what that writer
|
|
13
|
+
* writes for the merged value. Memory is one decoded segment per part plus one
|
|
14
|
+
* open output segment. This module opens and checks the parts, reads the key
|
|
15
|
+
* range and loads the fold, refusing each in the words east-c and east-py use.
|
|
16
|
+
*
|
|
17
|
+
* Equal keys across parts fold in part order: with a merge function (Dict
|
|
18
|
+
* parts) `acc = merge(key, acc, value)`; in union mode (Set parts) the first
|
|
19
|
+
* element stands. Without a fold, an equal key is the library's duplicate
|
|
20
|
+
* error. A part whose keys do not ascend, a part whose type is not part 0's,
|
|
21
|
+
* and an Array part are refused.
|
|
22
|
+
*
|
|
23
|
+
* With a key range (a blob of `Struct{from: Option<K>, to: Option<K>}` over
|
|
24
|
+
* the parts' key type) only the keys in `[from, to)` merge: every part is
|
|
25
|
+
* sought to the segment owning `from` through its fences and read up to the
|
|
26
|
+
* first key at or past `to`, so a unit over a range of a large output reads
|
|
27
|
+
* that range's share of each part, plus at most one segment. An absent bound
|
|
28
|
+
* is open; both absent is the whole merge.
|
|
29
|
+
*
|
|
30
|
+
* This is the fan-in of a split task's set and dict parts: e3 runs it as a
|
|
31
|
+
* merge unit on the task's runner, one per key range of a group of parts, and
|
|
32
|
+
* never decodes a part itself. east-c and east-py merge through the same
|
|
33
|
+
* contract, so the three runners write the same bytes.
|
|
34
|
+
*/
|
|
35
|
+
import { type EastTypeValue } from "./type_of_type.js";
|
|
36
|
+
import type { PlatformFunction } from "./platform.js";
|
|
37
|
+
import { type Beast2ManifestSink, type Beast2MergeStats } from "./serialization/beast2/index.js";
|
|
38
|
+
import { type UnitIO } from "./runner_io.js";
|
|
39
|
+
/** A compiled `(K, V, V) -> V` fold of equal keys. */
|
|
40
|
+
export type UnitMergeFunction = (key: unknown, acc: unknown, value: unknown) => unknown;
|
|
41
|
+
/**
|
|
42
|
+
* Loads a merge function: an IR file holding a `(K, V, V) -> V` East function
|
|
43
|
+
* over the given key and value types, compiled with the unit's platforms.
|
|
44
|
+
* Shared by a run unit's dict output and the merge of parts.
|
|
45
|
+
*
|
|
46
|
+
* @param io - the unit's files
|
|
47
|
+
* @param path - the IR file, in any encoding a unit may name
|
|
48
|
+
* @param keyType - the key type
|
|
49
|
+
* @param valueType - the value type
|
|
50
|
+
* @param platforms - the unit's platform functions
|
|
51
|
+
* @param subject - what the function must match, for the message: `the emit
|
|
52
|
+
* parameter` or `the inputs`
|
|
53
|
+
* @returns the compiled merge function
|
|
54
|
+
* @throws {Error} When the IR is not a function of that shape, naming the
|
|
55
|
+
* expected and the actual types.
|
|
56
|
+
*/
|
|
57
|
+
export declare function loadUnitMergeFunction(io: UnitIO, path: string, keyType: EastTypeValue, valueType: EastTypeValue, platforms: PlatformFunction[], subject: string): UnitMergeFunction;
|
|
58
|
+
/** Options accepted by {@link mergeUnitParts}. */
|
|
59
|
+
export interface UnitMergeOptions {
|
|
60
|
+
/** Dict parts: an IR file holding a `(K, V, V) -> V` East function over the
|
|
61
|
+
* parts' key and value types, compiled with `platforms`. Equal keys fold
|
|
62
|
+
* with it in part order. */
|
|
63
|
+
merge?: string;
|
|
64
|
+
/** Set parts: the first of equal elements stands. */
|
|
65
|
+
union?: boolean;
|
|
66
|
+
/** A beast2 blob of `Struct{from: Option<K>, to: Option<K>}` over the
|
|
67
|
+
* parts' key type: only the keys in `[from, to)` merge; an absent bound is
|
|
68
|
+
* open. */
|
|
69
|
+
range?: string;
|
|
70
|
+
/** The platform functions the merge function compiles with. */
|
|
71
|
+
platforms?: PlatformFunction[];
|
|
72
|
+
/** Whether the unit's host places a manifest part's segments as they are
|
|
73
|
+
* read: the unit's `fetch`. */
|
|
74
|
+
fetch?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Merges a merge unit's sorted Set or Dict parts of one type into one
|
|
78
|
+
* canonical collection.
|
|
79
|
+
*
|
|
80
|
+
* @param io - the unit's files
|
|
81
|
+
* @param parts - the parts, in the order equal keys fold; at least one
|
|
82
|
+
* @param output - the sink a manifest directory is written through, or the
|
|
83
|
+
* blob's bytes as they are produced
|
|
84
|
+
* @param options - the fold, its platforms, the key range, and the unit's
|
|
85
|
+
* `fetch`
|
|
86
|
+
* @returns the account: parts merged, entries written, keys folded
|
|
87
|
+
* @throws {Error} With the merge's message — a part of another type than part
|
|
88
|
+
* 0's, an Array part, keys that do not ascend, a fold whose signature does
|
|
89
|
+
* not match the parts, a range blob of another shape than the bounds over
|
|
90
|
+
* the parts' key type, a file that cannot be read, a shared key without a
|
|
91
|
+
* fold — leaving the output unfinalised (no terminator or index, or no
|
|
92
|
+
* manifest). Nothing is written before every part has opened.
|
|
93
|
+
*/
|
|
94
|
+
export declare function mergeUnitParts(io: UnitIO, parts: readonly string[], output: Beast2ManifestSink | ((bytes: Uint8Array) => void), options?: UnitMergeOptions): Beast2MergeStats;
|
|
95
|
+
//#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,EACxB,MAAM,EAAE,kBAAkB,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC,EAC1D,OAAO,GAAE,gBAAqB,GAC7B,gBAAgB,CA4BlB"}
|
|
@@ -0,0 +1,238 @@
|
|
|
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 a merge unit's parts (issue #770), over a {@link UnitIO}.
|
|
7
|
+
*
|
|
8
|
+
* Canonical Set or Dict collections of one type in — sorted, indexed beast2 v5
|
|
9
|
+
* blobs, or manifest directories, as a unit's parts are staged — and one
|
|
10
|
+
* canonical collection out, merged by `mergeBeast2For`: every part is read
|
|
11
|
+
* segment by segment through ranged reads, and the output is written through
|
|
12
|
+
* the canonical element writer, so it is byte-identical to what that writer
|
|
13
|
+
* writes for the merged value. Memory is one decoded segment per part plus one
|
|
14
|
+
* open output segment. This module opens and checks the parts, reads the key
|
|
15
|
+
* range and loads the fold, refusing each in the words east-c and east-py use.
|
|
16
|
+
*
|
|
17
|
+
* Equal keys across parts fold in part order: with a merge function (Dict
|
|
18
|
+
* parts) `acc = merge(key, acc, value)`; in union mode (Set parts) the first
|
|
19
|
+
* element stands. Without a fold, an equal key is the library's duplicate
|
|
20
|
+
* error. A part whose keys do not ascend, a part whose type is not part 0's,
|
|
21
|
+
* and an Array part are refused.
|
|
22
|
+
*
|
|
23
|
+
* With a key range (a blob of `Struct{from: Option<K>, to: Option<K>}` over
|
|
24
|
+
* the parts' key type) only the keys in `[from, to)` merge: every part is
|
|
25
|
+
* sought to the segment owning `from` through its fences and read up to the
|
|
26
|
+
* first key at or past `to`, so a unit over a range of a large output reads
|
|
27
|
+
* that range's share of each part, plus at most one segment. An absent bound
|
|
28
|
+
* is open; both absent is the whole merge.
|
|
29
|
+
*
|
|
30
|
+
* This is the fan-in of a split task's set and dict parts: e3 runs it as a
|
|
31
|
+
* merge unit on the task's runner, one per key range of a group of parts, and
|
|
32
|
+
* never decodes a part itself. east-c and east-py merge through the same
|
|
33
|
+
* contract, so the three runners write the same bytes.
|
|
34
|
+
*/
|
|
35
|
+
import { fromEastTypeValue, isTypeValueEqual, toEastTypeValue } from "./type_of_type.js";
|
|
36
|
+
import { OptionType, StructType } from "./types.js";
|
|
37
|
+
import { printTypeValue } from "./compile/runtime.js";
|
|
38
|
+
import { decodeBeast2For, mergeBeast2For, readBeast2Extents, readBeast2HeaderType, readBeast2Manifest, readBeast2Type, } from "./serialization/beast2/index.js";
|
|
39
|
+
import { loadUnitProgram, readUnitRange, segmentPath } from "./runner_io.js";
|
|
40
|
+
/**
|
|
41
|
+
* Loads a merge function: an IR file holding a `(K, V, V) -> V` East function
|
|
42
|
+
* over the given key and value types, compiled with the unit's platforms.
|
|
43
|
+
* Shared by a run unit's dict output and the merge of parts.
|
|
44
|
+
*
|
|
45
|
+
* @param io - the unit's files
|
|
46
|
+
* @param path - the IR file, in any encoding a unit may name
|
|
47
|
+
* @param keyType - the key type
|
|
48
|
+
* @param valueType - the value type
|
|
49
|
+
* @param platforms - the unit's platform functions
|
|
50
|
+
* @param subject - what the function must match, for the message: `the emit
|
|
51
|
+
* parameter` or `the inputs`
|
|
52
|
+
* @returns the compiled merge function
|
|
53
|
+
* @throws {Error} When the IR is not a function of that shape, naming the
|
|
54
|
+
* expected and the actual types.
|
|
55
|
+
*/
|
|
56
|
+
export function loadUnitMergeFunction(io, path, keyType, valueType, platforms, subject) {
|
|
57
|
+
const bundle = loadUnitProgram(io, path);
|
|
58
|
+
const fnType = bundle.ir.value.type;
|
|
59
|
+
const shape = fnType.type === "Function" ? fnType.value : null;
|
|
60
|
+
if (shape === null || shape.inputs.length !== 3 ||
|
|
61
|
+
!isTypeValueEqual(shape.inputs[0], keyType) ||
|
|
62
|
+
!isTypeValueEqual(shape.inputs[1], valueType) ||
|
|
63
|
+
!isTypeValueEqual(shape.inputs[2], valueType) ||
|
|
64
|
+
!isTypeValueEqual(shape.output, valueType)) {
|
|
65
|
+
throw new Error(`merge function: expected a function (K, V, V) -> V matching ${subject} ` +
|
|
66
|
+
`(K = ${printTypeValue(keyType)}, V = ${printTypeValue(valueType)}), got ${printTypeValue(fnType)}`);
|
|
67
|
+
}
|
|
68
|
+
return bundle.compile(platforms);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The segments of the manifest directory at `path`, each read through ranged
|
|
72
|
+
* reads on its file in `<path>.segments/`, the layout e3 stages parts in, and
|
|
73
|
+
* asked for as it is first read when the unit's host places segments as they
|
|
74
|
+
* are read.
|
|
75
|
+
*/
|
|
76
|
+
function manifestSource(io, path, manifest, fetch) {
|
|
77
|
+
return {
|
|
78
|
+
manifest,
|
|
79
|
+
segment(i) {
|
|
80
|
+
const file = segmentPath(path, manifest.entries[i].hash);
|
|
81
|
+
io.segment(file, fetch);
|
|
82
|
+
let size;
|
|
83
|
+
try {
|
|
84
|
+
size = io.size(file);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
throw new Error(`beast2 v5: manifest segment ${file} cannot be read`);
|
|
88
|
+
}
|
|
89
|
+
return { size, read: (offset, length) => readUnitRange(io, file, offset, length) };
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Opens part `index` at `path` and checks it is a canonical Set or Dict
|
|
95
|
+
* collection of `expected`'s type: a blob, read through ranged reads on its
|
|
96
|
+
* file, or a manifest directory, read through its segment files.
|
|
97
|
+
*
|
|
98
|
+
* @throws {Error} When there is no file at `path`, it is not a blob (too
|
|
99
|
+
* short, or without the magic — the reader's own words), it cannot be read
|
|
100
|
+
* as a canonical collection blob or a manifest, or its type is not
|
|
101
|
+
* `expected`.
|
|
102
|
+
*/
|
|
103
|
+
function openPart(io, path, index, expected, fetch) {
|
|
104
|
+
let size;
|
|
105
|
+
try {
|
|
106
|
+
size = io.size(path);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw new Error(`merge: input ${index} (${path}): cannot open the file`);
|
|
110
|
+
}
|
|
111
|
+
const reader = { size, read: (offset, length) => readUnitRange(io, path, offset, length) };
|
|
112
|
+
let manifest;
|
|
113
|
+
let type;
|
|
114
|
+
let selfContained;
|
|
115
|
+
try {
|
|
116
|
+
// The header first: a file too short for a blob, or one without the
|
|
117
|
+
// magic, is refused in the reader's words — the sentence east-c and
|
|
118
|
+
// east-py give for the same bytes — before the index is looked for.
|
|
119
|
+
readBeast2HeaderType(reader);
|
|
120
|
+
// A manifest directory is the collection its manifest names, its
|
|
121
|
+
// segments standalone blobs, each self-contained.
|
|
122
|
+
manifest = readBeast2Manifest(reader);
|
|
123
|
+
if (manifest !== null) {
|
|
124
|
+
type = manifest.type;
|
|
125
|
+
selfContained = true;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const extents = readBeast2Extents(reader);
|
|
129
|
+
type = extents.typeValue;
|
|
130
|
+
selfContained = extents.selfContained;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
throw new Error(`merge: input ${index} (${path}): ${err.message ?? String(err)}`);
|
|
135
|
+
}
|
|
136
|
+
if (expected !== null && !isTypeValueEqual(type, expected)) {
|
|
137
|
+
throw new Error(`merge: input ${index} (${path}) has type ${printTypeValue(type)}, expected ${printTypeValue(expected)} (input 0)`);
|
|
138
|
+
}
|
|
139
|
+
if (type.type !== "Set" && type.type !== "Dict") {
|
|
140
|
+
throw new Error(`merge: inputs must be Set or Dict blobs, got ${type.type}`);
|
|
141
|
+
}
|
|
142
|
+
if (!selfContained) {
|
|
143
|
+
throw new Error(`merge: input ${index} (${path}): the blob is not self-contained`);
|
|
144
|
+
}
|
|
145
|
+
return { type, source: manifest === null ? reader : manifestSource(io, path, manifest, fetch) };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Reads a range blob: `Struct{from: Option<K>, to: Option<K>}` over the parts'
|
|
149
|
+
* key type, self-describing, checked against that type.
|
|
150
|
+
*
|
|
151
|
+
* @throws {Error} When the file cannot be read or read as a beast2 blob, or
|
|
152
|
+
* its type is not the bounds struct over the parts' key type.
|
|
153
|
+
*/
|
|
154
|
+
function readKeyRange(io, path, keyType) {
|
|
155
|
+
let bytes;
|
|
156
|
+
try {
|
|
157
|
+
bytes = io.read(path);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
throw new Error(`merge: range (${path}): cannot open the file`);
|
|
161
|
+
}
|
|
162
|
+
// The same shape east-c builds (merge.c) and e3-core writes
|
|
163
|
+
// (execution/steps.ts): the bounds struct over the key type.
|
|
164
|
+
const key = fromEastTypeValue(keyType);
|
|
165
|
+
const rangeType = toEastTypeValue(StructType({ from: OptionType(key), to: OptionType(key) }));
|
|
166
|
+
let type;
|
|
167
|
+
try {
|
|
168
|
+
type = readBeast2Type(bytes);
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
throw new Error(`merge: range (${path}): ${err.message ?? String(err)}`);
|
|
172
|
+
}
|
|
173
|
+
if (!isTypeValueEqual(type, rangeType)) {
|
|
174
|
+
throw new Error(`merge: range (${path}) has type ${printTypeValue(type)}, expected ${printTypeValue(rangeType)} (bounds over the inputs' key type)`);
|
|
175
|
+
}
|
|
176
|
+
let bounds;
|
|
177
|
+
try {
|
|
178
|
+
bounds = decodeBeast2For(rangeType)(bytes);
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
throw new Error(`merge: range (${path}): ${err.message ?? String(err)}`);
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
from: bounds.from.type === "some" ? bounds.from.value : undefined,
|
|
185
|
+
to: bounds.to.type === "some" ? bounds.to.value : undefined,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Merges a merge unit's sorted Set or Dict parts of one type into one
|
|
190
|
+
* canonical collection.
|
|
191
|
+
*
|
|
192
|
+
* @param io - the unit's files
|
|
193
|
+
* @param parts - the parts, in the order equal keys fold; at least one
|
|
194
|
+
* @param output - the sink a manifest directory is written through, or the
|
|
195
|
+
* blob's bytes as they are produced
|
|
196
|
+
* @param options - the fold, its platforms, the key range, and the unit's
|
|
197
|
+
* `fetch`
|
|
198
|
+
* @returns the account: parts merged, entries written, keys folded
|
|
199
|
+
* @throws {Error} With the merge's message — a part of another type than part
|
|
200
|
+
* 0's, an Array part, keys that do not ascend, a fold whose signature does
|
|
201
|
+
* not match the parts, a range blob of another shape than the bounds over
|
|
202
|
+
* the parts' key type, a file that cannot be read, a shared key without a
|
|
203
|
+
* fold — leaving the output unfinalised (no terminator or index, or no
|
|
204
|
+
* manifest). Nothing is written before every part has opened.
|
|
205
|
+
*/
|
|
206
|
+
export function mergeUnitParts(io, parts, output, options = {}) {
|
|
207
|
+
if (parts.length === 0)
|
|
208
|
+
throw new Error("merge: at least one input is needed");
|
|
209
|
+
if (options.merge !== undefined && options.union) {
|
|
210
|
+
throw new Error("merge: a merge function and union are two folds — give one");
|
|
211
|
+
}
|
|
212
|
+
const fetch = options.fetch ?? false;
|
|
213
|
+
const first = openPart(io, parts[0], 0, null, fetch);
|
|
214
|
+
const type = first.type;
|
|
215
|
+
const dict = type.type === "Dict";
|
|
216
|
+
if (options.merge !== undefined && !dict)
|
|
217
|
+
throw new Error("merge: a merge function applies to Dict inputs only");
|
|
218
|
+
if (options.union && dict)
|
|
219
|
+
throw new Error("merge: union applies to Set inputs only");
|
|
220
|
+
const keyType = (dict ? type.value.key : type.value);
|
|
221
|
+
const merge = options.merge !== undefined
|
|
222
|
+
? loadUnitMergeFunction(io, options.merge, keyType, type.value.value, options.platforms ?? [], "the inputs")
|
|
223
|
+
: undefined;
|
|
224
|
+
const range = options.range !== undefined ? readKeyRange(io, options.range, keyType) : { from: undefined, to: undefined };
|
|
225
|
+
const opened = [first];
|
|
226
|
+
for (let i = 1; i < parts.length; i++)
|
|
227
|
+
opened.push(openPart(io, parts[i], i, type, fetch));
|
|
228
|
+
return mergeBeast2For(type, {
|
|
229
|
+
...(merge !== undefined && { merge }),
|
|
230
|
+
union: options.union ?? false,
|
|
231
|
+
from: range.from,
|
|
232
|
+
to: range.to,
|
|
233
|
+
labels: parts,
|
|
234
|
+
// Frames deflate on worker threads, where the host has them (#763).
|
|
235
|
+
parallel: true,
|
|
236
|
+
})(opened.map((part) => part.source), output);
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=runner_merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner_merge.js","sourceRoot":"","sources":["../../src/runner_merge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAsB,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GAMf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAe,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK1F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CACnC,EAAU,EACV,IAAY,EACZ,OAAsB,EACtB,SAAwB,EACxB,SAA6B,EAC7B,OAAe;IAEf,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACzC,MAAM,MAAM,GAAI,MAAM,CAAC,EAAyC,CAAC,KAAK,CAAC,IAAI,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAA2D,CAAC,CAA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