@serfab/cadre-core 1.21.0 → 1.23.0
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/README.md +294 -294
- package/dist/cadre-node.d.ts +334 -53
- package/dist/cadre-node.js +794 -85
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +32 -2
- package/dist/control-authorization.js +19 -0
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-database.d.ts +236 -23
- package/dist/control-database.js +587 -173
- package/dist/control-database.js.map +1 -1
- package/dist/control-schema.d.ts +3 -3
- package/dist/control-schema.js +71 -7
- package/dist/control-schema.js.map +1 -1
- package/dist/ed25519-key.d.ts +8 -0
- package/dist/ed25519-key.js +11 -1
- package/dist/ed25519-key.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/machine-removal.d.ts +51 -1
- package/dist/machine-removal.js +42 -1
- package/dist/machine-removal.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +8 -0
- package/dist/membership-connection-gater.js +13 -1
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/membership-view.js +4 -1
- package/dist/membership-view.js.map +1 -1
- package/dist/owner-keys.js +2 -1
- package/dist/owner-keys.js.map +1 -1
- package/dist/owner-signer.js +3 -4
- package/dist/owner-signer.js.map +1 -1
- package/dist/peer-authorization.d.ts +14 -2
- package/dist/peer-authorization.js +24 -1
- package/dist/peer-authorization.js.map +1 -1
- package/dist/sealed-party-key.d.ts +32 -0
- package/dist/sealed-party-key.js +162 -0
- package/dist/sealed-party-key.js.map +1 -0
- package/dist/seed-bootstrap.d.ts +10 -3
- package/dist/seed-bootstrap.js +12 -0
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/strand-addr-protocol.d.ts +56 -6
- package/dist/strand-addr-protocol.js +57 -5
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-commit-durability.d.ts +33 -2
- package/dist/strand-commit-durability.js +44 -4
- package/dist/strand-commit-durability.js.map +1 -1
- package/dist/strand-database.d.ts +35 -5
- package/dist/strand-database.js +34 -10
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +200 -18
- package/dist/strand-instance-manager.js +434 -64
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +250 -51
- package/dist/strand-membership-reconciler.js +410 -66
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +7 -0
- package/dist/strand-membership-writer.js +9 -0
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-party-key-rotation.d.ts +177 -0
- package/dist/strand-party-key-rotation.js +340 -0
- package/dist/strand-party-key-rotation.js.map +1 -0
- package/dist/strand-party-machines.d.ts +111 -0
- package/dist/strand-party-machines.js +258 -0
- package/dist/strand-party-machines.js.map +1 -0
- package/dist/strand-party-peers.d.ts +101 -0
- package/dist/strand-party-peers.js +49 -0
- package/dist/strand-party-peers.js.map +1 -0
- package/dist/strand-peer-redial.d.ts +34 -7
- package/dist/strand-peer-redial.js +46 -13
- package/dist/strand-peer-redial.js.map +1 -1
- package/dist/strand-revocation-enforcer.d.ts +15 -1
- package/dist/strand-revocation-enforcer.js +16 -9
- package/dist/strand-revocation-enforcer.js.map +1 -1
- package/dist/strand-transport-key.js +3 -0
- package/dist/strand-transport-key.js.map +1 -1
- package/dist/strand-watcher.d.ts +7 -4
- package/dist/strand-watcher.js +12 -7
- package/dist/strand-watcher.js.map +1 -1
- package/dist/types.d.ts +169 -13
- package/dist/types.js.map +1 -1
- package/package.json +9 -8
- package/src/cadre-node.ts +12280 -11528
- package/src/control-authorization.ts +41 -1
- package/src/control-database.ts +6123 -5603
- package/src/control-schema.ts +71 -7
- package/src/ed25519-key.ts +12 -1
- package/src/index.ts +957 -924
- package/src/machine-removal.ts +80 -1
- package/src/membership-connection-gater.ts +13 -1
- package/src/membership-view.ts +4 -1
- package/src/owner-keys.ts +2 -1
- package/src/owner-signer.ts +92 -94
- package/src/peer-authorization.ts +27 -3
- package/src/sealed-party-key.ts +190 -0
- package/src/seed-bootstrap.ts +17 -3
- package/src/strand-addr-protocol.ts +67 -6
- package/src/strand-commit-durability.ts +54 -5
- package/src/strand-database.ts +47 -11
- package/src/strand-instance-manager.ts +524 -65
- package/src/strand-membership-reconciler.ts +1310 -942
- package/src/strand-membership-writer.ts +10 -0
- package/src/strand-party-key-rotation.ts +436 -0
- package/src/strand-party-machines.ts +293 -0
- package/src/strand-party-peers.ts +129 -0
- package/src/strand-peer-redial.ts +61 -14
- package/src/strand-revocation-enforcer.ts +27 -9
- package/src/strand-transport-key.ts +3 -0
- package/src/strand-watcher.ts +12 -7
- package/src/types.ts +3121 -2963
|
@@ -118,8 +118,8 @@ export class StrandAddrService {
|
|
|
118
118
|
* (over {@link maxConcurrent}, reply without looking up any address), a read
|
|
119
119
|
* timeout (a peer that never half-closes is aborted inside {@link readFrame}/
|
|
120
120
|
* `readStreamToEnd`), and the existing malformed/oversized-frame guard. A
|
|
121
|
-
* lookup that throws is `unavailable` too, never an empty `ok
|
|
122
|
-
*
|
|
121
|
+
* lookup that throws is `unavailable` too, never an empty `ok`, whose retries
|
|
122
|
+
* climb all the way to the asker's refresh interval.
|
|
123
123
|
*/
|
|
124
124
|
async handleStream(stream, remotePeerId) {
|
|
125
125
|
log('Incoming strand-addr request from: %s', remotePeerId);
|
|
@@ -194,6 +194,58 @@ export class StrandAddrService {
|
|
|
194
194
|
this.options.onDelegateAnnounce(remotePeerId, strandId, delegatePeerId);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* The first wait after an ask that produced no address ({@link nextStrandAddrAsk}),
|
|
199
|
+
* doubling per further such ask. One second is the step `CLAIM_RESTART_REDIAL_STEP_MS`
|
|
200
|
+
* uses for the same restart on the control connection.
|
|
201
|
+
*/
|
|
202
|
+
export const STRAND_PEER_ADDR_FIRST_RETRY_MS = 1000;
|
|
203
|
+
/**
|
|
204
|
+
* The longest wait after a sibling did NOT answer — unreachable, `unavailable`, or
|
|
205
|
+
* `unsupported` ({@link nextStrandAddrAsk}). A refusal matters most: a phone asking
|
|
206
|
+
* before its `CadrePeer` row has replicated to the sibling is refused and its
|
|
207
|
+
* delegate grant goes unrecorded, and waiting the full refresh interval for the next
|
|
208
|
+
* try is the delay this bounds. A pass arms its own wake for the earliest due time it
|
|
209
|
+
* leaves behind (`nextReconcileWakeMs`), so a sibling that keeps failing costs one
|
|
210
|
+
* timed-out RPC a minute, with no pass in between.
|
|
211
|
+
*/
|
|
212
|
+
export const STRAND_PEER_ADDR_RETRY_MS = 60 * 1000;
|
|
213
|
+
/**
|
|
214
|
+
* When to ask a (sibling, strand) for addresses again, from how the ask just made ended
|
|
215
|
+
* and `priorStreak`, the step of the climbing wait the asks before it reached. Returns the
|
|
216
|
+
* wait and the streak to remember.
|
|
217
|
+
*
|
|
218
|
+
* An answer with addresses waits `refreshMs` and ends the streak. Anything else waits
|
|
219
|
+
* {@link STRAND_PEER_ADDR_FIRST_RETRY_MS}, doubling along the streak: a sibling that is
|
|
220
|
+
* starting up fails, then answers `empty` until its strand launches, then answers with
|
|
221
|
+
* addresses, all within seconds, so `empty` and the failures share one streak and a retry
|
|
222
|
+
* landing in the `empty` stretch is followed by another within seconds.
|
|
223
|
+
*
|
|
224
|
+
* A failure stops climbing at {@link STRAND_PEER_ADDR_RETRY_MS}. `empty` climbs to
|
|
225
|
+
* `refreshMs`, because it is also a steady state that keeps one ask per refresh interval:
|
|
226
|
+
* a phone has no listening strand addresses and always answers it, and so does a
|
|
227
|
+
* hibernating sibling. `refreshMs` caps both, so a configured refresh shorter than the
|
|
228
|
+
* retry does not leave a failing sibling waiting longer than a healthy one.
|
|
229
|
+
*
|
|
230
|
+
* The streak stops growing when the wait does: failures that outlast the cap would otherwise
|
|
231
|
+
* send the first `empty` after them straight to `refreshMs`, however briefly that sibling
|
|
232
|
+
* then stays empty.
|
|
233
|
+
*
|
|
234
|
+
* NOTE: the `empty` climb is 10 asks in its first 17 minutes rather than 2 (counted from the
|
|
235
|
+
* steps, not measured), per (sibling, strand) and per new control connection, and its steps
|
|
236
|
+
* below the 2-minute backstop are 7 extra reconcile passes, each of which also redials any
|
|
237
|
+
* sibling left unconnected and advances the redial wait (`nextReconcileWakeMs`). If those wakes
|
|
238
|
+
* show up on a phone's battery or in pass counts, stop the `empty` steps from waking a pass and
|
|
239
|
+
* let them wait for the backstop.
|
|
240
|
+
*/
|
|
241
|
+
export function nextStrandAddrAsk(outcome, priorStreak, refreshMs) {
|
|
242
|
+
if (outcome === 'answered') {
|
|
243
|
+
return { waitMs: refreshMs, streak: 0 };
|
|
244
|
+
}
|
|
245
|
+
const capMs = outcome === 'empty' ? refreshMs : Math.min(refreshMs, STRAND_PEER_ADDR_RETRY_MS);
|
|
246
|
+
const stepMs = STRAND_PEER_ADDR_FIRST_RETRY_MS * 2 ** priorStreak;
|
|
247
|
+
return stepMs < capMs ? { waitMs: stepMs, streak: priorStreak + 1 } : { waitMs: capMs, streak: priorStreak };
|
|
248
|
+
}
|
|
197
249
|
/**
|
|
198
250
|
* Client side: ask each candidate sibling for its live strand-`strandId`
|
|
199
251
|
* multiaddrs and return the **deduplicated union** of every answer, ordered
|
|
@@ -202,9 +254,9 @@ export class StrandAddrService {
|
|
|
202
254
|
* Best-effort per peer: a failed/timed-out/empty sibling contributes no address
|
|
203
255
|
* and never fails the collection — an empty union (no sibling online or running
|
|
204
256
|
* the strand) is an acceptable seed that self-heals on the next resume/reconcile
|
|
205
|
-
* pass. `outcomes` is what lets a caller
|
|
206
|
-
*
|
|
207
|
-
*
|
|
257
|
+
* pass. `outcomes` is what lets a caller schedule each sibling's next ask from how
|
|
258
|
+
* this one ended. The local node (`node.peerId`) is excluded so we never RPC ourselves
|
|
259
|
+
* or seed with our own strand address.
|
|
208
260
|
*
|
|
209
261
|
* Dials run concurrently but the union preserves candidate order, so the result
|
|
210
262
|
* is deterministic regardless of which sibling answers first.
|
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I,KAAK,QAAQ,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CommitFullyHeld, SqlCommitDurability } from '@serfab/quereus-plugin-sereus';
|
|
2
|
+
import type { PartyStrandPeer } from './strand-party-peers.js';
|
|
2
3
|
/** What one commit on a strand wrote, and whether it survives this machine stopping for good. */
|
|
3
4
|
export interface StrandCommitDurability {
|
|
4
5
|
readonly strandId: string;
|
|
@@ -15,6 +16,13 @@ export interface StrandCommitDurability {
|
|
|
15
16
|
* reaches the others while this database stays open. False means nothing will say so.
|
|
16
17
|
*/
|
|
17
18
|
readonly followed: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The party's other machines known to hold this strand that do not hold this commit yet: those
|
|
21
|
+
* not in `report.durability.overall.cohortPeerIds`, or named in its `unconfirmed`. Empty when
|
|
22
|
+
* {@link heldElsewhere} is true. Absent on a node offering no offline mode, which does not track them.
|
|
23
|
+
* Empty with `heldElsewhere` false does not prove a cadre of one (docs/strands.md → "A commit's durability").
|
|
24
|
+
*/
|
|
25
|
+
readonly awaitedMachines?: readonly PartyStrandPeer[];
|
|
18
26
|
/** The plugin's report, for per-table detail. */
|
|
19
27
|
readonly report: SqlCommitDurability;
|
|
20
28
|
}
|
|
@@ -38,12 +46,35 @@ export interface StrandCommitListeners {
|
|
|
38
46
|
export declare class StrandCommitRecord {
|
|
39
47
|
private readonly strandId;
|
|
40
48
|
private readonly listeners;
|
|
49
|
+
/**
|
|
50
|
+
* The tracker's last good answer: {@link reportCommit} runs inside the commit and cannot wait for a read.
|
|
51
|
+
*
|
|
52
|
+
* NOTE: a commit does not ask the tracker to retry a failed read; the offline gate's re-check and
|
|
53
|
+
* the next control-table change do. In online mode a failed read can therefore list nobody until
|
|
54
|
+
* the next change. If an app ever shows that, call `refresh()` here when `lastReadFailed()`.
|
|
55
|
+
*/
|
|
56
|
+
private readonly partyMachines?;
|
|
41
57
|
private readonly commits;
|
|
42
|
-
constructor(strandId: string, listeners: StrandCommitListeners
|
|
58
|
+
constructor(strandId: string, listeners: StrandCommitListeners,
|
|
59
|
+
/**
|
|
60
|
+
* The tracker's last good answer: {@link reportCommit} runs inside the commit and cannot wait for a read.
|
|
61
|
+
*
|
|
62
|
+
* NOTE: a commit does not ask the tracker to retry a failed read; the offline gate's re-check and
|
|
63
|
+
* the next control-table change do. In online mode a failed read can therefore list nobody until
|
|
64
|
+
* the next change. If an app ever shows that, call `refresh()` here when `lastReadFailed()`.
|
|
65
|
+
*/
|
|
66
|
+
partyMachines?: (() => readonly PartyStrandPeer[]) | undefined);
|
|
43
67
|
get(transactionId: string): StrandCommitDurability | undefined;
|
|
44
68
|
/** A plugin `onCommitDurability` report: record it, then forward it. */
|
|
45
69
|
reportCommit(report: SqlCommitDurability): void;
|
|
46
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* A plugin `onCommitFullyHeld` event: mark the commit held, then forward it — also for one no longer recorded.
|
|
72
|
+
*
|
|
73
|
+
* NOTE: accepted tradeoff — the event fires when the under-replication drain settles the commit,
|
|
74
|
+
* so with two machines out the first to take the copies clears the list while the second still
|
|
75
|
+
* lacks them. The field answers "who was this commit waiting for" until another machine holds it;
|
|
76
|
+
* {@link StrandCommitDurability.heldElsewhere} is the survival answer.
|
|
77
|
+
*/
|
|
47
78
|
reportHeld({ transactionId }: CommitFullyHeld): void;
|
|
48
79
|
private remember;
|
|
49
80
|
/**
|
|
@@ -15,6 +15,24 @@ function isHeldElsewhere(overall) {
|
|
|
15
15
|
&& durabilityRank(overall.quorum) >= durabilityRank('majority')
|
|
16
16
|
&& (overall.torn?.length ?? 0) === 0;
|
|
17
17
|
}
|
|
18
|
+
const NO_MACHINES = Object.freeze([]);
|
|
19
|
+
/**
|
|
20
|
+
* With no `cohortPeerIds` the answering layer could not name the cohort, so no machine is
|
|
21
|
+
* confirmed to hold the commit and every one is listed.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: reads the scalars, which describe the weakest answer, and ignores `otherCohorts`, so a
|
|
24
|
+
* machine that another cohort's answer shows holding one block can be listed although that block
|
|
25
|
+
* reached it. The list over-reports; {@link isHeldElsewhere} stays the answer to survival. If an
|
|
26
|
+
* app ever needs the list per block, walk `otherCohorts` here.
|
|
27
|
+
*/
|
|
28
|
+
function machinesAwaited(overall, machines) {
|
|
29
|
+
if (isHeldElsewhere(overall)) {
|
|
30
|
+
return NO_MACHINES;
|
|
31
|
+
}
|
|
32
|
+
const cohort = overall?.cohortPeerIds && new Set(overall.cohortPeerIds);
|
|
33
|
+
const unconfirmed = new Set(overall?.unconfirmed);
|
|
34
|
+
return Object.freeze(machines.filter(({ strandPeerId }) => !cohort?.has(strandPeerId) || unconfirmed.has(strandPeerId)));
|
|
35
|
+
}
|
|
18
36
|
/**
|
|
19
37
|
* The durability of the most recent commits on one strand database, by transaction id. The
|
|
20
38
|
* plugin reports a commit — and a `covered` commit is held — before the statement that made it
|
|
@@ -23,9 +41,18 @@ function isHeldElsewhere(overall) {
|
|
|
23
41
|
* from {@link get} never changes under its reader.
|
|
24
42
|
*/
|
|
25
43
|
export class StrandCommitRecord {
|
|
26
|
-
constructor(strandId, listeners
|
|
44
|
+
constructor(strandId, listeners,
|
|
45
|
+
/**
|
|
46
|
+
* The tracker's last good answer: {@link reportCommit} runs inside the commit and cannot wait for a read.
|
|
47
|
+
*
|
|
48
|
+
* NOTE: a commit does not ask the tracker to retry a failed read; the offline gate's re-check and
|
|
49
|
+
* the next control-table change do. In online mode a failed read can therefore list nobody until
|
|
50
|
+
* the next change. If an app ever shows that, call `refresh()` here when `lastReadFailed()`.
|
|
51
|
+
*/
|
|
52
|
+
partyMachines) {
|
|
27
53
|
this.strandId = strandId;
|
|
28
54
|
this.listeners = listeners;
|
|
55
|
+
this.partyMachines = partyMachines;
|
|
29
56
|
this.commits = new Map();
|
|
30
57
|
}
|
|
31
58
|
get(transactionId) {
|
|
@@ -33,21 +60,34 @@ export class StrandCommitRecord {
|
|
|
33
60
|
}
|
|
34
61
|
/** A plugin `onCommitDurability` report: record it, then forward it. */
|
|
35
62
|
reportCommit(report) {
|
|
63
|
+
const { overall } = report.durability;
|
|
36
64
|
const commit = Object.freeze({
|
|
37
65
|
strandId: this.strandId,
|
|
38
66
|
transactionId: report.transactionId,
|
|
39
|
-
heldElsewhere: isHeldElsewhere(
|
|
67
|
+
heldElsewhere: isHeldElsewhere(overall),
|
|
40
68
|
followed: report.followed,
|
|
69
|
+
...(this.partyMachines && { awaitedMachines: machinesAwaited(overall, this.partyMachines()) }),
|
|
41
70
|
report
|
|
42
71
|
});
|
|
43
72
|
this.remember(commit);
|
|
44
73
|
this.forward('durability', report.transactionId, () => this.listeners.onCommitDurability?.(commit));
|
|
45
74
|
}
|
|
46
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* A plugin `onCommitFullyHeld` event: mark the commit held, then forward it — also for one no longer recorded.
|
|
77
|
+
*
|
|
78
|
+
* NOTE: accepted tradeoff — the event fires when the under-replication drain settles the commit,
|
|
79
|
+
* so with two machines out the first to take the copies clears the list while the second still
|
|
80
|
+
* lacks them. The field answers "who was this commit waiting for" until another machine holds it;
|
|
81
|
+
* {@link StrandCommitDurability.heldElsewhere} is the survival answer.
|
|
82
|
+
*/
|
|
47
83
|
reportHeld({ transactionId }) {
|
|
48
84
|
const recorded = this.commits.get(transactionId);
|
|
49
85
|
if (recorded) {
|
|
50
|
-
this.commits.set(transactionId, Object.freeze({
|
|
86
|
+
this.commits.set(transactionId, Object.freeze({
|
|
87
|
+
...recorded,
|
|
88
|
+
heldElsewhere: true,
|
|
89
|
+
...(recorded.awaitedMachines && { awaitedMachines: NO_MACHINES })
|
|
90
|
+
}));
|
|
51
91
|
}
|
|
52
92
|
this.forward('held', transactionId, () => this.listeners.onCommitHeld?.({ strandId: this.strandId, transactionId }));
|
|
53
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strand-commit-durability.js","sourceRoot":"","sources":["../src/strand-commit-durability.ts"],"names":[],"mappings":"AAAA,OAA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CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC;gBAC5C,GAAG,QAAQ;gBACX,aAAa,EAAE,IAAI;gBACnB,GAAG,CAAC,QAAQ,CAAC,eAAe,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;aAClE,CAAC,CAAC,CAAC;QACN,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;IACvH,CAAC;IAEO,QAAQ,CAAC,MAA8B;QAC7C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,mBAAmB,EAAE,CAAC;YAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAM,CAAC;YACjD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,OAAO,CAAC,IAAY,EAAE,aAAqB,EAAE,OAAmB;QACtE,IAAI,CAAC;YACH,OAAO,EAAE,CAAC;QACZ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,oDAAoD,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QACvG,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Database } from '@quereus/quereus';
|
|
2
2
|
import type { SereusPluginResult } from '@serfab/quereus-plugin-sereus';
|
|
3
3
|
import type { Libp2p } from '@libp2p/interface';
|
|
4
|
-
import type { IRepo } from '@optimystic/db-core';
|
|
4
|
+
import type { ICohortReachability, IRepo } from '@optimystic/db-core';
|
|
5
5
|
import type { IKVStore } from '@optimystic/db-p2p';
|
|
6
6
|
import type { SAppConfig } from './types.js';
|
|
7
|
+
import type { PartyStrandPeer } from './strand-party-peers.js';
|
|
7
8
|
import type { StrandCommitDurability, StrandCommitListeners } from './strand-commit-durability.js';
|
|
8
9
|
import type { TableChangeWatch, TableChangeWatchOptions } from './table-change-watch.js';
|
|
9
10
|
import type { StrandOfflineListeners, StrandOfflineMode, StrandOfflineQueue } from './strand-offline.js';
|
|
@@ -64,6 +65,12 @@ export interface StrandDatabaseConfig extends StrandCommitListeners {
|
|
|
64
65
|
offline?: StrandDatabaseOffline;
|
|
65
66
|
/** Where to report the `App` schema apply when it is held back (docs/strands.md → "An app schema upgrade waits for the queue or the cohort"). */
|
|
66
67
|
appSchema?: StrandAppSchemaListeners;
|
|
68
|
+
/**
|
|
69
|
+
* The party's other machines known to hold the strand (`StrandPartyMachines.machines`), named in
|
|
70
|
+
* each commit's {@link StrandCommitDurability.awaitedMachines}. Absent on a node offering no
|
|
71
|
+
* offline mode, which does not track them.
|
|
72
|
+
*/
|
|
73
|
+
partyMachines?: () => readonly PartyStrandPeer[];
|
|
67
74
|
}
|
|
68
75
|
/** {@link StrandDatabaseConfig.offline}: one build's journal, the strand's mode, and where to report. */
|
|
69
76
|
export interface StrandDatabaseOffline extends StrandOfflineListeners {
|
|
@@ -77,6 +84,12 @@ export interface StrandDatabaseOffline extends StrandOfflineListeners {
|
|
|
77
84
|
* {@link StrandDatabase.applyOfflineMode}, never captured, so the newest choice wins.
|
|
78
85
|
*/
|
|
79
86
|
mode: () => StrandOfflineMode;
|
|
87
|
+
/**
|
|
88
|
+
* The gate the queue and offline live reads ask in place of the strand node's own: the node's
|
|
89
|
+
* gate closed also while the party has machines holding the strand that this node is not in a
|
|
90
|
+
* cohort with (`strand-party-machines.ts`). Absent on a node whose strand node offers no gate.
|
|
91
|
+
*/
|
|
92
|
+
cohortReachability?: ICohortReachability;
|
|
80
93
|
}
|
|
81
94
|
/**
|
|
82
95
|
* StrandDatabase manages the sApp schema for a strand using Quereus with the
|
|
@@ -232,10 +245,27 @@ export declare class StrandDatabase {
|
|
|
232
245
|
*/
|
|
233
246
|
getTransactor(): SereusPluginResult['transactor'];
|
|
234
247
|
/**
|
|
235
|
-
* Close the database and cleanup resources.
|
|
236
|
-
*
|
|
237
|
-
* then
|
|
238
|
-
*
|
|
248
|
+
* Close the database and cleanup resources. Closes the Quereus `Database` and waits for it
|
|
249
|
+
* (it stops every running statement and open iterator and resolves once nothing reads or
|
|
250
|
+
* writes), then runs the strand-connection shutdown (collection-factory teardown; the
|
|
251
|
+
* injected node keeps running), so no statement reaches released storage. Safe on an
|
|
252
|
+
* instance whose {@link initialize} failed part-way.
|
|
253
|
+
*
|
|
254
|
+
* The handle stays set across the awaits, so a second, concurrent close (a build released
|
|
255
|
+
* part-way closes its database again) awaits the same Quereus teardown rather than skipping
|
|
256
|
+
* ahead to the strand shutdown, which is safe to run twice (each release it makes is
|
|
257
|
+
* idempotent, and the storage-cache release is latched). A rejected Quereus close is logged and the
|
|
258
|
+
* teardown goes on, because callers stop the strand's node once this resolves.
|
|
259
|
+
*
|
|
260
|
+
* NOTE: this makes `close()` wait on a statement in a network wait, bounded by Optimystic's
|
|
261
|
+
* RPC deadlines; the strand shutdown aborts no in-flight request, so closing it first never
|
|
262
|
+
* cut that wait short. Revisit (abort in-flight collection work before closing Quereus) if
|
|
263
|
+
* strand stops show up slow.
|
|
264
|
+
*
|
|
265
|
+
* NOTE: the plugin raises the commit-durability and commit-held reports from inside the
|
|
266
|
+
* committing statement, but through listeners nobody awaits, so an app handler that starts
|
|
267
|
+
* `stopStrand` does not make the statement wait for this close. If a delivery path ever
|
|
268
|
+
* awaits its listeners, a stop started from one waits for itself and never resolves.
|
|
239
269
|
*/
|
|
240
270
|
close(): Promise<void>;
|
|
241
271
|
private ensureInitialized;
|
package/dist/strand-database.js
CHANGED
|
@@ -39,7 +39,7 @@ export class StrandDatabase {
|
|
|
39
39
|
/** Subscriptions handed out by {@link watchTables}. */
|
|
40
40
|
this.tableWatches = new TableWatchRegistry();
|
|
41
41
|
this.config = config;
|
|
42
|
-
this.commits = new StrandCommitRecord(config.strandId, config);
|
|
42
|
+
this.commits = new StrandCommitRecord(config.strandId, config, config.partyMachines);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Initialize the database — create the `Database` and delegate the strand
|
|
@@ -60,6 +60,7 @@ export class StrandDatabase {
|
|
|
60
60
|
}
|
|
61
61
|
log('Initializing StrandDatabase for strand: %s (%s)', sid, sAppConfig ? `sApp: ${sAppConfig.id} v${sAppConfig.version}` : 'storage replica');
|
|
62
62
|
const offline = this.config.offline && { journal: await this.config.offline.journal() };
|
|
63
|
+
const cohortReachability = this.config.offline?.cohortReachability;
|
|
63
64
|
this.db = new Database();
|
|
64
65
|
// Delegate to the shared composition. The node is injected, so:
|
|
65
66
|
// - `connectToStrand` never creates or stops a node; `StrandInstanceManager`
|
|
@@ -81,6 +82,7 @@ export class StrandDatabase {
|
|
|
81
82
|
coordinatedRepo: this.config.coordinatedRepo,
|
|
82
83
|
enableCache: true,
|
|
83
84
|
offline,
|
|
85
|
+
...(cohortReachability && { cohortReachability }),
|
|
84
86
|
});
|
|
85
87
|
this.shutdownStrand = result.shutdown;
|
|
86
88
|
this.resolvedTransactor = result.transactor;
|
|
@@ -322,10 +324,27 @@ export class StrandDatabase {
|
|
|
322
324
|
return this.resolvedTransactor;
|
|
323
325
|
}
|
|
324
326
|
/**
|
|
325
|
-
* Close the database and cleanup resources.
|
|
326
|
-
*
|
|
327
|
-
* then
|
|
328
|
-
*
|
|
327
|
+
* Close the database and cleanup resources. Closes the Quereus `Database` and waits for it
|
|
328
|
+
* (it stops every running statement and open iterator and resolves once nothing reads or
|
|
329
|
+
* writes), then runs the strand-connection shutdown (collection-factory teardown; the
|
|
330
|
+
* injected node keeps running), so no statement reaches released storage. Safe on an
|
|
331
|
+
* instance whose {@link initialize} failed part-way.
|
|
332
|
+
*
|
|
333
|
+
* The handle stays set across the awaits, so a second, concurrent close (a build released
|
|
334
|
+
* part-way closes its database again) awaits the same Quereus teardown rather than skipping
|
|
335
|
+
* ahead to the strand shutdown, which is safe to run twice (each release it makes is
|
|
336
|
+
* idempotent, and the storage-cache release is latched). A rejected Quereus close is logged and the
|
|
337
|
+
* teardown goes on, because callers stop the strand's node once this resolves.
|
|
338
|
+
*
|
|
339
|
+
* NOTE: this makes `close()` wait on a statement in a network wait, bounded by Optimystic's
|
|
340
|
+
* RPC deadlines; the strand shutdown aborts no in-flight request, so closing it first never
|
|
341
|
+
* cut that wait short. Revisit (abort in-flight collection work before closing Quereus) if
|
|
342
|
+
* strand stops show up slow.
|
|
343
|
+
*
|
|
344
|
+
* NOTE: the plugin raises the commit-durability and commit-held reports from inside the
|
|
345
|
+
* committing statement, but through listeners nobody awaits, so an app handler that starts
|
|
346
|
+
* `stopStrand` does not make the statement wait for this close. If a delivery path ever
|
|
347
|
+
* awaits its listeners, a stop started from one waits for itself and never resolves.
|
|
329
348
|
*/
|
|
330
349
|
async close() {
|
|
331
350
|
// First, so an event from the closing connection reaches no app handler or table watch.
|
|
@@ -337,16 +356,21 @@ export class StrandDatabase {
|
|
|
337
356
|
this.appSchemaReport = null;
|
|
338
357
|
this.offlineQueue = null;
|
|
339
358
|
this.tableWatches.disposeAll();
|
|
359
|
+
if (this.db) {
|
|
360
|
+
try {
|
|
361
|
+
await this.db.close();
|
|
362
|
+
}
|
|
363
|
+
catch (err) {
|
|
364
|
+
log('Closing the Quereus database for strand %s failed; shutting the strand connection down anyway: %O', this.config.strandId, err);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
340
367
|
if (this.shutdownStrand) {
|
|
341
368
|
await this.shutdownStrand();
|
|
342
369
|
this.shutdownStrand = null;
|
|
343
370
|
}
|
|
344
|
-
// Again: a subscription taken during the
|
|
371
|
+
// Again: a subscription taken during the awaits above would keep its timers past close.
|
|
345
372
|
this.tableWatches.disposeAll();
|
|
346
|
-
|
|
347
|
-
void this.db.close();
|
|
348
|
-
this.db = null;
|
|
349
|
-
}
|
|
373
|
+
this.db = null;
|
|
350
374
|
this.resolvedTransactor = null;
|
|
351
375
|
this.initialized = false;
|
|
352
376
|
log('StrandDatabase for strand %s closed', this.config.strandId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strand-database.js","sourceRoot":"","sources":["../src/strand-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"strand-database.js","sourceRoot":"","sources":["../src/strand-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAOhF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAA4D,MAAM,+BAA+B,CAAC;AAEhI,MAAM,GAAG,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAsF5C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,cAAc;IAezB,YAAY,MAA4B;QAdhC,OAAE,GAAoB,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