@amalgm/live 0.2.81-main.42101108434 → 0.2.81-main.42147386482
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/drive/contracts.d.ts +14 -1
- package/dist/drive/contracts.d.ts.map +1 -1
- package/dist/drive/contracts.js.map +1 -1
- package/dist/drive/drive.d.ts +46 -3
- package/dist/drive/drive.d.ts.map +1 -1
- package/dist/drive/drive.js +84 -4
- package/dist/drive/drive.js.map +1 -1
- package/dist/drive/index.d.ts +1 -0
- package/dist/drive/index.d.ts.map +1 -1
- package/dist/drive/index.js +1 -0
- package/dist/drive/index.js.map +1 -1
- package/dist/drive/placements.d.ts +22 -3
- package/dist/drive/placements.d.ts.map +1 -1
- package/dist/drive/placements.js +37 -4
- package/dist/drive/placements.js.map +1 -1
- package/dist/drive/removal.d.ts +35 -0
- package/dist/drive/removal.d.ts.map +1 -0
- package/dist/drive/removal.js +26 -0
- package/dist/drive/removal.js.map +1 -0
- package/dist/drive/where.d.ts +7 -2
- package/dist/drive/where.d.ts.map +1 -1
- package/dist/drive/where.js +12 -1
- package/dist/drive/where.js.map +1 -1
- package/dist-cjs/drive/contracts.js.map +1 -1
- package/dist-cjs/drive/drive.js +83 -3
- package/dist-cjs/drive/drive.js.map +1 -1
- package/dist-cjs/drive/index.js +1 -0
- package/dist-cjs/drive/index.js.map +1 -1
- package/dist-cjs/drive/placements.js +37 -4
- package/dist-cjs/drive/placements.js.map +1 -1
- package/dist-cjs/drive/removal.js +29 -0
- package/dist-cjs/drive/removal.js.map +1 -0
- package/dist-cjs/drive/where.js +13 -1
- package/dist-cjs/drive/where.js.map +1 -1
- package/package.json +5 -5
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* first touch of it places it. A reference in the home leads into another
|
|
10
10
|
* root, with its own map and shelf, shown inline; a look at the reference
|
|
11
11
|
* reads only that root's top. The drive itself writes nothing: it judges
|
|
12
|
-
* addresses, and asks the host's placer for exactly the units a touch needs
|
|
12
|
+
* addresses, and asks the host's placer for exactly the units a touch needs,
|
|
13
|
+
* and its remover for the one removal that needs no bytes.
|
|
13
14
|
*/
|
|
14
15
|
import type { EntityStatus, EntityType, PortableFileMode } from '../entities/types.js';
|
|
15
16
|
/** One entity as the map carries it: the fields of the cloud record the
|
|
@@ -119,6 +120,17 @@ export interface Unit {
|
|
|
119
120
|
export interface PlacerPort {
|
|
120
121
|
place(unit: Unit): Promise<void>;
|
|
121
122
|
}
|
|
123
|
+
/** The host's remover: records the Trash of one unit this computer never
|
|
124
|
+
* placed, a file, a link or a folder the drive lists nothing beneath, at the
|
|
125
|
+
* version the map lists, with no bytes (`recordRemoval`). True once that
|
|
126
|
+
* record is durable and the map no longer lists the unit as active. False,
|
|
127
|
+
* recording nothing, when the sharing policy on the unit's root's shelf
|
|
128
|
+
* keeps the address local: a removal there is local ground's alone, so the
|
|
129
|
+
* drive places the unit and the host removes it from the shelf. The drive
|
|
130
|
+
* asks only once that root's top, and so its policy, stands. */
|
|
131
|
+
export interface RemoverPort {
|
|
132
|
+
remove(unit: Unit): Promise<boolean>;
|
|
133
|
+
}
|
|
122
134
|
/** Why a placement did not finish. `unavailable`: the bytes could not be
|
|
123
135
|
* reached now (offline, or the cloud did not answer in the placer's bound);
|
|
124
136
|
* `refused`: the placer declines this unit, with its reason; `fault`: the
|
|
@@ -156,6 +168,7 @@ export interface Clock {
|
|
|
156
168
|
export interface DrivePorts {
|
|
157
169
|
readonly roots: RootsPort;
|
|
158
170
|
readonly placer: PlacerPort;
|
|
171
|
+
readonly remover: RemoverPort;
|
|
159
172
|
readonly clock: Clock;
|
|
160
173
|
readonly activity?: ActivityHook;
|
|
161
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/drive/contracts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/drive/contracts.ts"],"names":[],"mapp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contracts.js","sourceRoot":"","sources":["../../src/drive/contracts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/drive/contracts.ts"],"names":[],"mappings":"AA6JA;iEACiE;AACjE,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAuB;IACpC,oCAAoC;IAC3B,IAAI,CAAO;IACpB;sEACkE;IACzD,MAAM,CAAS;IAExB,YAAY,IAA0B,EAAE,OAAe,EAAE,IAAU,EAAE,SAAiB,IAAI,CAAC,IAAI;QAC7F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;sDACkD;IAClD,MAAM,CAAC,IAAI,CAAC,KAAc,EAAE,IAAU;QACpC,IAAI,KAAK,YAAY,UAAU;YAAE,OAAO,KAAK,CAAC;QAC9C,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAkC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxG,MAAM,KAAK,GAAG,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtG,MAAM,OAAO,GAAG,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1G,MAAM,MAAM,GAAG,KAAK,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACjH,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAA4B,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACvG,CAAC;CACF;AAED,MAAM,aAAa,GAAwB,IAAI,GAAG,CAChD,CAAC,aAAa,EAAE,SAAS,EAAE,OAAO,CAAkC,CACrE,CAAC"}
|
package/dist/drive/drive.d.ts
CHANGED
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
* and a creation touches the address it creates at, so its ancestors stand.
|
|
10
10
|
* After a touch the shelf speaks, and the host does what it would do on any
|
|
11
11
|
* folder, on the shelf of the root the judgment names. An operation that
|
|
12
|
-
* creates, renames
|
|
13
|
-
*
|
|
12
|
+
* creates, renames or changes an address asks `change` instead, which
|
|
13
|
+
* refuses an address that names no ground (`addressOnly`), and a rename onto
|
|
14
|
+
* a directory asks `vacate`, which also refuses a directory the drive shows
|
|
15
|
+
* anything in. A removal asks `remove`, the one operation that may need no
|
|
16
|
+
* bytes: a never-placed unit's ground is its listing, so its removal is
|
|
17
|
+
* recorded from the map alone. A host asked whether a removal may happen
|
|
18
|
+
* before it happens asks `removable`, which places nothing.
|
|
14
19
|
*/
|
|
15
|
-
import type { DrivePorts } from './contracts.js';
|
|
20
|
+
import type { DrivePorts, Unit } from './contracts.js';
|
|
16
21
|
import { type Listing } from './listing.js';
|
|
17
22
|
import { type Receipt } from './placements.js';
|
|
18
23
|
import { type Where } from './where.js';
|
|
@@ -21,6 +26,13 @@ export interface Touched {
|
|
|
21
26
|
readonly where: Where;
|
|
22
27
|
readonly placed: readonly Receipt[];
|
|
23
28
|
}
|
|
29
|
+
/** A removal the remover recorded: the drive lists the unit no more. */
|
|
30
|
+
export interface Recorded {
|
|
31
|
+
readonly recorded: Unit;
|
|
32
|
+
/** What the removal placed first: the top of the unit's root, with its
|
|
33
|
+
* sharing policy, when it was not placed. */
|
|
34
|
+
readonly placed: readonly Receipt[];
|
|
35
|
+
}
|
|
24
36
|
export declare class Drive {
|
|
25
37
|
private readonly ports;
|
|
26
38
|
private readonly placements;
|
|
@@ -40,6 +52,37 @@ export declare class Drive {
|
|
|
40
52
|
* that computer moves it. Beneath this computer's own folder there is
|
|
41
53
|
* nothing to change: the drive never shows it. */
|
|
42
54
|
change(path: readonly string[]): Promise<Touched | null>;
|
|
55
|
+
/** A change that removes the directory at this address: a rename onto it.
|
|
56
|
+
* A directory is empty only when the drive shows nothing in it, whatever
|
|
57
|
+
* its shelf holds: a placed folder's directory stands empty on the shelf
|
|
58
|
+
* while its children wait on the map, and removing it would remove them.
|
|
59
|
+
* 'not-empty', placing nothing, when a listing here shows an entry or a
|
|
60
|
+
* door; otherwise as `change`. The shelf's own names the host's removal
|
|
61
|
+
* meets for itself. */
|
|
62
|
+
vacate(path: readonly string[]): Promise<Touched | 'not-empty' | null>;
|
|
63
|
+
/** Whether a removal may happen at this address, placing nothing: false
|
|
64
|
+
* exactly where `change` answers null. */
|
|
65
|
+
removable(path: readonly string[]): Promise<boolean>;
|
|
66
|
+
/** A removal at this address: `unlink`, or `rmdir` as a `directory`, which
|
|
67
|
+
* answers 'not-empty' as `vacate` does. A never-placed unit's ground is its
|
|
68
|
+
* listing, and its removal's result needs none of its bytes, so when the
|
|
69
|
+
* address names a unit of its own (`recordable`) the remover records its
|
|
70
|
+
* Trash at the version listed, placing nothing of it: the drive lists it no
|
|
71
|
+
* more. Whether that removal is shared is its root's sharing policy, which
|
|
72
|
+
* stands with the root's top, so a top not placed yet is placed first, with
|
|
73
|
+
* the reference and folders that lead to it and no other bytes. Anything
|
|
74
|
+
* else, or a unit the remover keeps local, is placed as `change` places it,
|
|
75
|
+
* and the host removes it from the shelf, where Detect records it. */
|
|
76
|
+
remove(path: readonly string[], as: 'file' | 'directory'): Promise<Touched | Recorded | 'not-empty' | null>;
|
|
77
|
+
/** The unit a removal at this judgment records without bytes, or null:
|
|
78
|
+
* listed in a root whose top stands, and the unit itself, not a file its
|
|
79
|
+
* unplaced repository holds, whose bytes and removal travel in that
|
|
80
|
+
* repository's package; the kind removed; and alone in its slot, so its
|
|
81
|
+
* leaving moves no sibling's address. A unit placing now records nothing
|
|
82
|
+
* (placements.ts): its Trash would land under its standing shelf. */
|
|
83
|
+
private recordable;
|
|
84
|
+
/** Places what the judgment needs and judges again; once more each time
|
|
85
|
+
* a removal took a unit it asked for, which the map lists no more. */
|
|
43
86
|
private settle;
|
|
44
87
|
/** Placements in flight now; the activity hook hears the same count. */
|
|
45
88
|
placing(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/drive/drive.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/drive/drive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAA2C,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjF,MAAM,WAAW,OAAO;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC;AAED,wEAAwE;AACxE,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB;iDAC6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC;AAED,qBAAa,KAAK;IAGJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAEX,KAAK,EAAE,UAAU;IAI9C,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;IAI9C,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/C;;;8CAG0C;IACpC,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD;;;;;;sDAMkD;IAC5C,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAK9D;;;;;;2BAMuB;IACjB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,GAAG,WAAW,GAAG,IAAI,CAAC;IAM5E;8CAC0C;IACpC,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAI1D;;;;;;;;;0EASsE;IAChE,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,IAAI,CAAC;IAajH;;;;;yEAKqE;YACvD,UAAU;IASxB;0EACsE;YACxD,MAAM;IAYpB,wEAAwE;IACxE,OAAO,IAAI,MAAM;CAGlB"}
|
package/dist/drive/drive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { listing } from './listing.js';
|
|
2
2
|
import { Placements } from './placements.js';
|
|
3
|
-
import { addressOnly, where } from './where.js';
|
|
3
|
+
import { addressOnly, aloneInSlot, rootOf, where } from './where.js';
|
|
4
4
|
export class Drive {
|
|
5
5
|
ports;
|
|
6
6
|
placements;
|
|
@@ -32,14 +32,94 @@ export class Drive {
|
|
|
32
32
|
const before = await this.where(path);
|
|
33
33
|
return addressOnly(this.ports.roots, path, before) ? null : this.settle(path, before);
|
|
34
34
|
}
|
|
35
|
+
/** A change that removes the directory at this address: a rename onto it.
|
|
36
|
+
* A directory is empty only when the drive shows nothing in it, whatever
|
|
37
|
+
* its shelf holds: a placed folder's directory stands empty on the shelf
|
|
38
|
+
* while its children wait on the map, and removing it would remove them.
|
|
39
|
+
* 'not-empty', placing nothing, when a listing here shows an entry or a
|
|
40
|
+
* door; otherwise as `change`. The shelf's own names the host's removal
|
|
41
|
+
* meets for itself. */
|
|
42
|
+
async vacate(path) {
|
|
43
|
+
const before = await this.where(path);
|
|
44
|
+
if (addressOnly(this.ports.roots, path, before))
|
|
45
|
+
return null;
|
|
46
|
+
return shows(await this.list(path)) ? 'not-empty' : this.settle(path, before);
|
|
47
|
+
}
|
|
48
|
+
/** Whether a removal may happen at this address, placing nothing: false
|
|
49
|
+
* exactly where `change` answers null. */
|
|
50
|
+
async removable(path) {
|
|
51
|
+
return !addressOnly(this.ports.roots, path, await this.where(path));
|
|
52
|
+
}
|
|
53
|
+
/** A removal at this address: `unlink`, or `rmdir` as a `directory`, which
|
|
54
|
+
* answers 'not-empty' as `vacate` does. A never-placed unit's ground is its
|
|
55
|
+
* listing, and its removal's result needs none of its bytes, so when the
|
|
56
|
+
* address names a unit of its own (`recordable`) the remover records its
|
|
57
|
+
* Trash at the version listed, placing nothing of it: the drive lists it no
|
|
58
|
+
* more. Whether that removal is shared is its root's sharing policy, which
|
|
59
|
+
* stands with the root's top, so a top not placed yet is placed first, with
|
|
60
|
+
* the reference and folders that lead to it and no other bytes. Anything
|
|
61
|
+
* else, or a unit the remover keeps local, is placed as `change` places it,
|
|
62
|
+
* and the host removes it from the shelf, where Detect records it. */
|
|
63
|
+
async remove(path, as) {
|
|
64
|
+
const before = await this.where(path);
|
|
65
|
+
if (addressOnly(this.ports.roots, path, before))
|
|
66
|
+
return null;
|
|
67
|
+
if (as === 'directory' && shows(await this.list(path)))
|
|
68
|
+
return 'not-empty';
|
|
69
|
+
const top = throughTop(before);
|
|
70
|
+
const placed = top.length === 0 ? [] : (await this.placements.place(top)).receipts;
|
|
71
|
+
const at = top.length === 0 ? before : await this.where(path);
|
|
72
|
+
const unit = await this.recordable(at, as);
|
|
73
|
+
if (unit !== null && await this.placements.remove(unit, () => this.ports.remover.remove(unit)))
|
|
74
|
+
return { recorded: unit, placed };
|
|
75
|
+
const settled = await this.settle(path, at);
|
|
76
|
+
return placed.length === 0 ? settled : { where: settled.where, placed: [...placed, ...settled.placed] };
|
|
77
|
+
}
|
|
78
|
+
/** The unit a removal at this judgment records without bytes, or null:
|
|
79
|
+
* listed in a root whose top stands, and the unit itself, not a file its
|
|
80
|
+
* unplaced repository holds, whose bytes and removal travel in that
|
|
81
|
+
* repository's package; the kind removed; and alone in its slot, so its
|
|
82
|
+
* leaving moves no sibling's address. A unit placing now records nothing
|
|
83
|
+
* (placements.ts): its Trash would land under its standing shelf. */
|
|
84
|
+
async recordable(at, as) {
|
|
85
|
+
if (at.kind !== 'listed' || throughTop(at).length > 0)
|
|
86
|
+
return null;
|
|
87
|
+
const unit = at.placing.at(-1);
|
|
88
|
+
if (unit?.uuid !== at.entity.uuid)
|
|
89
|
+
return null;
|
|
90
|
+
if ((at.entry.kind === 'directory') !== (as === 'directory'))
|
|
91
|
+
return null;
|
|
92
|
+
const root = await rootOf(this.ports.roots, at.root);
|
|
93
|
+
return root !== null && aloneInSlot(root.map, at.entity) ? unit : null;
|
|
94
|
+
}
|
|
95
|
+
/** Places what the judgment needs and judges again; once more each time
|
|
96
|
+
* a removal took a unit it asked for, which the map lists no more. */
|
|
35
97
|
async settle(path, before) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
98
|
+
const placed = [];
|
|
99
|
+
for (let at = before;;) {
|
|
100
|
+
const placing = 'placing' in at ? at.placing : [];
|
|
101
|
+
if (placing.length === 0)
|
|
102
|
+
return { where: at, placed };
|
|
103
|
+
const { receipts, complete } = await this.placements.place(placing);
|
|
104
|
+
placed.push(...receipts);
|
|
105
|
+
at = await this.where(path);
|
|
106
|
+
if (complete)
|
|
107
|
+
return { where: at, placed };
|
|
108
|
+
}
|
|
39
109
|
}
|
|
40
110
|
/** Placements in flight now; the activity hook hears the same count. */
|
|
41
111
|
placing() {
|
|
42
112
|
return this.placements.count();
|
|
43
113
|
}
|
|
44
114
|
}
|
|
115
|
+
/** The units a listed judgment places through the top of its root, when
|
|
116
|
+
* that top is not placed: the reference that leads there and the folders
|
|
117
|
+
* above it, then the top. Empty when the top stands. */
|
|
118
|
+
function throughTop(at) {
|
|
119
|
+
return at.kind === 'listed' ? at.placing.slice(0, at.placing.findIndex(unit => unit.uuid === at.root) + 1) : [];
|
|
120
|
+
}
|
|
121
|
+
/** Whether a listing shows anything beside the shelf's own names. */
|
|
122
|
+
function shows(listed) {
|
|
123
|
+
return listed.kind === 'entries' && (listed.entries.length > 0 || listed.doors.length > 0);
|
|
124
|
+
}
|
|
45
125
|
//# sourceMappingURL=drive.js.map
|
package/dist/drive/drive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/drive/drive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/drive/drive.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,UAAU,EAAgB,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAc,MAAM,YAAY,CAAC;AAgBjF,MAAM,OAAO,KAAK;IAGa;IAFZ,UAAU,CAAa;IAExC,YAA6B,KAAiB;QAAjB,UAAK,GAAL,KAAK,CAAY;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,IAAuB;QAC3B,OAA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,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drive/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/drive/index.js
CHANGED
package/dist/drive/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drive/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drive/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
* itself. The count of placements in flight is said whole each time it
|
|
14
14
|
* changes, and once at the start: zero, so a drive that has placed nothing
|
|
15
15
|
* is heard idle rather than never heard.
|
|
16
|
+
*
|
|
17
|
+
* A unit is placed or removed, one at a time. A removal that records a unit
|
|
18
|
+
* with none of its bytes records nothing while the unit is placing, and a
|
|
19
|
+
* touch that asks for a unit, or a folder above it, while its removal
|
|
20
|
+
* records waits on that removal: a unit it removed is not there to place,
|
|
21
|
+
* so the touch places nothing more and judges its address again.
|
|
16
22
|
*/
|
|
17
23
|
import { type ActivityHook, type Clock, type PlacerPort, type Unit } from './contracts.js';
|
|
18
24
|
/** One unit asked of the placer for one touch; the folders of its run came
|
|
@@ -28,22 +34,35 @@ export interface PlacementPorts {
|
|
|
28
34
|
readonly clock: Clock;
|
|
29
35
|
readonly activity?: ActivityHook;
|
|
30
36
|
}
|
|
37
|
+
/** What a touch's units placed, and whether every one was asked: false when
|
|
38
|
+
* a removal took one of them, ending the touch before what follows it. */
|
|
39
|
+
export interface Placed {
|
|
40
|
+
readonly receipts: readonly Receipt[];
|
|
41
|
+
readonly complete: boolean;
|
|
42
|
+
}
|
|
31
43
|
export declare class Placements {
|
|
32
44
|
private readonly ports;
|
|
33
45
|
/** Each unit placing now, with the placement it waits on: its own, or
|
|
34
46
|
* that of the unit below it it is placed with. */
|
|
35
47
|
private readonly inFlight;
|
|
48
|
+
/** Each unit a removal records now, with whether it removed the unit. */
|
|
49
|
+
private readonly removing;
|
|
36
50
|
private asked;
|
|
37
51
|
constructor(ports: PlacementPorts);
|
|
38
|
-
/** The units in order; the receipts once the last is placed
|
|
39
|
-
|
|
52
|
+
/** The units in order; the receipts once the last is placed, or once a
|
|
53
|
+
* removal took one of them. */
|
|
54
|
+
place(units: readonly Unit[]): Promise<Placed>;
|
|
55
|
+
/** A removal `record` makes of a unit with none of its bytes, and whether
|
|
56
|
+
* it removed the unit: false, recording nothing, while the unit is placing
|
|
57
|
+
* or another removal of it records. */
|
|
58
|
+
remove(unit: Unit, record: () => Promise<boolean>): Promise<boolean>;
|
|
40
59
|
/** Placements in flight now. */
|
|
41
60
|
count(): number;
|
|
42
61
|
/** One run: the folders above its last unit, then that unit. A placement
|
|
43
62
|
* another touch started that holds any of them is waited on first; one
|
|
44
63
|
* asked for the last unit is this touch's too, and one that holds it as a
|
|
45
64
|
* folder above a deeper unit places it when it finishes. Otherwise the
|
|
46
|
-
* run is asked for itself. */
|
|
65
|
+
* run is asked for itself. Null when a removal took one of them. */
|
|
47
66
|
private ask;
|
|
48
67
|
private end;
|
|
49
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placements.d.ts","sourceRoot":"","sources":["../../src/drive/placements.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"placements.d.ts","sourceRoot":"","sources":["../../src/drive/placements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAc,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEvG;cACc;AACd,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CAClC;AAED;0EAC0E;AAC1E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAWD,qBAAa,UAAU;IAQT,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPlC;sDACkD;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IACvD,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuC;IAChE,OAAO,CAAC,KAAK,CAAK;gBAEW,KAAK,EAAE,cAAc;IAIlD;mCAC+B;IACzB,KAAK,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAepD;;2CAEuC;IACjC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAW1E,gCAAgC;IAChC,KAAK,IAAI,MAAM;IAIf;;;;wEAIoE;YACtD,GAAG;IAoCjB,OAAO,CAAC,GAAG;CAKZ"}
|
package/dist/drive/placements.js
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
* itself. The count of placements in flight is said whole each time it
|
|
14
14
|
* changes, and once at the start: zero, so a drive that has placed nothing
|
|
15
15
|
* is heard idle rather than never heard.
|
|
16
|
+
*
|
|
17
|
+
* A unit is placed or removed, one at a time. A removal that records a unit
|
|
18
|
+
* with none of its bytes records nothing while the unit is placing, and a
|
|
19
|
+
* touch that asks for a unit, or a folder above it, while its removal
|
|
20
|
+
* records waits on that removal: a unit it removed is not there to place,
|
|
21
|
+
* so the touch places nothing more and judges its address again.
|
|
16
22
|
*/
|
|
17
23
|
import { DriveError } from './contracts.js';
|
|
18
24
|
/** Whether a placement finished; its failure is its own waiters' to hear. */
|
|
@@ -22,12 +28,15 @@ export class Placements {
|
|
|
22
28
|
/** Each unit placing now, with the placement it waits on: its own, or
|
|
23
29
|
* that of the unit below it it is placed with. */
|
|
24
30
|
inFlight = new Map();
|
|
31
|
+
/** Each unit a removal records now, with whether it removed the unit. */
|
|
32
|
+
removing = new Map();
|
|
25
33
|
asked = 0;
|
|
26
34
|
constructor(ports) {
|
|
27
35
|
this.ports = ports;
|
|
28
36
|
ports.activity?.(this.asked);
|
|
29
37
|
}
|
|
30
|
-
/** The units in order; the receipts once the last is placed
|
|
38
|
+
/** The units in order; the receipts once the last is placed, or once a
|
|
39
|
+
* removal took one of them. */
|
|
31
40
|
async place(units) {
|
|
32
41
|
const receipts = [];
|
|
33
42
|
let run = [];
|
|
@@ -36,10 +45,28 @@ export class Placements {
|
|
|
36
45
|
const next = units[index + 1];
|
|
37
46
|
if (next !== undefined && unit.type === 'folder' && next.root === unit.root)
|
|
38
47
|
continue;
|
|
39
|
-
|
|
48
|
+
const receipt = await this.ask(run);
|
|
49
|
+
if (receipt === null)
|
|
50
|
+
return { receipts, complete: false };
|
|
51
|
+
receipts.push(receipt);
|
|
40
52
|
run = [];
|
|
41
53
|
}
|
|
42
|
-
return receipts;
|
|
54
|
+
return { receipts, complete: true };
|
|
55
|
+
}
|
|
56
|
+
/** A removal `record` makes of a unit with none of its bytes, and whether
|
|
57
|
+
* it removed the unit: false, recording nothing, while the unit is placing
|
|
58
|
+
* or another removal of it records. */
|
|
59
|
+
async remove(unit, record) {
|
|
60
|
+
if (this.inFlight.has(unit.uuid) || this.removing.has(unit.uuid))
|
|
61
|
+
return false;
|
|
62
|
+
const removal = record();
|
|
63
|
+
this.removing.set(unit.uuid, removal.catch(() => false));
|
|
64
|
+
try {
|
|
65
|
+
return await removal;
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
this.removing.delete(unit.uuid);
|
|
69
|
+
}
|
|
43
70
|
}
|
|
44
71
|
/** Placements in flight now. */
|
|
45
72
|
count() {
|
|
@@ -49,11 +76,17 @@ export class Placements {
|
|
|
49
76
|
* another touch started that holds any of them is waited on first; one
|
|
50
77
|
* asked for the last unit is this touch's too, and one that holds it as a
|
|
51
78
|
* folder above a deeper unit places it when it finishes. Otherwise the
|
|
52
|
-
* run is asked for itself. */
|
|
79
|
+
* run is asked for itself. Null when a removal took one of them. */
|
|
53
80
|
async ask(run) {
|
|
54
81
|
const unit = run[run.length - 1];
|
|
55
82
|
const started = this.ports.clock.now();
|
|
56
83
|
for (;;) {
|
|
84
|
+
const removal = run.map(each => this.removing.get(each.uuid)).find(each => each !== undefined);
|
|
85
|
+
if (removal !== undefined) {
|
|
86
|
+
if (await removal)
|
|
87
|
+
return null;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
57
90
|
const own = this.inFlight.get(unit.uuid);
|
|
58
91
|
if (own?.asked === unit.uuid) {
|
|
59
92
|
await own.outcome;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placements.js","sourceRoot":"","sources":["../../src/drive/placements.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"placements.js","sourceRoot":"","sources":["../../src/drive/placements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,UAAU,EAA6D,MAAM,gBAAgB,CAAC;AA8BvG,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,CAAC,OAAgB,EAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAEvG,MAAM,OAAO,UAAU;IAQQ;IAP7B;sDACkD;IACjC,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IACvD,yEAAyE;IACxD,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,KAAK,GAAG,CAAC,CAAC;IAElB,YAA6B,KAAqB;QAArB,UAAK,GAAL,KAAK,CAAgB;QAChD,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED;mCAC+B;IAC/B,KAAK,CAAC,KAAK,CAAC,KAAsB;QAChC,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,IAAI,GAAG,GAAW,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,IAAI,IAAI,KAAK,SAA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,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The record a removal through the drive makes of a unit this computer never
|
|
3
|
+
* placed. Its ground is its listing, so the removal is proved by the act
|
|
4
|
+
* itself, and its result, Trash, needs none of its bytes: one Detect-shaped
|
|
5
|
+
* status change at the version the map lists, never permanent deletion,
|
|
6
|
+
* recoverable from Trash as any removal is. Live builds it, the host's store
|
|
7
|
+
* appends it in one transaction, and the rail is rung.
|
|
8
|
+
*/
|
|
9
|
+
import type { CloudEntityRecord } from '../entities/cloud.js';
|
|
10
|
+
import type { Sha256Hex } from '../entities/types.js';
|
|
11
|
+
import { type LocalEntityRecord } from '../records/contracts.js';
|
|
12
|
+
import type { EntityRecordStorePort } from '../records/rail-ports.js';
|
|
13
|
+
export interface Removal {
|
|
14
|
+
/** The record the map lists for the unit. The drive removes a folder only
|
|
15
|
+
* when it lists nothing beneath it, so a folder's Trash holds no members. */
|
|
16
|
+
readonly base: CloudEntityRecord;
|
|
17
|
+
readonly authorityId: string;
|
|
18
|
+
/** Stable for every retry of this one act; a new act mints a new id. */
|
|
19
|
+
readonly mutationId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface RemovalRecordStorePort extends Pick<EntityRecordStorePort, 'readEntityCursor'> {
|
|
22
|
+
/** One transaction: insert the pending Outbox row. A removal seals no payload. */
|
|
23
|
+
append(record: LocalEntityRecord, payload: null): Promise<void> | void;
|
|
24
|
+
}
|
|
25
|
+
export interface RemovalRecordPorts {
|
|
26
|
+
readonly store: RemovalRecordStorePort;
|
|
27
|
+
readonly sha256Hex: Sha256Hex;
|
|
28
|
+
readonly now: () => number;
|
|
29
|
+
/** The rail's `localRecordsAvailable`, rung only after the row commits. */
|
|
30
|
+
readonly localRecordsAvailable: () => void;
|
|
31
|
+
}
|
|
32
|
+
/** Records one removal. Null when the base is no longer active, so there is
|
|
33
|
+
* nothing to remove. */
|
|
34
|
+
export declare function recordRemoval(removal: Removal, ports: RemovalRecordPorts): Promise<LocalEntityRecord | null>;
|
|
35
|
+
//# sourceMappingURL=removal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal.d.ts","sourceRoot":"","sources":["../../src/drive/removal.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,WAAW,OAAO;IACtB;iFAC6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,kBAAkB,CAAC;IAC7F,kFAAkF;IAClF,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxE;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,qBAAqB,EAAE,MAAM,IAAI,CAAC;CAC5C;AAED;wBACwB;AACxB,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAgBlH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { trashRemovedEntitiesSteps } from '../detection/removals.js';
|
|
2
|
+
import { detectedChangeProposal } from '../detection/record-proposal.js';
|
|
3
|
+
import { createLocalEntityRecord } from '../records/contracts.js';
|
|
4
|
+
import { finishSteps } from '../steps.js';
|
|
5
|
+
/** Records one removal. Null when the base is no longer active, so there is
|
|
6
|
+
* nothing to remove. */
|
|
7
|
+
export async function recordRemoval(removal, ports) {
|
|
8
|
+
const { base } = removal;
|
|
9
|
+
const result = finishSteps(trashRemovedEntitiesSteps([base], new Set([base.uuid]), ports.sha256Hex)).get(base.uuid);
|
|
10
|
+
if (result === undefined)
|
|
11
|
+
return null;
|
|
12
|
+
const change = detectedChangeProposal({ base, result, replay: { kind: 'structure' }, lifecycleAuthorization: 'trash' });
|
|
13
|
+
if (change === null)
|
|
14
|
+
return null;
|
|
15
|
+
const record = createLocalEntityRecord({
|
|
16
|
+
mutationId: removal.mutationId,
|
|
17
|
+
authorityId: removal.authorityId,
|
|
18
|
+
lastSeenGlobalSequence: await ports.store.readEntityCursor(base.uuid),
|
|
19
|
+
change,
|
|
20
|
+
createdAt: ports.now(),
|
|
21
|
+
});
|
|
22
|
+
await ports.store.append(record, null);
|
|
23
|
+
ports.localRecordsAvailable();
|
|
24
|
+
return record;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=removal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal.js","sourceRoot":"","sources":["../../src/drive/removal.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAA0B,MAAM,yBAAyB,CAAC;AAE1F,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwB1C;wBACwB;AACxB,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAgB,EAAE,KAAyB;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,MAAM,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,MAAM,GAAG,sBAAsB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAC,CAAC;IACxH,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,MAAM,MAAM,GAAG,uBAAuB,CAAC;QACrC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,sBAAsB,EAAE,MAAM,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;QACrE,MAAM;QACN,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;KACvB,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,KAAK,CAAC,qBAAqB,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/drive/where.d.ts
CHANGED
|
@@ -34,12 +34,13 @@ export type Where =
|
|
|
34
34
|
readonly address: readonly string[];
|
|
35
35
|
readonly entity: MapEntity | null;
|
|
36
36
|
}
|
|
37
|
-
/** The map lists
|
|
38
|
-
* `placing` in order, then the shelf speaks. */
|
|
37
|
+
/** The map lists `entity` here, as `entry`, and nothing stands on the
|
|
38
|
+
* shelf. A touch places `placing` in order, then the shelf speaks. */
|
|
39
39
|
| {
|
|
40
40
|
readonly kind: 'listed';
|
|
41
41
|
readonly root: string;
|
|
42
42
|
readonly address: readonly string[];
|
|
43
|
+
readonly entity: MapEntity;
|
|
43
44
|
readonly entry: Entry;
|
|
44
45
|
readonly placing: readonly Unit[];
|
|
45
46
|
}
|
|
@@ -86,6 +87,10 @@ export declare function addressOnly(roots: RootsPort, path: readonly string[], a
|
|
|
86
87
|
* holds that no shared slot can derive is nobody's. Only a shared slot, held
|
|
87
88
|
* or deriving, reads the whole group (`materializedSlotNames`'s law). */
|
|
88
89
|
export declare function childAt(map: MapPort, parentUUID: string, name: string): MapEntity | null;
|
|
90
|
+
/** Whether an entity stands at its bare name in a slot no sibling's name
|
|
91
|
+
* depends on: it alone holds that name, and no shared slot could derive it.
|
|
92
|
+
* Its leaving then moves no other address. */
|
|
93
|
+
export declare function aloneInSlot(map: MapPort, entity: MapEntity): boolean;
|
|
89
94
|
/** Each active child with the name it stands at. */
|
|
90
95
|
export declare function derivedNames(children: readonly MapEntity[]): [MapEntity, string][];
|
|
91
96
|
/** The entry a program sees for a map entity at a name. A reference whose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../src/drive/where.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhF,wEAAwE;AACxE,MAAM,WAAW,KAAK;IACpB,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,SAAS,CA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,CAKzD;AAED,wBAAgB,MAAM,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,EAAE,CAElE"}
|
package/dist/drive/where.js
CHANGED
|
@@ -109,7 +109,7 @@ export async function where(roots, path) {
|
|
|
109
109
|
if (repository)
|
|
110
110
|
covered = true;
|
|
111
111
|
if (last)
|
|
112
|
-
return { kind: 'listed', root, address, entry: entryOf(entity, shown), placing };
|
|
112
|
+
return { kind: 'listed', root, address, entity, entry: entryOf(entity, shown), placing };
|
|
113
113
|
if (!CONTAINERS.has(entity.type))
|
|
114
114
|
return { kind: 'notdir' };
|
|
115
115
|
}
|
|
@@ -175,6 +175,17 @@ export function childAt(map, parentUUID, name) {
|
|
|
175
175
|
}
|
|
176
176
|
return null;
|
|
177
177
|
}
|
|
178
|
+
/** Whether an entity stands at its bare name in a slot no sibling's name
|
|
179
|
+
* depends on: it alone holds that name, and no shared slot could derive it.
|
|
180
|
+
* Its leaving then moves no other address. */
|
|
181
|
+
export function aloneInSlot(map, entity) {
|
|
182
|
+
const parent = entity.parentUUID;
|
|
183
|
+
if (parent === null)
|
|
184
|
+
return false;
|
|
185
|
+
const holders = active(map.holders(parent, entity.name));
|
|
186
|
+
return holders.length === 1 && holders[0]?.uuid === entity.uuid
|
|
187
|
+
&& !collisionBases(entity.name).some(base => active(map.holders(parent, base)).length > 1);
|
|
188
|
+
}
|
|
178
189
|
/** Each active child with the name it stands at. */
|
|
179
190
|
export function derivedNames(children) {
|
|
180
191
|
const derived = materializedSlotNames(children);
|
package/dist/drive/where.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"where.js","sourceRoot":"","sources":["../../src/drive/where.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,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E,OAAO,WAAW,CAAC;IAC7C,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,MAAM,CAAC;IAClE,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,MAAM,CAAC;IAC3D,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,2BAA2B,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,QAA8B;IACnD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/drive/contracts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/drive/contracts.ts"],"names":[],"mappings":";;;AA6JA;iEACiE;AACjE,MAAa,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAuB;IACpC,oCAAoC;IAC3B,IAAI,CAAO;IACpB;sEACkE;IACzD,MAAM,CAAS;IAExB,YAAY,IAA0B,EAAE,OAAe,EAAE,IAAU,EAAE,SAAiB,IAAI,CAAC,IAAI;QAC7F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;sDACkD;IAClD,MAAM,CAAC,IAAI,CAAC,KAAc,EAAE,IAAU;QACpC,IAAI,KAAK,YAAY,UAAU;YAAE,OAAO,KAAK,CAAC;QAC9C,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAkC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxG,MAAM,KAAK,GAAG,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtG,MAAM,OAAO,GAAG,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1G,MAAM,MAAM,GAAG,KAAK,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACjH,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAA4B,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACvG,CAAC;CACF;AA1BD,gCA0BC;AAED,MAAM,aAAa,GAAwB,IAAI,GAAG,CAChD,CAAC,aAAa,EAAE,SAAS,EAAE,OAAO,CAAkC,CACrE,CAAC"}
|
package/dist-cjs/drive/drive.js
CHANGED
|
@@ -35,10 +35,80 @@ class Drive {
|
|
|
35
35
|
const before = await this.where(path);
|
|
36
36
|
return (0, where_js_1.addressOnly)(this.ports.roots, path, before) ? null : this.settle(path, before);
|
|
37
37
|
}
|
|
38
|
+
/** A change that removes the directory at this address: a rename onto it.
|
|
39
|
+
* A directory is empty only when the drive shows nothing in it, whatever
|
|
40
|
+
* its shelf holds: a placed folder's directory stands empty on the shelf
|
|
41
|
+
* while its children wait on the map, and removing it would remove them.
|
|
42
|
+
* 'not-empty', placing nothing, when a listing here shows an entry or a
|
|
43
|
+
* door; otherwise as `change`. The shelf's own names the host's removal
|
|
44
|
+
* meets for itself. */
|
|
45
|
+
async vacate(path) {
|
|
46
|
+
const before = await this.where(path);
|
|
47
|
+
if ((0, where_js_1.addressOnly)(this.ports.roots, path, before))
|
|
48
|
+
return null;
|
|
49
|
+
return shows(await this.list(path)) ? 'not-empty' : this.settle(path, before);
|
|
50
|
+
}
|
|
51
|
+
/** Whether a removal may happen at this address, placing nothing: false
|
|
52
|
+
* exactly where `change` answers null. */
|
|
53
|
+
async removable(path) {
|
|
54
|
+
return !(0, where_js_1.addressOnly)(this.ports.roots, path, await this.where(path));
|
|
55
|
+
}
|
|
56
|
+
/** A removal at this address: `unlink`, or `rmdir` as a `directory`, which
|
|
57
|
+
* answers 'not-empty' as `vacate` does. A never-placed unit's ground is its
|
|
58
|
+
* listing, and its removal's result needs none of its bytes, so when the
|
|
59
|
+
* address names a unit of its own (`recordable`) the remover records its
|
|
60
|
+
* Trash at the version listed, placing nothing of it: the drive lists it no
|
|
61
|
+
* more. Whether that removal is shared is its root's sharing policy, which
|
|
62
|
+
* stands with the root's top, so a top not placed yet is placed first, with
|
|
63
|
+
* the reference and folders that lead to it and no other bytes. Anything
|
|
64
|
+
* else, or a unit the remover keeps local, is placed as `change` places it,
|
|
65
|
+
* and the host removes it from the shelf, where Detect records it. */
|
|
66
|
+
async remove(path, as) {
|
|
67
|
+
const before = await this.where(path);
|
|
68
|
+
if ((0, where_js_1.addressOnly)(this.ports.roots, path, before))
|
|
69
|
+
return null;
|
|
70
|
+
if (as === 'directory' && shows(await this.list(path)))
|
|
71
|
+
return 'not-empty';
|
|
72
|
+
const top = throughTop(before);
|
|
73
|
+
const placed = top.length === 0 ? [] : (await this.placements.place(top)).receipts;
|
|
74
|
+
const at = top.length === 0 ? before : await this.where(path);
|
|
75
|
+
const unit = await this.recordable(at, as);
|
|
76
|
+
if (unit !== null && await this.placements.remove(unit, () => this.ports.remover.remove(unit)))
|
|
77
|
+
return { recorded: unit, placed };
|
|
78
|
+
const settled = await this.settle(path, at);
|
|
79
|
+
return placed.length === 0 ? settled : { where: settled.where, placed: [...placed, ...settled.placed] };
|
|
80
|
+
}
|
|
81
|
+
/** The unit a removal at this judgment records without bytes, or null:
|
|
82
|
+
* listed in a root whose top stands, and the unit itself, not a file its
|
|
83
|
+
* unplaced repository holds, whose bytes and removal travel in that
|
|
84
|
+
* repository's package; the kind removed; and alone in its slot, so its
|
|
85
|
+
* leaving moves no sibling's address. A unit placing now records nothing
|
|
86
|
+
* (placements.ts): its Trash would land under its standing shelf. */
|
|
87
|
+
async recordable(at, as) {
|
|
88
|
+
if (at.kind !== 'listed' || throughTop(at).length > 0)
|
|
89
|
+
return null;
|
|
90
|
+
const unit = at.placing.at(-1);
|
|
91
|
+
if (unit?.uuid !== at.entity.uuid)
|
|
92
|
+
return null;
|
|
93
|
+
if ((at.entry.kind === 'directory') !== (as === 'directory'))
|
|
94
|
+
return null;
|
|
95
|
+
const root = await (0, where_js_1.rootOf)(this.ports.roots, at.root);
|
|
96
|
+
return root !== null && (0, where_js_1.aloneInSlot)(root.map, at.entity) ? unit : null;
|
|
97
|
+
}
|
|
98
|
+
/** Places what the judgment needs and judges again; once more each time
|
|
99
|
+
* a removal took a unit it asked for, which the map lists no more. */
|
|
38
100
|
async settle(path, before) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
101
|
+
const placed = [];
|
|
102
|
+
for (let at = before;;) {
|
|
103
|
+
const placing = 'placing' in at ? at.placing : [];
|
|
104
|
+
if (placing.length === 0)
|
|
105
|
+
return { where: at, placed };
|
|
106
|
+
const { receipts, complete } = await this.placements.place(placing);
|
|
107
|
+
placed.push(...receipts);
|
|
108
|
+
at = await this.where(path);
|
|
109
|
+
if (complete)
|
|
110
|
+
return { where: at, placed };
|
|
111
|
+
}
|
|
42
112
|
}
|
|
43
113
|
/** Placements in flight now; the activity hook hears the same count. */
|
|
44
114
|
placing() {
|
|
@@ -46,4 +116,14 @@ class Drive {
|
|
|
46
116
|
}
|
|
47
117
|
}
|
|
48
118
|
exports.Drive = Drive;
|
|
119
|
+
/** The units a listed judgment places through the top of its root, when
|
|
120
|
+
* that top is not placed: the reference that leads there and the folders
|
|
121
|
+
* above it, then the top. Empty when the top stands. */
|
|
122
|
+
function throughTop(at) {
|
|
123
|
+
return at.kind === 'listed' ? at.placing.slice(0, at.placing.findIndex(unit => unit.uuid === at.root) + 1) : [];
|
|
124
|
+
}
|
|
125
|
+
/** Whether a listing shows anything beside the shelf's own names. */
|
|
126
|
+
function shows(listed) {
|
|
127
|
+
return listed.kind === 'entries' && (listed.entries.length > 0 || listed.doors.length > 0);
|
|
128
|
+
}
|
|
49
129
|
//# sourceMappingURL=drive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/drive/drive.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/drive/drive.ts"],"names":[],"mappings":";;;AAoBA,6CAAqD;AACrD,mDAA2D;AAC3D,yCAAiF;AAgBjF,MAAa,KAAK;IAGa;IAFZ,UAAU,CAAa;IAExC,YAA6B,KAAiB;QAAjB,UAAK,GAAL,KAAK,CAAY;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,0BAAU,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,IAAuB;QAC3B,OAAO,IAAA,gBAAK,EAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,IAAuB;QAC1B,OAAO,IAAA,oBAAO,EAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;8CAG0C;IAC1C,KAAK,CAAC,KAAK,CAAC,IAAuB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;sDAM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AC,CAAC;YAC5B,IAAI,QAAQ;gBAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;CACF;AA9GD,sBA8GC;AAED;;wDAEwD;AACxD,SAAS,UAAU,CAAC,EAAS;IAC3B,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClH,CAAC;AAED,qEAAqE;AACrE,SAAS,KAAK,CAAC,MAAe;IAC5B,OAAO,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC7F,CAAC"}
|
package/dist-cjs/drive/index.js
CHANGED
|
@@ -25,5 +25,6 @@ __exportStar(require("./where.js"), exports);
|
|
|
25
25
|
__exportStar(require("./listing.js"), exports);
|
|
26
26
|
__exportStar(require("./placements.js"), exports);
|
|
27
27
|
__exportStar(require("./drive.js"), exports);
|
|
28
|
+
__exportStar(require("./removal.js"), exports);
|
|
28
29
|
__exportStar(require("./map-index.js"), exports);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drive/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,iDAA+B;AAC/B,6CAA2B;AAC3B,+CAA6B;AAC7B,kDAAgC;AAChC,6CAA2B;AAC3B,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drive/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,iDAA+B;AAC/B,6CAA2B;AAC3B,+CAA6B;AAC7B,kDAAgC;AAChC,6CAA2B;AAC3B,+CAA6B;AAC7B,iDAA+B"}
|
|
@@ -16,6 +16,12 @@ exports.Placements = void 0;
|
|
|
16
16
|
* itself. The count of placements in flight is said whole each time it
|
|
17
17
|
* changes, and once at the start: zero, so a drive that has placed nothing
|
|
18
18
|
* is heard idle rather than never heard.
|
|
19
|
+
*
|
|
20
|
+
* A unit is placed or removed, one at a time. A removal that records a unit
|
|
21
|
+
* with none of its bytes records nothing while the unit is placing, and a
|
|
22
|
+
* touch that asks for a unit, or a folder above it, while its removal
|
|
23
|
+
* records waits on that removal: a unit it removed is not there to place,
|
|
24
|
+
* so the touch places nothing more and judges its address again.
|
|
19
25
|
*/
|
|
20
26
|
const contracts_js_1 = require("./contracts.js");
|
|
21
27
|
/** Whether a placement finished; its failure is its own waiters' to hear. */
|
|
@@ -25,12 +31,15 @@ class Placements {
|
|
|
25
31
|
/** Each unit placing now, with the placement it waits on: its own, or
|
|
26
32
|
* that of the unit below it it is placed with. */
|
|
27
33
|
inFlight = new Map();
|
|
34
|
+
/** Each unit a removal records now, with whether it removed the unit. */
|
|
35
|
+
removing = new Map();
|
|
28
36
|
asked = 0;
|
|
29
37
|
constructor(ports) {
|
|
30
38
|
this.ports = ports;
|
|
31
39
|
ports.activity?.(this.asked);
|
|
32
40
|
}
|
|
33
|
-
/** The units in order; the receipts once the last is placed
|
|
41
|
+
/** The units in order; the receipts once the last is placed, or once a
|
|
42
|
+
* removal took one of them. */
|
|
34
43
|
async place(units) {
|
|
35
44
|
const receipts = [];
|
|
36
45
|
let run = [];
|
|
@@ -39,10 +48,28 @@ class Placements {
|
|
|
39
48
|
const next = units[index + 1];
|
|
40
49
|
if (next !== undefined && unit.type === 'folder' && next.root === unit.root)
|
|
41
50
|
continue;
|
|
42
|
-
|
|
51
|
+
const receipt = await this.ask(run);
|
|
52
|
+
if (receipt === null)
|
|
53
|
+
return { receipts, complete: false };
|
|
54
|
+
receipts.push(receipt);
|
|
43
55
|
run = [];
|
|
44
56
|
}
|
|
45
|
-
return receipts;
|
|
57
|
+
return { receipts, complete: true };
|
|
58
|
+
}
|
|
59
|
+
/** A removal `record` makes of a unit with none of its bytes, and whether
|
|
60
|
+
* it removed the unit: false, recording nothing, while the unit is placing
|
|
61
|
+
* or another removal of it records. */
|
|
62
|
+
async remove(unit, record) {
|
|
63
|
+
if (this.inFlight.has(unit.uuid) || this.removing.has(unit.uuid))
|
|
64
|
+
return false;
|
|
65
|
+
const removal = record();
|
|
66
|
+
this.removing.set(unit.uuid, removal.catch(() => false));
|
|
67
|
+
try {
|
|
68
|
+
return await removal;
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
this.removing.delete(unit.uuid);
|
|
72
|
+
}
|
|
46
73
|
}
|
|
47
74
|
/** Placements in flight now. */
|
|
48
75
|
count() {
|
|
@@ -52,11 +79,17 @@ class Placements {
|
|
|
52
79
|
* another touch started that holds any of them is waited on first; one
|
|
53
80
|
* asked for the last unit is this touch's too, and one that holds it as a
|
|
54
81
|
* folder above a deeper unit places it when it finishes. Otherwise the
|
|
55
|
-
* run is asked for itself. */
|
|
82
|
+
* run is asked for itself. Null when a removal took one of them. */
|
|
56
83
|
async ask(run) {
|
|
57
84
|
const unit = run[run.length - 1];
|
|
58
85
|
const started = this.ports.clock.now();
|
|
59
86
|
for (;;) {
|
|
87
|
+
const removal = run.map(each => this.removing.get(each.uuid)).find(each => each !== undefined);
|
|
88
|
+
if (removal !== undefined) {
|
|
89
|
+
if (await removal)
|
|
90
|
+
return null;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
60
93
|
const own = this.inFlight.get(unit.uuid);
|
|
61
94
|
if (own?.asked === unit.uuid) {
|
|
62
95
|
await own.outcome;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placements.js","sourceRoot":"","sources":["../../src/drive/placements.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"placements.js","sourceRoot":"","sources":["../../src/drive/placements.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iDAAuG;AA8BvG,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,CAAC,OAAgB,EAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAEvG,MAAa,UAAU;IAQQ;IAP7B;sDACkD;IACjC,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IACvD,yEAAyE;IACxD,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,KAAK,GAAG,CAAC,CAAC;IAElB,YAA6B,KAAqB;QAArB,UAAK,GAAL,KAAK,CAAgB;QAChD,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED;mCAC+B;IAC/B,KAAK,CAAC,KAAK,CAAC,KAAsB;QAChC,MAAM,QAAQ,GAAc,EAAE,CAAC;QAC/B,IAAI,GAAG,GAAW,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;gBAAE,SAAS;YACtF,MAAM,OAAO,GAAG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
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recordRemoval = recordRemoval;
|
|
4
|
+
const removals_js_1 = require("../detection/removals.js");
|
|
5
|
+
const record_proposal_js_1 = require("../detection/record-proposal.js");
|
|
6
|
+
const contracts_js_1 = require("../records/contracts.js");
|
|
7
|
+
const steps_js_1 = require("../steps.js");
|
|
8
|
+
/** Records one removal. Null when the base is no longer active, so there is
|
|
9
|
+
* nothing to remove. */
|
|
10
|
+
async function recordRemoval(removal, ports) {
|
|
11
|
+
const { base } = removal;
|
|
12
|
+
const result = (0, steps_js_1.finishSteps)((0, removals_js_1.trashRemovedEntitiesSteps)([base], new Set([base.uuid]), ports.sha256Hex)).get(base.uuid);
|
|
13
|
+
if (result === undefined)
|
|
14
|
+
return null;
|
|
15
|
+
const change = (0, record_proposal_js_1.detectedChangeProposal)({ base, result, replay: { kind: 'structure' }, lifecycleAuthorization: 'trash' });
|
|
16
|
+
if (change === null)
|
|
17
|
+
return null;
|
|
18
|
+
const record = (0, contracts_js_1.createLocalEntityRecord)({
|
|
19
|
+
mutationId: removal.mutationId,
|
|
20
|
+
authorityId: removal.authorityId,
|
|
21
|
+
lastSeenGlobalSequence: await ports.store.readEntityCursor(base.uuid),
|
|
22
|
+
change,
|
|
23
|
+
createdAt: ports.now(),
|
|
24
|
+
});
|
|
25
|
+
await ports.store.append(record, null);
|
|
26
|
+
ports.localRecordsAvailable();
|
|
27
|
+
return record;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=removal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal.js","sourceRoot":"","sources":["../../src/drive/removal.ts"],"names":[],"mappings":";;AAwCA,sCAgBC;AA9CD,0DAAqE;AACrE,wEAAyE;AACzE,0DAA0F;AAE1F,0CAA0C;AAwB1C;wBACwB;AACjB,KAAK,UAAU,aAAa,CAAC,OAAgB,EAAE,KAAyB;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,MAAM,GAAG,IAAA,sBAAW,EAAC,IAAA,uCAAyB,EAAC,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,MAAM,GAAG,IAAA,2CAAsB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAC,CAAC;IACxH,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,MAAM,MAAM,GAAG,IAAA,sCAAuB,EAAC;QACrC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,sBAAsB,EAAE,MAAM,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;QACrE,MAAM;QACN,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;KACvB,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,KAAK,CAAC,qBAAqB,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist-cjs/drive/where.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.where = where;
|
|
|
4
4
|
exports.rootOf = rootOf;
|
|
5
5
|
exports.addressOnly = addressOnly;
|
|
6
6
|
exports.childAt = childAt;
|
|
7
|
+
exports.aloneInSlot = aloneInSlot;
|
|
7
8
|
exports.derivedNames = derivedNames;
|
|
8
9
|
exports.entryOf = entryOf;
|
|
9
10
|
exports.kindOf = kindOf;
|
|
@@ -119,7 +120,7 @@ async function where(roots, path) {
|
|
|
119
120
|
if (repository)
|
|
120
121
|
covered = true;
|
|
121
122
|
if (last)
|
|
122
|
-
return { kind: 'listed', root, address, entry: entryOf(entity, shown), placing };
|
|
123
|
+
return { kind: 'listed', root, address, entity, entry: entryOf(entity, shown), placing };
|
|
123
124
|
if (!types_js_1.CONTAINERS.has(entity.type))
|
|
124
125
|
return { kind: 'notdir' };
|
|
125
126
|
}
|
|
@@ -185,6 +186,17 @@ function childAt(map, parentUUID, name) {
|
|
|
185
186
|
}
|
|
186
187
|
return null;
|
|
187
188
|
}
|
|
189
|
+
/** Whether an entity stands at its bare name in a slot no sibling's name
|
|
190
|
+
* depends on: it alone holds that name, and no shared slot could derive it.
|
|
191
|
+
* Its leaving then moves no other address. */
|
|
192
|
+
function aloneInSlot(map, entity) {
|
|
193
|
+
const parent = entity.parentUUID;
|
|
194
|
+
if (parent === null)
|
|
195
|
+
return false;
|
|
196
|
+
const holders = active(map.holders(parent, entity.name));
|
|
197
|
+
return holders.length === 1 && holders[0]?.uuid === entity.uuid
|
|
198
|
+
&& !(0, rules_js_1.collisionBases)(entity.name).some(base => active(map.holders(parent, base)).length > 1);
|
|
199
|
+
}
|
|
188
200
|
/** Each active child with the name it stands at. */
|
|
189
201
|
function derivedNames(children) {
|
|
190
202
|
const derived = (0, rules_js_1.materializedSlotNames)(children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"where.js","sourceRoot":"","sources":["../../src/drive/where.ts"],"names":[],"mappings":";;AAgGA,sBAsEC;AAID,wBAEC;AAoBD,kCAIC;AAMD,0BAQC;AAGD,oCAGC;AAKD,0BAaC;AAKD,wBAKC;AAED,wBAEC;
|
|
1
|
+
{"version":3,"file":"where.js","sourceRoot":"","sources":["../../src/drive/where.ts"],"names":[],"mappings":";;AAgGA,sBAsEC;AAID,wBAEC;AAoBD,kCAIC;AAMD,0BAQC;AAKD,kCAMC;AAGD,oCAGC;AAKD,0BAaC;AAKD,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I;QACJ,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI;QACxD,MAAM;QACN,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC;AACJ,CAAC;AAED;;uBAEuB;AACvB,SAAgB,MAAM,CAAC,IAAuB;IAC5C,IAAI,qBAAU,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,WAAW,CAAC;IAC7C,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,aAAa;QAAE,OAAO,MAAM,CAAC;IAClE,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,MAAM,CAAC;IAC3D,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,2BAA2B,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,MAAM,CAAC,QAA8B;IACnD,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amalgm/live",
|
|
3
|
-
"version": "0.2.81-main.
|
|
3
|
+
"version": "0.2.81-main.42147386482",
|
|
4
4
|
"description": "Portable realtime SDK for Amalgm — wire contracts, mutation discipline, and delivery state machines behind host-injected adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-cjs/index.js",
|
|
@@ -110,13 +110,13 @@
|
|
|
110
110
|
]
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
-
"@amalgm/core": "0.5.1-main.
|
|
113
|
+
"@amalgm/core": "0.5.1-main.42135462570"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "b88c89d1a4340befec69c153304571bd5f0b6545",
|
|
116
116
|
"amalgmSource": {
|
|
117
117
|
"repository": "amalgm-inc/amalgm-live",
|
|
118
118
|
"branch": "main",
|
|
119
|
-
"commit": "
|
|
120
|
-
"occurrence": "
|
|
119
|
+
"commit": "b88c89d1a4340befec69c153304571bd5f0b6545",
|
|
120
|
+
"occurrence": "42147386482"
|
|
121
121
|
}
|
|
122
122
|
}
|