@optimystic/db-p2p 0.25.1 → 0.27.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/dist/src/cluster/certified-claims.d.ts +17 -3
- package/dist/src/cluster/certified-claims.d.ts.map +1 -1
- package/dist/src/cluster/certified-claims.js +5 -3
- package/dist/src/cluster/certified-claims.js.map +1 -1
- package/dist/src/cluster/cluster-repo.d.ts +57 -92
- package/dist/src/cluster/cluster-repo.d.ts.map +1 -1
- package/dist/src/cluster/cluster-repo.js +149 -201
- package/dist/src/cluster/cluster-repo.js.map +1 -1
- package/dist/src/cluster/commit-proof.d.ts +16 -0
- package/dist/src/cluster/commit-proof.d.ts.map +1 -1
- package/dist/src/cluster/commit-proof.js +32 -1
- package/dist/src/cluster/commit-proof.js.map +1 -1
- package/dist/src/cluster/quorum-restore.d.ts +81 -28
- package/dist/src/cluster/quorum-restore.d.ts.map +1 -1
- package/dist/src/cluster/quorum-restore.js +148 -51
- package/dist/src/cluster/quorum-restore.js.map +1 -1
- package/dist/src/cluster/race-resolution.d.ts +89 -0
- package/dist/src/cluster/race-resolution.d.ts.map +1 -0
- package/dist/src/cluster/race-resolution.js +140 -0
- package/dist/src/cluster/race-resolution.js.map +1 -0
- package/dist/src/cluster/reconcile-block.d.ts +9 -4
- package/dist/src/cluster/reconcile-block.d.ts.map +1 -1
- package/dist/src/cluster/reconcile-block.js +28 -11
- package/dist/src/cluster/reconcile-block.js.map +1 -1
- package/dist/src/cluster/record-operations.d.ts +25 -0
- package/dist/src/cluster/record-operations.d.ts.map +1 -0
- package/dist/src/cluster/record-operations.js +56 -0
- package/dist/src/cluster/record-operations.js.map +1 -0
- package/dist/src/cohort-topic/host.d.ts +133 -51
- package/dist/src/cohort-topic/host.d.ts.map +1 -1
- package/dist/src/cohort-topic/host.js +290 -83
- package/dist/src/cohort-topic/host.js.map +1 -1
- package/dist/src/libp2p-node-base.d.ts +13 -4
- package/dist/src/libp2p-node-base.d.ts.map +1 -1
- package/dist/src/libp2p-node-base.js +5 -5
- package/dist/src/libp2p-node-base.js.map +1 -1
- package/dist/src/repo/cluster-coordinator.d.ts +9 -0
- package/dist/src/repo/cluster-coordinator.d.ts.map +1 -1
- package/dist/src/repo/cluster-coordinator.js +13 -2
- package/dist/src/repo/cluster-coordinator.js.map +1 -1
- package/dist/src/repo/coordinator-repo.d.ts +34 -2
- package/dist/src/repo/coordinator-repo.d.ts.map +1 -1
- package/dist/src/repo/coordinator-repo.js +57 -3
- package/dist/src/repo/coordinator-repo.js.map +1 -1
- package/dist/src/storage/block-latch.d.ts +5 -4
- package/dist/src/storage/block-latch.d.ts.map +1 -1
- package/dist/src/storage/block-latch.js +5 -4
- package/dist/src/storage/block-latch.js.map +1 -1
- package/dist/src/storage/block-storage.d.ts +1 -1
- package/dist/src/storage/block-storage.d.ts.map +1 -1
- package/dist/src/storage/block-storage.js +11 -3
- package/dist/src/storage/block-storage.js.map +1 -1
- package/dist/src/storage/cached-raw-storage.d.ts +17 -1
- package/dist/src/storage/cached-raw-storage.d.ts.map +1 -1
- package/dist/src/storage/cached-raw-storage.js +8 -1
- package/dist/src/storage/cached-raw-storage.js.map +1 -1
- package/dist/src/storage/cached-store-driver.d.ts +7 -0
- package/dist/src/storage/cached-store-driver.d.ts.map +1 -1
- package/dist/src/storage/cached-store-driver.js +20 -0
- package/dist/src/storage/cached-store-driver.js.map +1 -1
- package/dist/src/storage/i-block-storage.d.ts +45 -2
- package/dist/src/storage/i-block-storage.d.ts.map +1 -1
- package/dist/src/storage/i-block-storage.js +29 -0
- package/dist/src/storage/i-block-storage.js.map +1 -1
- package/dist/src/storage/i-raw-storage.d.ts +16 -0
- package/dist/src/storage/i-raw-storage.d.ts.map +1 -1
- package/dist/src/storage/kv-raw-storage.d.ts +5 -1
- package/dist/src/storage/kv-raw-storage.d.ts.map +1 -1
- package/dist/src/storage/kv-raw-storage.js +8 -1
- package/dist/src/storage/kv-raw-storage.js.map +1 -1
- package/dist/src/storage/raw-store-driver.d.ts +15 -0
- package/dist/src/storage/raw-store-driver.d.ts.map +1 -1
- package/dist/src/storage/shared-cache-pool.d.ts +5 -0
- package/dist/src/storage/shared-cache-pool.d.ts.map +1 -1
- package/dist/src/storage/shared-cache-pool.js +6 -1
- package/dist/src/storage/shared-cache-pool.js.map +1 -1
- package/dist/src/storage/storage-repo.d.ts.map +1 -1
- package/dist/src/storage/storage-repo.js +141 -99
- package/dist/src/storage/storage-repo.js.map +1 -1
- package/dist/src/storage/with-read-cache.d.ts +9 -5
- package/dist/src/storage/with-read-cache.d.ts.map +1 -1
- package/dist/src/storage/with-read-cache.js +16 -6
- package/dist/src/storage/with-read-cache.js.map +1 -1
- package/package.json +2 -2
- package/{README.md → readme.md} +2 -2
- package/src/cluster/certified-claims.ts +22 -9
- package/src/cluster/cluster-repo.ts +199 -212
- package/src/cluster/commit-proof.ts +38 -2
- package/src/cluster/quorum-restore.ts +183 -56
- package/src/cluster/race-resolution.ts +158 -0
- package/src/cluster/reconcile-block.ts +34 -11
- package/src/cluster/record-operations.ts +59 -0
- package/src/cohort-topic/host.ts +423 -118
- package/src/libp2p-node-base.ts +18 -9
- package/src/repo/cluster-coordinator.ts +1039 -1027
- package/src/repo/coordinator-repo.ts +1937 -1855
- package/src/storage/block-latch.ts +5 -4
- package/src/storage/block-storage.ts +11 -3
- package/src/storage/cached-raw-storage.ts +21 -1
- package/src/storage/cached-store-driver.ts +23 -0
- package/src/storage/i-block-storage.ts +47 -2
- package/src/storage/i-raw-storage.ts +17 -0
- package/src/storage/kv-raw-storage.ts +8 -1
- package/src/storage/raw-store-driver.ts +26 -0
- package/src/storage/shared-cache-pool.ts +6 -1
- package/src/storage/storage-repo.ts +143 -103
- package/src/storage/with-read-cache.ts +16 -6
package/src/libp2p-node-base.ts
CHANGED
|
@@ -140,14 +140,17 @@ const wiringLog = createLogger('node-wiring');
|
|
|
140
140
|
/**
|
|
141
141
|
* Factory function or instance for creating raw storage. The node puts the write-through read
|
|
142
142
|
* cache in front of the resolved instance (`withReadCache`, unless it is a `MemoryRawStorage` or
|
|
143
|
-
* already cached) under a lease, and releases THAT LEASE when it stops; the instance you
|
|
144
|
-
* is never disposed. The cache is shared per backing store: two concurrently running nodes handed
|
|
143
|
+
* already read-cached) under a lease, and releases THAT LEASE when it stops; the instance you
|
|
144
|
+
* supplied is never disposed. The cache is shared per backing store: two concurrently running nodes handed
|
|
145
145
|
* one uncached instance — or two instances that report the same `getStoreIdentity()`, such as two
|
|
146
146
|
* `FileRawStorage` over one directory — read and write through ONE cache, which is cleared and
|
|
147
147
|
* unregistered only when the last of them stops. Sequential reuse (a restart over the same
|
|
148
148
|
* instance) starts cold once the previous node's lease has released. What remains unguarded is
|
|
149
|
-
* the cross-process case (Invariant 5 in `packages/db-p2p/docs/storage.md`). A host that
|
|
150
|
-
* its own
|
|
149
|
+
* the cross-process case (Invariant 5 in `packages/db-p2p/docs/storage.md`). A host that attaches
|
|
150
|
+
* its own read cache and hands the result in keeps owning it; the node never releases it. Either
|
|
151
|
+
* documented cache construction is accepted here — `new CachedRawStorage(inner)` or
|
|
152
|
+
* `new KvRawStorage(new CachedStoreDriver(driver))`, the latter preferred when the backend's
|
|
153
|
+
* driver is reachable. Both report `IRawStorage.readCached`, which is what the seam checks.
|
|
151
154
|
*/
|
|
152
155
|
export type RawStorageProvider = IRawStorage | (() => IRawStorage);
|
|
153
156
|
|
|
@@ -271,6 +274,12 @@ export type NodeOptions = ClusterPolicyOptions & {
|
|
|
271
274
|
* confirms them, so a rebalance never releases them and a ring shift's confirm phase aborts on
|
|
272
275
|
* them (`docs/arachnode-ring-handoff.md` § Phase B). Clearing the backlog means running the
|
|
273
276
|
* receivers with this `false` until every such block has been rewritten under current code.
|
|
277
|
+
* That backlog no longer grows from commits: every `CoordinatorRepo.commit` path under current
|
|
278
|
+
* code attaches a proof, solo cohorts included (the lone member self-signs one via
|
|
279
|
+
* `mintSoloCommitProof`). Still uncertifiable: blocks whose last write predates that, blocks
|
|
280
|
+
* committed without a content digest (the retention rule stores no proof for those), and
|
|
281
|
+
* revisions landed by the read-driven promotion in `StorageRepo.get`, which has no proof to
|
|
282
|
+
* attach — the last of those heal when a push back-fills one.
|
|
274
283
|
*/
|
|
275
284
|
blockTransfer?: { requirePushCertificate?: boolean };
|
|
276
285
|
|
|
@@ -362,13 +371,13 @@ export type NodeOptions = ClusterPolicyOptions & {
|
|
|
362
371
|
/**
|
|
363
372
|
* Resolve the node's raw storage and put the write-through read cache in front of it. This is
|
|
364
373
|
* the single place the network node resolves its `IRawStorage`, so it is the single place the
|
|
365
|
-
* cache is wired (`withReadCache` states the exclusions: memory storage and
|
|
366
|
-
*
|
|
367
|
-
* routed through the helper — nothing to cache.
|
|
374
|
+
* cache is wired (`withReadCache` states the exclusions: memory storage, and storage that
|
|
375
|
+
* already reports `readCached`, pass through unchanged). The default is a bare
|
|
376
|
+
* `MemoryRawStorage`, deliberately not routed through the helper — nothing to cache.
|
|
368
377
|
*
|
|
369
378
|
* `lease` is this node's claim on the (possibly shared) cache, and the ONLY thing its stop path
|
|
370
|
-
* may release — a host that supplied
|
|
371
|
-
* {@link ResolvedReadCache}).
|
|
379
|
+
* may release — a host that supplied an already-cached storage, in either documented
|
|
380
|
+
* construction, keeps owning it (see {@link ResolvedReadCache}).
|
|
372
381
|
*/
|
|
373
382
|
function resolveStorage(provider: RawStorageProvider | undefined, networkName: string): ResolvedReadCache {
|
|
374
383
|
if (!provider) {
|