@amalgm/shell 0.1.164-main.42790312725 → 0.1.164-main.43198222283

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 (58) hide show
  1. package/dist/accepted-fold.d.ts +33 -51
  2. package/dist/accepted-fold.js +66 -339
  3. package/dist/accepted-fold.js.map +1 -1
  4. package/dist/apply-map.d.ts +22 -14
  5. package/dist/apply-map.js +154 -131
  6. package/dist/apply-map.js.map +1 -1
  7. package/dist/apply-window-host.js +29 -22
  8. package/dist/apply-window-host.js.map +1 -1
  9. package/dist/apply-window-lane.js +2 -2
  10. package/dist/apply-window-lane.js.map +1 -1
  11. package/dist/apply-window-verify.d.ts +5 -2
  12. package/dist/apply-window-verify.js +3 -2
  13. package/dist/apply-window-verify.js.map +1 -1
  14. package/dist/detection/repository-state.d.ts +2 -1
  15. package/dist/detection/repository-state.js +18 -12
  16. package/dist/detection/repository-state.js.map +1 -1
  17. package/dist/detection/root-examination.js +2 -2
  18. package/dist/detection/root-examination.js.map +1 -1
  19. package/dist/detection/root-walk.d.ts +4 -0
  20. package/dist/detection/root-walk.js +2 -2
  21. package/dist/detection/root-walk.js.map +1 -1
  22. package/dist/detection/withheld.d.ts +7 -2
  23. package/dist/detection/withheld.js +7 -4
  24. package/dist/detection/withheld.js.map +1 -1
  25. package/dist/drive/cloud-files/contents.d.ts +6 -5
  26. package/dist/drive/cloud-files/contents.js +27 -35
  27. package/dist/drive/cloud-files/contents.js.map +1 -1
  28. package/dist/drive/mount.d.ts +3 -2
  29. package/dist/drive/mount.js +3 -3
  30. package/dist/drive/mount.js.map +1 -1
  31. package/dist/drive/operations.d.ts +3 -3
  32. package/dist/drive/operations.js +19 -19
  33. package/dist/drive/operations.js.map +1 -1
  34. package/dist/drive/shelf.js +5 -2
  35. package/dist/drive/shelf.js.map +1 -1
  36. package/dist/git/held-package.d.ts +66 -0
  37. package/dist/git/held-package.js +101 -0
  38. package/dist/git/held-package.js.map +1 -0
  39. package/dist/ground-contract.d.ts +2 -2
  40. package/dist/ground-contract.js +2 -2
  41. package/dist/native/cloud-files.node +0 -0
  42. package/dist/native/windows-fs.node +0 -0
  43. package/dist/received-state.d.ts +8 -1
  44. package/dist/received-state.js +24 -4
  45. package/dist/received-state.js.map +1 -1
  46. package/dist/registry-graph.d.ts +61 -40
  47. package/dist/registry-graph.js +292 -140
  48. package/dist/registry-graph.js.map +1 -1
  49. package/dist/registry-page-cache.d.ts +2 -4
  50. package/dist/registry-page-cache.js.map +1 -1
  51. package/dist/user-ground-host.d.ts +31 -1
  52. package/dist/user-ground-host.js +151 -8
  53. package/dist/user-ground-host.js.map +1 -1
  54. package/npm-shrinkwrap.json +13 -13
  55. package/package.json +5 -5
  56. package/dist/git/cached-notebook.d.ts +0 -3
  57. package/dist/git/cached-notebook.js +0 -21
  58. package/dist/git/cached-notebook.js.map +0 -1
@@ -1,69 +1,51 @@
1
1
  /**
2
2
  * The accepted fold: a committed head H at watermark M with every result
3
- * the authority accepted in (M, N], resolved by Live's one reducer.
3
+ * the authority accepted in (M, N], read through Live's accepted view
4
+ * (accepted-view.ts), which answers what the one reducer holds a point at a
5
+ * time.
4
6
  *
5
- * H is paged per root, and nothing reads the whole account. A result acts
6
- * only on rows in the roots it reaches: the root H held its entity in, the
7
- * root H held its parent in, and, through a parent the tail itself states,
8
- * every root that parent reaches. Roots joined this way form a component.
9
- * Folding a component's results, in acceptance order, onto its roots'
10
- * records is the whole fold restricted to those roots, because no result
11
- * outside the component reads or writes a row inside it.
12
- *
13
- * The fold is held (Reduction): advancing it through later results folds
14
- * only those, onto each component's reduction, and that is the fold of the
15
- * whole tail at once. A join keeps a reduction only when the other side
16
- * adds no base rows and no result the reduction has passed; otherwise the
17
- * joined component opens again from its roots. A component folds when a
18
- * reader asks for a row in it. Its rows return to their final roots by
19
- * parent chain, and every root it loaded answers, empty when nothing stays
20
- * in it. A root no result reaches is H's own.
7
+ * H is paged per root, and nothing reads the whole account. A row, a
8
+ * listing or a subtree within a root reads only what it names; only `locate`
9
+ * and a whole root ask where H holds something. A whole root is read only
10
+ * when asked for: from H's pages when no result touches an identity H holds
11
+ * in it, since then it holds exactly H's rows, and otherwise as the view's
12
+ * subtree beneath it.
21
13
  */
22
- import { type CloudEntityRecord, type Sha256Hex } from "@amalgm/live";
14
+ import { type AcceptedRecord, type CloudEntityRecord, type Sha256Hex } from "@amalgm/live";
23
15
  import type { RegistryGraph } from "./registry-graph.js";
24
- /** Where the fold holds one identity: its final root and resolved row. */
25
- export interface AcceptedRecord {
26
- readonly root: string;
27
- readonly record: CloudEntityRecord;
28
- }
16
+ export type { AcceptedRecord } from "@amalgm/live";
29
17
  export declare class AcceptedFold {
30
18
  #private;
31
19
  readonly graph: RegistryGraph;
32
- private readonly sha256Hex;
33
20
  private constructor();
34
- /** Join `results` into components over `graph`'s roots. Nothing folds
35
- * until a reader asks for a root the results reach. */
21
+ /** The view of `results` over `graph`. Nothing folds: each question reads
22
+ * what it names. */
36
23
  static open(graph: RegistryGraph, results: readonly CloudEntityRecord[], sha256Hex: Sha256Hex): Promise<AcceptedFold>;
37
- /** Take the results accepted next, in acceptance order. */
38
- advance(results: readonly CloudEntityRecord[]): Promise<void>;
39
- /** One root's resolved rows. */
24
+ /** Take the results accepted next, in acceptance order, and say which
25
+ * identities they touch: every row whose answer they can move is among
26
+ * them. */
27
+ advance(results: readonly CloudEntityRecord[]): Promise<Set<string>>;
28
+ /** One root's rows, in uuid order; empty when the fold holds no root by
29
+ * that id. Only this asks where H holds what a result touched. */
40
30
  root(rootId: string): Promise<readonly CloudEntityRecord[]>;
41
- /** The subtree `uuid` heads after the fold, any status; empty when the
42
- * fold holds no row for it. */
31
+ /** The subtree `uuid` heads, `uuid` first, any status; empty when the fold
32
+ * holds no row for it. A root H holds is read whole first, so the walk
33
+ * beneath it answers from memory; a subtree within one reads only the pages
34
+ * that hold its containers' children. */
43
35
  subtree(uuid: string): Promise<readonly CloudEntityRecord[]>;
44
- /** The rows directly beneath `uuid` after the fold, any status; empty when
45
- * the fold holds no row for it. */
36
+ /** The rows directly beneath `uuid`, any status; empty when the fold holds
37
+ * no row for it. */
46
38
  children(uuid: string): Promise<readonly CloudEntityRecord[]>;
39
+ /** The row the fold holds for `uuid`, or undefined for none. */
40
+ row(uuid: string): Promise<CloudEntityRecord | undefined>;
41
+ /** The row the fold holds for each of `uuids` it holds, read together. */
42
+ rows(uuids: readonly string[]): Promise<ReadonlyMap<string, CloudEntityRecord>>;
47
43
  /** Where the fold holds `uuid`, or null when it holds no row for it. */
48
44
  locate(uuid: string): Promise<AcceptedRecord | null>;
49
- /** Every root's own row after the fold: the discovery set. Only a root's
50
- * own result creates, changes or demotes it, so only the components such
51
- * results join resolve. */
45
+ /** Every root's own row: the discovery set. Only a root's own result
46
+ * creates, changes or demotes it. */
52
47
  rootRecords(): Promise<readonly CloudEntityRecord[]>;
53
- /** Every root a result reaches, after the fold: what a head through N
54
- * must rebuild so it never names a watermark it has not applied. */
48
+ /** Every root a result reaches: what a head through N must rebuild so it
49
+ * never names a watermark it has not applied. */
55
50
  reached(): Promise<readonly string[]>;
56
- /** The reduction of the component that holds `uuid`, joining its root;
57
- * null when the fold holds no row for it. */
58
- private holding;
59
- private componentOf;
60
- /** The root H holds `uuid` in, asked of H once. */
61
- private where;
62
- private partition;
63
- /** The component's reduction through all its results. */
64
- private resolve;
65
- /** Fold the results the reduction has not passed, opening it from the
66
- * component's roots when there is none. A fold that fails leaves the
67
- * reduction half-folded, so it is dropped. */
68
- private fold;
69
51
  }
@@ -1,379 +1,106 @@
1
1
  /**
2
2
  * The accepted fold: a committed head H at watermark M with every result
3
- * the authority accepted in (M, N], resolved by Live's one reducer.
3
+ * the authority accepted in (M, N], read through Live's accepted view
4
+ * (accepted-view.ts), which answers what the one reducer holds a point at a
5
+ * time.
4
6
  *
5
- * H is paged per root, and nothing reads the whole account. A result acts
6
- * only on rows in the roots it reaches: the root H held its entity in, the
7
- * root H held its parent in, and, through a parent the tail itself states,
8
- * every root that parent reaches. Roots joined this way form a component.
9
- * Folding a component's results, in acceptance order, onto its roots'
10
- * records is the whole fold restricted to those roots, because no result
11
- * outside the component reads or writes a row inside it.
12
- *
13
- * The fold is held (Reduction): advancing it through later results folds
14
- * only those, onto each component's reduction, and that is the fold of the
15
- * whole tail at once. A join keeps a reduction only when the other side
16
- * adds no base rows and no result the reduction has passed; otherwise the
17
- * joined component opens again from its roots. A component folds when a
18
- * reader asks for a row in it. Its rows return to their final roots by
19
- * parent chain, and every root it loaded answers, empty when nothing stays
20
- * in it. A root no result reaches is H's own.
7
+ * H is paged per root, and nothing reads the whole account. A row, a
8
+ * listing or a subtree within a root reads only what it names; only `locate`
9
+ * and a whole root ask where H holds something. A whole root is read only
10
+ * when asked for: from H's pages when no result touches an identity H holds
11
+ * in it, since then it holds exactly H's rows, and otherwise as the view's
12
+ * subtree beneath it.
21
13
  */
22
- import { eachStep, Reduction } from "@amalgm/live";
14
+ import { AcceptedView, sortSteps, } from "@amalgm/live";
23
15
  import { finishStepsInTurns } from "./turns.js";
16
+ const byUuid = (left, right) => left.uuid < right.uuid ? -1 : left.uuid > right.uuid ? 1 : 0;
24
17
  export class AcceptedFold {
25
18
  graph;
26
- sha256Hex;
27
- #results = [];
19
+ #view;
20
+ #heldRoots;
28
21
  /** Every resulting identity that is or becomes a root. */
29
22
  #statedRoots = new Set();
30
- #heldRoots;
31
- /** Where H holds each identity a result named, null for none. */
32
- #located = new Map();
33
- /** Every `root:<id>` and `uuid:<id>` a result reaches, to its component. */
34
- #joins = new Joins();
23
+ /** Every identity a result touched. */
24
+ #touched = new Set();
35
25
  constructor(graph, sha256Hex) {
36
26
  this.graph = graph;
37
- this.sha256Hex = sha256Hex;
27
+ this.#view = new AcceptedView(graph, sha256Hex);
38
28
  this.#heldRoots = new Set(graph.rootIds());
39
29
  }
40
- /** Join `results` into components over `graph`'s roots. Nothing folds
41
- * until a reader asks for a root the results reach. */
30
+ /** The view of `results` over `graph`. Nothing folds: each question reads
31
+ * what it names. */
42
32
  static async open(graph, results, sha256Hex) {
43
33
  const fold = new AcceptedFold(graph, sha256Hex);
44
34
  await fold.advance(results);
45
35
  return fold;
46
36
  }
47
- /** Take the results accepted next, in acceptance order. */
37
+ /** Take the results accepted next, in acceptance order, and say which
38
+ * identities they touch: every row whose answer they can move is among
39
+ * them. */
48
40
  async advance(results) {
49
- const first = this.#results.length;
50
- const asked = new Set();
51
- for (const result of results) {
52
- const { uuid, parentUUID } = result;
53
- this.#results.push(result);
41
+ for (const { uuid, parentUUID } of results) {
54
42
  if (parentUUID === null || this.#heldRoots.has(uuid))
55
43
  this.#statedRoots.add(uuid);
56
- if (!this.#located.has(uuid))
57
- asked.add(uuid);
58
- if (parentUUID !== null && !this.#located.has(parentUUID))
59
- asked.add(parentUUID);
60
- }
61
- if (asked.size > 0) {
62
- const located = await this.graph.membership(asked);
63
- for (const uuid of asked)
64
- this.#located.set(uuid, located.get(uuid) ?? null);
65
- }
66
- const joins = this.#joins;
67
- for (let index = first; index < this.#results.length; index += 1) {
68
- const { uuid, parentUUID: parent } = this.#results[index];
69
- const entity = `uuid:${uuid}`;
70
- joins.add(entity);
71
- const held = this.#located.get(uuid);
72
- if (held !== null)
73
- joins.union(entity, `root:${held}`);
74
- if (parent !== null) {
75
- joins.union(entity, `uuid:${parent}`);
76
- const parentHeld = this.#located.get(parent);
77
- if (parentHeld !== null)
78
- joins.union(`uuid:${parent}`, `root:${parentHeld}`);
79
- }
80
- joins.state(entity, index);
81
44
  }
45
+ const touched = await this.#view.advance(results);
46
+ for (const uuid of touched)
47
+ this.#touched.add(uuid);
48
+ return touched;
82
49
  }
83
- /** One root's resolved rows. */
50
+ /** One root's rows, in uuid order; empty when the fold holds no root by
51
+ * that id. Only this asks where H holds what a result touched. */
84
52
  async root(rootId) {
85
- const component = this.componentOf(rootId);
86
- if (!component)
53
+ const reached = new Set((await this.graph.rootsOf([...this.#touched])).values());
54
+ if (!reached.has(rootId) && !this.#touched.has(rootId))
87
55
  return this.graph.recordsFor(rootId);
88
- return (await this.partition(component)).get(rootId) ?? [];
89
- }
90
- /** The subtree `uuid` heads after the fold, any status; empty when the
91
- * fold holds no row for it. */
56
+ const own = await this.#view.row(rootId);
57
+ if (!own || own.parentUUID !== null)
58
+ return [];
59
+ return finishStepsInTurns(sortSteps(await this.subtree(rootId), byUuid));
60
+ }
61
+ /** The subtree `uuid` heads, `uuid` first, any status; empty when the fold
62
+ * holds no row for it. A root H holds is read whole first, so the walk
63
+ * beneath it answers from memory; a subtree within one reads only the pages
64
+ * that hold its containers' children. */
92
65
  async subtree(uuid) {
93
- const reduction = await this.holding(uuid);
94
- const record = reduction?.row(uuid);
95
- return record ? finishStepsInTurns(subtreeSteps(reduction, record)) : [];
66
+ if (this.#heldRoots.has(uuid))
67
+ await this.graph.recordsFor(uuid);
68
+ return this.#view.subtree(uuid);
96
69
  }
97
- /** The rows directly beneath `uuid` after the fold, any status; empty when
98
- * the fold holds no row for it. */
99
- async children(uuid) {
100
- const reduction = await this.holding(uuid);
101
- return reduction?.row(uuid) ? reduction.childrenOf(uuid).map((child) => reduction.row(child)) : [];
70
+ /** The rows directly beneath `uuid`, any status; empty when the fold holds
71
+ * no row for it. */
72
+ children(uuid) {
73
+ return this.#view.children(uuid);
74
+ }
75
+ /** The row the fold holds for `uuid`, or undefined for none. */
76
+ row(uuid) {
77
+ return this.#view.row(uuid);
78
+ }
79
+ /** The row the fold holds for each of `uuids` it holds, read together. */
80
+ rows(uuids) {
81
+ return this.#view.rows(uuids);
102
82
  }
103
83
  /** Where the fold holds `uuid`, or null when it holds no row for it. */
104
- async locate(uuid) {
105
- let component = this.#joins.component(`uuid:${uuid}`);
106
- let held = null;
107
- if (!component) {
108
- held = await this.where(uuid);
109
- if (held === null)
110
- return null;
111
- component = this.#joins.component(`root:${held}`);
112
- }
113
- if (!component) {
114
- const record = uuid === held
115
- ? await this.graph.rootRecord(held)
116
- : await this.graph.recordIn(held, uuid);
117
- return record ? { root: held, record } : null;
118
- }
119
- const reduction = await this.resolve(component);
120
- const record = reduction.row(uuid);
121
- return record ? { root: rootOf(reduction, record), record } : null;
84
+ locate(uuid) {
85
+ return this.#view.locate(uuid);
122
86
  }
123
- /** Every root's own row after the fold: the discovery set. Only a root's
124
- * own result creates, changes or demotes it, so only the components such
125
- * results join resolve. */
87
+ /** Every root's own row: the discovery set. Only a root's own result
88
+ * creates, changes or demotes it. */
126
89
  async rootRecords() {
127
90
  const roots = new Map((await this.graph.rootRecords()).map((record) => [record.uuid, record]));
91
+ const stated = await this.#view.rows([...this.#statedRoots]);
128
92
  for (const uuid of this.#statedRoots) {
129
93
  roots.delete(uuid);
130
- const held = await this.locate(uuid);
131
- if (held?.record.parentUUID === null)
132
- roots.set(uuid, held.record);
94
+ const row = stated.get(uuid);
95
+ if (row?.parentUUID === null)
96
+ roots.set(uuid, row);
133
97
  }
134
98
  return [...roots.values()];
135
99
  }
136
- /** Every root a result reaches, after the fold: what a head through N
137
- * must rebuild so it never names a watermark it has not applied. */
138
- async reached() {
139
- const roots = [];
140
- for (const component of [...this.#joins.components()]) {
141
- if (component.indexes.length === 0)
142
- continue;
143
- for (const root of (await this.partition(component)).keys())
144
- roots.push(root);
145
- }
146
- return roots;
147
- }
148
- /** The reduction of the component that holds `uuid`, joining its root;
149
- * null when the fold holds no row for it. */
150
- async holding(uuid) {
151
- let component = this.#joins.component(`uuid:${uuid}`);
152
- if (!component) {
153
- const held = await this.where(uuid);
154
- if (held === null)
155
- return null;
156
- component = this.#joins.add(`root:${held}`);
157
- }
158
- return this.resolve(component);
159
- }
160
- componentOf(rootId) {
161
- return this.#joins.component(`root:${rootId}`) ?? this.#joins.component(`uuid:${rootId}`);
162
- }
163
- /** The root H holds `uuid` in, asked of H once. */
164
- async where(uuid) {
165
- let held = this.#located.get(uuid);
166
- if (held === undefined)
167
- this.#located.set(uuid, held = await this.graph.locate(uuid));
168
- return held;
169
- }
170
- async partition(component) {
171
- const reduction = await this.resolve(component);
172
- if (component.partition?.folded !== component.folded) {
173
- const records = await finishStepsInTurns(reduction.recordsSteps());
174
- component.partition = {
175
- folded: component.folded,
176
- roots: await finishStepsInTurns(partitionSteps(records, component.roots)),
177
- };
178
- }
179
- return component.partition.roots;
180
- }
181
- /** The component's reduction through all its results. */
182
- async resolve(component) {
183
- for (;;) {
184
- if (component.resolving) {
185
- await component.resolving.catch(() => undefined);
186
- continue;
187
- }
188
- if (component.reduction && component.folded === component.indexes.length)
189
- return component.reduction;
190
- const resolving = this.fold(component);
191
- component.resolving = resolving;
192
- try {
193
- return await resolving;
194
- }
195
- finally {
196
- component.resolving = null;
197
- }
198
- }
199
- }
200
- /** Fold the results the reduction has not passed, opening it from the
201
- * component's roots when there is none. A fold that fails leaves the
202
- * reduction half-folded, so it is dropped. */
203
- async fold(component) {
204
- try {
205
- if (!component.reduction) {
206
- const base = [];
207
- for (const root of component.roots) {
208
- for (const record of await this.graph.recordsFor(root))
209
- base.push(record);
210
- }
211
- component.reduction = await finishStepsInTurns(Reduction.openSteps(base, this.sha256Hex));
212
- component.folded = 0;
213
- component.partition = null;
214
- }
215
- const reduction = component.reduction;
216
- const results = component.indexes.slice(component.folded).map((index) => this.#results[index]);
217
- await finishStepsInTurns(reduction.foldSteps(results));
218
- component.folded = component.indexes.length;
219
- return reduction;
220
- }
221
- catch (error) {
222
- component.reduction = null;
223
- component.folded = 0;
224
- component.partition = null;
225
- throw error;
226
- }
227
- }
228
- }
229
- /** The root `record`'s parent chain reaches. */
230
- function rootOf(reduction, record) {
231
- const chain = new Set();
232
- for (let at = record;;) {
233
- if (at.parentUUID === null)
234
- return at.uuid;
235
- if (chain.has(at.uuid))
236
- throw new Error(`accepted entity ${record.uuid} has a parent cycle`);
237
- chain.add(at.uuid);
238
- const parent = reduction.row(at.parentUUID);
239
- if (!parent)
240
- throw new Error(`accepted entity ${record.uuid} descends from no committed root`);
241
- at = parent;
242
- }
243
- }
244
- /** Every row beneath `top`, `top` included, any status. */
245
- function* subtreeSteps(reduction, top) {
246
- const rows = [];
247
- const stack = [top];
248
- for (let work = 1; stack.length > 0; work += 1) {
249
- const row = stack.pop();
250
- rows.push(row);
251
- for (const child of reduction.childrenOf(row.uuid))
252
- stack.push(reduction.row(child));
253
- if (work % 1024 === 0)
254
- yield;
255
- }
256
- return rows;
257
- }
258
- /** Rows by the root their parent chain reaches; each loaded root answers. */
259
- function* partitionSteps(records, loaded) {
260
- const byUuid = new Map();
261
- yield* eachStep(records, (record) => { byUuid.set(record.uuid, record); });
262
- const rootOf = new Map();
263
- const partitions = new Map(loaded.map((root) => [root, []]));
264
- yield* eachStep(records, (record) => {
265
- const chain = new Set();
266
- let at = record;
267
- let root = rootOf.get(at.uuid);
268
- while (root === undefined) {
269
- if (at.parentUUID === null) {
270
- root = at.uuid;
271
- break;
272
- }
273
- if (chain.has(at.uuid))
274
- throw new Error(`accepted entity ${record.uuid} has a parent cycle`);
275
- chain.add(at.uuid);
276
- const parent = byUuid.get(at.parentUUID);
277
- if (!parent)
278
- throw new Error(`accepted entity ${record.uuid} descends from no committed root`);
279
- at = parent;
280
- root = rootOf.get(at.uuid);
281
- }
282
- for (const uuid of chain)
283
- rootOf.set(uuid, root);
284
- let partition = partitions.get(root);
285
- if (!partition)
286
- partitions.set(root, partition = []);
287
- partition.push(record);
288
- });
289
- return partitions;
290
- }
291
- /** Union-find over component keys, each leader holding its component. */
292
- class Joins {
293
- #parent = new Map();
294
- #components = new Map();
295
- /** The key's component, created on first sight: a root key brings its
296
- * root's rows. */
297
- add(key) {
298
- if (!this.#parent.has(key)) {
299
- this.#parent.set(key, key);
300
- this.#components.set(key, {
301
- roots: key.startsWith("root:") ? [key.slice("root:".length)] : [], indexes: [],
302
- reduction: null, folded: 0, partition: null, resolving: null,
303
- });
304
- }
305
- return this.component(key);
306
- }
307
- component(key) {
308
- return this.#parent.has(key) ? this.#components.get(this.find(key)) : undefined;
309
- }
310
- components() {
311
- return this.#components.values();
312
- }
313
- /** The result at `index`, accepted after every one joined so far, joins
314
- * `key`'s component. */
315
- state(key, index) {
316
- this.#components.get(this.find(key)).indexes.push(index);
317
- }
318
- union(left, right) {
319
- this.add(left);
320
- this.add(right);
321
- const a = this.find(left);
322
- const b = this.find(right);
323
- if (a === b)
324
- return;
325
- this.#parent.set(a, b);
326
- this.#components.set(b, joined(this.#components.get(a), this.#components.get(b)));
327
- this.#components.delete(a);
328
- }
329
- find(key) {
330
- let root = key;
331
- for (let next = this.#parent.get(root); next !== root; next = this.#parent.get(root))
332
- root = next;
333
- for (let at = key; at !== root;) {
334
- const next = this.#parent.get(at);
335
- this.#parent.set(at, root);
336
- at = next;
337
- }
338
- return root;
339
- }
340
- }
341
- /** One component holding both, grown in place. A reduction survives only
342
- * when the other side brings no base rows and no result it has passed. */
343
- function joined(a, b) {
344
- const bare = (component) => component.roots.length === 0 && component.indexes.length === 0;
345
- if (bare(b))
346
- return a;
347
- if (bare(a))
348
- return b;
349
- const keeps = (held, other) => held.reduction !== null
350
- && other.reduction === null && other.roots.length === 0
351
- && (held.folded === 0 || other.indexes[0] > held.indexes[held.folded - 1]);
352
- const into = keeps(b, a) ? b : keeps(a, b) ? a : a.indexes.length >= b.indexes.length ? a : b;
353
- const from = into === a ? b : a;
354
- if (!keeps(into, from)) {
355
- into.reduction = null;
356
- into.folded = 0;
357
- }
358
- into.partition = null;
359
- for (const root of from.roots)
360
- into.roots.push(root);
361
- const last = into.indexes[into.indexes.length - 1];
362
- if (last === undefined || from.indexes.length === 0 || from.indexes[0] > last) {
363
- for (const index of from.indexes)
364
- into.indexes.push(index);
365
- return into;
366
- }
367
- const merged = [];
368
- for (let i = 0, j = 0; i < into.indexes.length || j < from.indexes.length;) {
369
- if (j >= from.indexes.length || (i < into.indexes.length && into.indexes[i] < from.indexes[j])) {
370
- merged.push(into.indexes[i++]);
371
- }
372
- else {
373
- merged.push(from.indexes[j++]);
374
- }
100
+ /** Every root a result reaches: what a head through N must rebuild so it
101
+ * never names a watermark it has not applied. */
102
+ reached() {
103
+ return this.#view.reached();
375
104
  }
376
- into.indexes = merged;
377
- return into;
378
105
  }
379
106
  //# sourceMappingURL=accepted-fold.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accepted-fold.js","sourceRoot":"","sources":["../src/accepted-fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAsD,MAAM,cAAc,CAAC;AAGvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAmBhD,MAAM,OAAO,YAAY;IAUM;IAAuC;IAT3D,QAAQ,GAAwB,EAAE,CAAC;IAC5C,0DAA0D;IACjD,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,UAAU,CAAsB;IACzC,iEAAiE;IACxD,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IACrD,4EAA4E;IACnE,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;IAE9B,YAA6B,KAAoB,EAAmB,SAAoB;QAA3D,UAAK,GAAL,KAAK,CAAe;QAAmB,cAAS,GAAT,SAAS,CAAW;QACtF,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;2DACuD;IACvD,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,KAAoB,EACpB,OAAqC,EACrC,SAAoB;QAEpB,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2DAA2D;IAC3D,KAAK,CAAC,OAAO,CAAC,OAAqC;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAChC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,EA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