@amalgm/shell 0.1.164-main.42033196669 → 0.1.164-main.42054328268
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/cloud-files/contents.d.ts +3 -0
- package/dist/drive/cloud-files/contents.js +31 -2
- package/dist/drive/cloud-files/contents.js.map +1 -1
- package/dist/entity-grant-watch.d.ts +4 -5
- package/dist/entity-grant-watch.js +11 -41
- package/dist/entity-grant-watch.js.map +1 -1
- package/dist/native/cloud-files.node +0 -0
- package/dist/native/windows-fs.node +0 -0
- package/dist/user-ground-host.d.ts +10 -0
- package/dist/user-ground-host.js +35 -3
- package/dist/user-ground-host.js.map +1 -1
- package/dist/wire-join.d.ts +19 -0
- package/dist/wire-join.js +54 -0
- package/dist/wire-join.js.map +1 -0
- package/npm-shrinkwrap.json +45 -36
- package/package.json +11 -11
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* listing places each (`linkAt`) and makes it beside the placeholders, never
|
|
15
15
|
* a placeholder itself (asks.ts). One link that cannot be placed now keeps
|
|
16
16
|
* no other name from showing, and is made after the listing (reconcile.ts).
|
|
17
|
+
* A reference into a root this person holds stands on the shelf as a link,
|
|
18
|
+
* but the drive shows that root inline where it stands: it is a folder, as
|
|
19
|
+
* every computer's look says, never a link to place.
|
|
17
20
|
*/
|
|
18
21
|
import { type Stats } from "node:fs";
|
|
19
22
|
import type { Drive } from "@amalgm/live/drive";
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* listing places each (`linkAt`) and makes it beside the placeholders, never
|
|
15
15
|
* a placeholder itself (asks.ts). One link that cannot be placed now keeps
|
|
16
16
|
* no other name from showing, and is made after the listing (reconcile.ts).
|
|
17
|
+
* A reference into a root this person holds stands on the shelf as a link,
|
|
18
|
+
* but the drive shows that root inline where it stands: it is a folder, as
|
|
19
|
+
* every computer's look says, never a link to place.
|
|
17
20
|
*/
|
|
18
21
|
import { lstatSync, statSync } from "node:fs";
|
|
19
22
|
import { addressOf, errno } from "../operations.js";
|
|
@@ -57,8 +60,13 @@ export async function contents(serving, at, mounted) {
|
|
|
57
60
|
continue;
|
|
58
61
|
throw error;
|
|
59
62
|
}
|
|
60
|
-
if (stats.isSymbolicLink())
|
|
61
|
-
|
|
63
|
+
if (stats.isSymbolicLink()) {
|
|
64
|
+
const into = await entered(serving, at, name, listed.root, mounted);
|
|
65
|
+
if (into === null)
|
|
66
|
+
links.push(name);
|
|
67
|
+
else
|
|
68
|
+
items.push(into);
|
|
69
|
+
}
|
|
62
70
|
else if (stats.isDirectory())
|
|
63
71
|
items.push(folder(name, stats.mtimeMs, stats.birthtimeMs));
|
|
64
72
|
else if (stats.isFile())
|
|
@@ -94,6 +102,27 @@ export const placed = (name, stats) => ({
|
|
|
94
102
|
const folder = (name, mtimeMs, birthtimeMs = mtimeMs) => ({
|
|
95
103
|
name, directory: true, size: 0, mtimeMs, birthtimeMs, identity: identityText({ v: null, s: null }),
|
|
96
104
|
});
|
|
105
|
+
/** The folder a shelf link in a folder at a drive path stands for when the
|
|
106
|
+
* drive leads through it into a root other than `root`, the folder's own:
|
|
107
|
+
* the root it enters, at its shelf's times, or the mount's while nothing
|
|
108
|
+
* stands there. Null for a link the drive shows as itself. */
|
|
109
|
+
async function entered(serving, at, name, root, mounted) {
|
|
110
|
+
const where = await serving.drive.where(addressOf(childOf(at, name)));
|
|
111
|
+
if (where.kind === "listed")
|
|
112
|
+
return where.root !== root && where.entry.kind === "directory" ? folder(name, mounted.getTime()) : null;
|
|
113
|
+
if (where.kind !== "shelf" || where.root === root)
|
|
114
|
+
return null;
|
|
115
|
+
let stats;
|
|
116
|
+
try {
|
|
117
|
+
stats = statSync(serving.shelf(where.root).path(where.address));
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (missing(error))
|
|
121
|
+
return null;
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
return stats.isDirectory() ? folder(name, stats.mtimeMs, stats.birthtimeMs) : null;
|
|
125
|
+
}
|
|
97
126
|
/** The link a folder at a drive path shows by name, placed, as the sync root
|
|
98
127
|
* makes it: its own target text, and the kind of what that target is on the
|
|
99
128
|
* shelf, a file when nothing stands there. Rejects as its placement does. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contents.js","sourceRoot":"","sources":["../../../src/drive/cloud-files/contents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contents.js","sourceRoot":"","sources":["../../../src/drive/cloud-files/contents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAc,MAAM,SAAS,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAwB,MAAM,kBAAkB,CAAC;AAG1E,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAyBnE;;;0BAG0B;AAC1B,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAgB,EAAE,EAAU,EAAE,OAAa;IACxE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAClC,MAAM,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK;YAAE,MAAM,UAAU,CAAC,KAAK,CAAC,OAAO,CAA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,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrF,CAAC;AAED;;6EAE6E;AAC7E,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAgB,EAAE,EAAU,EAAE,IAAY;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;QAAE,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,CAAC;QAAC,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,qCAAqC,CAAC,CAAC;IAC1I,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The one watch this computer keeps on its own grant signal. The authority
|
|
3
|
-
* holds a watch per socket, so a dropped wire ends it. The watch is asked
|
|
4
|
-
* the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* background: a computer with no network starts, and joins when one returns.
|
|
3
|
+
* holds a watch per socket, so a dropped wire ends it. The watch is asked on
|
|
4
|
+
* every join of the wire (wire-join.ts), and what the gap hid (at start,
|
|
5
|
+
* everything) is read again by saying "gap" only after the new watch stands,
|
|
6
|
+
* so no signal falls between.
|
|
8
7
|
*/
|
|
9
8
|
import type { EntityAccessWirePort, GrantSignal } from "./entity-access-wire.js";
|
|
10
9
|
export declare function watchGrantSignals(wire: EntityAccessWirePort, listener: (signal: GrantSignal) => void): () => void;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The one watch this computer keeps on its own grant signal. The authority
|
|
3
|
-
* holds a watch per socket, so a dropped wire ends it. The watch is asked
|
|
4
|
-
* the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* background: a computer with no network starts, and joins when one returns.
|
|
3
|
+
* holds a watch per socket, so a dropped wire ends it. The watch is asked on
|
|
4
|
+
* every join of the wire (wire-join.ts), and what the gap hid (at start,
|
|
5
|
+
* everything) is read again by saying "gap" only after the new watch stands,
|
|
6
|
+
* so no signal falls between.
|
|
8
7
|
*/
|
|
9
|
-
import {
|
|
8
|
+
import { askOnEveryJoin } from "./wire-join.js";
|
|
10
9
|
const isGrantFrame = (frame) => typeof frame === "object" && frame !== null && frame.type === "entity.grant.changed";
|
|
11
10
|
export function watchGrantSignals(wire, listener) {
|
|
12
|
-
const ask = () => wire.request({ type: "entity.access.watch" }, ["entity.access.watching"]);
|
|
13
11
|
const stopFrames = wire.onFrame((frame) => {
|
|
14
12
|
if (!isGrantFrame(frame))
|
|
15
13
|
return;
|
|
@@ -18,42 +16,14 @@ export function watchGrantSignals(wire, listener) {
|
|
|
18
16
|
revoked: frame.revoked === true,
|
|
19
17
|
});
|
|
20
18
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (joining) {
|
|
27
|
-
droppedAgain = true;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
joining = true;
|
|
31
|
-
let delay = ENTITY_RECORD_RETRY_BASE_MS;
|
|
32
|
-
while (!stopped) {
|
|
33
|
-
droppedAgain = false;
|
|
34
|
-
const answered = await ask().then(() => true, () => false);
|
|
35
|
-
if (answered && !droppedAgain)
|
|
36
|
-
break;
|
|
37
|
-
if (answered)
|
|
38
|
-
continue;
|
|
39
|
-
await new Promise((resolve) => {
|
|
40
|
-
retry = setTimeout(resolve, delay);
|
|
41
|
-
retry.unref();
|
|
42
|
-
});
|
|
43
|
-
delay = Math.min(delay * 2, ENTITY_RECORD_RETRY_MAX_MS);
|
|
44
|
-
}
|
|
45
|
-
joining = false;
|
|
46
|
-
if (!stopped)
|
|
47
|
-
listener({ entityId: null, revoked: false });
|
|
48
|
-
};
|
|
49
|
-
const stopDrops = wire.onDisconnect(() => void join());
|
|
50
|
-
void join();
|
|
19
|
+
const stopJoins = askOnEveryJoin({
|
|
20
|
+
onDisconnect: (heard) => wire.onDisconnect(heard),
|
|
21
|
+
ask: () => wire.request({ type: "entity.access.watch" }, ["entity.access.watching"]),
|
|
22
|
+
answered: () => listener({ entityId: null, revoked: false }),
|
|
23
|
+
});
|
|
51
24
|
return () => {
|
|
52
|
-
|
|
53
|
-
if (retry)
|
|
54
|
-
clearTimeout(retry);
|
|
25
|
+
stopJoins();
|
|
55
26
|
stopFrames();
|
|
56
|
-
stopDrops();
|
|
57
27
|
};
|
|
58
28
|
}
|
|
59
29
|
//# sourceMappingURL=entity-grant-watch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-grant-watch.js","sourceRoot":"","sources":["../src/entity-grant-watch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"entity-grant-watch.js","sourceRoot":"","sources":["../src/entity-grant-watch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuD,EAAE,CAC3F,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAA4B,CAAC,IAAI,KAAK,sBAAsB,CAAC;AAE/G,MAAM,UAAU,iBAAiB,CAC/B,IAA0B,EAC1B,QAAuC;IAEvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACxC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAAE,OAAO;QACjC,QAAQ,CAAC;YACP,QAAQ,EAAE,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;YACtE,OAAO,EAAE,KAAK,CAAC,OAAO,KAAK,IAAI;SAChC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,cAAc,CAAC;QAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QACjD,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,EAAE,CAAC,wBAAwB,CAAC,CAAC;QACpF,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC7D,CAAC,CAAC;IACH,OAAO,GAAG,EAAE;QACV,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
Binary file
|
|
Binary file
|
|
@@ -303,6 +303,7 @@ export declare class UserGroundHost {
|
|
|
303
303
|
private constructLedger;
|
|
304
304
|
private constructDoor;
|
|
305
305
|
private releaseGrantWatch;
|
|
306
|
+
private releaseHeadWatch;
|
|
306
307
|
private applyRail;
|
|
307
308
|
private applyHost;
|
|
308
309
|
/** The last placement of accepted declarations (reference-placement.ts);
|
|
@@ -434,6 +435,9 @@ export declare class UserGroundHost {
|
|
|
434
435
|
/** Records arrived, or these entities' O rows changed: every map reads
|
|
435
436
|
* the received prefix again and takes each entity where it stands now. */
|
|
436
437
|
private wakeDriveMaps;
|
|
438
|
+
/** What every map lists may have changed at no new position: each loads
|
|
439
|
+
* again. */
|
|
440
|
+
private reloadDriveMaps;
|
|
437
441
|
private closeDriveMaps;
|
|
438
442
|
private wakeObservedApply;
|
|
439
443
|
/** A Detect dependency is a request, never a hope. It is made in the same
|
|
@@ -885,6 +889,12 @@ export declare class UserGroundHost {
|
|
|
885
889
|
* rows standing now: a later one is its Register's, which submits and
|
|
886
890
|
* places it itself. */
|
|
887
891
|
private resolveLeftDeclarations;
|
|
892
|
+
/** A Register on another computer publishes only the graph head, which no
|
|
893
|
+
* delivery announces, and placed ground reads no head to start. So the
|
|
894
|
+
* head is read in the background once ready and on every join of the wire
|
|
895
|
+
* (wire-join.ts), and a newer one reloads the drive (keepGraphHead). A
|
|
896
|
+
* computer that stays connected hears the next one at its next join. */
|
|
897
|
+
private watchGraphHead;
|
|
888
898
|
/** AV: the authority's current head H plus every accepted result Receive
|
|
889
899
|
* has delivered after its watermark M. The head is read fresh, because a
|
|
890
900
|
* graph-head commit is never an entity delivery. `beyond` is a delivery a
|
package/dist/user-ground-host.js
CHANGED
|
@@ -79,6 +79,7 @@ import { beginGroundWait, GroundCoordinator, GroundEffectCrossedError, GroundFoo
|
|
|
79
79
|
import { physicalPath } from "./sync-address.js";
|
|
80
80
|
import { readAcceptedTail } from "./accepted-tail.js";
|
|
81
81
|
import { readDeliveryReceipt, readGraphBasis, readNewestGraphHead } from "./graph-heads.js";
|
|
82
|
+
import { askOnEveryJoin } from "./wire-join.js";
|
|
82
83
|
import { AcceptedFold } from "./accepted-fold.js";
|
|
83
84
|
import { journaledDeclaration, readDeclarationJournal } from "./declaration-journal.js";
|
|
84
85
|
import { acceptedView, derivePublication } from "./graph-publication.js";
|
|
@@ -258,6 +259,7 @@ export class UserGroundHost {
|
|
|
258
259
|
constructLedger = null;
|
|
259
260
|
constructDoor = null;
|
|
260
261
|
releaseGrantWatch = null;
|
|
262
|
+
releaseHeadWatch = null;
|
|
261
263
|
applyRail = null;
|
|
262
264
|
applyHost = null;
|
|
263
265
|
/** The last placement of accepted declarations (reference-placement.ts);
|
|
@@ -485,6 +487,7 @@ export class UserGroundHost {
|
|
|
485
487
|
// before the stop still owes its way in core, which it holds W until
|
|
486
488
|
// placed.
|
|
487
489
|
this.resolveLeftDeclarations(this.activeIdentity, this.authorityId);
|
|
490
|
+
this.watchGraphHead(this.activeIdentity, this.authorityId);
|
|
488
491
|
// Native rings collected while convergence was establishing Watch
|
|
489
492
|
// coverage are ordinary evidence, not a startup exception. They get
|
|
490
493
|
// one Detect generation now that Apply recovery is authoritative.
|
|
@@ -708,6 +711,13 @@ export class UserGroundHost {
|
|
|
708
711
|
void map.refresh(uuids).catch((error) => this.options.onBackgroundError?.(error));
|
|
709
712
|
}
|
|
710
713
|
}
|
|
714
|
+
/** What every map lists may have changed at no new position: each loads
|
|
715
|
+
* again. */
|
|
716
|
+
reloadDriveMaps() {
|
|
717
|
+
for (const map of this.driveMaps.values())
|
|
718
|
+
map.drop();
|
|
719
|
+
this.wakeDriveMaps();
|
|
720
|
+
}
|
|
711
721
|
closeDriveMaps() {
|
|
712
722
|
for (const map of this.driveMaps.values())
|
|
713
723
|
map.drop();
|
|
@@ -1989,9 +1999,7 @@ export class UserGroundHost {
|
|
|
1989
1999
|
this.applyRail?.capabilityChanged();
|
|
1990
2000
|
this.applyRail?.localStateChanged();
|
|
1991
2001
|
// An Add admits a whole root's rows at once: every map loads again.
|
|
1992
|
-
|
|
1993
|
-
map.drop();
|
|
1994
|
-
this.wakeDriveMaps();
|
|
2002
|
+
this.reloadDriveMaps();
|
|
1995
2003
|
}
|
|
1996
2004
|
async startRecordRail(identity) {
|
|
1997
2005
|
if (!this.authorityId)
|
|
@@ -2425,6 +2433,8 @@ export class UserGroundHost {
|
|
|
2425
2433
|
await attempt(() => this.ownedWire?.dispose());
|
|
2426
2434
|
this.releaseGrantWatch?.();
|
|
2427
2435
|
this.releaseGrantWatch = null;
|
|
2436
|
+
this.releaseHeadWatch?.();
|
|
2437
|
+
this.releaseHeadWatch = null;
|
|
2428
2438
|
this.entityAccess = null;
|
|
2429
2439
|
this.constructLedger = null;
|
|
2430
2440
|
this.constructDoor = null;
|
|
@@ -2870,6 +2880,8 @@ export class UserGroundHost {
|
|
|
2870
2880
|
async keepGraphHead(frame, head) {
|
|
2871
2881
|
if (head.graph.checksum() !== head.checksum)
|
|
2872
2882
|
throw new Error("cloud registry head does not match its checksum");
|
|
2883
|
+
const database = groundDatabase(this.databasePath());
|
|
2884
|
+
const newest = readNewestGraphHead(database, head.resourceId)?.checksum;
|
|
2873
2885
|
await save(this.databasePath(), "record.keepGraphHead", {
|
|
2874
2886
|
authorityId: head.resourceId,
|
|
2875
2887
|
deliveryWatermark: head.deliveryWatermark,
|
|
@@ -2877,6 +2889,10 @@ export class UserGroundHost {
|
|
|
2877
2889
|
snapshot: Buffer.from(String(frame.snapshot_b64 || ""), "base64"),
|
|
2878
2890
|
checksum: head.checksum,
|
|
2879
2891
|
});
|
|
2892
|
+
// A head the drive reads moved with no delivery (a Register sends none),
|
|
2893
|
+
// so no position wakes the maps.
|
|
2894
|
+
if (readNewestGraphHead(database, head.resourceId)?.checksum !== newest)
|
|
2895
|
+
this.reloadDriveMaps();
|
|
2880
2896
|
}
|
|
2881
2897
|
/** The authority's stored snapshot as this machine's graph. A head is held
|
|
2882
2898
|
* lazily — no page is read until an operation asks for a root — and every
|
|
@@ -5135,6 +5151,22 @@ export class UserGroundHost {
|
|
|
5135
5151
|
};
|
|
5136
5152
|
attempt();
|
|
5137
5153
|
}
|
|
5154
|
+
/** A Register on another computer publishes only the graph head, which no
|
|
5155
|
+
* delivery announces, and placed ground reads no head to start. So the
|
|
5156
|
+
* head is read in the background once ready and on every join of the wire
|
|
5157
|
+
* (wire-join.ts), and a newer one reloads the drive (keepGraphHead). A
|
|
5158
|
+
* computer that stays connected hears the next one at its next join. */
|
|
5159
|
+
watchGraphHead(identity, resourceId) {
|
|
5160
|
+
this.releaseHeadWatch = askOnEveryJoin({
|
|
5161
|
+
onDisconnect: (heard) => this.wire.onDisconnect(heard),
|
|
5162
|
+
ask: () => this.operation(() => this.readHead(identity, resourceId, { kind: "none" })),
|
|
5163
|
+
failed: (error) => {
|
|
5164
|
+
if (this.closing || this.wire.signal.aborted)
|
|
5165
|
+
return;
|
|
5166
|
+
this.options.onBackgroundError?.(error instanceof Error ? error : new Error(String(error)));
|
|
5167
|
+
},
|
|
5168
|
+
});
|
|
5169
|
+
}
|
|
5138
5170
|
/** AV: the authority's current head H plus every accepted result Receive
|
|
5139
5171
|
* has delivered after its watermark M. The head is read fresh, because a
|
|
5140
5172
|
* graph-head commit is never an entity delivery. `beyond` is a delivery a
|