@serfab/cadre-core 1.18.0 → 1.19.1
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/dist/cadre-node.d.ts +65 -2
- package/dist/cadre-node.js +120 -4
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-read-retry.d.ts +19 -16
- package/dist/control-read-retry.js +22 -54
- package/dist/control-read-retry.js.map +1 -1
- package/dist/control-retry.d.ts +50 -6
- package/dist/control-retry.js +53 -6
- package/dist/control-retry.js.map +1 -1
- package/dist/control-write-retry.d.ts +24 -16
- package/dist/control-write-retry.js +58 -30
- package/dist/control-write-retry.js.map +1 -1
- package/dist/edge-node/config.d.ts +8 -2
- package/dist/edge-node/config.js +5 -1
- package/dist/edge-node/config.js.map +1 -1
- package/dist/edge-node/edge-join.js +2 -0
- package/dist/edge-node/edge-join.js.map +1 -1
- package/dist/edge-node/edge-node.d.ts +10 -0
- package/dist/edge-node/edge-node.js +52 -8
- package/dist/edge-node/edge-node.js.map +1 -1
- package/dist/edge-node/options.d.ts +11 -2
- package/dist/edge-node/options.js +11 -4
- package/dist/edge-node/options.js.map +1 -1
- package/dist/edge-node/platform.d.ts +15 -3
- package/dist/edge-node/strands.js +3 -2
- package/dist/edge-node/strands.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +8 -11
- package/dist/peer-join-backfill.js +22 -35
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/self-address-update.d.ts +13 -0
- package/dist/self-address-update.js +19 -0
- package/dist/self-address-update.js.map +1 -0
- package/dist/strand-database.d.ts +56 -0
- package/dist/strand-database.js +87 -0
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +67 -2
- package/dist/strand-instance-manager.js +105 -4
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +13 -1
- package/dist/strand-membership-reconciler.js +23 -14
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +16 -2
- package/dist/strand-membership-writer.js +54 -8
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-offline.d.ts +131 -0
- package/dist/strand-offline.js +142 -0
- package/dist/strand-offline.js.map +1 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/cadre-node.ts +11456 -11326
- package/src/control-read-retry.ts +22 -58
- package/src/control-retry.ts +54 -6
- package/src/control-write-retry.ts +58 -30
- package/src/edge-node/config.ts +11 -2
- package/src/edge-node/edge-join.ts +1 -0
- package/src/edge-node/edge-node.ts +55 -6
- package/src/edge-node/options.ts +20 -4
- package/src/edge-node/platform.ts +15 -3
- package/src/edge-node/strands.ts +3 -2
- package/src/index.ts +917 -899
- package/src/peer-join-backfill.ts +33 -43
- package/src/self-address-update.ts +19 -0
- package/src/strand-database.ts +466 -352
- package/src/strand-instance-manager.ts +2210 -2092
- package/src/strand-membership-reconciler.ts +29 -14
- package/src/strand-membership-writer.ts +61 -14
- package/src/strand-offline.ts +247 -0
- package/src/types.ts +2960 -2926
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* for it. Fixed for the app's lifetime.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { IRawStorage, Libp2pTransports, NoiseCryptoInterface } from '@optimystic/db-p2p';
|
|
7
|
+
import type { IKVStore, IRawStorage, Libp2pTransports, NoiseCryptoInterface } from '@optimystic/db-p2p';
|
|
8
8
|
import type { KeyStore } from '../key-store.js';
|
|
9
9
|
import type { DurableSlot } from '../node-local-snapshot.js';
|
|
10
10
|
import type { CadreNodeConfig } from '../types.js';
|
|
@@ -123,6 +123,17 @@ export interface EdgeNodeStorage {
|
|
|
123
123
|
* strand stops.
|
|
124
124
|
*/
|
|
125
125
|
rawStorage(scope: string): IRawStorage;
|
|
126
|
+
/**
|
|
127
|
+
* A strand's offline journal (`CadreNodeConfig.strandOffline.journal`), kept in the strand
|
|
128
|
+
* scope's own database beside its blocks: the journal's keys are all under
|
|
129
|
+
* `optimystic-offline/`, a node key-value namespace the platform stores apart from blocks. The
|
|
130
|
+
* same instance for the same scope until {@link close}, which flushes and closes it with the
|
|
131
|
+
* scope's handle; cadre-core asks again on every rebuild of the strand, and a second store over
|
|
132
|
+
* one handle would not see the first one's unflushed writes. {@link destroyScope} closes it too.
|
|
133
|
+
* A rejection fails the strand's build. Absent: no offline mode on this platform
|
|
134
|
+
* (`setStrandOfflineMode` throws `StrandOfflineUnavailableError`).
|
|
135
|
+
*/
|
|
136
|
+
offlineJournal?(scope: string): Promise<IKVStore>;
|
|
126
137
|
/** Delete a scope's storage. No handle on it may be open. Resolves when it is gone or was absent. */
|
|
127
138
|
destroyScope(scope: string): Promise<void>;
|
|
128
139
|
/**
|
|
@@ -132,8 +143,9 @@ export interface EdgeNodeStorage {
|
|
|
132
143
|
*/
|
|
133
144
|
nodeLocal(): NodeLocalKv;
|
|
134
145
|
/**
|
|
135
|
-
* Flush and close the node-local store
|
|
136
|
-
* failure closing one is logged and the rest still close;
|
|
146
|
+
* Flush and close the node-local store and every {@link offlineJournal}, then close every
|
|
147
|
+
* handle {@link rawStorage} opened. A failure closing one is logged and the rest still close;
|
|
148
|
+
* the call does not reject.
|
|
137
149
|
*/
|
|
138
150
|
close(): Promise<void>;
|
|
139
151
|
/**
|
package/src/edge-node/strands.ts
CHANGED
|
@@ -40,8 +40,9 @@ export async function attachStrandWhenWritable(
|
|
|
40
40
|
* Optimystic's cluster coordinator reports a write that could not gather enough approvals this
|
|
41
41
|
* way. It is transient right after a node restarts alone: its cohort has not reconnected yet.
|
|
42
42
|
*
|
|
43
|
-
* NOTE: matched on the message
|
|
44
|
-
*
|
|
43
|
+
* NOTE: matched on the message. Optimystic 1.20.0 raises this failure as `PromiseShortfallError` and
|
|
44
|
+
* keeps the sentence unchanged as a contract, so the match holds; moving to the type is the second arm
|
|
45
|
+
* of backlog `debt-control-write-retry-matches-the-shortfall-by-type`.
|
|
45
46
|
*/
|
|
46
47
|
const SUPER_MAJORITY_FAILURE = /Failed to get super-majority/i;
|
|
47
48
|
|