@serfab/cadre-core 0.11.0 → 0.13.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 +3 -2
- package/dist/announce-addrs.d.ts +49 -0
- package/dist/announce-addrs.js +78 -0
- package/dist/announce-addrs.js.map +1 -0
- package/dist/cadre-node.d.ts +607 -53
- package/dist/cadre-node.js +1268 -157
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +174 -23
- package/dist/control-database.js +317 -107
- package/dist/control-database.js.map +1 -1
- package/dist/control-read-retry.d.ts +103 -0
- package/dist/control-read-retry.js +145 -0
- package/dist/control-read-retry.js.map +1 -0
- package/dist/control-retry.d.ts +101 -0
- package/dist/control-retry.js +108 -0
- package/dist/control-retry.js.map +1 -0
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +50 -6
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +59 -35
- package/dist/control-write-retry.js +21 -92
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +17 -15
- package/dist/delegate-admission.js +17 -15
- package/dist/delegate-admission.js.map +1 -1
- package/dist/enrolled-machine-store-file.d.ts +13 -0
- package/dist/enrolled-machine-store-file.js +41 -0
- package/dist/enrolled-machine-store-file.js.map +1 -0
- package/dist/enrolled-machine-store.d.ts +81 -0
- package/dist/enrolled-machine-store.js +225 -0
- package/dist/enrolled-machine-store.js.map +1 -0
- package/dist/file-durable-slot.js +5 -3
- package/dist/file-durable-slot.js.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.js +39 -12
- package/dist/index.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +226 -26
- package/dist/membership-connection-gater.js +316 -30
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/node-local-snapshot.d.ts +6 -0
- package/dist/node-local-snapshot.js +7 -1
- package/dist/node-local-snapshot.js.map +1 -1
- package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
- package/dist/{strand-backfill.js → peer-join-backfill.js} +146 -56
- package/dist/peer-join-backfill.js.map +1 -0
- package/dist/peer-record.d.ts +26 -0
- package/dist/peer-record.js +32 -0
- package/dist/peer-record.js.map +1 -1
- package/dist/relay-addrs.d.ts +145 -22
- package/dist/relay-addrs.js +314 -31
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +20 -15
- package/dist/relay-reservation.js +18 -14
- package/dist/relay-reservation.js.map +1 -1
- package/dist/strand-addr-protocol.js +16 -0
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-database.d.ts +12 -0
- package/dist/strand-database.js +16 -0
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-formation-manager.d.ts +22 -9
- package/dist/strand-formation-manager.js +20 -12
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +83 -9
- package/dist/strand-formation-protocol.js +86 -10
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +151 -17
- package/dist/strand-instance-manager.js +237 -32
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +118 -14
- package/dist/strand-membership-writer.js +203 -15
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-network-config.d.ts +84 -0
- package/dist/strand-network-config.js +136 -0
- package/dist/strand-network-config.js.map +1 -0
- package/dist/strand-revocation-enforcer.d.ts +392 -0
- package/dist/strand-revocation-enforcer.js +533 -0
- package/dist/strand-revocation-enforcer.js.map +1 -0
- package/dist/strand-solicitation.d.ts +10 -3
- package/dist/strand-solicitation.js +12 -7
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-wake-protocol.d.ts +47 -2
- package/dist/strand-wake-protocol.js +76 -6
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/strand-watcher.js +6 -1
- package/dist/strand-watcher.js.map +1 -1
- package/dist/types.d.ts +282 -43
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/package.json +16 -8
- package/src/announce-addrs.ts +93 -0
- package/src/cadre-node.ts +1366 -171
- package/src/control-database.ts +2628 -2406
- package/src/control-read-retry.ts +167 -0
- package/src/control-retry.ts +190 -0
- package/src/control-schema.ts +50 -6
- package/src/control-write-retry.ts +30 -130
- package/src/delegate-admission.ts +17 -15
- package/src/enrolled-machine-store-file.ts +43 -0
- package/src/enrolled-machine-store.ts +280 -0
- package/src/file-durable-slot.ts +5 -3
- package/src/index.ts +477 -407
- package/src/membership-connection-gater.ts +539 -204
- package/src/node-local-snapshot.ts +13 -1
- package/src/peer-addr-book.ts +251 -250
- package/src/{strand-backfill.ts → peer-join-backfill.ts} +187 -75
- package/src/peer-record.ts +33 -0
- package/src/relay-addrs.ts +436 -111
- package/src/relay-reservation.ts +828 -823
- package/src/strand-addr-protocol.ts +17 -0
- package/src/strand-database.ts +17 -0
- package/src/strand-formation-manager.ts +511 -491
- package/src/strand-formation-protocol.ts +808 -692
- package/src/strand-instance-manager.ts +899 -611
- package/src/strand-membership-writer.ts +232 -15
- package/src/strand-network-config.ts +172 -0
- package/src/strand-revocation-enforcer.ts +653 -0
- package/src/strand-solicitation.ts +484 -472
- package/src/strand-wake-protocol.ts +94 -8
- package/src/strand-watcher.ts +319 -314
- package/src/types.ts +1554 -1309
- package/dist/strand-backfill.js.map +0 -1
|
@@ -347,6 +347,18 @@ export async function collectStrandAddrs(
|
|
|
347
347
|
* failure. Tries each dial target in order (peerId first to reuse an open control
|
|
348
348
|
* connection, then explicit addrs) until one answers; a total failure is logged
|
|
349
349
|
* and folded to `[]` so a single dead sibling never aborts the collection.
|
|
350
|
+
*
|
|
351
|
+
* A total failure logs ONE line naming every target and its cause. `[]` alone
|
|
352
|
+
* cannot tell the caller "this sibling was unreachable" apart from "this sibling
|
|
353
|
+
* answered and has no strand address" — and per-target lines scattered through a
|
|
354
|
+
* concurrent fan-out do not reassemble into that answer either. The return
|
|
355
|
+
* contract is unchanged: best-effort `[]`, never a throw.
|
|
356
|
+
*
|
|
357
|
+
* NOTE: cost is (targets × `timeoutMs`) with no whole-sibling budget, the same
|
|
358
|
+
* shape `dialWake` bounds with `DEFAULT_WAKE_DIAL_BUDGET_MS`. Fine today —
|
|
359
|
+
* `dialTargets` yields the peerId plus whatever `resolvePeerAddrs` returned,
|
|
360
|
+
* which for a cadre device is one or two addresses. If a sibling's record ever
|
|
361
|
+
* carries a long address list, give this the same whole-sibling budget.
|
|
350
362
|
*/
|
|
351
363
|
async function dialOneSibling(
|
|
352
364
|
node: Libp2p,
|
|
@@ -363,6 +375,7 @@ async function dialOneSibling(
|
|
|
363
375
|
return [];
|
|
364
376
|
}
|
|
365
377
|
|
|
378
|
+
const failures: string[] = [];
|
|
366
379
|
for (const target of targets) {
|
|
367
380
|
try {
|
|
368
381
|
// One deadline per attempt: its signal aborts the in-flight dialProtocol and
|
|
@@ -374,9 +387,13 @@ async function dialOneSibling(
|
|
|
374
387
|
);
|
|
375
388
|
return response.multiaddrs;
|
|
376
389
|
} catch (err) {
|
|
390
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
391
|
+
failures.push(`${describeTarget(target)} — ${error.message}`);
|
|
377
392
|
log('Strand-addr dial to %s via %s failed: %o', peer.peerId, describeTarget(target), err);
|
|
378
393
|
}
|
|
379
394
|
}
|
|
395
|
+
log('Strand-addr dial to %s failed on all %d target(s), contributing no addrs: %s',
|
|
396
|
+
peer.peerId, failures.length, failures.join('; '));
|
|
380
397
|
return [];
|
|
381
398
|
}
|
|
382
399
|
|
package/src/strand-database.ts
CHANGED
|
@@ -154,6 +154,23 @@ export class StrandDatabase {
|
|
|
154
154
|
return strandMemberKeyPair(memberPrivateKey);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Run the founder membership bootstrap against an ALREADY-LIVE database — the
|
|
159
|
+
* seam {@link StrandInstanceManager.foundExistingStrand} uses when a founder
|
|
160
|
+
* request arrives for an instance that was first launched as a joiner.
|
|
161
|
+
* Idempotent: every bootstrap write is insert-if-absent
|
|
162
|
+
* ({@link bootstrapFounderMembership}), so calling it on an instance that
|
|
163
|
+
* already founded writes nothing. Also flips the captured config's `founder`,
|
|
164
|
+
* so this object's own record of how it was launched stays coherent with what
|
|
165
|
+
* actually ran (a construction-time `founder: false` is a statement about the
|
|
166
|
+
* launch, not a permanent identity).
|
|
167
|
+
*/
|
|
168
|
+
async ensureFounderBootstrap(): Promise<void> {
|
|
169
|
+
this.ensureInitialized();
|
|
170
|
+
this.config.founder = true;
|
|
171
|
+
await this.bootstrapFounder();
|
|
172
|
+
}
|
|
173
|
+
|
|
157
174
|
/**
|
|
158
175
|
* Get the underlying database for queries
|
|
159
176
|
*/
|