@serfab/cadre-core 1.20.0 → 1.22.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 +329 -53
- package/dist/cadre-node.js +767 -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 +601 -178
- 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/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/relay-reservation.js +20 -1
- package/dist/relay-reservation.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-app-schema-report.d.ts +6 -3
- package/dist/strand-app-schema-report.js +13 -7
- package/dist/strand-app-schema-report.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 +36 -6
- package/dist/strand-database.js +35 -11
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +133 -9
- package/dist/strand-instance-manager.js +266 -42
- 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 +165 -17
- package/dist/types.js.map +1 -1
- package/package.json +9 -8
- package/src/cadre-node.ts +12252 -11528
- package/src/control-authorization.ts +41 -1
- package/src/control-database.ts +6123 -5594
- 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/owner-keys.ts +2 -1
- package/src/owner-signer.ts +92 -94
- package/src/peer-authorization.ts +27 -3
- package/src/relay-reservation.ts +28 -1
- 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-app-schema-report.ts +17 -10
- package/src/strand-commit-durability.ts +54 -5
- package/src/strand-database.ts +48 -12
- package/src/strand-instance-manager.ts +330 -42
- 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 +3112 -2962
|
@@ -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
|
|
@@ -211,7 +224,7 @@ export declare class StrandDatabase {
|
|
|
211
224
|
/**
|
|
212
225
|
* Whether this database runs the `App` schema its launch was given. `'waiting-for-queue'` or
|
|
213
226
|
* `'waiting-for-cohort'` while the apply is held back, so `StrandInstance.sAppInfo` names a version
|
|
214
|
-
* whose new tables or columns
|
|
227
|
+
* whose new tables or columns may not be usable yet; check this before relying on them.
|
|
215
228
|
*/
|
|
216
229
|
appSchemaState(): StrandAppSchemaState;
|
|
217
230
|
/**
|
|
@@ -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;
|
|
@@ -291,7 +293,7 @@ export class StrandDatabase {
|
|
|
291
293
|
/**
|
|
292
294
|
* Whether this database runs the `App` schema its launch was given. `'waiting-for-queue'` or
|
|
293
295
|
* `'waiting-for-cohort'` while the apply is held back, so `StrandInstance.sAppInfo` names a version
|
|
294
|
-
* whose new tables or columns
|
|
296
|
+
* whose new tables or columns may not be usable yet; check this before relying on them.
|
|
295
297
|
*/
|
|
296
298
|
appSchemaState() {
|
|
297
299
|
this.ensureInitialized();
|
|
@@ -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,CAA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,GAAG,IAAI,CAAC;QAC7B,CAAC;QACD,wFAAwF;QACxF,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACf,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,GAAG,CAAC,qCAAqC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,MAAM,CAAC,QAAQ,4CAA4C,CAAC,CAAC;QACjH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -6,6 +6,7 @@ import { type PeerJoinBackfillConfig } from './peer-join-backfill.js';
|
|
|
6
6
|
import { type StrandNetworkStateStore } from './strand-network-state.js';
|
|
7
7
|
import { type StrandRevocationEnforcementConfig } from './strand-revocation-enforcer.js';
|
|
8
8
|
import { type PendingMembershipInviteSource, type StrandMembershipReconciliationConfig } from './strand-membership-reconciler.js';
|
|
9
|
+
import type { PartyStrandPeer, PartyStrandPeerSource } from './strand-party-peers.js';
|
|
9
10
|
import { type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
|
|
10
11
|
import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, NodeProfile, SAppConfig } from './types.js';
|
|
11
12
|
import { type StrandReactivityConfig } from './strand-reactivity.js';
|
|
@@ -178,6 +179,39 @@ export interface StartStrandConfig {
|
|
|
178
179
|
* default `DEFAULT_MEMBERSHIP_RECONCILE_INTERVAL_MS`.
|
|
179
180
|
*/
|
|
180
181
|
membershipReconciliation?: StrandMembershipReconciliationConfig;
|
|
182
|
+
/**
|
|
183
|
+
* The party's machines in THIS strand, as the control database records them
|
|
184
|
+
* (`strand-party-peers.ts`): `CadreNode.launchStrand` wires it for every strand, open or
|
|
185
|
+
* closed, party key or not. Bring-up publishes this machine's own `StrandPeer` row through it
|
|
186
|
+
* in the background, once the strand's libp2p node exists (launch and hibernation resume
|
|
187
|
+
* alike, since the row is this machine's statement of a peer id that is the same across
|
|
188
|
+
* both). On a closed strand the membership reconciler reads the party's other machines
|
|
189
|
+
* through it to bind them (`strand-membership-reconciler.ts` → "Binding the party's other
|
|
190
|
+
* machines"); on a node offering offline mode ({@link offline}) the queue's gate reads them
|
|
191
|
+
* as the machines a queued transaction waits for (`strand-party-machines.ts`). An open
|
|
192
|
+
* strand's row serves only that wait. Retained with the launch config.
|
|
193
|
+
*/
|
|
194
|
+
partyPeers?: PartyStrandPeerSource;
|
|
195
|
+
/**
|
|
196
|
+
* Called when the membership reconciler finds the party's PENDING membership key seated as a
|
|
197
|
+
* `Strand.Member` in this strand (`strand-membership-reconciler.ts` → "Redeeming under the
|
|
198
|
+
* pending key"): it redeemed the host's fresh invitation under that key, or another party's
|
|
199
|
+
* manager admitted the key by hand. `CadreNode` wires it to its party key rotation driver,
|
|
200
|
+
* which then finishes the move on an owner machine the key is sealed to
|
|
201
|
+
* (`strand-party-key-rotation.ts`). Called on every pass that sees the seat until the control
|
|
202
|
+
* record is swapped, so the receiver refuses cheaply when it cannot drive. Retained with the
|
|
203
|
+
* launch config.
|
|
204
|
+
*/
|
|
205
|
+
onPartyKeySeated?: (strandId: string) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Called when a read of the party's machines finds one removed from the cadre in
|
|
208
|
+
* {@link bootstrapNodes}, on a node tracking them ({@link offline} with {@link partyPeers}), and
|
|
209
|
+
* once per such machine ({@link watchRemovedMachinesInSeed}). The node refuses that peer but
|
|
210
|
+
* cannot drop it from its frozen seed, so its queue stays held until a new node is built from a
|
|
211
|
+
* fresh seed: `CadreNode` quiesces and resumes the runtime. May be called during a build or a
|
|
212
|
+
* rebuild, so the receiver serializes. Retained with the launch config.
|
|
213
|
+
*/
|
|
214
|
+
onRemovedMachineInSeed?: (strandId: string) => void;
|
|
181
215
|
/**
|
|
182
216
|
* Called when THIS node's own peer id turns up in the strand's revoked set —
|
|
183
217
|
* this node's party was removed from the closed strand, or left it. Fires once
|
|
@@ -288,6 +322,12 @@ export interface ResumeStrandOverrides {
|
|
|
288
322
|
* {@link StartStrandConfig} does — it retains the last value; see `resumeStrand`.
|
|
289
323
|
*/
|
|
290
324
|
servingMachines?: number;
|
|
325
|
+
/**
|
|
326
|
+
* The party's membership key for a closed strand as the control record names it now
|
|
327
|
+
* (`StrandPartyKey.PrivateKey`), re-read by `CadreNode.resumeStrandRuntime` because a party
|
|
328
|
+
* key rotation can finish while the strand hibernates. Omitted, the retained key stands.
|
|
329
|
+
*/
|
|
330
|
+
partyMemberPrivateKey?: string;
|
|
291
331
|
}
|
|
292
332
|
/**
|
|
293
333
|
* Get the isolated storage path for a specific strand.
|
|
@@ -379,6 +419,21 @@ export declare class StrandInstanceManager {
|
|
|
379
419
|
* nobody and a resume redials over the new node.
|
|
380
420
|
*/
|
|
381
421
|
private peerRedials;
|
|
422
|
+
/**
|
|
423
|
+
* The party's other machines known to hold each strand (`strand-party-machines.ts`), keyed
|
|
424
|
+
* by strand id, on a node offering offline mode for a launch with a party-machine seam. Same
|
|
425
|
+
* lifecycle as {@link peerRedials}: built in `buildStrandRuntime` before the libp2p node (the
|
|
426
|
+
* node's redial loop, the database's offline gate and its commit record read it), stopped and dropped in
|
|
427
|
+
* `releaseRuntime`, so a resume reads the control database afresh. Refreshed by
|
|
428
|
+
* {@link notifyPartyPeersChanged}.
|
|
429
|
+
*/
|
|
430
|
+
private partyMachines;
|
|
431
|
+
/**
|
|
432
|
+
* Per strand, the removed machines' peer ids a rebuild was asked for
|
|
433
|
+
* ({@link watchRemovedMachinesInSeed}). Outlives a runtime, which is its point: it is what stops
|
|
434
|
+
* a rebuilt node whose seed still names one from asking again. Dropped with the launch config.
|
|
435
|
+
*/
|
|
436
|
+
private seedRemovalsAnnounced;
|
|
382
437
|
/**
|
|
383
438
|
* The resolved (cache-wrapped) raw storage per strand id — the instance's OWN
|
|
384
439
|
* store, resolved once in `startStrand` and held until `stopStrand` disposes it.
|
|
@@ -509,10 +564,27 @@ export declare class StrandInstanceManager {
|
|
|
509
564
|
private buildStrandDatabase;
|
|
510
565
|
/**
|
|
511
566
|
* One build's {@link StrandDatabaseOffline}: the strand's journal, which the database resolves as
|
|
512
|
-
* it initializes (a throw or rejection fails the build),
|
|
513
|
-
* time it applies it.
|
|
567
|
+
* it initializes (a throw or rejection fails the build), the strand's mode, which it reads each
|
|
568
|
+
* time it applies it, and the gate its queue asks, when one could be built.
|
|
514
569
|
*/
|
|
515
570
|
private offlineDatabaseConfig;
|
|
571
|
+
/**
|
|
572
|
+
* The gate a build's offline queue asks: the node's own, closed also while the party has
|
|
573
|
+
* machines holding the strand that this node is alone in a cohort without
|
|
574
|
+
* (`cohortGateWaitingForMachines`). None when the launch tracks no party machines (no offline
|
|
575
|
+
* mode, or no party-machine seam), or when the node carries no gate or key network to compose
|
|
576
|
+
* over; the queue then asks the node's own gate, as before.
|
|
577
|
+
*/
|
|
578
|
+
private offlineCohortGate;
|
|
579
|
+
/** Ask the launcher for a rebuild when a machine removed from the party is in this runtime's seed. */
|
|
580
|
+
private watchSeedForRemovedMachines;
|
|
581
|
+
/**
|
|
582
|
+
* The party's other machines known to hold `strandId` with no open connection from its strand
|
|
583
|
+
* node: what an offline queue reporting `waitingFor: 'cohort'` may be waiting for
|
|
584
|
+
* (`docs/strands.md` → "Waiting for the party's own machines"). Empty for a strand not tracked
|
|
585
|
+
* or not running here, and on a launch that tracks no party machines.
|
|
586
|
+
*/
|
|
587
|
+
unreachedPartyMachines(strandId: string): readonly PartyStrandPeer[];
|
|
516
588
|
/**
|
|
517
589
|
* Whether this strand's raw store holds no block. False for a store that cannot list its
|
|
518
590
|
* blocks, or whose listing fails, so such a launch probes at once.
|
|
@@ -626,6 +698,55 @@ export declare class StrandInstanceManager {
|
|
|
626
698
|
* loop's own serialized chain and never rejects.
|
|
627
699
|
*/
|
|
628
700
|
notifyMembershipInviteStaged(strandId: string): void;
|
|
701
|
+
/**
|
|
702
|
+
* The party's machines changed in the control database — a `StrandPeer` row, a `CadrePeer`
|
|
703
|
+
* row or a tombstone arrived or was written here (`CadreNode`'s watch on those tables,
|
|
704
|
+
* coalesced). Re-arm every armed membership reconciler, so a sibling's row is bound, or a
|
|
705
|
+
* removed machine's binding cleared, within the watch's window rather than at the next
|
|
706
|
+
* resume, and read every strand's party machines again, so an offline queue waits for a
|
|
707
|
+
* machine as soon as its row arrives and stops waiting for one as soon as it is removed.
|
|
708
|
+
* Table events carry no row keys, so every strand's loop and tracker is woken; a loop with
|
|
709
|
+
* nothing to do confirms and stops again. Returns at once; each pass runs on its loop's own
|
|
710
|
+
* serialized chain and never rejects.
|
|
711
|
+
*/
|
|
712
|
+
notifyPartyPeersChanged(): void;
|
|
713
|
+
/** Re-arm `strandId`'s membership reconciler for `cause`; `false` when none is armed. */
|
|
714
|
+
private rearmMembershipReconciler;
|
|
715
|
+
/**
|
|
716
|
+
* Build and start `instance`'s membership reconciler from `config`, for a closed strand that
|
|
717
|
+
* carries the party's own membership key with the loop enabled; nothing otherwise. Called by
|
|
718
|
+
* {@link buildStrandRuntime} after the database phase, and by {@link rekeyParty} over a
|
|
719
|
+
* running instance with the re-keyed config. Every dependency is read per pass, never
|
|
720
|
+
* captured, so the loop follows the instance through quiesce and resume.
|
|
721
|
+
*/
|
|
722
|
+
private armMembershipReconciler;
|
|
723
|
+
/**
|
|
724
|
+
* Move a tracked closed strand onto `partyMemberPrivateKey`, the party's membership key the
|
|
725
|
+
* control record now names (a party key rotation finished here or replicated from the machine
|
|
726
|
+
* that finished it: `strand-party-key-rotation.ts`). The retained launch config is replaced
|
|
727
|
+
* with a fresh object carrying the key ({@link foundExistingStrand}'s idiom: the caller's
|
|
728
|
+
* config object is not ours to rewrite), so every later resume rebuilds under it, and the
|
|
729
|
+
* founder bootstrap a resume re-runs derives from it (insert-if-absent; the strand's rows
|
|
730
|
+
* already hold the new key as member and manager, so it writes nothing). The running
|
|
731
|
+
* instance's membership reconciler, which signs with the key, is stopped and awaited, then
|
|
732
|
+
* rebuilt and started over the re-keyed config, so its next pass binds under the new key.
|
|
733
|
+
*
|
|
734
|
+
* A tracked instance with no party key before (a storage replica launched before the party's
|
|
735
|
+
* row reached this node) is keyed the same way and gains its reconciler now rather than at its
|
|
736
|
+
* next resume. A build in flight is waited out first, so the reconciler it arms is the one
|
|
737
|
+
* replaced here rather than a second one beside it; a key the retained config already names
|
|
738
|
+
* is answered before that wait, since the party key watch asks this for every tracked closed
|
|
739
|
+
* strand on every change to the key tables.
|
|
740
|
+
*
|
|
741
|
+
* @returns `rekeyed` when a running instance's reconciler was rebuilt; `retained` when only the
|
|
742
|
+
* config changed (a hibernating instance, or one with the loop disabled); `unchanged` when
|
|
743
|
+
* the key already matched or the strand is open; `untracked` when the strand is not here.
|
|
744
|
+
*/
|
|
745
|
+
rekeyParty(strandId: string, partyMemberPrivateKey: string): Promise<'rekeyed' | 'retained' | 'unchanged' | 'untracked'>;
|
|
746
|
+
/** Whether {@link rekeyParty} has anything to do for `strandId`: the retained config is a closed strand's and names another key. */
|
|
747
|
+
private rekeyNeeded;
|
|
748
|
+
/** The ids of every tracked closed strand, running or hibernating. */
|
|
749
|
+
trackedClosedStrandIds(): string[];
|
|
629
750
|
/**
|
|
630
751
|
* Best-effort removal of THIS machine's own `Strand.MemberPeer` binding — the
|
|
631
752
|
* self arm of `removeMemberPeer`, signed with the retained launch config's party
|
|
@@ -643,13 +764,16 @@ export declare class StrandInstanceManager {
|
|
|
643
764
|
* and its in-flight pass awaited — FIRST, so a pass that was already past its
|
|
644
765
|
* own stopped check cannot re-register the binding this is about to clear.
|
|
645
766
|
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
*
|
|
767
|
+
* A machine removed from the CADRE at the control layer is not cleared here either: the
|
|
768
|
+
* party replaces its key in the strand instead (`strand-party-key-rotation.ts`), which
|
|
769
|
+
* leaves that machine's binding an orphan the revoked-peer gate denies, and the membership
|
|
770
|
+
* reconciler clears what a lagging sibling wrote under the new key.
|
|
771
|
+
*
|
|
772
|
+
* NOTE: deliberately NOT handled here (or anywhere yet): clearing the bindings of a party's
|
|
773
|
+
* OTHER machines when the party unpublishes — the party still holds the key on every
|
|
774
|
+
* surviving machine and can clear from any of them, and the stale rows grant nothing while
|
|
775
|
+
* admission is deny-list only. Revisit when `feat-strand-member-allowlist-admission` lands
|
|
776
|
+
* and a stale binding starts granting admission rather than merely mis-crediting diversity.
|
|
653
777
|
*/
|
|
654
778
|
clearOwnMemberPeerBinding(strandId: string): Promise<void>;
|
|
655
779
|
/**
|