@serfab/cadre-core 0.12.0 → 1.0.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 +23 -8
- package/dist/bootstrap-peer-store-file.js +2 -2
- package/dist/bootstrap-peer-store.d.ts +32 -12
- package/dist/bootstrap-peer-store.js +41 -15
- package/dist/bootstrap-peer-store.js.map +1 -1
- package/dist/cadre-node.d.ts +883 -102
- package/dist/cadre-node.js +1800 -209
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +2 -2
- package/dist/control-authorization.js +1 -0
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +13 -26
- package/dist/control-cohort.js +0 -26
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +318 -44
- package/dist/control-database.js +516 -74
- package/dist/control-database.js.map +1 -1
- package/dist/control-read-retry.d.ts +40 -11
- package/dist/control-read-retry.js +48 -15
- package/dist/control-read-retry.js.map +1 -1
- package/dist/control-retry.d.ts +58 -3
- package/dist/control-retry.js +58 -3
- package/dist/control-retry.js.map +1 -1
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +133 -21
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +80 -11
- package/dist/control-write-retry.js +168 -29
- package/dist/control-write-retry.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 +17 -8
- package/dist/index.js +54 -9
- package/dist/index.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +15 -1
- package/dist/membership-connection-gater.js +9 -3
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/node-local-snapshot.d.ts +21 -7
- package/dist/node-local-snapshot.js +30 -9
- package/dist/node-local-snapshot.js.map +1 -1
- package/dist/peer-dial.d.ts +143 -0
- package/dist/peer-dial.js +176 -0
- package/dist/peer-dial.js.map +1 -0
- package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
- package/dist/{strand-backfill.js → peer-join-backfill.js} +133 -52
- package/dist/peer-join-backfill.js.map +1 -0
- package/dist/relay-addrs.d.ts +160 -49
- package/dist/relay-addrs.js +287 -60
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +71 -3
- package/dist/relay-reservation.js +116 -8
- package/dist/relay-reservation.js.map +1 -1
- package/dist/seed-bootstrap.d.ts +30 -1
- package/dist/seed-bootstrap.js +62 -17
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/storage-scope.d.ts +62 -0
- package/dist/storage-scope.js +75 -0
- package/dist/storage-scope.js.map +1 -0
- package/dist/strand-database.d.ts +41 -11
- package/dist/strand-database.js +48 -18
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +152 -0
- package/dist/strand-first-sync-gate.js +208 -0
- package/dist/strand-first-sync-gate.js.map +1 -0
- package/dist/strand-formation-manager.d.ts +99 -5
- package/dist/strand-formation-manager.js +119 -8
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +97 -3
- package/dist/strand-formation-protocol.js +108 -2
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +389 -19
- package/dist/strand-instance-manager.js +678 -65
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-member-key.d.ts +20 -12
- package/dist/strand-member-key.js +20 -12
- package/dist/strand-member-key.js.map +1 -1
- package/dist/strand-member-registry.js +3 -0
- package/dist/strand-member-registry.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +361 -0
- package/dist/strand-membership-reconciler.js +548 -0
- package/dist/strand-membership-reconciler.js.map +1 -0
- package/dist/strand-membership-writer.d.ts +143 -11
- package/dist/strand-membership-writer.js +419 -135
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-network-config.d.ts +116 -0
- package/dist/strand-network-config.js +192 -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 +17 -1
- package/dist/strand-solicitation.js +13 -2
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-wake-protocol.d.ts +11 -7
- package/dist/strand-wake-protocol.js +20 -52
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/strand-watcher.js +12 -1
- package/dist/strand-watcher.js.map +1 -1
- package/dist/timed-step.d.ts +12 -0
- package/dist/timed-step.js +28 -0
- package/dist/timed-step.js.map +1 -0
- package/dist/timeout-scheduler.d.ts +19 -0
- package/dist/timeout-scheduler.js +22 -0
- package/dist/timeout-scheduler.js.map +1 -0
- package/dist/types.d.ts +472 -46
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/package.json +16 -8
- package/src/bootstrap-peer-store-file.ts +2 -2
- package/src/bootstrap-peer-store.ts +69 -27
- package/src/cadre-node.ts +1926 -228
- package/src/control-authorization.ts +2 -1
- package/src/control-cohort.ts +122 -130
- package/src/control-database.ts +586 -74
- package/src/control-read-retry.ts +202 -167
- package/src/control-retry.ts +297 -190
- package/src/control-schema.ts +133 -21
- package/src/control-write-retry.ts +525 -383
- 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 +134 -15
- package/src/membership-connection-gater.ts +9 -3
- package/src/node-local-snapshot.ts +38 -9
- package/src/peer-addr-book.ts +251 -250
- package/src/peer-dial.ts +215 -0
- package/src/{strand-backfill.ts → peer-join-backfill.ts} +478 -389
- package/src/relay-addrs.ts +458 -218
- package/src/relay-reservation.ts +951 -828
- package/src/seed-bootstrap.ts +76 -18
- package/src/storage-scope.ts +78 -0
- package/src/strand-database.ts +61 -21
- package/src/strand-first-sync-gate.ts +258 -0
- package/src/strand-formation-manager.ts +162 -8
- package/src/strand-formation-protocol.ts +850 -692
- package/src/strand-instance-manager.ts +877 -74
- package/src/strand-member-key.ts +20 -12
- package/src/strand-member-registry.ts +3 -0
- package/src/strand-membership-reconciler.ts +680 -0
- package/src/strand-membership-writer.ts +550 -190
- package/src/strand-network-config.ts +250 -0
- package/src/strand-revocation-enforcer.ts +653 -0
- package/src/strand-solicitation.ts +499 -471
- package/src/strand-wake-protocol.ts +21 -66
- package/src/strand-watcher.ts +325 -314
- package/src/timed-step.ts +28 -0
- package/src/timeout-scheduler.ts +28 -0
- package/src/types.ts +487 -52
- package/dist/strand-backfill.js.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-local, NON-replicated record of how many machines this party had enrolled
|
|
3
|
+
* the last time this node looked — the block-repair corroboration yardstick the
|
|
4
|
+
* CONTROL network declares when its libp2p node is built.
|
|
5
|
+
*
|
|
6
|
+
* ## Why the number has to be remembered rather than read
|
|
7
|
+
*
|
|
8
|
+
* `resolveRepairYardstick` (in `@serfab/quereus-plugin-sereus`'s `cluster-size.ts`
|
|
9
|
+
* — read it first; the arithmetic and both clamps are explained there and are not
|
|
10
|
+
* repeated here) derives the yardstick from the machines that SERVE the network being
|
|
11
|
+
* configured. For the CONTROL network that is the machines enrolled in the party, and
|
|
12
|
+
* exactly so: every enrolled machine runs the control node by construction. (It is NOT
|
|
13
|
+
* the right number for a strand, which runs on a subset — see
|
|
14
|
+
* `StartStrandConfig.servingMachines`. This store is control-network-only, and that
|
|
15
|
+
* scope is a safety property, not an accident.) Optimystic freezes a network's
|
|
16
|
+
* `clusterPolicy` when its libp2p node is built and offers no runtime setter, so the
|
|
17
|
+
* number has to be known at construction time.
|
|
18
|
+
*
|
|
19
|
+
* The control node cannot read it when it needs it. `CadreNode.buildControlNodeOptions`
|
|
20
|
+
* runs inside `start()` BEFORE `createControlNode()`, which is before the
|
|
21
|
+
* `ControlDatabase` holding the `CadrePeer` rows exists — so at the one moment the
|
|
22
|
+
* number is needed, nothing can answer. That deadlock is why the control network
|
|
23
|
+
* declared no yardstick at all and ran at `CONTROL_CLUSTER_POLICY`'s
|
|
24
|
+
* `assumedClusterSize` of 2.
|
|
25
|
+
*
|
|
26
|
+
* This store breaks it the only way a chicken-and-egg is broken: by remembering
|
|
27
|
+
* across the restart. `CadreNode.refreshAuthorizedControlPeers` records the count
|
|
28
|
+
* every time membership is recomputed; `CadreNode.start()` reads it back before the
|
|
29
|
+
* control node is built. A node therefore declares what it last knew, and a party
|
|
30
|
+
* that grows applies the larger number on each node's NEXT launch. Raising the
|
|
31
|
+
* yardstick is the safe direction and a node still holding the old value is running
|
|
32
|
+
* at exactly today's behaviour, so the next natural restart is soon enough — there
|
|
33
|
+
* is deliberately no forced rebuild.
|
|
34
|
+
*
|
|
35
|
+
* ## Why this is NOT a `NodeLocalSnapshot` like its two siblings
|
|
36
|
+
*
|
|
37
|
+
* The trusted-owner anchor (`trusted-owner-store.ts`) and the cold-start
|
|
38
|
+
* bootstrap-peer store (`bootstrap-peer-store.ts`) are the same `{ version,
|
|
39
|
+
* partyId, ... }` envelope over a {@link DurableSlot} this record is, and this
|
|
40
|
+
* module is deliberately symmetrical with them — same injected-backend shape, same
|
|
41
|
+
* `Memory*` / `Persistent*` / `File*` split, same party scoping. It does NOT share
|
|
42
|
+
* their `NodeLocalSnapshot` machinery, for two reasons:
|
|
43
|
+
*
|
|
44
|
+
* - **Shape.** `NodeLocalSnapshot` is a `key -> entry` map. This record is one
|
|
45
|
+
* integer that must be able to go DOWN after a machine is removed.
|
|
46
|
+
* - **Load policy — the important one.** `NodeLocalSnapshot.open` THROWS when the
|
|
47
|
+
* slot is present but unreadable. That is right for the anchor (a record that
|
|
48
|
+
* cannot be read in full is not a trust anchor) and right for the peer store (a
|
|
49
|
+
* failed read reported as absent would let the next snapshot write destroy a
|
|
50
|
+
* stranded node's only way home). It is WRONG here. Nothing in this record is
|
|
51
|
+
* trust-bearing, it holds nothing that is not recomputed the moment the control
|
|
52
|
+
* database is up, and refusing to start a node over an unreadable *repair hint*
|
|
53
|
+
* is strictly worse than declaring today's 2. So every unreadable, unparsable,
|
|
54
|
+
* foreign-party or junk slot LOGS and COLD-STARTS, yielding `undefined`, which
|
|
55
|
+
* declares nothing, which is byte-for-byte today's behaviour.
|
|
56
|
+
*
|
|
57
|
+
* Do not "unify" the three modules by routing this one through `NodeLocalSnapshot`:
|
|
58
|
+
* that would quietly import the throw, and turn an unreadable hint into a node that
|
|
59
|
+
* will not start.
|
|
60
|
+
*
|
|
61
|
+
* NOTE: writes are serialised in-process only, the same caveat `NodeLocalSnapshot`
|
|
62
|
+
* carries. Two processes (or two browser tabs) sharing ONE slot for ONE party each
|
|
63
|
+
* write their own view and the loser's count is lost. Two same-origin tabs of
|
|
64
|
+
* `reference-app-web` do exactly that — its slot is one key of a shared IndexedDB
|
|
65
|
+
* database, the same last-writer-wins caveat its `node-local-slots.ts` already
|
|
66
|
+
* records for the other two records. Harmless here, unlike there: this value is one
|
|
67
|
+
* integer both tabs re-derive from the same membership rows on their next refresh,
|
|
68
|
+
* so the views reconverge rather than losing an entry nobody rewrites.
|
|
69
|
+
*/
|
|
70
|
+
import debug from 'debug';
|
|
71
|
+
const log = debug('sereus:cadre:enrolled-machine-store');
|
|
72
|
+
/** Envelope version. Guards future migrations; an unknown version cold-starts. */
|
|
73
|
+
const ENVELOPE_VERSION = 1;
|
|
74
|
+
/** Envelope property holding the count. */
|
|
75
|
+
const PAYLOAD_KEY = 'enrolledMachines';
|
|
76
|
+
/**
|
|
77
|
+
* Ephemeral in-memory store — the default when no store is injected via
|
|
78
|
+
* `CadreNodeConfig.enrolledMachines`. A node using this cold-starts on every
|
|
79
|
+
* launch: `count()` is `undefined` at `start()`, so its control node declares
|
|
80
|
+
* nothing and runs at today's behaviour, exactly as before this record existed.
|
|
81
|
+
*/
|
|
82
|
+
export class MemoryEnrolledMachineStore {
|
|
83
|
+
constructor(partyId) {
|
|
84
|
+
this.partyId = partyId;
|
|
85
|
+
}
|
|
86
|
+
count() {
|
|
87
|
+
return this.current;
|
|
88
|
+
}
|
|
89
|
+
async record(count) {
|
|
90
|
+
const accepted = asMachineCount(count);
|
|
91
|
+
if (accepted === undefined) {
|
|
92
|
+
log('refusing to record a non-positive-integer count %o for party %s', count, this.partyId);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.current = accepted;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Durable {@link EnrolledMachineStore} over an app-supplied {@link DurableSlot} —
|
|
100
|
+
* the cross-platform half of every persistent backend (the Node
|
|
101
|
+
* `FileEnrolledMachineStore` is this class over a file slot).
|
|
102
|
+
*
|
|
103
|
+
* Construct via {@link open}. Load policy is the module comment's: every failure
|
|
104
|
+
* mode cold-starts, and `open` never rejects.
|
|
105
|
+
*/
|
|
106
|
+
export class PersistentEnrolledMachineStore {
|
|
107
|
+
constructor(slot, partyId, loaded) {
|
|
108
|
+
this.slot = slot;
|
|
109
|
+
this.partyId = partyId;
|
|
110
|
+
/** Serialises persists so the last count recorded is the last one written. */
|
|
111
|
+
this.writeChain = Promise.resolve();
|
|
112
|
+
this.current = loaded;
|
|
113
|
+
this.persisted = loaded;
|
|
114
|
+
}
|
|
115
|
+
/** Load (or cold-start) the party's last recorded machine count from `slot`. */
|
|
116
|
+
static async open(slot, partyId) {
|
|
117
|
+
return new PersistentEnrolledMachineStore(slot, partyId, await loadCount(slot, partyId));
|
|
118
|
+
}
|
|
119
|
+
count() {
|
|
120
|
+
return this.current;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Record the count: visible via {@link count} synchronously, then persisted.
|
|
124
|
+
*
|
|
125
|
+
* Writes are SKIPPED when the slot already holds this number, because the sole
|
|
126
|
+
* caller runs on every committed membership write *and* every timed reconcile
|
|
127
|
+
* pass — a party whose membership is stable would otherwise rewrite the same
|
|
128
|
+
* integer forever. The skip is keyed off {@link persisted} rather than
|
|
129
|
+
* {@link current}, so a write that FAILED is retried by the next refresh instead
|
|
130
|
+
* of being suppressed as "unchanged".
|
|
131
|
+
*/
|
|
132
|
+
record(count) {
|
|
133
|
+
const accepted = asMachineCount(count);
|
|
134
|
+
if (accepted === undefined) {
|
|
135
|
+
log('refusing to record a non-positive-integer count %o for party %s', count, this.partyId);
|
|
136
|
+
return Promise.resolve();
|
|
137
|
+
}
|
|
138
|
+
this.current = accepted;
|
|
139
|
+
if (this.persisted === accepted) {
|
|
140
|
+
return Promise.resolve();
|
|
141
|
+
}
|
|
142
|
+
this.writeChain = this.writeChain.then(() => this.persistCurrent());
|
|
143
|
+
return this.writeChain;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Write whatever {@link current} holds when this link of the chain runs — so a
|
|
147
|
+
* burst of records collapses into one write of the latest value — and never
|
|
148
|
+
* throw (see {@link EnrolledMachineStore.record}).
|
|
149
|
+
*/
|
|
150
|
+
async persistCurrent() {
|
|
151
|
+
const pending = this.current;
|
|
152
|
+
if (pending === undefined || pending === this.persisted) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const envelope = {
|
|
156
|
+
version: ENVELOPE_VERSION,
|
|
157
|
+
partyId: this.partyId,
|
|
158
|
+
[PAYLOAD_KEY]: pending
|
|
159
|
+
};
|
|
160
|
+
try {
|
|
161
|
+
await this.slot.save(JSON.stringify(envelope, null, '\t'));
|
|
162
|
+
this.persisted = pending;
|
|
163
|
+
log('recorded %d enrolled machine(s) for party %s', pending, this.partyId);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
log('persisting %d enrolled machine(s) for party %s failed (in-memory count stands, retried on the next refresh): %o', pending, this.partyId, error);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A usable machine count, or `undefined`. Anything that is not a positive integer
|
|
172
|
+
* is unknown rather than coerced — `'3'`, `0`, `-1`, `2.5`, `null` and a missing key
|
|
173
|
+
* all cold-start. Coercing here would be the beginning of a parser, and Optimystic
|
|
174
|
+
* itself treats a degenerate declaration as absent, so a rounded value would be a
|
|
175
|
+
* number nobody chose.
|
|
176
|
+
*/
|
|
177
|
+
function asMachineCount(value) {
|
|
178
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 1 ? value : undefined;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Read the slot into the initial count. EVERY failure — unreadable slot, unparsable
|
|
182
|
+
* JSON, wrong envelope version, foreign `partyId`, junk payload — logs and returns
|
|
183
|
+
* `undefined` (see the module comment for why this record, unlike its two siblings,
|
|
184
|
+
* must not throw on an unreadable slot).
|
|
185
|
+
*/
|
|
186
|
+
async function loadCount(slot, partyId) {
|
|
187
|
+
let text;
|
|
188
|
+
try {
|
|
189
|
+
text = await slot.load();
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
// The deliberate divergence from `NodeLocalSnapshot.open`, which throws here.
|
|
193
|
+
log('slot for party %s is present but unreadable (cold start — this node declares no yardstick): %o', partyId, error);
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
if (text === undefined) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
let parsed;
|
|
200
|
+
try {
|
|
201
|
+
parsed = JSON.parse(text);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
log('corrupt slot for party %s (cold start): %o', partyId, error);
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
if (!isRecord(parsed) || parsed.version !== ENVELOPE_VERSION || parsed.partyId !== partyId) {
|
|
208
|
+
// A non-string partyId cannot equal the requested one, so this covers both a
|
|
209
|
+
// malformed envelope and a slot reused for another party.
|
|
210
|
+
log('slot for party %s has an unknown shape or a foreign partyId (cold start)', partyId);
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const count = asMachineCount(parsed[PAYLOAD_KEY]);
|
|
214
|
+
if (count === undefined) {
|
|
215
|
+
log('slot for party %s holds an unusable %s value %o (cold start)', partyId, PAYLOAD_KEY, parsed[PAYLOAD_KEY]);
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
log('loaded %d enrolled machine(s) for party %s', count, partyId);
|
|
219
|
+
return count;
|
|
220
|
+
}
|
|
221
|
+
/** A plain JSON object. Arrays excluded: an array envelope is not an envelope. */
|
|
222
|
+
function isRecord(value) {
|
|
223
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=enrolled-machine-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrolled-machine-store.js","sourceRoot":"","sources":["../src/enrolled-machine-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,GAAG,GAAG,KAAK,CAAC,qCAAqC,CAAC,CAAC;AAEzD,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,2CAA2C;AAC3C,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAiCvC;;;;;GAKG;AACH,MAAM,OAAO,0BAA0B;IAGtC,YAAqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAExC,KAAK;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACzB,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,GAAG,CAAC,iEAAiE,EAAE,KA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age.
|
|
6
6
|
*
|
|
7
7
|
* This is the whole platform-specific part of the file-backed node-local
|
|
8
|
-
* stores (`trusted-owner-store-file.ts`, `bootstrap-peer-store-file.ts
|
|
9
|
-
* load policy, envelope and write chain
|
|
10
|
-
* `node-local-snapshot.ts
|
|
8
|
+
* stores (`trusted-owner-store-file.ts`, `bootstrap-peer-store-file.ts`,
|
|
9
|
+
* `enrolled-machine-store-file.ts`); the load policy, envelope and write chain
|
|
10
|
+
* are cross-platform — in `node-local-snapshot.ts` for the first two, and in
|
|
11
|
+
* `enrolled-machine-store.ts` for the third, which deliberately does not share
|
|
12
|
+
* that machinery. Like its three importers, this module imports
|
|
11
13
|
* `node:fs/promises`, so it is kept OUT of the package's cross-platform
|
|
12
14
|
* default entry and is not itself an exported subpath.
|
|
13
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-durable-slot.js","sourceRoot":"","sources":["../src/file-durable-slot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"file-durable-slot.js","sourceRoot":"","sources":["../src/file-durable-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1F,MAAM,OAAO,eAAe;IAI3B,YACkB,GAAW,EACX,IAAY,EAC7B,OAAe;QAFE,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QAG7B,IAAI,CAAC,YAAY,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI;QACT,IAAI,CAAC;YACJ,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,UAAU,CAAC,KAAK,CAAC;gBAAE,OAAO,SAAS,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,QAAQ,EAAE,4BAA4B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACpG,CAAC;IACF,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY;QACtB,MAAM,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACvG,CAAC;IAEO,QAAQ;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,iFAAiF;IACzE,QAAQ;QACf,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC,CAAC;IAC1E,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export { canonicalJson } from './canonical-json.js';
|
|
3
3
|
export { CadreNode } from './cadre-node.js';
|
|
4
|
-
export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type RevokedRowRef } from './control-database.js';
|
|
4
|
+
export { ControlDatabase, MissingHostStrandError, buildAuthorizationMessage, formationVouchMessage, formationConsentMessage, REAPABLE_TABLES, type ReapableTable, type ControlDatabaseConfig, type ControlTable, type RevocableTable, type FormationUsageResult, type MembershipChangeListener, type GuardedDeleteListener, type ControlWriteAbandonedListener, type RevokedRowRef } from './control-database.js';
|
|
5
5
|
export { CONTROL_WRITE_ATTEMPTS, CONTROL_WRITE_RETRY_BUDGET_MS, SCHEMA_INIT_ATTEMPTS, SCHEMA_INIT_RETRY_POLICY, isRetriableControlWriteFailure, isRetriableSchemaInitFailure, retryControlWrite, type ControlWriteRetryOptions } from './control-write-retry.js';
|
|
6
6
|
export { CONTROL_READ_ATTEMPTS, CONTROL_READ_RETRY_DELAYS_MS, CONTROL_READ_RETRY_BUDGET_MS, isRetriableControlReadFailure, retryControlRead, type ControlReadRetryOptions } from './control-read-retry.js';
|
|
7
|
+
export type { ControlRetryAbandonment, ControlRetryAbandonReason, ControlRetryAbandonListener } from './control-retry.js';
|
|
7
8
|
export { controlAuthorizationFields, type ControlDomain, type ControlAction } from './control-authorization.js';
|
|
8
9
|
export { ed25519KeyPairFromLibp2p, ed25519PublicKeyFromPrivate, requireEd25519PublicKeyB64, type Ed25519KeyPair } from './ed25519-key.js';
|
|
9
10
|
export { InMemoryKeyStore, KeyStoreAccessError, DEFAULT_IDENTITY_KEY_ID, type KeyStore, type KeyId } from './key-store.js';
|
|
@@ -11,10 +12,16 @@ export { loadOrCreateIdentityKey, peerKeySigner, type PeerKeySigner } from './id
|
|
|
11
12
|
export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
|
|
12
13
|
export type { DurableSlot } from './node-local-snapshot.js';
|
|
13
14
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore, type BootstrapPeerStore, type BootstrapPeerEntry } from './bootstrap-peer-store.js';
|
|
15
|
+
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore, type EnrolledMachineStore } from './enrolled-machine-store.js';
|
|
16
|
+
export { controlStorageScope, isControlStorageScope } from './storage-scope.js';
|
|
14
17
|
export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
|
|
15
18
|
export { StrandWatcher, type StrandWatcherCallbacks, type StrandQueryable, type SAppIdLookup, type StrandRowWithApp } from './strand-watcher.js';
|
|
16
|
-
export { StrandInstanceManager, type StartStrandConfig, type ResumeStrandOverrides, getStrandStoragePath } from './strand-instance-manager.js';
|
|
17
|
-
export {
|
|
19
|
+
export { StrandInstanceManager, type StartStrandConfig, type ResumeStrandOverrides, getStrandStoragePath, isAwaitingFirstSync, liveStrandStatus } from './strand-instance-manager.js';
|
|
20
|
+
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS, DEFAULT_STRAND_FIRST_SYNC_POLL_MS, strandHeaderHeld, appTablesReadable, strandFirstSyncComplete, type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
|
|
21
|
+
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES, type PeerJoinBackfillConfig, type PeerJoinBackfillDeps, type PeerJoinBackfillResult, type PeerJoinBackfillPushClient } from './peer-join-backfill.js';
|
|
22
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_POLL_INTERVAL_MS, type StrandRevocationEnforcementConfig, type StrandRevocationEnforcerDeps, type StrandRevocationRows, type StrandMemberPeerBinding, type StrandRevocationJudge, type StrandRevocationNetwork, type RevocationRefreshScheduler } from './strand-revocation-enforcer.js';
|
|
23
|
+
export { StrandMembershipReconciler, IDLE_PASSES_BEFORE_ESCALATION, INITIAL_JOIN_RETRY_INTERVAL_MS, type StrandMembershipReconcilerDeps, type StrandMembershipReconciliationConfig, type PendingMembershipInviteSource } from './strand-membership-reconciler.js';
|
|
24
|
+
export { defaultTimeoutScheduler, type TimeoutScheduler } from './timeout-scheduler.js';
|
|
18
25
|
export { HibernationManager, type HibernationCallbacks } from './hibernation-manager.js';
|
|
19
26
|
export { ArachnodeStub, createArachnodeStub, type RingConfig } from './arachnode-stub.js';
|
|
20
27
|
export { EnrollmentService, type MemberVerifier, type MemberRegistry } from './enrollment.js';
|
|
@@ -22,7 +29,7 @@ export { StrandSolicitationService, createDefaultFormationResponseValidator, typ
|
|
|
22
29
|
export { createHttpFormationApprover, signFormationApproval, verifyFormationApproval, FormationApprovalError, type FormationApprovalRequest, type FormationVouchFields, type FormationApproval, type FormationApprover, type FormationApprovalFailure } from './formation-approval.js';
|
|
23
30
|
export { ControlFormationUsageRecorder } from './control-formation-recorder.js';
|
|
24
31
|
export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-key.js';
|
|
25
|
-
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, issueInvite, consumeInvite, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams, type SealStrandParams } from './strand-membership-writer.js';
|
|
32
|
+
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, PreSplitStrandIdentityError, issueInvite, consumeInvite, burnInvite, isStrandMember, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, StrandTransactionBusyError, STRAND_ENGINE, STRAND_ENGINE_VERSION, type FounderBootstrapParams, type IssueInviteParams, type IssuedInvite, type ConsumeInviteParams, type CancelInviteParams, type OutstandingInvite, type AddMemberByManagerParams, type RevokeMemberParams, type LeaveStrandParams, type RegisterMemberPeerParams, type RemoveOwnPeerParams, type RemoveMemberPeerByManagerParams, type RemoveMemberPeerParams, type AddManagerParams, type AdmitManagerParams, type RemoveManagerParams, type SealStrandParams, type StrandWriteOptions } from './strand-membership-writer.js';
|
|
26
33
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
27
34
|
export { StrandMemberRegistry, StrandMemberVerifier, memberRegistrationPayload, type StrandAdmission } from './strand-member-registry.js';
|
|
28
35
|
export { SeedBootstrapService, SEED_PROTOCOL, ed25519PublicKeyB64FromPeerId, type SeedBootstrapConfig, type SeedEventCallbacks } from './seed-bootstrap.js';
|
|
@@ -35,12 +42,14 @@ export { STRAND_WAKE_TYPE, type StrandWakePayload } from './strand-wake-payload.
|
|
|
35
42
|
export type { PushNotifier, PushMessage, PushSendResult } from './push-notifier.js';
|
|
36
43
|
export { validatePushCredentials, redactPushCredentials, REDACTED } from './push-credentials.js';
|
|
37
44
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
|
|
38
|
-
export { selectControlCohortDials,
|
|
45
|
+
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
|
|
46
|
+
export { dialPeerAddrs, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
|
|
39
47
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
40
48
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
41
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
42
|
-
export { StrandFormationManager, createStrandFormationManager, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
49
|
+
export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
50
|
+
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
43
51
|
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UNAUTHORIZED_RESERVATION_TTL_MS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
|
|
44
|
-
export { RelayReservationFailedError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
52
|
+
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
53
|
+
export { strandNodeAddrs, type StrandNodeAddrs } from './strand-network-config.js';
|
|
45
54
|
export { circuitMultiaddrs, superviseRelayReservation, DEFAULT_RELAY_RESERVE_TIMEOUT_MS, DEFAULT_RELAY_RESERVE_POLL_MS, DEFAULT_RELAY_CHECK_MS, DEFAULT_RELAY_MIN_BACKOFF_MS, DEFAULT_RELAY_MAX_BACKOFF_MS, type RelayReservationStatus, type RelayReservationState, type RelayReserveOptions, type RelayReservationSupervisor, type RelayReservationSupervisorOptions } from './relay-reservation.js';
|
|
46
55
|
export { classifyTransport, classifyConnectionPath, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS, type ConnectionPathKind, type ConnectionTransport, type ConnectionPath, type ConnectionPathSummary, type ConnectionLike } from './diagnostics/connection-path.js';
|
package/dist/index.js
CHANGED
|
@@ -40,14 +40,45 @@ export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore } from './trusted-
|
|
|
40
40
|
// interface + in-memory store here, Node-only file backend behind the subpath
|
|
41
41
|
// '@serfab/cadre-core/bootstrap-peer-store-file'.
|
|
42
42
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore } from './bootstrap-peer-store.js';
|
|
43
|
+
// Node-local enrolled-machine count: the machines this party had enrolled the
|
|
44
|
+
// last time this node looked, remembered across restarts so the CONTROL node can
|
|
45
|
+
// declare a block-repair yardstick at bring-up — which is before the database
|
|
46
|
+
// holding the membership rows exists. Same cross-platform split as the two
|
|
47
|
+
// records above; Node-only file backend behind the subpath
|
|
48
|
+
// '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
|
|
49
|
+
// DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
|
|
50
|
+
// see the module comment before unifying the three.
|
|
51
|
+
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore } from './enrolled-machine-store.js';
|
|
52
|
+
// Storage scope keys — what `CadreNodeConfig.storage.provider` is called with. A
|
|
53
|
+
// strand's key is its strand id; the control database's key carries the party id,
|
|
54
|
+
// so two parties on one device never share a control store.
|
|
55
|
+
export { controlStorageScope, isControlStorageScope } from './storage-scope.js';
|
|
43
56
|
// Strand database
|
|
44
57
|
export { StrandDatabase } from './strand-database.js';
|
|
45
58
|
// Strand management
|
|
46
59
|
export { StrandWatcher } from './strand-watcher.js';
|
|
47
|
-
export { StrandInstanceManager, getStrandStoragePath } from './strand-instance-manager.js';
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
60
|
+
export { StrandInstanceManager, getStrandStoragePath, isAwaitingFirstSync, liveStrandStatus } from './strand-instance-manager.js';
|
|
61
|
+
// The joining machine's first-sync write gate: a non-founder launch withholds its
|
|
62
|
+
// database (status 'syncing') until the strand's Header has arrived from a peer, so a
|
|
63
|
+
// write before the first sync can never fork the strand's tables.
|
|
64
|
+
export { StrandAwaitingFirstSyncError, DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS, DEFAULT_STRAND_FIRST_SYNC_POLL_MS, strandHeaderHeld, appTablesReadable, strandFirstSyncComplete } from './strand-first-sync-gate.js';
|
|
65
|
+
// Peer-join block catch-up (push this network's own blocks to each newly
|
|
66
|
+
// connected peer, so a late joiner physically holds pre-join blocks). Shared
|
|
67
|
+
// by the strand networks (ungated) and the control network (membership-gated).
|
|
68
|
+
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES } from './peer-join-backfill.js';
|
|
69
|
+
// Closed-strand revoked-peer enforcement (deny the network nodes of removed
|
|
70
|
+
// members at the stream and connection layers, and hang up the sessions they
|
|
71
|
+
// already hold — see the module doc for the settled deny-list design, the
|
|
72
|
+
// teardown seam, and the fail directions).
|
|
73
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_POLL_INTERVAL_MS } from './strand-revocation-enforcer.js';
|
|
74
|
+
// Closed-strand membership reconciliation: the bring-up loop that finishes a
|
|
75
|
+
// party's join on every machine — redeem the staged formation invitation, then
|
|
76
|
+
// write the durable machine→party MemberPeer binding — without ever blocking
|
|
77
|
+
// bring-up (see the module doc for the pass ladder and terminal states).
|
|
78
|
+
export { StrandMembershipReconciler, IDLE_PASSES_BEFORE_ESCALATION, INITIAL_JOIN_RETRY_INTERVAL_MS } from './strand-membership-reconciler.js';
|
|
79
|
+
// The timer seam the self-rescheduling strand bring-up loops share (first-sync gate
|
|
80
|
+
// probe loop, membership retry ladder) — injected by tests as a hand-cranked clock.
|
|
81
|
+
export { defaultTimeoutScheduler } from './timeout-scheduler.js';
|
|
51
82
|
// Hibernation
|
|
52
83
|
export { HibernationManager } from './hibernation-manager.js';
|
|
53
84
|
// Arachnode (stub)
|
|
@@ -68,7 +99,7 @@ export { generateStrandMemberKey, strandMemberKeyPair } from './strand-member-ke
|
|
|
68
99
|
// manager-admit, member-peer registration, manager rotation, sealing — the sole
|
|
69
100
|
// manager permanently freezing admission — + shared signing primitives reused
|
|
70
101
|
// across the flows).
|
|
71
|
-
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, issueInvite, consumeInvite, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, STRAND_ENGINE, STRAND_ENGINE_VERSION } from './strand-membership-writer.js';
|
|
102
|
+
export { signStrandPayload, verifyStrandPayload, signStrandApproval, generateStrandStampId, bootstrapFounderMembership, PreSplitStrandIdentityError, issueInvite, consumeInvite, burnInvite, isStrandMember, cancelInvite, listOutstandingInvites, addMemberByManager, revokeMember, leaveStrand, registerMemberPeer, listMemberPeers, removeMemberPeer, addManager, admitManager, removeManager, sealStrand, isStrandSealed, StrandTransactionBusyError, STRAND_ENGINE, STRAND_ENGINE_VERSION } from './strand-membership-writer.js';
|
|
72
103
|
// Engine-canonical datetime helper (shared by control + strand signed-write flows
|
|
73
104
|
// so a signed timestamp byte-matches the datetime-coerced column the CHECK sees).
|
|
74
105
|
export { canonicalDatetime } from './canonical-datetime.js';
|
|
@@ -100,21 +131,35 @@ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push
|
|
|
100
131
|
export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS } from './push-fanout.js';
|
|
101
132
|
// Control-cohort dial selection (backbone-preferential, bounded out-degree) +
|
|
102
133
|
// the cadence/degree defaults the proactive reconcile routine reads.
|
|
103
|
-
export { selectControlCohortDials,
|
|
134
|
+
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE } from './control-cohort.js';
|
|
135
|
+
// Dialing one peer from several candidate addresses, each under its own time
|
|
136
|
+
// limit, so an address that never answers cannot starve the rest.
|
|
137
|
+
export { dialPeerAddrs, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
|
|
104
138
|
// Seed trust policy (trust anchor for incoming seeds)
|
|
105
139
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
|
|
106
140
|
// Schema Verification
|
|
107
141
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
108
142
|
// Strand Formation transport (native cadre-core protocol)
|
|
109
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
143
|
+
export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
110
144
|
// Strand Formation manager (drives the native transport)
|
|
111
|
-
export { StrandFormationManager, createStrandFormationManager } from './strand-formation-manager.js';
|
|
145
|
+
export { StrandFormationManager, createStrandFormationManager, MEMBERSHIP_INVITE_TTL_MS, MEMBERSHIP_INVITE_UNAVAILABLE_REASON, HOST_STRAND_MUST_BE_RECREATED_REASON } from './strand-formation-manager.js';
|
|
112
146
|
// Control-network inbound connection gate (membership defense-in-depth)
|
|
113
147
|
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UNAUTHORIZED_RESERVATION_TTL_MS, UnauthorizedReservationBudget } from './membership-connection-gater.js';
|
|
114
148
|
// Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
|
|
115
149
|
// not land on its first attempt — the fail-fast posture of that config field now
|
|
116
150
|
// that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
|
|
117
|
-
|
|
151
|
+
// `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
|
|
152
|
+
// config: a `network.listenAddrs` entry whose transport the node will not have refuses
|
|
153
|
+
// start instead of being silently dropped by libp2p's transport manager.
|
|
154
|
+
//
|
|
155
|
+
// `resolveListenAddrs` and `strandNodeAddrs` are the derivations themselves — what a
|
|
156
|
+
// `NetworkConfig` actually turns into for the control node and for each strand node.
|
|
157
|
+
// Exported so an embedder that hand-writes a `network` block (the React Native and web
|
|
158
|
+
// reference apps) can assert on the resulting SHAPE rather than on its own field names,
|
|
159
|
+
// which is the difference between a test that proves reachability and one that proves a
|
|
160
|
+
// spelling.
|
|
161
|
+
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR, resolveListenAddrs } from './relay-addrs.js';
|
|
162
|
+
export { strandNodeAddrs } from './strand-network-config.js';
|
|
118
163
|
// Relay reservation via the bare `/p2p-circuit` search listener — the one route
|
|
119
164
|
// every control node takes; `network.relayAddrs` is its fail-fast posture
|
|
120
165
|
// (see relay-reservation.ts)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAwO,MAAM,uBAAuB,CAAC;AAElZ,+EAA+E;AAC/E,qFAAqF;AACrF,yCAAyC;AACzC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAChF,yFAAyF;AACzF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAWjC,2FAA2F;AAC3F,OAAO,E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BAAwB,EACxB,oCAAoC,EACpC,oCAAoC,EAGrC,MAAM,+BAA+B,CAAC;AAEvC,wEAAwE;AACxE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,mCAAmC,EACnC,mCAAmC,EACnC,+BAA+B,EAC/B,6BAA6B,EAG9B,MAAM,kCAAkC,CAAC;AAE1C,iFAAiF;AACjF,iFAAiF;AACjF,mFAAmF;AACnF,sFAAsF;AACtF,uFAAuF;AACvF,yEAAyE;AACzE,EAAE;AACF,qFAAqF;AACrF,qFAAqF;AACrF,uFAAuF;AACvF,wFAAwF;AACxF,wFAAwF;AACxF,YAAY;AACZ,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AAEnF,gFAAgF;AAChF,0EAA0E;AAC1E,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAM7B,MAAM,wBAAwB,CAAC;AAEhC,2EAA2E;AAC3E,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EAMzB,MAAM,kCAAkC,CAAC"}
|
|
@@ -327,6 +327,20 @@ export declare class UnauthorizedReservationBudget {
|
|
|
327
327
|
* dialer sees its "open" connection close moments later.
|
|
328
328
|
*
|
|
329
329
|
* Control node only: strand cohort nodes legitimately connect cross-party
|
|
330
|
-
* peers, so
|
|
330
|
+
* peers, so cadre membership never gates them. An OPEN strand's node receives
|
|
331
|
+
* the raw configured gater unchanged; a CLOSED strand's node composes its own
|
|
332
|
+
* revoked-peer denial onto it instead — a deny-list on positive revocation
|
|
333
|
+
* evidence, not this module's membership admission — see
|
|
334
|
+
* `strand-revocation-enforcer.ts`.
|
|
331
335
|
*/
|
|
332
336
|
export declare function createMembershipConnectionGater(policy: InboundAdmissionPolicy, base?: ConnectionGater, decisionTimeoutMs?: number, reserveDeadlineMs?: number): ConnectionGater;
|
|
337
|
+
/**
|
|
338
|
+
* Run one admission decision under `timeoutMs`, resolving to `fallback` (the
|
|
339
|
+
* fail-open outcome) if it has not settled in time — see
|
|
340
|
+
* {@link ADMISSION_DECISION_TIMEOUT_MS} for why an unbounded await is not safe
|
|
341
|
+
* on the connection hook. The timer is always cleared so a decided call never
|
|
342
|
+
* holds the event loop open. Exported for the strand revoked-peer gate
|
|
343
|
+
* (`strand-revocation-enforcer.ts`), which bounds its connection hooks with the
|
|
344
|
+
* same fail-open contract.
|
|
345
|
+
*/
|
|
346
|
+
export declare function decideWithinDeadline<T>(decide: () => Promise<T> | T, fallback: T, timeoutMs: number, what: string): Promise<T>;
|
|
@@ -313,7 +313,11 @@ export class UnauthorizedReservationBudget {
|
|
|
313
313
|
* dialer sees its "open" connection close moments later.
|
|
314
314
|
*
|
|
315
315
|
* Control node only: strand cohort nodes legitimately connect cross-party
|
|
316
|
-
* peers, so
|
|
316
|
+
* peers, so cadre membership never gates them. An OPEN strand's node receives
|
|
317
|
+
* the raw configured gater unchanged; a CLOSED strand's node composes its own
|
|
318
|
+
* revoked-peer denial onto it instead — a deny-list on positive revocation
|
|
319
|
+
* evidence, not this module's membership admission — see
|
|
320
|
+
* `strand-revocation-enforcer.ts`.
|
|
317
321
|
*/
|
|
318
322
|
export function createMembershipConnectionGater(policy, base, decisionTimeoutMs = ADMISSION_DECISION_TIMEOUT_MS, reserveDeadlineMs = RELAY_ADMISSION_RESERVE_DEADLINE_MS) {
|
|
319
323
|
const pendingReservations = new PendingReserveDeadlines(reserveDeadlineMs);
|
|
@@ -378,9 +382,11 @@ export function createMembershipConnectionGater(policy, base, decisionTimeoutMs
|
|
|
378
382
|
* fail-open outcome) if it has not settled in time — see
|
|
379
383
|
* {@link ADMISSION_DECISION_TIMEOUT_MS} for why an unbounded await is not safe
|
|
380
384
|
* on the connection hook. The timer is always cleared so a decided call never
|
|
381
|
-
* holds the event loop open.
|
|
385
|
+
* holds the event loop open. Exported for the strand revoked-peer gate
|
|
386
|
+
* (`strand-revocation-enforcer.ts`), which bounds its connection hooks with the
|
|
387
|
+
* same fail-open contract.
|
|
382
388
|
*/
|
|
383
|
-
async function decideWithinDeadline(decide, fallback, timeoutMs, what) {
|
|
389
|
+
export async function decideWithinDeadline(decide, fallback, timeoutMs, what) {
|
|
384
390
|
let timer;
|
|
385
391
|
try {
|
|
386
392
|
return await Promise.race([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership-connection-gater.js","sourceRoot":"","sources":["../src/membership-connection-gater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0JG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,GAAG,GAAG,KAAK,CAAC,+BAA+B,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAK,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAK,CAAC;AAEzD;;;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M,CAAC,YAAoB;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,YAAoB,EAAE,KAA6B;QAChE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC9C,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,OAAO,EAAE,IAAI,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC;QACD,GAAG,CAAC,oGAAoG,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzI,IAAI,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,sEAAsE,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;QAC3H,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,yEAAyE;YACzE,GAAG,CAAC,8DAA8D,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;CACF"}
|
|
@@ -12,6 +12,12 @@ export interface DurableSlot {
|
|
|
12
12
|
* failed read reported as `undefined` silently converts a recoverable error
|
|
13
13
|
* (permissions, a blocked database upgrade, an I/O fault) into destruction
|
|
14
14
|
* of a still-intact record on the next save.
|
|
15
|
+
*
|
|
16
|
+
* A slot always reports the fault; what a READER does with it is the
|
|
17
|
+
* reader's policy. The two records here rethrow it; the enrolled-machine
|
|
18
|
+
* count catches it and cold-starts, because losing a repair hint must not
|
|
19
|
+
* stop a node. So an implementation must never soften this to `undefined`
|
|
20
|
+
* on a reader's behalf.
|
|
15
21
|
*/
|
|
16
22
|
load(): Promise<string | undefined>;
|
|
17
23
|
/**
|
|
@@ -65,9 +71,9 @@ export declare class NodeLocalSnapshot<E> {
|
|
|
65
71
|
private readonly spec;
|
|
66
72
|
private readonly entries;
|
|
67
73
|
/**
|
|
68
|
-
* Serialises persists: every {@link put} snapshot-writes
|
|
69
|
-
* so chaining writes keeps them ordered and the last landed
|
|
70
|
-
* complete.
|
|
74
|
+
* Serialises persists: every write ({@link put}, {@link remove}) snapshot-writes
|
|
75
|
+
* the full entry set, so chaining writes keeps them ordered and the last landed
|
|
76
|
+
* snapshot complete.
|
|
71
77
|
*/
|
|
72
78
|
private writeChain;
|
|
73
79
|
private constructor();
|
|
@@ -89,12 +95,12 @@ export declare class NodeLocalSnapshot<E> {
|
|
|
89
95
|
*/
|
|
90
96
|
static open<E>(slot: DurableSlot, partyId: string, spec: NodeLocalSnapshotSpec<E>): Promise<NodeLocalSnapshot<E>>;
|
|
91
97
|
has(key: string): boolean;
|
|
92
|
-
/** Fresh copy of the keys — a snapshot decoupled from later {@link put} calls. */
|
|
98
|
+
/** Fresh copy of the keys — a snapshot decoupled from later {@link put} / {@link remove} calls. */
|
|
93
99
|
keySnapshot(): Set<string>;
|
|
94
100
|
/**
|
|
95
101
|
* Fresh copy of the `key -> entry` map — a snapshot decoupled from later
|
|
96
|
-
* {@link put} calls. The entries themselves need no copy:
|
|
97
|
-
* REPLACES an entry rather than mutating it in place.
|
|
102
|
+
* {@link put} / {@link remove} calls. The entries themselves need no copy:
|
|
103
|
+
* {@link put} REPLACES an entry rather than mutating it in place.
|
|
98
104
|
*/
|
|
99
105
|
entrySnapshot(): Map<string, E>;
|
|
100
106
|
/**
|
|
@@ -102,8 +108,16 @@ export declare class NodeLocalSnapshot<E> {
|
|
|
102
108
|
* synchronous caller may consult the store the moment this returns), then
|
|
103
109
|
* the full snapshot is persisted. A persist failure rejects the returned
|
|
104
110
|
* promise but leaves the entry in memory — this session's decision stands,
|
|
105
|
-
* and any later successful
|
|
111
|
+
* and any later successful write re-lands the complete set.
|
|
106
112
|
*/
|
|
107
113
|
put(key: string, entry: E): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Remove an entry, with {@link put}'s contract: the in-memory map updates
|
|
116
|
+
* SYNCHRONOUSLY, then the full snapshot is persisted. Removing an absent key
|
|
117
|
+
* changes nothing, so it writes nothing.
|
|
118
|
+
*/
|
|
119
|
+
remove(key: string): Promise<void>;
|
|
120
|
+
/** Chain a full-snapshot write behind every earlier one (see {@link put}). */
|
|
121
|
+
private queuePersist;
|
|
108
122
|
private persistSnapshot;
|
|
109
123
|
}
|