@serfab/cadre-core 1.22.0 → 1.24.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 +216 -294
- package/dist/arachnode-stub.d.ts +12 -4
- package/dist/arachnode-stub.js +15 -8
- package/dist/arachnode-stub.js.map +1 -1
- package/dist/cadre-invite-protocol.js +5 -4
- package/dist/cadre-invite-protocol.js.map +1 -1
- package/dist/cadre-node.d.ts +159 -53
- package/dist/cadre-node.js +276 -89
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +14 -2
- package/dist/control-authorization.js +8 -3
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +27 -13
- package/dist/control-cohort.js +21 -14
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +18 -16
- package/dist/control-database.js +57 -22
- package/dist/control-database.js.map +1 -1
- package/dist/control-protocol-guard.d.ts +1 -1
- package/dist/control-protocol-guard.js +7 -3
- package/dist/control-protocol-guard.js.map +1 -1
- package/dist/control-read-retry.d.ts +49 -11
- package/dist/control-read-retry.js +56 -15
- package/dist/control-read-retry.js.map +1 -1
- package/dist/control-retry.d.ts +32 -3
- package/dist/control-retry.js +35 -4
- package/dist/control-retry.js.map +1 -1
- package/dist/control-schema-version.d.ts +5 -5
- package/dist/control-schema-version.js +5 -5
- package/dist/control-schema-version.js.map +1 -1
- package/dist/control-schema.d.ts +5 -5
- package/dist/control-schema.js +1032 -1011
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +54 -65
- package/dist/control-write-retry.js +134 -158
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +1 -1
- package/dist/delegate-admission.js +1 -1
- package/dist/edge-node/config.d.ts +4 -3
- package/dist/edge-node/config.js +11 -9
- package/dist/edge-node/config.js.map +1 -1
- package/dist/edge-node/dissolve.d.ts +4 -4
- package/dist/edge-node/dissolve.js +4 -4
- package/dist/edge-node/edge-join.d.ts +1 -1
- package/dist/edge-node/edge-join.js +1 -1
- package/dist/edge-node/edge-node.js +2 -2
- package/dist/edge-node/edge-node.js.map +1 -1
- package/dist/edge-node/index.d.ts +1 -0
- package/dist/edge-node/index.js +1 -0
- package/dist/edge-node/index.js.map +1 -1
- package/dist/edge-node/join-credential.d.ts +1 -1
- package/dist/edge-node/join-credential.js +1 -1
- package/dist/edge-node/lazy-raw-storage.js +12 -0
- package/dist/edge-node/lazy-raw-storage.js.map +1 -1
- package/dist/edge-node/listen-addrs.d.ts +21 -0
- package/dist/edge-node/listen-addrs.js +25 -0
- package/dist/edge-node/listen-addrs.js.map +1 -0
- package/dist/edge-node/owner-grant.d.ts +1 -1
- package/dist/edge-node/owner-grant.js +1 -1
- package/dist/edge-node/platform.d.ts +5 -4
- package/dist/edge-node/platform.js.map +1 -1
- package/dist/edge-node/strand-move.d.ts +1 -1
- package/dist/edge-node/strand-move.js +1 -1
- package/dist/edge-node/strands.js +27 -11
- package/dist/edge-node/strands.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +28 -5
- package/dist/invitation-bootstrap.js +41 -8
- package/dist/invitation-bootstrap.js.map +1 -1
- package/dist/link-budget.d.ts +53 -4
- package/dist/link-budget.js +58 -5
- package/dist/link-budget.js.map +1 -1
- package/dist/machine-removal.d.ts +2 -2
- package/dist/machine-removal.js +4 -3
- package/dist/machine-removal.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +2 -2
- package/dist/membership-connection-gater.js +2 -2
- package/dist/membership-view.d.ts +2 -2
- package/dist/membership-view.js +6 -3
- package/dist/membership-view.js.map +1 -1
- package/dist/node-claim-payload.d.ts +15 -7
- package/dist/node-claim-payload.js +25 -9
- package/dist/node-claim-payload.js.map +1 -1
- package/dist/node-class.d.ts +36 -0
- package/dist/node-class.js +26 -0
- package/dist/node-class.js.map +1 -0
- package/dist/node-default-transports.d.ts +50 -3
- package/dist/node-default-transports.js +48 -3
- package/dist/node-default-transports.js.map +1 -1
- package/dist/node-roles.d.ts +118 -0
- package/dist/node-roles.js +142 -0
- package/dist/node-roles.js.map +1 -0
- package/dist/node-transports.d.ts +6 -2
- package/dist/node-transports.js +39 -7
- package/dist/node-transports.js.map +1 -1
- package/dist/owner-anchor-sync.js +1 -1
- package/dist/owner-key-export.js +1 -1
- package/dist/owner-key-flows.d.ts +1 -1
- package/dist/owner-key-store.js +1 -1
- package/dist/owner-signer.js +1 -1
- package/dist/peer-authorization.d.ts +3 -1
- package/dist/peer-authorization.js +3 -1
- package/dist/peer-authorization.js.map +1 -1
- package/dist/peer-dial.d.ts +74 -10
- package/dist/peer-dial.js +89 -17
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.js +4 -4
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/peer-record.d.ts +34 -9
- package/dist/peer-record.js +66 -13
- package/dist/peer-record.js.map +1 -1
- package/dist/pending-join-runner.d.ts +1 -1
- package/dist/pending-join-runner.js +1 -1
- package/dist/provider/client.d.ts +6 -5
- package/dist/provider/client.js +3 -3
- package/dist/provider/client.js.map +1 -1
- package/dist/provider/descriptor.d.ts +1 -1
- package/dist/provider/descriptor.js +1 -1
- package/dist/provider/oauth.d.ts +1 -1
- package/dist/provider/oauth.js +1 -1
- package/dist/provider/rent-node.d.ts +4 -3
- package/dist/provider/rent-node.js +3 -3
- package/dist/provider/rent-node.js.map +1 -1
- package/dist/relay-addrs.d.ts +62 -7
- package/dist/relay-addrs.js +74 -11
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +1 -1
- package/dist/relay-reservation.js +1 -1
- package/dist/relay-server.d.ts +6 -5
- package/dist/relay-server.js +5 -5
- package/dist/relay-server.js.map +1 -1
- package/dist/schema-verification.d.ts +13 -10
- package/dist/schema-verification.js +32 -24
- package/dist/schema-verification.js.map +1 -1
- package/dist/sealed-party-key.js +1 -1
- package/dist/seed-bootstrap.d.ts +4 -3
- package/dist/seed-bootstrap.js +6 -7
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/strand-addr-protocol.d.ts +8 -6
- package/dist/strand-addr-protocol.js +12 -10
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-app-schema-report.d.ts +16 -2
- package/dist/strand-app-schema-report.js +15 -0
- package/dist/strand-app-schema-report.js.map +1 -1
- package/dist/strand-cohort.d.ts +1 -4
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-commit-durability.d.ts +1 -1
- package/dist/strand-database.d.ts +13 -6
- package/dist/strand-database.js +17 -9
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +3 -2
- package/dist/strand-first-sync-gate.js +3 -2
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-formation-deadlines.d.ts +2 -2
- package/dist/strand-formation-deadlines.js +2 -2
- package/dist/strand-formation-protocol.d.ts +1 -1
- package/dist/strand-formation-protocol.js +51 -16
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +134 -42
- package/dist/strand-instance-manager.js +331 -76
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +8 -3
- package/dist/strand-membership-reconciler.js +8 -3
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +2 -2
- package/dist/strand-membership-writer.js +41 -39
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-move.js +1 -1
- package/dist/strand-network-config.d.ts +15 -5
- package/dist/strand-network-config.js +7 -6
- package/dist/strand-network-config.js.map +1 -1
- package/dist/strand-party-key-rotation.d.ts +7 -3
- package/dist/strand-party-key-rotation.js +7 -3
- package/dist/strand-party-key-rotation.js.map +1 -1
- package/dist/strand-party-machines.d.ts +19 -8
- package/dist/strand-party-machines.js +26 -11
- package/dist/strand-party-machines.js.map +1 -1
- package/dist/strand-party-peers.d.ts +36 -14
- package/dist/strand-party-peers.js +24 -15
- package/dist/strand-party-peers.js.map +1 -1
- package/dist/strand-peer-redial.d.ts +1 -1
- package/dist/strand-peer-redial.js +1 -1
- package/dist/strand-reactivity.d.ts +20 -17
- package/dist/strand-reactivity.js +31 -18
- package/dist/strand-reactivity.js.map +1 -1
- package/dist/strand-revocation-enforcer.d.ts +3 -3
- package/dist/strand-revocation-enforcer.js +3 -3
- package/dist/strand-wake-protocol.d.ts +19 -7
- package/dist/strand-wake-protocol.js +22 -10
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/strand-watcher.d.ts +1 -1
- package/dist/strand-watcher.js +1 -1
- package/dist/table-change-watch.js +1 -1
- package/dist/types.d.ts +127 -57
- package/dist/types.js.map +1 -1
- package/dist/webrtc-upgrade.d.ts +254 -0
- package/dist/webrtc-upgrade.js +355 -0
- package/dist/webrtc-upgrade.js.map +1 -0
- package/package.json +9 -9
- package/src/announce-addrs.ts +93 -93
- package/src/arachnode-stub.ts +18 -10
- package/src/bootstrap-peer-store-file.ts +44 -44
- package/src/bootstrap-peer-store.ts +214 -214
- package/src/cadre-invite-protocol.ts +741 -740
- package/src/cadre-node.ts +12462 -12252
- package/src/claim-proof.ts +147 -147
- package/src/control-authorization.ts +290 -276
- package/src/control-cohort.ts +223 -204
- package/src/control-database.ts +72 -28
- package/src/control-formation-recorder.ts +359 -359
- package/src/control-protocol-guard.ts +370 -366
- package/src/control-read-retry.ts +222 -180
- package/src/control-retry.ts +36 -4
- package/src/control-schema-version.ts +301 -301
- package/src/control-schema.ts +1108 -1087
- package/src/control-write-retry.ts +639 -669
- package/src/delegate-admission.ts +351 -351
- package/src/describe-thrown.ts +60 -60
- package/src/ed25519-key.ts +185 -185
- package/src/edge-node/config.ts +13 -10
- package/src/edge-node/dissolve.ts +252 -252
- package/src/edge-node/edge-join.ts +320 -320
- package/src/edge-node/edge-node.ts +1095 -1095
- package/src/edge-node/index.ts +60 -59
- package/src/edge-node/join-credential.ts +16 -16
- package/src/edge-node/lazy-raw-storage.ts +194 -178
- package/src/edge-node/listen-addrs.ts +26 -0
- package/src/edge-node/node-local.ts +84 -84
- package/src/edge-node/options.ts +195 -195
- package/src/edge-node/owner-grant.ts +63 -63
- package/src/edge-node/platform.ts +5 -4
- package/src/edge-node/strand-move.ts +266 -266
- package/src/edge-node/strands.ts +27 -12
- package/src/enrolled-machine-store-file.ts +43 -43
- package/src/enrolled-machine-store.ts +280 -280
- package/src/fetch-impl.ts +23 -23
- package/src/file-durable-slot.ts +64 -64
- package/src/file-safe-name.ts +32 -32
- package/src/formation-approval.ts +604 -604
- package/src/formation-token.ts +63 -63
- package/src/fs-atomic.ts +92 -92
- package/src/index.ts +987 -957
- package/src/invitation-bootstrap.ts +152 -118
- package/src/joined-strand-store.ts +553 -553
- package/src/key-store-file.ts +142 -142
- package/src/link-budget.ts +61 -5
- package/src/machine-removal.ts +211 -210
- package/src/member-redemption.ts +643 -643
- package/src/membership-connection-gater.ts +650 -650
- package/src/membership-view.ts +147 -144
- package/src/node-claim-payload.ts +34 -12
- package/src/node-class.ts +47 -0
- package/src/node-default-transports.ts +65 -3
- package/src/node-roles.ts +220 -0
- package/src/node-transports.ts +86 -49
- package/src/owner-anchor-sync.ts +172 -172
- package/src/owner-grant-protocol.ts +547 -547
- package/src/owner-key-export.ts +348 -348
- package/src/owner-key-flows.ts +109 -109
- package/src/owner-key-store.ts +1 -1
- package/src/owner-keys.ts +179 -179
- package/src/owner-signer.ts +92 -92
- package/src/peer-addr-book.ts +252 -252
- package/src/peer-authorization.ts +584 -582
- package/src/peer-dial.ts +698 -605
- package/src/peer-join-backfill.ts +961 -961
- package/src/peer-record.ts +71 -16
- package/src/pending-join-runner.ts +798 -798
- package/src/primary-lan-address.ts +47 -47
- package/src/provider/client.ts +327 -326
- package/src/provider/descriptor.ts +129 -129
- package/src/provider/index.ts +59 -59
- package/src/provider/oauth.ts +285 -285
- package/src/provider/rent-node.ts +276 -275
- package/src/relay-addrs.ts +90 -12
- package/src/relay-reservation.ts +1 -1
- package/src/relay-server.ts +99 -98
- package/src/schema-verification.ts +38 -23
- package/src/sealed-party-key.ts +190 -190
- package/src/seed-bootstrap.ts +8 -11
- package/src/seed-trust-policy.ts +353 -353
- package/src/self-address-update.ts +19 -19
- package/src/strand-addr-protocol.ts +17 -14
- package/src/strand-app-schema-report.ts +147 -122
- package/src/strand-cohort.ts +1 -5
- package/src/strand-commit-durability.ts +165 -165
- package/src/strand-database.ts +522 -510
- package/src/strand-first-sync-gate.ts +3 -2
- package/src/strand-formation-deadlines.ts +227 -227
- package/src/strand-formation-manager.ts +731 -731
- package/src/strand-formation-protocol.ts +1174 -1138
- package/src/strand-fret-addrs.ts +179 -179
- package/src/strand-instance-manager.ts +381 -85
- package/src/strand-membership-reconciler.ts +1315 -1310
- package/src/strand-membership-writer.ts +2152 -2150
- package/src/strand-move.ts +1 -1
- package/src/strand-network-config.ts +16 -6
- package/src/strand-offline.ts +178 -178
- package/src/strand-party-key-rotation.ts +440 -436
- package/src/strand-party-machines.ts +308 -293
- package/src/strand-party-peers.ts +151 -129
- package/src/strand-peer-redial.ts +1 -1
- package/src/strand-reactivity.ts +36 -19
- package/src/strand-revocation-enforcer.ts +758 -758
- package/src/strand-wake-protocol.ts +406 -394
- package/src/strand-watcher.ts +1 -1
- package/src/table-change-watch.ts +285 -285
- package/src/timed-step.ts +28 -28
- package/src/timeout-scheduler.ts +29 -29
- package/src/trusted-owner-store.ts +242 -242
- package/src/types.ts +3182 -3112
- package/src/webrtc-upgrade.ts +439 -0
|
@@ -8,11 +8,12 @@ import { type StrandRevocationEnforcementConfig } from './strand-revocation-enfo
|
|
|
8
8
|
import { type PendingMembershipInviteSource, type StrandMembershipReconciliationConfig } from './strand-membership-reconciler.js';
|
|
9
9
|
import type { PartyStrandPeer, PartyStrandPeerSource } from './strand-party-peers.js';
|
|
10
10
|
import { type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
|
|
11
|
-
import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint,
|
|
11
|
+
import type { StrandInstance, StrandRow, StorageConfig, NetworkConfig, LatencyHint, SAppConfig } from './types.js';
|
|
12
|
+
import type { NodeRoles } from './node-roles.js';
|
|
12
13
|
import { type StrandReactivityConfig } from './strand-reactivity.js';
|
|
13
14
|
/**
|
|
14
|
-
* How often a
|
|
15
|
-
*
|
|
15
|
+
* How often a launch that could not build its database, because no machine that can answer for
|
|
16
|
+
* the strand's blocks was reachable, retries the build on its running libp2p node
|
|
16
17
|
* (`StrandInstanceManager.deferUnreachableJoin`). Each attempt composes a fresh database and
|
|
17
18
|
* re-reads the schema catalog over the network, so it is spaced well above the first-sync
|
|
18
19
|
* gate's probe cadence.
|
|
@@ -61,7 +62,15 @@ export interface StartStrandConfig {
|
|
|
61
62
|
sAppConfig?: SAppConfig;
|
|
62
63
|
storage?: StorageConfig;
|
|
63
64
|
network?: NetworkConfig;
|
|
64
|
-
|
|
65
|
+
/**
|
|
66
|
+
* What this node does, resolved once by the owning {@link CadreNode} (`node-roles.ts`).
|
|
67
|
+
* Retained with the launch config, so a strand woken from hibernation is rebuilt with the
|
|
68
|
+
* same roles. Read here for the FRET tier, Ring Zulu, the relay-server default, the
|
|
69
|
+
* cohort-topic host profile, and — `strandCohortMember` — whether the strand node stores
|
|
70
|
+
* the strand's blocks or is built as a client that reads and writes through the machines
|
|
71
|
+
* that do (`buildStrandRuntime`; `startStrand` resolves no store for a client).
|
|
72
|
+
*/
|
|
73
|
+
roles: NodeRoles;
|
|
65
74
|
defaultLatencyHint: LatencyHint;
|
|
66
75
|
privateKey?: PrivateKey;
|
|
67
76
|
/** Cohort-derived discovery seed (multiaddr strings). Defaults to [] when omitted. */
|
|
@@ -265,15 +274,16 @@ export interface StartStrandConfig {
|
|
|
265
274
|
*/
|
|
266
275
|
onCommitHeld?: (event: StrandCommitHeld) => void;
|
|
267
276
|
/**
|
|
268
|
-
* Offline mode for this strand (docs/strands.md → "Offline mode"), forwarded from
|
|
277
|
+
* Offline mode for this strand (docs/strands/writes.md → "Offline mode"), forwarded from
|
|
269
278
|
* `CadreNodeConfig.strandOffline`, with where each database built for the launch reports its
|
|
270
279
|
* queue (`CadreNode` emits them as events). Absent: no database gets an offline queue. The mode
|
|
271
280
|
* itself is the manager's, per strand ({@link StrandInstanceManager.setOfflineMode}).
|
|
272
281
|
*/
|
|
273
282
|
offline?: StrandOfflineConfig & StrandOfflineListeners;
|
|
274
283
|
/**
|
|
275
|
-
* Where each database built for the launch reports an `App` schema apply it held back
|
|
276
|
-
* (`CadreNode` emits
|
|
284
|
+
* Where each database built for the launch reports an `App` schema apply it held back, and a
|
|
285
|
+
* higher App schema version another member recorded (`CadreNode` emits the first as events and
|
|
286
|
+
* stops the strand on the second). Retained and isolated like {@link onCommitDurability}.
|
|
277
287
|
*/
|
|
278
288
|
appSchema?: StrandAppSchemaListeners;
|
|
279
289
|
/**
|
|
@@ -353,7 +363,7 @@ export declare class StrandInstanceManager {
|
|
|
353
363
|
/**
|
|
354
364
|
* Retained launch config per strand, captured in `startStrand` and cleared in
|
|
355
365
|
* `stopStrand`. `resumeStrand` reuses it to rebuild a quiesced strand's runtime
|
|
356
|
-
* without the caller re-threading storage/network/
|
|
366
|
+
* without the caller re-threading storage/network/node-class/key/sApp config.
|
|
357
367
|
*/
|
|
358
368
|
private launchConfigs;
|
|
359
369
|
/**
|
|
@@ -419,6 +429,13 @@ export declare class StrandInstanceManager {
|
|
|
419
429
|
* nobody and a resume redials over the new node.
|
|
420
430
|
*/
|
|
421
431
|
private peerRedials;
|
|
432
|
+
/**
|
|
433
|
+
* The per-strand background WebRTC upgrade of relayed connections (`webrtc-upgrade.ts`), keyed
|
|
434
|
+
* by strand id. Same lifecycle as {@link peerRedials}: started in `buildStrandRuntime` once
|
|
435
|
+
* the libp2p node exists, stopped first in `releaseRuntime`, so a hibernating strand dials no
|
|
436
|
+
* upgrade and a resume judges the new node's connections with no backoff carried over.
|
|
437
|
+
*/
|
|
438
|
+
private webrtcUpgrades;
|
|
422
439
|
/**
|
|
423
440
|
* The party's other machines known to hold each strand (`strand-party-machines.ts`), keyed
|
|
424
441
|
* by strand id, on a node offering offline mode for a launch with a party-machine seam. Same
|
|
@@ -474,10 +491,19 @@ export declare class StrandInstanceManager {
|
|
|
474
491
|
private transitions;
|
|
475
492
|
/**
|
|
476
493
|
* The pending database retry per strand id of a launch whose database could not be built
|
|
477
|
-
* because no
|
|
494
|
+
* because no machine that can answer for the strand's blocks was reachable yet
|
|
495
|
+
* ({@link deferUnreachableJoin}). Cleared by
|
|
478
496
|
* {@link releaseRuntime}, so a stop or a quiesce cancels it.
|
|
479
497
|
*/
|
|
480
498
|
private unreachableJoinRetries;
|
|
499
|
+
/**
|
|
500
|
+
* Per strand id, the sApp claim ({@link attachSApp}) whose schema the retained launch config
|
|
501
|
+
* carries but no apply has landed yet: the claim found no live database, or its live apply failed
|
|
502
|
+
* for a reason that may pass. Lets a build that refuses that schema fall back to the replica
|
|
503
|
+
* ({@link revertRefusedAttach}). Deleted when a database applies the schema, by that fallback,
|
|
504
|
+
* and when {@link stopStrand} begins.
|
|
505
|
+
*/
|
|
506
|
+
private unappliedAttaches;
|
|
481
507
|
/**
|
|
482
508
|
* The offline mode set per strand id ({@link setOfflineMode}); a strand absent here runs in its
|
|
483
509
|
* launch's `initialMode`. Never cleared: the mode belongs to the strand, not to one database, so
|
|
@@ -506,6 +532,8 @@ export declare class StrandInstanceManager {
|
|
|
506
532
|
* Check if a strand is currently running
|
|
507
533
|
*/
|
|
508
534
|
hasStrand(strandId: string): boolean;
|
|
535
|
+
/** The sApp config the tracked strand's next build applies (its retained launch config's), or `undefined` for a replica or an untracked strand. */
|
|
536
|
+
launchedSAppConfig(strandId: string): SAppConfig | undefined;
|
|
509
537
|
/**
|
|
510
538
|
* Start a new strand instance.
|
|
511
539
|
*
|
|
@@ -539,15 +567,15 @@ export declare class StrandInstanceManager {
|
|
|
539
567
|
* Build (or rebuild) the libp2p node + StrandDatabase for an instance and
|
|
540
568
|
* attach them, transitioning it to `active`. Shared by `startStrand` (fresh
|
|
541
569
|
* launch) and `resumeStrand` (rehydrating a quiesced instance). Reads all
|
|
542
|
-
* volatile inputs (bootstrapNodes, servingMachines, network,
|
|
570
|
+
* volatile inputs (bootstrapNodes, servingMachines, network, roles,
|
|
543
571
|
* privateKey, sApp config) from `config`, so the caller controls the
|
|
544
572
|
* cohort-derived values. Storage is the
|
|
545
573
|
* one input it does NOT re-read from `config`: that belongs to the instance and
|
|
546
574
|
* comes from `strandStorages`.
|
|
547
575
|
*
|
|
548
|
-
* A database that cannot be built because no
|
|
549
|
-
* build: the runtime comes up `'syncing'` without it and the
|
|
550
|
-
* retried on the same node ({@link deferUnreachableJoin}).
|
|
576
|
+
* A database that cannot be built because no machine that can answer for the strand's blocks
|
|
577
|
+
* was reachable does not fail the build: the runtime comes up `'syncing'` without it and the
|
|
578
|
+
* database phase alone is retried on the same node ({@link deferUnreachableJoin}).
|
|
551
579
|
*/
|
|
552
580
|
private buildStrandRuntime;
|
|
553
581
|
/**
|
|
@@ -556,10 +584,13 @@ export declare class StrandInstanceManager {
|
|
|
556
584
|
* {@link buildStrandRuntime} and again by each {@link retryUnreachableJoin}, with a new
|
|
557
585
|
* StrandDatabase per attempt.
|
|
558
586
|
*
|
|
559
|
-
* Returns `'awaiting-
|
|
560
|
-
*
|
|
561
|
-
* other failure throws, with the attempt's database left with its gate for
|
|
587
|
+
* Returns `'awaiting-peer'` when initialize failed only because no machine that can answer for
|
|
588
|
+
* the strand's blocks was reachable: that attempt's database is closed and the node keeps
|
|
589
|
+
* running. Any other failure throws, with the attempt's database left with its gate for
|
|
562
590
|
* {@link releaseRuntime} to close.
|
|
591
|
+
*
|
|
592
|
+
* A client node's database (`roles.strandCohortMember: false`) is published as soon as it
|
|
593
|
+
* initializes, like a founder's: see the first-sync decision below.
|
|
563
594
|
*/
|
|
564
595
|
private buildStrandDatabase;
|
|
565
596
|
/**
|
|
@@ -579,9 +610,10 @@ export declare class StrandInstanceManager {
|
|
|
579
610
|
/** Ask the launcher for a rebuild when a machine removed from the party is in this runtime's seed. */
|
|
580
611
|
private watchSeedForRemovedMachines;
|
|
581
612
|
/**
|
|
582
|
-
* The party's other machines known to
|
|
613
|
+
* The party's other machines known to STORE `strandId` ({@link StrandPartyMachines.machines},
|
|
614
|
+
* clients already dropped) with no open connection from its strand
|
|
583
615
|
* 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
|
|
616
|
+
* (`docs/strands/writes.md` → "Waiting for the party's own machines"). Empty for a strand not tracked
|
|
585
617
|
* or not running here, and on a launch that tracks no party machines.
|
|
586
618
|
*/
|
|
587
619
|
unreachedPartyMachines(strandId: string): readonly PartyStrandPeer[];
|
|
@@ -593,22 +625,31 @@ export declare class StrandInstanceManager {
|
|
|
593
625
|
/** Close a database attempt that failed to initialize, and drop its gate if it is still the registered one. */
|
|
594
626
|
private discardDatabaseAttempt;
|
|
595
627
|
/**
|
|
596
|
-
* Keep a launch `'syncing'` when its database could not be built because no
|
|
597
|
-
*
|
|
598
|
-
* runtime already up.
|
|
628
|
+
* Keep a launch `'syncing'` when its database could not be built because no machine that can
|
|
629
|
+
* answer for the strand's blocks was reachable, and retry the database build every
|
|
630
|
+
* {@link UNREACHABLE_JOIN_RETRY_MS} on the runtime already up. Which launches reach here and
|
|
631
|
+
* why waiting beats refusing: `docs/strands/lifecycle.md` → "A launch with nobody to answer
|
|
632
|
+
* waits". What makes each of them unable to build:
|
|
633
|
+
*
|
|
634
|
+
* - **A joining storage replica whose seed is silent.** Optimystic (since 1.11.0) will not rule
|
|
635
|
+
* a block never-created while any of a node's `bootstrapNodes` is unheard, so a joiner alone
|
|
636
|
+
* with an unreachable seed cannot build even the schema catalog: `strandDb.initialize()` fails
|
|
637
|
+
* `cohort-unreachable`.
|
|
638
|
+
* - **A founder whose cohort is unreachable.** Its membership writes run inside `initialize()`
|
|
639
|
+
* and fail the same way. Normally a founder has no seed (no sibling runs the strand yet) and
|
|
640
|
+
* commits alone, so this is the founder given one.
|
|
641
|
+
* - **A client** (`roles.strandCohortMember: false`) with no serving machine reachable. Its own
|
|
642
|
+
* cohort is empty by construction, so every block its launch touches falls through to
|
|
643
|
+
* `findCoordinator`, which resolves nobody at all: the schema catalog it opens first, and a
|
|
644
|
+
* client founder's membership writes. A node that serves no storage never coordinates a key,
|
|
645
|
+
* however isolated it is, so founding alone is not open to it either.
|
|
599
646
|
*
|
|
600
|
-
*
|
|
601
|
-
* `bootstrapNodes` is unheard, so a joiner alone with an unreachable seed cannot build even
|
|
602
|
-
* the schema catalog: `strandDb.initialize()` fails with `cohort-unreachable`. A founder
|
|
603
|
-
* given a seed is refused the same way (normally it has none: no sibling runs the strand yet). Refusing is
|
|
604
|
-
* right (building it alone would fork the catalog), but failing the launch would drop the
|
|
605
|
-
* strand until the watcher relaunched it, and `addStrand` would reject with a raw Optimystic
|
|
606
|
-
* error. Deferring gives a joiner the same contract the first-sync gate gives one that did
|
|
647
|
+
* Deferring gives every one of them the contract the first-sync gate gives a joiner that did
|
|
607
648
|
* build: the strand stays tracked, {@link whenWritable} waits and rejects with the retryable
|
|
608
|
-
* `StrandAwaitingFirstSyncError`, and the launch proceeds once a
|
|
649
|
+
* `StrandAwaitingFirstSyncError`, and the launch proceeds once a machine answers.
|
|
609
650
|
*
|
|
610
|
-
* The libp2p node, its connections and the background loops stay up meanwhile. A
|
|
611
|
-
*
|
|
651
|
+
* The libp2p node, its connections and the background loops stay up meanwhile. A peer can
|
|
652
|
+
* answer just after the schema read gave up on it — on a slow link it connects and its
|
|
612
653
|
* peer-join backfill delivers the whole store — and the retry then builds the database, and
|
|
613
654
|
* runs the first-sync probe, while that peer is still connected.
|
|
614
655
|
*/
|
|
@@ -617,10 +658,18 @@ export declare class StrandInstanceManager {
|
|
|
617
658
|
* One retry scheduled by {@link deferUnreachableJoin}: the database phase again, on the
|
|
618
659
|
* runtime still attached. Skipped when the strand was stopped or released since — a quiesce
|
|
619
660
|
* releases it and the resume after rebuilds the whole runtime — or already has a database.
|
|
620
|
-
* A failure other than an
|
|
621
|
-
* `'error'`, as a failed resume does
|
|
661
|
+
* A failure other than an unreachable machine releases the runtime and marks the strand
|
|
662
|
+
* `'error'`, as a failed resume does, unless it is a refusal of a claim's schema the replica
|
|
663
|
+
* can fall back from ({@link buildJoinDatabaseOrReplica}).
|
|
622
664
|
*/
|
|
623
665
|
private retryUnreachableJoin;
|
|
666
|
+
/**
|
|
667
|
+
* A deferred join's database phase ({@link buildStrandDatabase}), run once more as the replica
|
|
668
|
+
* when it fails on the schema of a claim that has not applied yet ({@link revertRefusedAttach}).
|
|
669
|
+
* The failed attempt's database is closed first: a failure leaves it registered with its gate.
|
|
670
|
+
* `'released'` when a stop began while it closed.
|
|
671
|
+
*/
|
|
672
|
+
private buildJoinDatabaseOrReplica;
|
|
624
673
|
/** Whether `instance` is still tracked, with `node` still its runtime's libp2p node. */
|
|
625
674
|
private isCurrentRuntime;
|
|
626
675
|
/**
|
|
@@ -823,6 +872,28 @@ export declare class StrandInstanceManager {
|
|
|
823
872
|
private settleTransition;
|
|
824
873
|
/** Body of {@link resumeStrand}; at most one runs per strand at a time. */
|
|
825
874
|
private runResume;
|
|
875
|
+
/**
|
|
876
|
+
* {@link buildStrandRuntime}, run once more as the replica when it fails on the schema of a
|
|
877
|
+
* claim that has not applied yet ({@link revertRefusedAttach}). Safe to run twice: a failed
|
|
878
|
+
* build releases both handles before it rejects.
|
|
879
|
+
*/
|
|
880
|
+
private buildRuntimeOrReplica;
|
|
881
|
+
/**
|
|
882
|
+
* Undo a claim of a storage replica ({@link attachSApp}) after an apply of its schema was refused
|
|
883
|
+
* (`AppSchemaRefusedError`): the retained launch config drops the sApp, so later rebuilds run the
|
|
884
|
+
* replica, and the instance gets back the replica's unset `sAppInfo` and its latency hint. Only
|
|
885
|
+
* when `error` is such a refusal, `refused` is the claim the strand has not applied yet, and the
|
|
886
|
+
* retained config still carries it, so a config rewritten since is left alone.
|
|
887
|
+
*
|
|
888
|
+
* @returns the replica's launch config, or `undefined` when nothing was undone.
|
|
889
|
+
*/
|
|
890
|
+
private revertRefusedAttach;
|
|
891
|
+
/**
|
|
892
|
+
* Forget the unapplied claim of `strandId` once `database`, given the claim's sApp config as
|
|
893
|
+
* `applied`, has applied its schema. An apply still deferred keeps it, since its retry can still be
|
|
894
|
+
* refused by the strand's rows.
|
|
895
|
+
*/
|
|
896
|
+
private forgetAppliedAttach;
|
|
826
897
|
/**
|
|
827
898
|
* Honor a founder request against an ALREADY-TRACKED strand — the seam that
|
|
828
899
|
* closes the "whoever launches first decides whether the bootstrap runs" gap:
|
|
@@ -866,19 +937,24 @@ export declare class StrandInstanceManager {
|
|
|
866
937
|
*
|
|
867
938
|
* A runtime build in flight (the replica's launch, or a hibernation wake) is waited out
|
|
868
939
|
* first, so the attach acts on the database that build produced. Then, in order: the
|
|
869
|
-
* schema signature
|
|
870
|
-
*
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
940
|
+
* schema signature, and the refusals the schema's text alone decides (`checkAppSchema`: a
|
|
941
|
+
* `seed` item, an item the parser skipped, a syntax error), are checked before anything
|
|
942
|
+
* changes; the retained launch config takes the sApp, so every later rebuild applies it
|
|
943
|
+
* through `composeStrand`; the live database — published, or still held by the first-sync
|
|
944
|
+
* gate — gets the schema; and only then does the instance record `sAppInfo` and the sApp's
|
|
945
|
+
* latency hint. An instance with no live database gets the config alone: a quiesced one
|
|
946
|
+
* applies the schema at its next resume, a launch waiting for a seed peer at its next
|
|
947
|
+
* database retry, and that build falls back to the replica if the strand's tables and rows
|
|
948
|
+
* refuse the schema ({@link revertRefusedAttach}).
|
|
875
949
|
*
|
|
876
950
|
* @returns `'already-attached'` when the instance already runs an sApp — a DIFFERENT one
|
|
877
951
|
* is logged and left as it is, as a second claim of a claimed strand always has been —
|
|
878
952
|
* else `'attached'`.
|
|
879
953
|
* @throws when the strand is not tracked (a caller bug, or a launch that failed while
|
|
880
|
-
* this waited on it); when the schema signature is refused, having
|
|
881
|
-
*
|
|
954
|
+
* this waited on it); when the schema signature or the schema's text is refused, having
|
|
955
|
+
* changed nothing; `AppSchemaRefusedError` when the live apply refuses the schema against
|
|
956
|
+
* the replica's tables and rows, having put the retained config back to the replica's; and
|
|
957
|
+
* whatever else the live apply throws (e.g. a quiesce closed the database mid-apply) — the
|
|
882
958
|
* retained config then still carries the sApp and `sAppInfo` stays unset, so the next
|
|
883
959
|
* claim retries the apply.
|
|
884
960
|
*
|
|
@@ -890,11 +966,27 @@ export declare class StrandInstanceManager {
|
|
|
890
966
|
attachSApp(strandId: string, sAppConfig: SAppConfig, options?: {
|
|
891
967
|
requireSignedSchemas?: boolean;
|
|
892
968
|
}): Promise<'attached' | 'already-attached'>;
|
|
969
|
+
/**
|
|
970
|
+
* The tracked instance and retained config an {@link attachSApp} claim acts on, or
|
|
971
|
+
* `'already-attached'` when the instance already runs an sApp (a claim for a different one is
|
|
972
|
+
* logged and ignored).
|
|
973
|
+
*
|
|
974
|
+
* @throws when the strand is not tracked.
|
|
975
|
+
*/
|
|
976
|
+
private claimTarget;
|
|
977
|
+
/**
|
|
978
|
+
* Apply a claim's schema to the replica's live database. A refusal by the replica's tables and
|
|
979
|
+
* rows puts the retained config back to the replica's ({@link revertRefusedAttach}): the replica
|
|
980
|
+
* holds no `App` schema, so the refused apply left nothing to drop. Any other failure leaves the
|
|
981
|
+
* claim retained and unapplied, for the next claim or build to retry.
|
|
982
|
+
*/
|
|
983
|
+
private applyClaimedSchema;
|
|
893
984
|
/**
|
|
894
985
|
* Whether `strandId` is launched but still waiting for its first sync — a joiner whose
|
|
895
986
|
* runtime is up while its database is withheld (status `'syncing'`, or `'idle'` after
|
|
896
987
|
* the hibernation manager's idle timer fired on it), including one whose database build
|
|
897
|
-
* waits for a
|
|
988
|
+
* waits for a machine that can answer for the strand to be reachable
|
|
989
|
+
* ({@link deferUnreachableJoin}). `false` for a writable,
|
|
898
990
|
* quiesced, or untracked strand. The predicate {@link whenWritable}'s callers gate on.
|
|
899
991
|
*/
|
|
900
992
|
isAwaitingFirstSync(strandId: string): boolean;
|