@elaraai/e3-types 1.0.84 → 1.0.85

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.
Files changed (67) hide show
  1. package/dist/src/api.d.ts +523 -17
  2. package/dist/src/api.d.ts.map +1 -1
  3. package/dist/src/api.js +208 -22
  4. package/dist/src/api.js.map +1 -1
  5. package/dist/src/dataflow.d.ts +115 -12
  6. package/dist/src/dataflow.d.ts.map +1 -1
  7. package/dist/src/dataflow.js +151 -15
  8. package/dist/src/dataflow.js.map +1 -1
  9. package/dist/src/dataflow.spec.js +41 -7
  10. package/dist/src/dataflow.spec.js.map +1 -1
  11. package/dist/src/dataset-blob.d.ts +19 -2
  12. package/dist/src/dataset-blob.d.ts.map +1 -1
  13. package/dist/src/dataset-blob.js +100 -21
  14. package/dist/src/dataset-blob.js.map +1 -1
  15. package/dist/src/dataset-blob.spec.js +132 -0
  16. package/dist/src/dataset-blob.spec.js.map +1 -1
  17. package/dist/src/execution.d.ts +68 -8
  18. package/dist/src/execution.d.ts.map +1 -1
  19. package/dist/src/execution.js +49 -8
  20. package/dist/src/execution.js.map +1 -1
  21. package/dist/src/execution.spec.js +31 -9
  22. package/dist/src/execution.spec.js.map +1 -1
  23. package/dist/src/index.d.ts +8 -7
  24. package/dist/src/index.d.ts.map +1 -1
  25. package/dist/src/index.js +14 -11
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/names.d.ts +9 -0
  28. package/dist/src/names.d.ts.map +1 -1
  29. package/dist/src/names.js.map +1 -1
  30. package/dist/src/pieces.d.ts +47 -0
  31. package/dist/src/pieces.d.ts.map +1 -0
  32. package/dist/src/pieces.js +17 -0
  33. package/dist/src/pieces.js.map +1 -0
  34. package/dist/src/pieces.spec.d.ts +6 -0
  35. package/dist/src/pieces.spec.d.ts.map +1 -0
  36. package/dist/src/pieces.spec.js +20 -0
  37. package/dist/src/pieces.spec.js.map +1 -0
  38. package/dist/src/release.d.ts +1 -1
  39. package/dist/src/release.js +1 -1
  40. package/dist/src/repository.d.ts +16 -0
  41. package/dist/src/repository.d.ts.map +1 -1
  42. package/dist/src/repository.js +15 -0
  43. package/dist/src/repository.js.map +1 -1
  44. package/dist/src/structure.d.ts +27 -0
  45. package/dist/src/structure.d.ts.map +1 -1
  46. package/dist/src/structure.js +59 -18
  47. package/dist/src/structure.js.map +1 -1
  48. package/dist/src/structure.spec.d.ts +6 -0
  49. package/dist/src/structure.spec.d.ts.map +1 -0
  50. package/dist/src/structure.spec.js +57 -0
  51. package/dist/src/structure.spec.js.map +1 -0
  52. package/package.json +3 -2
  53. package/src/api.ts +225 -21
  54. package/src/dataflow.spec.ts +49 -7
  55. package/src/dataflow.ts +160 -14
  56. package/src/dataset-blob.spec.ts +147 -0
  57. package/src/dataset-blob.ts +97 -20
  58. package/src/execution.spec.ts +31 -9
  59. package/src/execution.ts +52 -7
  60. package/src/index.ts +38 -2
  61. package/src/names.ts +12 -0
  62. package/src/pieces.spec.ts +23 -0
  63. package/src/pieces.ts +49 -0
  64. package/src/release.ts +1 -1
  65. package/src/repository.ts +18 -0
  66. package/src/structure.spec.ts +65 -0
  67. package/src/structure.ts +64 -21
@@ -37,6 +37,12 @@ import { type CollectionManifestEntry } from './collection-manifest.js';
37
37
  * exactly how a new state shares its unchanged segments with the old one.
38
38
  */
39
39
  export type SegmentSink = (bytes: Uint8Array) => Promise<string>;
40
+ /**
41
+ * How many objects {@link writeCollectionManifest} has a sink write at once,
42
+ * unless its caller says otherwise: a store whose writes are round trips is
43
+ * waited on once for this many segments, rather than once for each.
44
+ */
45
+ export declare const SEGMENT_WRITES_IN_FLIGHT = 16;
40
46
  /**
41
47
  * Whether a dataset root type is a collection — the kinds stored segmented +
42
48
  * indexed so the paged read API can seek.
@@ -74,16 +80,27 @@ export type CollectionPiece = Beast2RecutPiece<EastType, CollectionSegmentRef>;
74
80
  * Writer's own: a piece's segments are carried over only when that is the
75
81
  * header they are under, which is the caller's to establish.
76
82
  *
83
+ * The objects are written at once, `inFlight` at a time — the segments in
84
+ * order, then the header — and the manifest is returned once every one is
85
+ * stored, so the caller stores the manifest after the objects it names. The
86
+ * sink is called in segment order, and each segment's blob is held until its
87
+ * write ends.
88
+ *
77
89
  * @param type - The collection type (Array / Set / Dict)
78
90
  * @param pieces - The collection's pieces, in order
79
91
  * @param sink - Writes one object and returns its hash
92
+ * @param options - `inFlight`, the most objects the sink writes at once
93
+ * (default {@link SEGMENT_WRITES_IN_FLIGHT})
80
94
  * @returns The manifest's bytes — the caller stores them, and its hash is the
81
95
  * dataset's content address
82
96
  * @throws {Error} When a piece's elements do not ascend (Set / Dict), a
83
97
  * segment's blob is not the one segment its reference describes, or the sink
84
- * rejects.
98
+ * rejects: once the writes in flight have ended, so none runs on after the
99
+ * writer returns.
85
100
  */
86
- export declare function writeCollectionManifest(type: EastType | EastTypeValue, pieces: Iterable<CollectionPiece> | AsyncIterable<CollectionPiece>, sink: SegmentSink): Promise<Uint8Array>;
101
+ export declare function writeCollectionManifest(type: EastType | EastTypeValue, pieces: Iterable<CollectionPiece> | AsyncIterable<CollectionPiece>, sink: SegmentSink, options?: {
102
+ inFlight?: number;
103
+ }): Promise<Uint8Array>;
87
104
  /**
88
105
  * Encode a dataset value for the object store.
89
106
  *
@@ -1 +1 @@
1
- {"version":3,"file":"dataset-blob.d.ts","sourceRoot":"","sources":["../../src/dataset-blob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAUL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAg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,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAoD3C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAElE;AAOD;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D;;oDAEgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAC1C;AAED;;iCAEiC;AACjC,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,QAAQ,GAAG,aAAa,EAC9B,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,eAAe,CAAC,EAClE,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAClC,OAAO,CAAC,UAAU,CAAC,CA0CrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAAC;AAC9F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC"}
@@ -28,6 +28,65 @@
28
28
  */
29
29
  import { SortedMap, SortedSet, compareFor, encodeBeast2For, encodeBeast2PagedFor, isVariant, recutBeast2For, segmentRuleFor, toEastTypeValue, } from '@elaraai/east';
30
30
  import { COLLECTION_MANIFEST_KIND, encodeCollectionManifest, } from './collection-manifest.js';
31
+ /**
32
+ * How many objects {@link writeCollectionManifest} has a sink write at once,
33
+ * unless its caller says otherwise: a store whose writes are round trips is
34
+ * waited on once for this many segments, rather than once for each.
35
+ */
36
+ export const SEGMENT_WRITES_IN_FLIGHT = 16;
37
+ /**
38
+ * The writes of one manifest's objects: each started in the order it is
39
+ * handed over, at most `width` in flight, and none left running once the
40
+ * manifest's writer returns.
41
+ *
42
+ * @internal
43
+ */
44
+ class SinkWrites {
45
+ sink;
46
+ width;
47
+ inFlight = new Set();
48
+ failure;
49
+ constructor(sink, width) {
50
+ this.sink = sink;
51
+ this.width = width;
52
+ }
53
+ /**
54
+ * Starts writing `bytes` once fewer than `width` writes are in flight.
55
+ *
56
+ * @param bytes - The object
57
+ * @param named - Told the object's hash once it is stored
58
+ * @throws The first failed write's error, once one has failed: nothing more
59
+ * is started after it.
60
+ */
61
+ async start(bytes, named) {
62
+ while (this.failure === undefined && this.inFlight.size >= this.width)
63
+ await Promise.race(this.inFlight);
64
+ if (this.failure !== undefined)
65
+ throw this.failure.error;
66
+ const write = this.sink(bytes)
67
+ .then(named, (error) => {
68
+ this.failure ??= { error };
69
+ })
70
+ .finally(() => {
71
+ this.inFlight.delete(write);
72
+ });
73
+ this.inFlight.add(write);
74
+ }
75
+ /** Waits for every write started, whatever its outcome. */
76
+ async settled() {
77
+ await Promise.all(this.inFlight);
78
+ }
79
+ /**
80
+ * Waits for every write started.
81
+ *
82
+ * @throws The first failed write's error.
83
+ */
84
+ async stored() {
85
+ await this.settled();
86
+ if (this.failure !== undefined)
87
+ throw this.failure.error;
88
+ }
89
+ }
31
90
  /**
32
91
  * Whether a dataset root type is a collection — the kinds stored segmented +
33
92
  * indexed so the paged read API can seek.
@@ -56,45 +115,65 @@ function asTypeValue(type) {
56
115
  * Writer's own: a piece's segments are carried over only when that is the
57
116
  * header they are under, which is the caller's to establish.
58
117
  *
118
+ * The objects are written at once, `inFlight` at a time — the segments in
119
+ * order, then the header — and the manifest is returned once every one is
120
+ * stored, so the caller stores the manifest after the objects it names. The
121
+ * sink is called in segment order, and each segment's blob is held until its
122
+ * write ends.
123
+ *
59
124
  * @param type - The collection type (Array / Set / Dict)
60
125
  * @param pieces - The collection's pieces, in order
61
126
  * @param sink - Writes one object and returns its hash
127
+ * @param options - `inFlight`, the most objects the sink writes at once
128
+ * (default {@link SEGMENT_WRITES_IN_FLIGHT})
62
129
  * @returns The manifest's bytes — the caller stores them, and its hash is the
63
130
  * dataset's content address
64
131
  * @throws {Error} When a piece's elements do not ascend (Set / Dict), a
65
132
  * segment's blob is not the one segment its reference describes, or the sink
66
- * rejects.
133
+ * rejects: once the writes in flight have ended, so none runs on after the
134
+ * writer returns.
67
135
  */
68
- export async function writeCollectionManifest(type, pieces, sink) {
136
+ export async function writeCollectionManifest(type, pieces, sink, options = {}) {
69
137
  const typeValue = asTypeValue(type);
70
138
  const entries = [];
139
+ const writes = new SinkWrites(sink, options.inFlight ?? SEGMENT_WRITES_IN_FLIGHT);
140
+ /** Writes a segment the manifest names at the place it takes now. */
141
+ const write = (blob, fence, count) => {
142
+ const at = entries.push({ hash: '', fence, count: BigInt(count), bytes: BigInt(blob.byteLength) }) - 1;
143
+ return writes.start(blob, (hash) => {
144
+ entries[at] = { ...entries[at], hash };
145
+ });
146
+ };
71
147
  // Frames deflate on the worker pool once the value is large enough to be
72
148
  // worth it; the pool holds the frames in flight and nothing more.
73
149
  const recut = recutBeast2For(typeValue, { parallel: true });
74
- const stats = await recut(pieces, {
75
- written: async (segment) => {
76
- entries.push({
77
- hash: await sink(segment.blob),
78
- fence: segment.fence,
79
- count: BigInt(segment.count),
80
- bytes: BigInt(segment.blob.byteLength),
81
- });
82
- },
83
- carried: async (ref) => {
84
- if (ref.entry !== undefined) {
85
- entries.push(ref.entry);
86
- return;
87
- }
88
- const blob = await ref.read();
89
- entries.push({ hash: await sink(blob), fence: ref.fence, count: BigInt(ref.count), bytes: BigInt(blob.byteLength) });
90
- },
91
- });
150
+ let header = '';
151
+ try {
152
+ const stats = await recut(pieces, {
153
+ written: (segment) => write(segment.blob, segment.fence, segment.count),
154
+ carried: async (ref) => {
155
+ if (ref.entry !== undefined) {
156
+ entries.push(ref.entry);
157
+ return;
158
+ }
159
+ await write(await ref.read(), ref.fence, ref.count);
160
+ },
161
+ });
162
+ await writes.start(stats.header, (hash) => {
163
+ header = hash;
164
+ });
165
+ }
166
+ catch (error) {
167
+ await writes.settled();
168
+ throw error;
169
+ }
170
+ await writes.stored();
92
171
  return encodeCollectionManifest({
93
172
  kind: COLLECTION_MANIFEST_KIND,
94
173
  level: 0n,
95
174
  type: typeValue,
96
175
  rule: segmentRuleFor(typeValue),
97
- header: await sink(stats.header),
176
+ header,
98
177
  entries,
99
178
  });
100
179
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dataset-blob.js","sourceRoot":"","sources":["../../src/dataset-blob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,cAAc,EACd,eAAe,GAKhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC;AAYlC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAwB;IACvD,OAAO,SAAS,CAAC,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC;AAC7F,CAAC;AAED,8DAA8D;AAC9D,SAAS,WAAW,CAAC,IAA8B;IACjD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,IAAsB,CAAC,CAAC,CAAC,eAAe,CAAC,IAAgB,CAAC,CAAC;AACvF,CAAC;AAmBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAA8B,EAC9B,MAAkE,EAClE,IAAiB;IAEjB,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC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AAS,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,KAAkB,CAAC;IAC1D,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO,KAAK,YAAY,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAI,KAAsB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAsB,CAAC,CAAC,CAAC;IAC9H,CAAC;IACD,MAAM,GAAG,GAAG,UAAU,CAAE,SAAS,CAAC,KAAgC,CAAC,GAAG,CAAC,CAAC;IACxE,OAAO,KAAK,YAAY,SAAS;QAC/B,CAAC,CAAE,KAAqC,CAAC,OAAO,EAAE;QAClD,CAAC,CAAC,CAAC,GAAI,KAA+B,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC"}
@@ -12,6 +12,46 @@ import assert from 'node:assert/strict';
12
12
  import { Beast2ManifestWriter, DictType, IntegerType, SortedMap, StringType, StructType, compareFor, decodeBeast2FenceFor, decodeCollectionManifest, encodeBeast2For, encodeBeast2PagedFor, sha256Hex, } from '@elaraai/east';
13
13
  import { encodeDatasetBlob, writeCollectionManifest } from './dataset-blob.js';
14
14
  const TableType = DictType(StringType, IntegerType);
15
+ /** `n` rows, in canonical order: 20,000 span sixteen segments. */
16
+ function rowsOf(n) {
17
+ return new SortedMap(Array.from({ length: n }, (_, i) => [`k${String(i).padStart(6, '0')}`, BigInt(i)]), compareFor(StringType));
18
+ }
19
+ /** A sink whose writes are held until the test ends each one: the writes in
20
+ * flight, and the hash of every object it was handed, in order. */
21
+ function heldSink() {
22
+ const open = [];
23
+ const calls = [];
24
+ const sink = (bytes) => new Promise((resolve, reject) => {
25
+ const hash = sha256Hex(bytes);
26
+ calls.push(hash);
27
+ const write = {
28
+ hash,
29
+ end: (failure) => {
30
+ open.splice(open.indexOf(write), 1);
31
+ if (failure === undefined)
32
+ resolve(hash);
33
+ else
34
+ reject(failure);
35
+ },
36
+ };
37
+ open.push(write);
38
+ });
39
+ return { sink, open, calls };
40
+ }
41
+ /** Lets `turns` rounds of the event loop pass. */
42
+ async function turns(turns) {
43
+ for (let i = 0; i < turns; i++)
44
+ await new Promise((resolve) => setImmediate(resolve));
45
+ }
46
+ /** Lets the event loop run until `done` holds. */
47
+ async function until(done, what) {
48
+ for (let i = 0; i < 10_000; i++) {
49
+ if (done())
50
+ return;
51
+ await turns(1);
52
+ }
53
+ assert.fail(`never: ${what}`);
54
+ }
15
55
  describe('writeCollectionManifest', () => {
16
56
  it("writes the manifest writer's manifest for the value, byte for byte", async () => {
17
57
  const value = new SortedMap(Array.from({ length: 20_000 }, (_, i) => [`k${String(i).padStart(6, '0')}`, BigInt(i)]), compareFor(StringType));
@@ -72,6 +112,98 @@ describe('writeCollectionManifest', () => {
72
112
  for (const entry of entries.slice(0, half))
73
113
  assert.ok(!written.has(entry.hash), `segment ${entry.hash.slice(0, 8)} is carried`);
74
114
  });
115
+ it('has the sink write the objects at once, as many as it is given, in order, and returns once every one is stored', async () => {
116
+ const value = rowsOf(20_000);
117
+ const expected = await writeCollectionManifest(TableType, [{ elements: value.entries() }], async (bytes) => sha256Hex(bytes));
118
+ const entries = decodeCollectionManifest(expected).entries;
119
+ const objects = entries.length + 1;
120
+ const { sink, open, calls } = heldSink();
121
+ let manifest;
122
+ const writing = writeCollectionManifest(TableType, [{ elements: value.entries() }], sink, { inFlight: 3 })
123
+ .then((bytes) => {
124
+ manifest = bytes;
125
+ });
126
+ // Each write ends only when the test ends it, the last begun first, so the
127
+ // writes end in another order than they began. Between ends, the writer
128
+ // has as many in flight as it may: three, or the objects left.
129
+ while (manifest === undefined) {
130
+ const inFlight = () => Math.min(3, objects - (calls.length - open.length));
131
+ await until(() => manifest !== undefined || open.length === inFlight(), 'as many writes in flight as may be');
132
+ await turns(20);
133
+ if (manifest !== undefined)
134
+ break;
135
+ assert.equal(open.length, inFlight(), `${open.length} writes in flight, of ${calls.length} begun`);
136
+ open.at(-1).end();
137
+ }
138
+ await writing;
139
+ assert.deepEqual(manifest, expected, 'the manifest a write at a time writes, each entry in its place');
140
+ assert.deepEqual(calls, [...entries.map((entry) => entry.hash), decodeCollectionManifest(expected).header], 'the segments, in order, and then the header');
141
+ });
142
+ /** A writer's failure, once it has failed: read through a function, which
143
+ * no assertion narrows. */
144
+ function failureOf(writing) {
145
+ let settled;
146
+ writing.then(() => {
147
+ settled = { failure: new Error('the writer did not fail') };
148
+ }, (failure) => {
149
+ settled = { failure };
150
+ });
151
+ return () => settled;
152
+ }
153
+ it('starts no write after one fails, and throws its failure once the writes in flight have ended', async () => {
154
+ const { sink, open, calls } = heldSink();
155
+ const writing = writeCollectionManifest(TableType, [{ elements: rowsOf(20_000).entries() }], sink, { inFlight: 3 });
156
+ const settled = failureOf(writing);
157
+ await until(() => open.length === 3, 'three writes in flight');
158
+ const failure = new Error('the store is gone');
159
+ open[1].end(failure);
160
+ await turns(20);
161
+ assert.equal(calls.length, 3, 'nothing is begun after a write fails');
162
+ assert.equal(settled(), undefined, 'the writer waits for the writes still in flight');
163
+ for (const write of [...open])
164
+ write.end();
165
+ await writing.catch(() => { });
166
+ assert.equal(settled()?.failure, failure);
167
+ });
168
+ it('throws a failure among the last writes, which no write after it meets', async () => {
169
+ const value = rowsOf(20_000);
170
+ const { header } = decodeCollectionManifest(await writeCollectionManifest(TableType, [{ elements: value.entries() }], async (bytes) => sha256Hex(bytes)));
171
+ const { sink, open } = heldSink();
172
+ const writing = writeCollectionManifest(TableType, [{ elements: value.entries() }], sink, { inFlight: 3 });
173
+ const settled = failureOf(writing);
174
+ // Every object is stored but the header, the last begun.
175
+ const failure = new Error('the store is gone');
176
+ for (;;) {
177
+ await until(() => settled() !== undefined || open.length > 0, 'a write in flight, or the writer\'s end');
178
+ if (settled() !== undefined)
179
+ break;
180
+ const write = open[0];
181
+ write.end(write.hash === header ? failure : undefined);
182
+ }
183
+ assert.equal(settled()?.failure, failure);
184
+ });
185
+ it('throws a piece\'s failure once the writes in flight have ended', async () => {
186
+ const { sink, open } = heldSink();
187
+ // Rows in order, then one out of it.
188
+ let disordered = false;
189
+ function* rows() {
190
+ yield* rowsOf(20_000).entries();
191
+ disordered = true;
192
+ yield ['a', 0n];
193
+ }
194
+ const writing = writeCollectionManifest(TableType, [{ elements: rows() }], sink, { inFlight: 64 });
195
+ const settled = failureOf(writing);
196
+ await until(() => disordered, 'the row out of order');
197
+ await turns(20);
198
+ assert.ok(open.length > 0, 'segments are in flight');
199
+ assert.equal(settled(), undefined, 'the writer waits for the writes still in flight');
200
+ for (const write of [...open])
201
+ write.end();
202
+ await writing.catch(() => { });
203
+ const failure = settled()?.failure;
204
+ assert.ok(failure instanceof Error, 'the piece\'s failure');
205
+ assert.match(failure.message, /ascend|order/);
206
+ });
75
207
  });
76
208
  describe('encodeDatasetBlob', () => {
77
209
  it('encodes a collection without a sink as its paged blob, and any other value whole', async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"dataset-blob.spec.js","sourceRoot":"","sources":["../../src/dataset-blob.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,oBAAoB,EACpB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAA6B,MAAM,mBAAmB,CAAC;AAE1G,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;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EAAE;QAChG,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAE9F,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QAClE,MAAM,GAAG,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,IAAI,GAAiB,EAAE,CAAC;QAC9B,MAAM,CAAC,SAAS,CAAC,MAAM,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjB,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC,CAAC,EAAE,KAAK,EAAE,6DAA6D,CAAC,CAAC;QAC1E,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -14,13 +14,42 @@
14
14
  * - For success: output hash, timing, peak memory and a split task's last plan
15
15
  * - For failed: exit code, timing and peak memory
16
16
  * - For error: internal error message and timing
17
- * - For cancelled and interrupted: how e3, not the task, ended it
17
+ * - For cancelled and interrupted: how e3, not the task, ended it, and why
18
18
  *
19
19
  * Every case says whether the execution is a unit of a split task — a piece,
20
20
  * or a merge of the pieces' outputs — which is recorded under its task's hash
21
21
  * as the task's own executions are, but is not a run of the task.
22
22
  */
23
- import { VariantType, StructType, ArrayType, OptionType, StringType, IntegerType, BooleanType, DateTimeType, ValueTypeOf } from '@elaraai/east';
23
+ import { VariantType, StructType, ArrayType, OptionType, StringType, IntegerType, BooleanType, DateTimeType, NullType, ValueTypeOf } from '@elaraai/east';
24
+ /**
25
+ * Why an execution stopped without finishing: what a `cancelled` or an
26
+ * `interrupted` record says, written in the same write as the record.
27
+ *
28
+ * - `aborted`: the signal it ran under was aborted — its run was cancelled,
29
+ * or the call it ran for ended
30
+ * - `yielded`: its run yielded mid-stage, and a run resumed takes the stage up
31
+ * again
32
+ * - `owner_gone`: its runner and the process, or the browser tab, that owned
33
+ * it are gone
34
+ * - `host`: a host's own reason, by its code — e3-cloud's for a container
35
+ * that stopped, say
36
+ * - `unrecorded`: it stopped before e3 recorded reasons; only the repository
37
+ * upgrade that carried its record forward writes it
38
+ *
39
+ * `message` is what e3 wrote as the attempt's log's last line, after its
40
+ * `e3: `, or the host's words; empty for `unrecorded`.
41
+ */
42
+ export declare const StopReasonType: StructType<{
43
+ readonly kind: VariantType<{
44
+ readonly aborted: NullType;
45
+ readonly yielded: NullType;
46
+ readonly owner_gone: NullType;
47
+ readonly host: StringType;
48
+ readonly unrecorded: NullType;
49
+ }>;
50
+ readonly message: StringType;
51
+ }>;
52
+ export type StopReason = ValueTypeOf<typeof StopReasonType>;
24
53
  /**
25
54
  * Execution status, stored locally at
26
55
  * executions/<taskHash>/<inputsHash>/<executionId>/status.beast2
@@ -29,10 +58,14 @@ import { VariantType, StructType, ArrayType, OptionType, StringType, IntegerType
29
58
  * - `success`: Task ran and returned exit code 0
30
59
  * - `failed`: Task ran and returned non-zero exit code
31
60
  * - `error`: e3 execution engine had an internal error (runner not found, output missing, etc.)
32
- * - `cancelled`: e3 stopped the execution because the run was aborted, before
33
- * its runner started or while it ran — not the task's own failure
34
- * - `interrupted`: the orchestrator that owned the execution exited before it
35
- * finished, and its runner is gone too, so nothing will write its outcome
61
+ * - `cancelled`: e3 stopped the execution because the signal it ran under was
62
+ * aborted, before its runner started or while it ran — not the task's own
63
+ * failure
64
+ * - `interrupted`: the execution can no longer finish, and nothing will write
65
+ * its outcome: its runner and its owner are gone, its host says it cannot,
66
+ * or its run yielded mid-stage
67
+ *
68
+ * Each of the two says why it stopped ({@link StopReasonType}).
36
69
  *
37
70
  * The `running` state includes process identification fields (pid, pidStartTime, bootId)
38
71
  * to enable detection of crashed executions. See design/e3-execution.md for details.
@@ -131,6 +164,17 @@ export declare const ExecutionStatusType: VariantType<{
131
164
  * the pieces' outputs — rather than a task's own execution, which the one
132
165
  * unit of a task whose input closes no piece is */
133
166
  readonly unit: BooleanType;
167
+ /** Why it stopped: `aborted` */
168
+ readonly reason: StructType<{
169
+ readonly kind: VariantType<{
170
+ readonly aborted: NullType;
171
+ readonly yielded: NullType;
172
+ readonly owner_gone: NullType;
173
+ readonly host: StringType;
174
+ readonly unrecorded: NullType;
175
+ }>;
176
+ readonly message: StringType;
177
+ }>;
134
178
  }>;
135
179
  readonly interrupted: StructType<{
136
180
  /** Unique execution ID (UUIDv7) */
@@ -147,6 +191,18 @@ export declare const ExecutionStatusType: VariantType<{
147
191
  * the pieces' outputs — rather than a task's own execution, which the one
148
192
  * unit of a task whose input closes no piece is */
149
193
  readonly unit: BooleanType;
194
+ /** Why it can no longer finish: `owner_gone`, `yielded`, or its host's
195
+ * reason */
196
+ readonly reason: StructType<{
197
+ readonly kind: VariantType<{
198
+ readonly aborted: NullType;
199
+ readonly yielded: NullType;
200
+ readonly owner_gone: NullType;
201
+ readonly host: StringType;
202
+ readonly unrecorded: NullType;
203
+ }>;
204
+ readonly message: StringType;
205
+ }>;
150
206
  }>;
151
207
  }>;
152
208
  export type ExecutionStatus = ValueTypeOf<typeof ExecutionStatusType>;
@@ -173,8 +229,12 @@ export declare function executionStatusRoots(status: ExecutionStatus): string[];
173
229
  * Decode an execution status.
174
230
  *
175
231
  * @remarks
176
- * Stored state, so it changes by hard cutover: a repository an older e3 wrote
177
- * is re-created rather than read, and this says so.
232
+ * Stored state, which changes as `docs/conventions/WIRE_MIGRATION.md` says:
233
+ * this reads the current form alone. A repository's upgrade steps carry its
234
+ * records into it when an e3 first opens the repository — the stop reasons'
235
+ * step those from before a stopped execution recorded why — so a record in an
236
+ * earlier form here is one from before repositories recorded their upgrades,
237
+ * whose repository is re-created, and this says so.
178
238
  *
179
239
  * @param data - the stored bytes
180
240
  * @returns the status
@@ -1 +1 @@
1
- {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/execution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EAEZ,MAAM,eAAe,CAAC;AAqFvB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB;;QAnG9B,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,gFAAgF;;QAEhF,4DAA4D;;QAE5D;;4DAEoD;;;;QAKpD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,iCAAiC;;QAEjC,6BAA6B;;QAE7B,+BAA+B;;QAE/B;;uCAE+B;;QAE/B;;6CAEqC;;QAErC;;4DAEoD;;;;QAKpD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,wBAAwB;;QAExB;;uCAE+B;;QAE/B;;4DAEoD;;;;QAKpD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,+CAA+C;;QAE/C;;4DAEoD;;;;QA4BlD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,yBAAyB;;QAEz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B;;QAE7B,+BAA+B;;QAE/B;;uCAE+B;;QAE/B;;6CAEqC;;QAErC;;4DAEoD;;;;QAKpD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,wBAAwB;;QAExB;;uCAE+B;;QAE/B;;4DAEoD;;;;QAKpD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,+BAA+B;;QAE/B,+CAA+C;;QAE/C;;4DAEoD;;;;QAgClD,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,yBAAyB;;QAEzB;;4DAEoD;;QAEpD,gCAAgC;;;;;;;;;;;;;QAIhC,mCAAmC;;QAEnC,2BAA2B;;QAE3B,6BAA6B;;QAE7B,sCAAsC;;QAEtC,gCAAgC;;QAEhC;;4DAEoD;;QAEpD;qBACa;;;;;;;;;;;;EAGf,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAKtE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE,CAKtE;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,eAAe,CASvE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB;IAC7B,qCAAqC;;IAErC,qFAAqF;;IAErF,4DAA4D;;EAE5D,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -14,13 +14,41 @@
14
14
  * - For success: output hash, timing, peak memory and a split task's last plan
15
15
  * - For failed: exit code, timing and peak memory
16
16
  * - For error: internal error message and timing
17
- * - For cancelled and interrupted: how e3, not the task, ended it
17
+ * - For cancelled and interrupted: how e3, not the task, ended it, and why
18
18
  *
19
19
  * Every case says whether the execution is a unit of a split task — a piece,
20
20
  * or a merge of the pieces' outputs — which is recorded under its task's hash
21
21
  * as the task's own executions are, but is not a run of the task.
22
22
  */
23
- import { VariantType, StructType, ArrayType, OptionType, StringType, IntegerType, BooleanType, DateTimeType, decodeBeast2For, } from '@elaraai/east';
23
+ import { VariantType, StructType, ArrayType, OptionType, StringType, IntegerType, BooleanType, DateTimeType, NullType, decodeBeast2For, } from '@elaraai/east';
24
+ /**
25
+ * Why an execution stopped without finishing: what a `cancelled` or an
26
+ * `interrupted` record says, written in the same write as the record.
27
+ *
28
+ * - `aborted`: the signal it ran under was aborted — its run was cancelled,
29
+ * or the call it ran for ended
30
+ * - `yielded`: its run yielded mid-stage, and a run resumed takes the stage up
31
+ * again
32
+ * - `owner_gone`: its runner and the process, or the browser tab, that owned
33
+ * it are gone
34
+ * - `host`: a host's own reason, by its code — e3-cloud's for a container
35
+ * that stopped, say
36
+ * - `unrecorded`: it stopped before e3 recorded reasons; only the repository
37
+ * upgrade that carried its record forward writes it
38
+ *
39
+ * `message` is what e3 wrote as the attempt's log's last line, after its
40
+ * `e3: `, or the host's words; empty for `unrecorded`.
41
+ */
42
+ export const StopReasonType = StructType({
43
+ kind: VariantType({
44
+ aborted: NullType,
45
+ yielded: NullType,
46
+ owner_gone: NullType,
47
+ host: StringType,
48
+ unrecorded: NullType,
49
+ }),
50
+ message: StringType,
51
+ });
24
52
  /** A running execution's process identification. */
25
53
  const RunningStatusType = StructType({
26
54
  /** Unique execution ID (UUIDv7) */
@@ -108,10 +136,14 @@ const ErrorStatusType = StructType({
108
136
  * - `success`: Task ran and returned exit code 0
109
137
  * - `failed`: Task ran and returned non-zero exit code
110
138
  * - `error`: e3 execution engine had an internal error (runner not found, output missing, etc.)
111
- * - `cancelled`: e3 stopped the execution because the run was aborted, before
112
- * its runner started or while it ran — not the task's own failure
113
- * - `interrupted`: the orchestrator that owned the execution exited before it
114
- * finished, and its runner is gone too, so nothing will write its outcome
139
+ * - `cancelled`: e3 stopped the execution because the signal it ran under was
140
+ * aborted, before its runner started or while it ran — not the task's own
141
+ * failure
142
+ * - `interrupted`: the execution can no longer finish, and nothing will write
143
+ * its outcome: its runner and its owner are gone, its host says it cannot,
144
+ * or its run yielded mid-stage
145
+ *
146
+ * Each of the two says why it stopped ({@link StopReasonType}).
115
147
  *
116
148
  * The `running` state includes process identification fields (pid, pidStartTime, bootId)
117
149
  * to enable detection of crashed executions. See design/e3-execution.md for details.
@@ -136,6 +168,8 @@ export const ExecutionStatusType = VariantType({
136
168
  * the pieces' outputs — rather than a task's own execution, which the one
137
169
  * unit of a task whose input closes no piece is */
138
170
  unit: BooleanType,
171
+ /** Why it stopped: `aborted` */
172
+ reason: StopReasonType,
139
173
  }),
140
174
  interrupted: StructType({
141
175
  /** Unique execution ID (UUIDv7) */
@@ -152,6 +186,9 @@ export const ExecutionStatusType = VariantType({
152
186
  * the pieces' outputs — rather than a task's own execution, which the one
153
187
  * unit of a task whose input closes no piece is */
154
188
  unit: BooleanType,
189
+ /** Why it can no longer finish: `owner_gone`, `yielded`, or its host's
190
+ * reason */
191
+ reason: StopReasonType,
155
192
  }),
156
193
  });
157
194
  /** An object's hash: a SHA-256 in lowercase hex. */
@@ -187,8 +224,12 @@ const decodeCurrentStatus = decodeBeast2For(ExecutionStatusType);
187
224
  * Decode an execution status.
188
225
  *
189
226
  * @remarks
190
- * Stored state, so it changes by hard cutover: a repository an older e3 wrote
191
- * is re-created rather than read, and this says so.
227
+ * Stored state, which changes as `docs/conventions/WIRE_MIGRATION.md` says:
228
+ * this reads the current form alone. A repository's upgrade steps carry its
229
+ * records into it when an e3 first opens the repository — the stop reasons'
230
+ * step those from before a stopped execution recorded why — so a record in an
231
+ * earlier form here is one from before repositories recorded their upgrades,
232
+ * whose repository is re-created, and this says so.
192
233
  *
193
234
  * @param data - the stored bytes
194
235
  * @returns the status