@optimystic/db-p2p 0.24.2 → 0.25.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.
Files changed (249) hide show
  1. package/{readme.md → README.md} +688 -668
  2. package/dist/src/cluster/block-transfer-service.d.ts +133 -10
  3. package/dist/src/cluster/block-transfer-service.d.ts.map +1 -1
  4. package/dist/src/cluster/block-transfer-service.js +155 -9
  5. package/dist/src/cluster/block-transfer-service.js.map +1 -1
  6. package/dist/src/cluster/block-transfer.d.ts +67 -7
  7. package/dist/src/cluster/block-transfer.d.ts.map +1 -1
  8. package/dist/src/cluster/block-transfer.js +127 -24
  9. package/dist/src/cluster/block-transfer.js.map +1 -1
  10. package/dist/src/cluster/certified-claims.d.ts +170 -0
  11. package/dist/src/cluster/certified-claims.d.ts.map +1 -0
  12. package/dist/src/cluster/certified-claims.js +200 -0
  13. package/dist/src/cluster/certified-claims.js.map +1 -0
  14. package/dist/src/cluster/client-signature-verifier.d.ts +23 -0
  15. package/dist/src/cluster/client-signature-verifier.d.ts.map +1 -0
  16. package/dist/src/cluster/client-signature-verifier.js +33 -0
  17. package/dist/src/cluster/client-signature-verifier.js.map +1 -0
  18. package/dist/src/cluster/cluster-policy.d.ts +9 -3
  19. package/dist/src/cluster/cluster-policy.d.ts.map +1 -1
  20. package/dist/src/cluster/cluster-policy.js +111 -27
  21. package/dist/src/cluster/cluster-policy.js.map +1 -1
  22. package/dist/src/cluster/cluster-repo.d.ts +140 -11
  23. package/dist/src/cluster/cluster-repo.d.ts.map +1 -1
  24. package/dist/src/cluster/cluster-repo.js +485 -29
  25. package/dist/src/cluster/cluster-repo.js.map +1 -1
  26. package/dist/src/cluster/commit-proof.d.ts +134 -0
  27. package/dist/src/cluster/commit-proof.d.ts.map +1 -0
  28. package/dist/src/cluster/commit-proof.js +263 -0
  29. package/dist/src/cluster/commit-proof.js.map +1 -0
  30. package/dist/src/cluster/quorum-restore.d.ts +95 -8
  31. package/dist/src/cluster/quorum-restore.d.ts.map +1 -1
  32. package/dist/src/cluster/quorum-restore.js +113 -14
  33. package/dist/src/cluster/quorum-restore.js.map +1 -1
  34. package/dist/src/cluster/rebalance-monitor.d.ts +84 -0
  35. package/dist/src/cluster/rebalance-monitor.d.ts.map +1 -1
  36. package/dist/src/cluster/rebalance-monitor.js +207 -5
  37. package/dist/src/cluster/rebalance-monitor.js.map +1 -1
  38. package/dist/src/cluster/reconcile-block.d.ts +27 -7
  39. package/dist/src/cluster/reconcile-block.d.ts.map +1 -1
  40. package/dist/src/cluster/reconcile-block.js +179 -38
  41. package/dist/src/cluster/reconcile-block.js.map +1 -1
  42. package/dist/src/cluster/service.d.ts +13 -4
  43. package/dist/src/cluster/service.d.ts.map +1 -1
  44. package/dist/src/cluster/service.js +17 -18
  45. package/dist/src/cluster/service.js.map +1 -1
  46. package/dist/src/cluster/spread-on-churn.d.ts +8 -2
  47. package/dist/src/cluster/spread-on-churn.d.ts.map +1 -1
  48. package/dist/src/cluster/spread-on-churn.js +7 -7
  49. package/dist/src/cluster/spread-on-churn.js.map +1 -1
  50. package/dist/src/cohort-topic/host.d.ts.map +1 -1
  51. package/dist/src/cohort-topic/host.js +8 -7
  52. package/dist/src/cohort-topic/host.js.map +1 -1
  53. package/dist/src/cohort-topic/stream-util.d.ts +7 -6
  54. package/dist/src/cohort-topic/stream-util.d.ts.map +1 -1
  55. package/dist/src/cohort-topic/stream-util.js +14 -41
  56. package/dist/src/cohort-topic/stream-util.js.map +1 -1
  57. package/dist/src/dispute/cascade.d.ts +7 -8
  58. package/dist/src/dispute/cascade.d.ts.map +1 -1
  59. package/dist/src/dispute/cascade.js +24 -7
  60. package/dist/src/dispute/cascade.js.map +1 -1
  61. package/dist/src/dispute/dispute-service.d.ts +5 -0
  62. package/dist/src/dispute/dispute-service.d.ts.map +1 -1
  63. package/dist/src/dispute/dispute-service.js +13 -3
  64. package/dist/src/dispute/dispute-service.js.map +1 -1
  65. package/dist/src/dispute/invalidation.d.ts +33 -15
  66. package/dist/src/dispute/invalidation.d.ts.map +1 -1
  67. package/dist/src/dispute/invalidation.js +127 -34
  68. package/dist/src/dispute/invalidation.js.map +1 -1
  69. package/dist/src/dispute/service.d.ts.map +1 -1
  70. package/dist/src/dispute/service.js +2 -1
  71. package/dist/src/dispute/service.js.map +1 -1
  72. package/dist/src/index.d.ts +7 -0
  73. package/dist/src/index.d.ts.map +1 -1
  74. package/dist/src/index.js +7 -0
  75. package/dist/src/index.js.map +1 -1
  76. package/dist/src/libp2p-key-network.d.ts +14 -10
  77. package/dist/src/libp2p-key-network.d.ts.map +1 -1
  78. package/dist/src/libp2p-key-network.js +28 -58
  79. package/dist/src/libp2p-key-network.js.map +1 -1
  80. package/dist/src/libp2p-node-base.d.ts +38 -7
  81. package/dist/src/libp2p-node-base.d.ts.map +1 -1
  82. package/dist/src/libp2p-node-base.js +148 -63
  83. package/dist/src/libp2p-node-base.js.map +1 -1
  84. package/dist/src/network/open-protocol-stream.d.ts +56 -0
  85. package/dist/src/network/open-protocol-stream.d.ts.map +1 -0
  86. package/dist/src/network/open-protocol-stream.js +60 -0
  87. package/dist/src/network/open-protocol-stream.js.map +1 -0
  88. package/dist/src/network/register-protocol-handler.d.ts +66 -0
  89. package/dist/src/network/register-protocol-handler.d.ts.map +1 -0
  90. package/dist/src/network/register-protocol-handler.js +51 -0
  91. package/dist/src/network/register-protocol-handler.js.map +1 -0
  92. package/dist/src/peer-address-book.d.ts +60 -2
  93. package/dist/src/peer-address-book.d.ts.map +1 -1
  94. package/dist/src/peer-address-book.js +89 -1
  95. package/dist/src/peer-address-book.js.map +1 -1
  96. package/dist/src/pend-validation.d.ts +65 -0
  97. package/dist/src/pend-validation.d.ts.map +1 -0
  98. package/dist/src/pend-validation.js +69 -0
  99. package/dist/src/pend-validation.js.map +1 -0
  100. package/dist/src/reactivity/notify-transport.d.ts.map +1 -1
  101. package/dist/src/reactivity/notify-transport.js +2 -1
  102. package/dist/src/reactivity/notify-transport.js.map +1 -1
  103. package/dist/src/reactivity/push-state-gossip.d.ts.map +1 -1
  104. package/dist/src/reactivity/push-state-gossip.js +2 -1
  105. package/dist/src/reactivity/push-state-gossip.js.map +1 -1
  106. package/dist/src/repo/cluster-coordinator.d.ts +32 -6
  107. package/dist/src/repo/cluster-coordinator.d.ts.map +1 -1
  108. package/dist/src/repo/cluster-coordinator.js +44 -10
  109. package/dist/src/repo/cluster-coordinator.js.map +1 -1
  110. package/dist/src/repo/coordinator-repo.d.ts +181 -25
  111. package/dist/src/repo/coordinator-repo.d.ts.map +1 -1
  112. package/dist/src/repo/coordinator-repo.js +650 -62
  113. package/dist/src/repo/coordinator-repo.js.map +1 -1
  114. package/dist/src/repo/served-repo-proxy.d.ts +30 -0
  115. package/dist/src/repo/served-repo-proxy.d.ts.map +1 -0
  116. package/dist/src/repo/served-repo-proxy.js +50 -0
  117. package/dist/src/repo/served-repo-proxy.js.map +1 -0
  118. package/dist/src/repo/service.d.ts +16 -1
  119. package/dist/src/repo/service.d.ts.map +1 -1
  120. package/dist/src/repo/service.js +18 -16
  121. package/dist/src/repo/service.js.map +1 -1
  122. package/dist/src/reputation/types.d.ts +3 -1
  123. package/dist/src/reputation/types.d.ts.map +1 -1
  124. package/dist/src/reputation/types.js +3 -1
  125. package/dist/src/reputation/types.js.map +1 -1
  126. package/dist/src/rn.d.ts +24 -2
  127. package/dist/src/rn.d.ts.map +1 -1
  128. package/dist/src/rn.js +33 -4
  129. package/dist/src/rn.js.map +1 -1
  130. package/dist/src/storage/block-archive.d.ts +153 -0
  131. package/dist/src/storage/block-archive.d.ts.map +1 -0
  132. package/dist/src/storage/block-archive.js +194 -0
  133. package/dist/src/storage/block-archive.js.map +1 -0
  134. package/dist/src/storage/block-latch.d.ts +92 -0
  135. package/dist/src/storage/block-latch.d.ts.map +1 -0
  136. package/dist/src/storage/block-latch.js +132 -0
  137. package/dist/src/storage/block-latch.js.map +1 -0
  138. package/dist/src/storage/block-storage.d.ts +169 -12
  139. package/dist/src/storage/block-storage.d.ts.map +1 -1
  140. package/dist/src/storage/block-storage.js +415 -152
  141. package/dist/src/storage/block-storage.js.map +1 -1
  142. package/dist/src/storage/cached-raw-storage.d.ts +5 -1
  143. package/dist/src/storage/cached-raw-storage.d.ts.map +1 -1
  144. package/dist/src/storage/cached-raw-storage.js +16 -1
  145. package/dist/src/storage/cached-raw-storage.js.map +1 -1
  146. package/dist/src/storage/cached-store-driver.d.ts +14 -4
  147. package/dist/src/storage/cached-store-driver.d.ts.map +1 -1
  148. package/dist/src/storage/cached-store-driver.js +39 -5
  149. package/dist/src/storage/cached-store-driver.js.map +1 -1
  150. package/dist/src/storage/i-block-storage.d.ts +70 -19
  151. package/dist/src/storage/i-block-storage.d.ts.map +1 -1
  152. package/dist/src/storage/i-block-storage.js +21 -1
  153. package/dist/src/storage/i-block-storage.js.map +1 -1
  154. package/dist/src/storage/i-raw-storage.d.ts +38 -0
  155. package/dist/src/storage/i-raw-storage.d.ts.map +1 -1
  156. package/dist/src/storage/kv-raw-storage.d.ts +14 -8
  157. package/dist/src/storage/kv-raw-storage.d.ts.map +1 -1
  158. package/dist/src/storage/kv-raw-storage.js +29 -9
  159. package/dist/src/storage/kv-raw-storage.js.map +1 -1
  160. package/dist/src/storage/memory-store-driver.d.ts +4 -1
  161. package/dist/src/storage/memory-store-driver.d.ts.map +1 -1
  162. package/dist/src/storage/memory-store-driver.js +22 -2
  163. package/dist/src/storage/memory-store-driver.js.map +1 -1
  164. package/dist/src/storage/raw-store-codec.js +2 -2
  165. package/dist/src/storage/raw-store-driver.d.ts +44 -3
  166. package/dist/src/storage/raw-store-driver.d.ts.map +1 -1
  167. package/dist/src/storage/shared-cache-pool.d.ts +60 -3
  168. package/dist/src/storage/shared-cache-pool.d.ts.map +1 -1
  169. package/dist/src/storage/shared-cache-pool.js +68 -4
  170. package/dist/src/storage/shared-cache-pool.js.map +1 -1
  171. package/dist/src/storage/storage-repo.d.ts +204 -26
  172. package/dist/src/storage/storage-repo.d.ts.map +1 -1
  173. package/dist/src/storage/storage-repo.js +422 -119
  174. package/dist/src/storage/storage-repo.js.map +1 -1
  175. package/dist/src/storage/store-identity.d.ts +21 -0
  176. package/dist/src/storage/store-identity.d.ts.map +1 -0
  177. package/dist/src/storage/store-identity.js +33 -0
  178. package/dist/src/storage/store-identity.js.map +1 -0
  179. package/dist/src/storage/struct.d.ts +15 -0
  180. package/dist/src/storage/struct.d.ts.map +1 -1
  181. package/dist/src/storage/with-read-cache.d.ts +92 -0
  182. package/dist/src/storage/with-read-cache.d.ts.map +1 -0
  183. package/dist/src/storage/with-read-cache.js +132 -0
  184. package/dist/src/storage/with-read-cache.js.map +1 -0
  185. package/dist/src/sync/service.d.ts +13 -3
  186. package/dist/src/sync/service.d.ts.map +1 -1
  187. package/dist/src/sync/service.js +7 -30
  188. package/dist/src/sync/service.js.map +1 -1
  189. package/dist/src/testing/mesh-harness.d.ts +75 -2
  190. package/dist/src/testing/mesh-harness.d.ts.map +1 -1
  191. package/dist/src/testing/mesh-harness.js +193 -81
  192. package/dist/src/testing/mesh-harness.js.map +1 -1
  193. package/dist/src/testing/raw-storage-conformance.d.ts +8 -0
  194. package/dist/src/testing/raw-storage-conformance.d.ts.map +1 -1
  195. package/dist/src/testing/raw-storage-conformance.js +97 -2
  196. package/dist/src/testing/raw-storage-conformance.js.map +1 -1
  197. package/package.json +5 -6
  198. package/src/cluster/block-transfer-service.ts +528 -312
  199. package/src/cluster/block-transfer.ts +547 -424
  200. package/src/cluster/certified-claims.ts +319 -0
  201. package/src/cluster/client-signature-verifier.ts +34 -0
  202. package/src/cluster/cluster-policy.ts +294 -203
  203. package/src/cluster/cluster-repo.ts +2501 -2034
  204. package/src/cluster/commit-proof.ts +344 -0
  205. package/src/cluster/quorum-restore.ts +348 -223
  206. package/src/cluster/rebalance-monitor.ts +539 -254
  207. package/src/cluster/reconcile-block.ts +404 -203
  208. package/src/cluster/service.ts +23 -20
  209. package/src/cluster/spread-on-churn.ts +352 -346
  210. package/src/cohort-topic/host.ts +8 -7
  211. package/src/cohort-topic/stream-util.ts +14 -43
  212. package/src/dispute/cascade.ts +31 -15
  213. package/src/dispute/dispute-service.ts +706 -696
  214. package/src/dispute/invalidation.ts +162 -52
  215. package/src/dispute/service.ts +126 -125
  216. package/src/index.ts +7 -0
  217. package/src/libp2p-key-network.ts +1204 -1235
  218. package/src/libp2p-node-base.ts +185 -70
  219. package/src/network/open-protocol-stream.ts +87 -0
  220. package/src/network/register-protocol-handler.ts +85 -0
  221. package/src/peer-address-book.ts +96 -2
  222. package/src/pend-validation.ts +89 -0
  223. package/src/reactivity/notify-transport.ts +2 -1
  224. package/src/reactivity/push-state-gossip.ts +2 -1
  225. package/src/repo/cluster-coordinator.ts +65 -11
  226. package/src/repo/coordinator-repo.ts +729 -71
  227. package/src/repo/served-repo-proxy.ts +55 -0
  228. package/src/repo/service.ts +25 -16
  229. package/src/reputation/types.ts +3 -1
  230. package/src/rn.ts +34 -4
  231. package/src/storage/block-archive.ts +242 -0
  232. package/src/storage/block-latch.ts +144 -0
  233. package/src/storage/block-storage.ts +787 -498
  234. package/src/storage/cached-raw-storage.ts +21 -1
  235. package/src/storage/cached-store-driver.ts +898 -859
  236. package/src/storage/i-block-storage.ts +172 -116
  237. package/src/storage/i-raw-storage.ts +40 -0
  238. package/src/storage/kv-raw-storage.ts +34 -9
  239. package/src/storage/memory-store-driver.ts +26 -2
  240. package/src/storage/raw-store-codec.ts +42 -42
  241. package/src/storage/raw-store-driver.ts +45 -3
  242. package/src/storage/shared-cache-pool.ts +516 -452
  243. package/src/storage/storage-repo.ts +1421 -1014
  244. package/src/storage/store-identity.ts +41 -0
  245. package/src/storage/struct.ts +52 -34
  246. package/src/storage/with-read-cache.ts +182 -0
  247. package/src/sync/service.ts +178 -198
  248. package/src/testing/mesh-harness.ts +524 -344
  249. package/src/testing/raw-storage-conformance.ts +114 -2
@@ -1 +1 @@
1
- {"version":3,"file":"raw-store-driver.d.ts","sourceRoot":"","sources":["../../../src/storage/raw-store-driver.ts"],"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AAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IACzE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG1E,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IACvF,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAAa,CAAC,IAAI,aAAa,CAAC;IAChC,yGAAyG;IACzG,YAAY,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,yEAAyE;IACzE,oBAAoB,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,gDAAgD;IAChD,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -1,4 +1,5 @@
1
1
  import type { BlockId, ActionId } from "@optimystic/db-core";
2
+ import type { StoreIdentity } from "./store-identity.js";
2
3
  /**
3
4
  * Which of the cache's entry classes a pool entry belongs to. Mirrors the sub-states of
4
5
  * `CachedStoreDriver`'s per-block cache state; the pool itself never branches on the class —
@@ -50,9 +51,21 @@ export interface PoolEntry<V = unknown> {
50
51
  export declare class CacheStoreHandle {
51
52
  readonly id: string;
52
53
  readonly label: string | undefined;
54
+ /**
55
+ * The backing store this cache fronts, when the backend names one. Held so
56
+ * {@link SharedCachePool.unregisterStore} can free the pool's live-identity claim; never
57
+ * used as, or mixed into, an entry key (that is {@link SharedCachePool.keyFor}'s `id`).
58
+ */
59
+ readonly identity: StoreIdentity | undefined;
53
60
  bytes: number;
54
61
  entries: number;
55
- constructor(id: string, label: string | undefined);
62
+ constructor(id: string, label: string | undefined,
63
+ /**
64
+ * The backing store this cache fronts, when the backend names one. Held so
65
+ * {@link SharedCachePool.unregisterStore} can free the pool's live-identity claim; never
66
+ * used as, or mixed into, an entry key (that is {@link SharedCachePool.keyFor}'s `id`).
67
+ */
68
+ identity?: StoreIdentity | undefined);
56
69
  }
57
70
  export interface CachePoolStats {
58
71
  maxBytes: number;
@@ -123,6 +136,23 @@ export interface SharedCachePoolOptions {
123
136
  * throws. Absurdly small values are accepted as-is: they cannot break coherence (the owning
124
137
  * cache is correct at any residency, including zero), they just degrade toward read-through.
125
138
  *
139
+ * **One cache per backing store, enforced here.** Every cache — however constructed — registers
140
+ * with a pool, so registration is the one choke point all construction paths share, and
141
+ * {@link registerStore} refuses a second live registration for a backing store identity that
142
+ * already has one (see its doc for why a throw, not a warning). Two deliberate escapes remain,
143
+ * both documented rather than closed:
144
+ *
145
+ * - **Two different pools.** The claim map lives on the pool, so two caches over one store
146
+ * registered with two DIFFERENT `SharedCachePool` instances both succeed and both diverge.
147
+ * Closing that would take a process-global identity registry outliving every pool — more
148
+ * machinery than the case deserves, since passing a non-default pool is an explicit act (tests
149
+ * do it for isolation, hosts for sizing). Pinned by a test so it reads as a decision.
150
+ * - **Backends that report no identity** (memory drivers, test doubles) are not covered at all,
151
+ * which is correct: two memory drivers are two genuinely different stores.
152
+ *
153
+ * The cross-process case — two OS processes over one directory — is out of scope entirely; it is
154
+ * the unenforced precondition of Invariant 5 in `packages/db-p2p/docs/storage.md`.
155
+ *
126
156
  * Not safe for use from multiple threads; like the caches it serves, it relies on JS
127
157
  * single-threaded execution — every mutation completes synchronously.
128
158
  */
@@ -142,6 +172,12 @@ export declare class SharedCachePool {
142
172
  private entriesTotal;
143
173
  private storeCounter;
144
174
  private readonly stores;
175
+ /**
176
+ * Live backing-store claims: one entry per registered store that named an identity, freed by
177
+ * {@link unregisterStore}. Registration bookkeeping only — it holds no values and never
178
+ * enters the byte or entry budget.
179
+ */
180
+ private readonly claims;
145
181
  private hits;
146
182
  private admissions;
147
183
  private ghostHits;
@@ -160,8 +196,23 @@ export declare class SharedCachePool {
160
196
  maxBytes?: number;
161
197
  maxEntries?: number;
162
198
  }): void;
163
- /** Register a store. The returned handle's `id` is unique for the pool's lifetime — never reused. */
164
- registerStore(label?: string): CacheStoreHandle;
199
+ /**
200
+ * Register a store. The returned handle's `id` is unique for the pool's lifetime — never reused.
201
+ *
202
+ * `identity` is the backing store the caller's cache fronts ({@link StoreIdentity}), when the
203
+ * backend names one. A second registration for an identity this pool already has live
204
+ * **throws**: the two caches are write-through views that never see each other's writes, so
205
+ * each serves its own half of the process a permanently stale picture. Throwing is the point —
206
+ * the failure it replaces is silent wrong data returned to a caller with no way to notice, and
207
+ * a log line is not a way to notice. A registration with no identity is unaffected: it
208
+ * registers exactly as it always did.
209
+ *
210
+ * The check runs BEFORE any mutation, so a refused registration leaves the pool exactly as it
211
+ * was — no store row, no consumed id, no claim.
212
+ *
213
+ * @throws Error when `identity` already has a live registration on this pool.
214
+ */
215
+ registerStore(label?: string, identity?: StoreIdentity): CacheStoreHandle;
165
216
  /**
166
217
  * Release a departing store: evict any of its entries still resident (defensively — the
167
218
  * owner normally clears first), purge its ghost keys, and remove it from the registry.
@@ -169,6 +220,12 @@ export declare class SharedCachePool {
169
220
  * would de-account entries the owner still references, leaving it serving values the pool
170
221
  * no longer counts. It does NOT ghost (the ghosts are being purged anyway) and does NOT
171
222
  * count as a budget eviction: it is a lifecycle release, not memory pressure.
223
+ *
224
+ * Also frees the handle's backing-store claim, so sequential reuse of one store (stop a node,
225
+ * start another over the same directory) registers cleanly instead of tripping
226
+ * {@link registerStore}'s guard. The claim is released only when the map still points at THIS
227
+ * handle — a second, late unregister of a departed handle must not strip the claim out from
228
+ * under the successor that legitimately took the identity in between.
172
229
  */
173
230
  unregisterStore(handle: CacheStoreHandle): void;
174
231
  /** Drop every ghost key belonging to `handle` (used by store clear/close — pre-clear recency must not survive the clear). */
@@ -1 +1 @@
1
- {"version":3,"file":"shared-cache-pool.d.ts","sourceRoot":"","sources":["../../../src/storage/shared-cache-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC;AAEtF;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC;IACT,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAI3B,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,QAAQ,CAAC,KA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OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,MAAM;IAUd,4FAA4F;IAC5F,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,SAAS;CAOjB;AA4BD;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAGlD"}
@@ -6,11 +6,19 @@
6
6
  export class CacheStoreHandle {
7
7
  id;
8
8
  label;
9
+ identity;
9
10
  bytes = 0;
10
11
  entries = 0;
11
- constructor(id, label) {
12
+ constructor(id, label,
13
+ /**
14
+ * The backing store this cache fronts, when the backend names one. Held so
15
+ * {@link SharedCachePool.unregisterStore} can free the pool's live-identity claim; never
16
+ * used as, or mixed into, an entry key (that is {@link SharedCachePool.keyFor}'s `id`).
17
+ */
18
+ identity = undefined) {
12
19
  this.id = id;
13
20
  this.label = label;
21
+ this.identity = identity;
14
22
  }
15
23
  }
16
24
  /**
@@ -48,6 +56,23 @@ const SEP = '\u0000';
48
56
  * throws. Absurdly small values are accepted as-is: they cannot break coherence (the owning
49
57
  * cache is correct at any residency, including zero), they just degrade toward read-through.
50
58
  *
59
+ * **One cache per backing store, enforced here.** Every cache — however constructed — registers
60
+ * with a pool, so registration is the one choke point all construction paths share, and
61
+ * {@link registerStore} refuses a second live registration for a backing store identity that
62
+ * already has one (see its doc for why a throw, not a warning). Two deliberate escapes remain,
63
+ * both documented rather than closed:
64
+ *
65
+ * - **Two different pools.** The claim map lives on the pool, so two caches over one store
66
+ * registered with two DIFFERENT `SharedCachePool` instances both succeed and both diverge.
67
+ * Closing that would take a process-global identity registry outliving every pool — more
68
+ * machinery than the case deserves, since passing a non-default pool is an explicit act (tests
69
+ * do it for isolation, hosts for sizing). Pinned by a test so it reads as a decision.
70
+ * - **Backends that report no identity** (memory drivers, test doubles) are not covered at all,
71
+ * which is correct: two memory drivers are two genuinely different stores.
72
+ *
73
+ * The cross-process case — two OS processes over one directory — is out of scope entirely; it is
74
+ * the unenforced precondition of Invariant 5 in `packages/db-p2p/docs/storage.md`.
75
+ *
51
76
  * Not safe for use from multiple threads; like the caches it serves, it relies on JS
52
77
  * single-threaded execution — every mutation completes synchronously.
53
78
  */
@@ -67,6 +92,12 @@ export class SharedCachePool {
67
92
  entriesTotal = 0;
68
93
  storeCounter = 0;
69
94
  stores = new Map();
95
+ /**
96
+ * Live backing-store claims: one entry per registered store that named an identity, freed by
97
+ * {@link unregisterStore}. Registration bookkeeping only — it holds no values and never
98
+ * enters the byte or entry budget.
99
+ */
100
+ claims = new Map();
70
101
  hits = 0;
71
102
  admissions = 0;
72
103
  ghostHits = 0;
@@ -97,10 +128,34 @@ export class SharedCachePool {
97
128
  this.evictToFit(0, 0);
98
129
  this.trimGhost();
99
130
  }
100
- /** Register a store. The returned handle's `id` is unique for the pool's lifetime — never reused. */
101
- registerStore(label) {
102
- const handle = new CacheStoreHandle(`s${++this.storeCounter}`, label);
131
+ /**
132
+ * Register a store. The returned handle's `id` is unique for the pool's lifetime — never reused.
133
+ *
134
+ * `identity` is the backing store the caller's cache fronts ({@link StoreIdentity}), when the
135
+ * backend names one. A second registration for an identity this pool already has live
136
+ * **throws**: the two caches are write-through views that never see each other's writes, so
137
+ * each serves its own half of the process a permanently stale picture. Throwing is the point —
138
+ * the failure it replaces is silent wrong data returned to a caller with no way to notice, and
139
+ * a log line is not a way to notice. A registration with no identity is unaffected: it
140
+ * registers exactly as it always did.
141
+ *
142
+ * The check runs BEFORE any mutation, so a refused registration leaves the pool exactly as it
143
+ * was — no store row, no consumed id, no claim.
144
+ *
145
+ * @throws Error when `identity` already has a live registration on this pool.
146
+ */
147
+ registerStore(label, identity) {
148
+ const claimed = identity === undefined ? undefined : this.claims.get(identity);
149
+ if (claimed !== undefined) {
150
+ throw new Error(`two caches over one backing store never converge: ${JSON.stringify(identity)} is already `
151
+ + `cached (label ${JSON.stringify(claimed.label ?? null)}); this registration `
152
+ + `(label ${JSON.stringify(label ?? null)}) would be a second, independent view. Share one `
153
+ + `CachedRawStorage — withReadCache does this for you — or dispose the first.`);
154
+ }
155
+ const handle = new CacheStoreHandle(`s${++this.storeCounter}`, label, identity);
103
156
  this.stores.set(handle.id, handle);
157
+ if (identity !== undefined)
158
+ this.claims.set(identity, handle);
104
159
  return handle;
105
160
  }
106
161
  /**
@@ -110,6 +165,12 @@ export class SharedCachePool {
110
165
  * would de-account entries the owner still references, leaving it serving values the pool
111
166
  * no longer counts. It does NOT ghost (the ghosts are being purged anyway) and does NOT
112
167
  * count as a budget eviction: it is a lifecycle release, not memory pressure.
168
+ *
169
+ * Also frees the handle's backing-store claim, so sequential reuse of one store (stop a node,
170
+ * start another over the same directory) registers cleanly instead of tripping
171
+ * {@link registerStore}'s guard. The claim is released only when the map still points at THIS
172
+ * handle — a second, late unregister of a departed handle must not strip the claim out from
173
+ * under the successor that legitimately took the identity in between.
113
174
  */
114
175
  unregisterStore(handle) {
115
176
  for (const queue of [this.a1in, this.am]) {
@@ -122,6 +183,9 @@ export class SharedCachePool {
122
183
  }
123
184
  this.purgeGhosts(handle);
124
185
  this.stores.delete(handle.id);
186
+ if (handle.identity !== undefined && this.claims.get(handle.identity) === handle) {
187
+ this.claims.delete(handle.identity);
188
+ }
125
189
  }
126
190
  /** Drop every ghost key belonging to `handle` (used by store clear/close — pre-clear recency must not survive the clear). */
127
191
  purgeGhosts(handle) {
@@ -1 +1 @@
1
- {"version":3,"file":"shared-cache-pool.js","sourceRoot":"","sources":["../../../src/storage/shared-cache-pool.ts"],"names":[],"mappings":"AAgDA;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAIlB;IACA;IAJV,KAAK,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,CAAC;IACZ,YACU,EAAU,EACV,KAAyB;QADzB,OAAE,GAAF,EAAE,CAAQ;QACV,UAAK,GAAL,KAAK,CAAoB;IAChC,CAAC;CACJ;AAmCD;;;;;;GAMG;AACH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I,0CAA0C,KAAK,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAS,oBAAoB;IAC5B,MAAM,CAAC,GAAG,UAAoE,CAAC;IAC/E,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,KAAK,aAAa;QAAE,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;IACnE,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACpD,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACzB,CAAC;AAED,IAAI,WAAwC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC/B,WAAW,KAAK,IAAI,eAAe,EAAE,CAAC;IACtC,OAAO,WAAW,CAAC;AACpB,CAAC"}
@@ -1,25 +1,7 @@
1
- import type { IRepo, MessageOptions, BlockId, CommitRequest, CommitResult, GetBlockResults, PendRequest, PendResult, ActionBlocks, BlockGets, IBlock, ActionRev, PendValidationHook, CollectionId, IBlockChangeNotifier, CollectionChangeListener } from "@optimystic/db-core";
1
+ import type { IRepo, MessageOptions, BlockId, CommitRequest, CommitResult, GetBlockResults, PendRequest, PendResult, ActionBlocks, ActionId, BlockGets, IBlock, ActionRev, PendValidationHook, UnvalidatablePendPolicy, CollectionId, IBlockChangeNotifier, CollectionChangeListener } from "@optimystic/db-core";
2
2
  import type { IBlockStorage } from "./i-block-storage.js";
3
3
  import type { IBlockReplicaStore } from "../cluster/block-transfer-service.js";
4
- /**
5
- * Single source of truth for the per-block commit latch key. Held by {@link StorageRepo.commit} and
6
- * {@link StorageRepo.saveReplicatedBlock}, and — through an injected runner ({@link withBlockCommitLatch})
7
- * — by the invalidation-apply path. Every out-of-band writer of a block's `meta.latest` must serialize
8
- * on this key against a concurrent local commit on the same block; keeping all call sites on this helper
9
- * is what prevents the key from drifting between them.
10
- */
11
- export declare const commitLatchKey: (blockId: BlockId) => string;
12
- /**
13
- * Runs `fn` while holding the per-block commit latch {@link commitLatchKey}. This is the capability the
14
- * dispute module's `applyInvalidation` is handed (through its context) so its compensating
15
- * `saveReplica`/`saveDeletion` read-modify-write of `meta.latest` is mutually exclusive with a concurrent
16
- * {@link StorageRepo.commit} on the same block — otherwise an invalidation advancing `latest` outside
17
- * that latch is invisible to commit's staleness guard and can be clobbered (a non-monotonic regression).
18
- *
19
- * Acquire/release is per call, so a caller holds at most one block latch at any instant and cannot
20
- * deadlock against commit's sorted, up-front multi-latch acquisition.
21
- */
22
- export declare function withBlockCommitLatch<T>(blockId: BlockId, fn: () => Promise<T>): Promise<T>;
4
+ import { type BlockCommitProof } from "../cluster/commit-proof.js";
23
5
  /**
24
6
  * Stable, greppable prefix on the failure reason a commit carries when this node cannot materialize
25
7
  * the revision it was asked to record. It is a STRING marker rather than only an error class because
@@ -27,6 +9,13 @@ export declare function withBlockCommitLatch<T>(blockId: BlockId, fn: () => Prom
27
9
  * also crosses the wire), so the class identity is lost by the time a caller inspects the result.
28
10
  */
29
11
  export declare const MISSING_BASE_REVISION_REASON = "missing-base-revision";
12
+ /**
13
+ * The two stable reject-reason prefixes a validating receiver emits, re-exported here (and from
14
+ * `cluster/cluster-repo.ts`) next to their siblings so a caller inspecting a `PendResult` reason
15
+ * need not know which module defines them. Both tiers refuse with the same prefixes because both
16
+ * run the same {@link checkPendValidation}.
17
+ */
18
+ export { PEND_NOT_VALIDATABLE, VALIDATOR_FAULT } from "../pend-validation.js";
30
19
  /**
31
20
  * This node was asked to commit revision N of a block it holds no materializable base for, so
32
21
  * applying the transform would materialize nothing while `latest` advanced to N — a block that is
@@ -48,10 +37,80 @@ export declare function isMissingBaseRevisionFailure(result: CommitResult): bool
48
37
  export type StorageRepoOptions = {
49
38
  /** Optional hook to validate transactions in PendRequests */
50
39
  validatePend?: PendValidationHook;
40
+ /**
41
+ * What this repo does — when a `validatePend` hook IS configured — with a pend that carries no
42
+ * `validation` payload and therefore nothing to re-check. Default 'accept'; see
43
+ * {@link UnvalidatablePendPolicy}. The cluster tier's mirror of this knob is
44
+ * `ClusterConsensusConfig.unvalidatablePendPolicy`, and both are enforced by the one
45
+ * `checkPendValidation`.
46
+ *
47
+ * NOTE: the two tiers are configured INDEPENDENTLY, so a node set to 'accept' at the cluster tier
48
+ * and 'reject' here would vote approve on a pend its own storage then refuses at apply — burning
49
+ * a consensus round to reach a verdict it already knew. Harmless today because no composition
50
+ * root supplies a checker at either tier (backlog
51
+ * `feat-no-deployment-validates-transactions-at-pend`); when one does, resolve both knobs from a
52
+ * single operator field rather than letting a deployment set them apart.
53
+ */
54
+ unvalidatablePendPolicy?: UnvalidatablePendPolicy;
55
+ };
56
+ /**
57
+ * What {@link StorageRepo.previewCommitDigest} predicts a commit would materialize. `digest` is the
58
+ * {@link canonicalBlockHash} of the materialized content, or `undefined` when the transform
59
+ * materializes nothing (a delete/tombstone, updates with no base to apply them to) or the base
60
+ * exists but cannot be materialized locally. `baseRev` is the local committed revision the preview
61
+ * was computed against (absent when there is none, or when the transform is base-independent and no
62
+ * base was read). `baseIndependent` is true when the pended transform carries an `insert`, making
63
+ * the result identical on every member regardless of what base it holds.
64
+ */
65
+ export type CommitDigestPreview = {
66
+ digest?: string;
67
+ baseRev?: number;
68
+ baseIndependent: boolean;
51
69
  };
52
- export declare class StorageRepo implements IRepo, IBlockChangeNotifier, IBlockReplicaStore {
70
+ /**
71
+ * The capability {@link ClusterMember.validateCommitOperations} probes its `storageRepo` for. Named
72
+ * (rather than written inline at the probe) so there is ONE definition of the contract and so a repo
73
+ * decorator wrapping the member's storage seam has something to `implements` and forward — a wrapper
74
+ * that drops the method silently disables the commit content-digest check on that node.
75
+ */
76
+ export interface ICommitDigestPreviewer {
77
+ previewCommitDigest(blockId: BlockId, actionId: ActionId, rev: number): Promise<CommitDigestPreview | undefined>;
78
+ }
79
+ /**
80
+ * The capability `ClusterMember.applyConsensusOperation` casts its `storageRepo` to when handing a
81
+ * {@link BlockCommitProof} down the commit path. Named for the same reason as
82
+ * {@link ICommitDigestPreviewer}: one definition of the widened contract, and something a repo
83
+ * decorator can `implements` and forward. `IRepo.commit` takes two arguments; the third is
84
+ * harmless at runtime for a plain `IRepo` implementation (the extra argument is ignored), so
85
+ * callers cast rather than structurally probe — but a decorator that narrows back to `IRepo`
86
+ * silently stops persisting proofs on that node.
87
+ */
88
+ export interface ICommitProofPersister {
89
+ commit(request: CommitRequest, options?: MessageOptions, proof?: BlockCommitProof): Promise<CommitResult>;
90
+ }
91
+ /**
92
+ * The capability that answers "which action committed revision N of this block?" — the question the
93
+ * commit-tier stale checks need when local `latest` has already advanced PAST a contested revision,
94
+ * so `latest.actionId` alone can no longer distinguish "my commit landed and history moved on"
95
+ * (abstain / not a conflict) from "a rival took my revision" (reject / retryable conflict).
96
+ * Consumed by the cluster member's promise-round stale-commit check
97
+ * (`ClusterMember.validateCommitRevisions`) and by `CoordinatorRepo`'s commit rejection classifier.
98
+ * Named (rather than probed inline) for the same reason as {@link ICommitDigestPreviewer}: one
99
+ * definition of the contract, and something a repo decorator can `implements` and forward — a
100
+ * wrapper that drops the method silently degrades both checks to an abstain on that node.
101
+ */
102
+ export interface IRevisionActionReader {
103
+ /**
104
+ * The action id recorded for `rev` of `blockId`, or `undefined` when this node holds no revision
105
+ * record for it (never seen, or history truncated below `rev`). Read-only; never takes the block
106
+ * write latch (callers are on vote/classification paths and must treat a throw as "unknown").
107
+ */
108
+ getRevisionAction(blockId: BlockId, rev: number): Promise<ActionId | undefined>;
109
+ }
110
+ export declare class StorageRepo implements IRepo, IBlockChangeNotifier, IBlockReplicaStore, ICommitDigestPreviewer, ICommitProofPersister, IRevisionActionReader {
53
111
  private readonly createBlockStorage;
54
112
  private readonly validatePend?;
113
+ private readonly unvalidatablePendPolicy;
55
114
  /** Per-collection change listeners; empty sets are pruned on unsubscribe. */
56
115
  private readonly changeListeners;
57
116
  /** Catch-all change listeners — fire for EVERY collection's commit on this node. */
@@ -85,6 +144,23 @@ export declare class StorageRepo implements IRepo, IBlockChangeNotifier, IBlockR
85
144
  /** Dispatch `event` to a snapshot of `listeners` (safe under mid-emit (un)subscribe), isolating + logging any throw. */
86
145
  private fireChangeListeners;
87
146
  get({ blockIds, context }: BlockGets, _options?: MessageOptions): Promise<GetBlockResults>;
147
+ /**
148
+ * The one place a local coverage gap is healed from a peer. `getBlock` is local-only; when it
149
+ * reports the target revision as not covered ({@link RevisionNotCoveredError}) this fetches it
150
+ * through `restoreRevision` under the block's write latch — the restore writes revision records
151
+ * and merges coverage into the metadata blob, so it must serialize against every other writer of
152
+ * the block — and re-reads. Only the restore is latched; the reads on either side are not, and
153
+ * the latch is never held across the two.
154
+ *
155
+ * A restore that fails on a **pending-only** block (metadata seeded by a pend, no committed
156
+ * revision) reads as ABSENT, not as a fault: the named revision was a guess about content this
157
+ * node never held, and the caller's insert-probe / pending-overlay logic already treats an absent
158
+ * base as "nothing committed here". A failed restore on a block that DOES hold a `latest` is a
159
+ * real fault (a `latest` this node cannot serve) and propagates, so the caller reports the block
160
+ * as unavailable. Any throw from the second read (records restored but nothing materializable
161
+ * under them) propagates the same way.
162
+ */
163
+ private readBlockHealing;
88
164
  /**
89
165
  * Emit a {@link CollectionChangeEvent} for each read-driven promotion that landed
90
166
  * during a {@link get}. A single get() can promote multiple distinct actions, each
@@ -95,7 +171,7 @@ export declare class StorageRepo implements IRepo, IBlockChangeNotifier, IBlockR
95
171
  pend(request: PendRequest, _options?: MessageOptions): Promise<PendResult>;
96
172
  cancel(actionRef: ActionBlocks, _options?: MessageOptions): Promise<void>;
97
173
  /**
98
- * Commit a previously-pended action across its blocks, under the per-block commit latches.
174
+ * Commit a previously-pended action across its blocks, under the block write latches.
99
175
  *
100
176
  * **Divergence vs genuine fault.** When the batch cannot be completed, the reason decides what
101
177
  * happens to the pending records the pend left behind. `ClusterMember.applyConsensusOperation`
@@ -122,7 +198,7 @@ export declare class StorageRepo implements IRepo, IBlockChangeNotifier, IBlockR
122
198
  * its `cancel` therefore still strands the record; that is pre-existing and orthogonal to the
123
199
  * divergence split above.
124
200
  */
125
- commit(request: CommitRequest, _options?: MessageOptions): Promise<CommitResult>;
201
+ commit(request: CommitRequest, _options?: MessageOptions, proof?: BlockCommitProof): Promise<CommitResult>;
126
202
  /**
127
203
  * Delete `actionId`'s pending record from every given block, tolerating absence.
128
204
  *
@@ -158,13 +234,115 @@ export declare class StorageRepo implements IRepo, IBlockChangeNotifier, IBlockR
158
234
  * already materialized from a departing owner, not as a pend/commit. See
159
235
  * {@link IBlockStorage.saveReplica} for the durability/monotonicity contract.
160
236
  *
161
- * Held under the same `StorageRepo.commit:<id>` latch as {@link commit} so the
162
- * replica's read-modify-write of `latest` is mutually exclusive with a concurrent
237
+ * Held under the same block write latch as {@link commit} so the replica's
238
+ * read-modify-write of the metadata blob is mutually exclusive with a concurrent
163
239
  * local commit on the same block — otherwise `saveReplica`'s monotonic guard could
164
240
  * read a stale `latest` and clobber a commit that advanced it in between.
241
+ *
242
+ * `verifiedProof` is retained when supplied: both the reconcile path
243
+ * (`cluster/reconcile-block.ts`) and the certified push path (`BlockTransferService.handlePush`)
244
+ * pass the {@link BlockCommitProof} they verified against these exact bytes (`certifyContent`'s
245
+ * digest check), so a repaired replica serves the proof onward and certification no longer decays
246
+ * across repair hops.
247
+ *
248
+ * When the push does NOT advance `latest` (this node already holds that revision), `saveReplica`
249
+ * is a no-op and persists nothing — so the proof is back-filled here instead, through
250
+ * {@link backFillProof}'s digest-match rule. It is deliberately NOT persisted inside
251
+ * `saveReplica`: the proof was verified against the PUSHED bytes, while a back-fill attaches it to
252
+ * this node's HELD materialization, and a diverged holder's bytes at the same `(rev, actionId)`
253
+ * may differ. Storing a proof whose declared digest contradicts local content would make this node
254
+ * serve content that fails its own proof — `digest-mismatch` is an ATTRIBUTABLE fault in
255
+ * `certified-claims.ts`, so every receiver would penalize it.
256
+ */
257
+ saveReplicatedBlock(blockId: BlockId, block: IBlock, source?: ActionRev, verifiedProof?: BlockCommitProof): Promise<void>;
258
+ /**
259
+ * The digest the block WOULD materialize to if `actionId`'s pending transform committed at `rev`,
260
+ * plus the base revision it was computed from. Read-only: touches no durable state and takes no
261
+ * block write latch.
262
+ *
263
+ * Mirrors {@link internalCommit}'s reads (pending transform → latest → base → applyTransform) so
264
+ * the prediction and the eventual commit cannot drift. Consumed by the cluster member's
265
+ * promise-round content-digest check (`ClusterMember.validateCommitOperations`), which compares it
266
+ * against the digest the transaction author declared on the commit request.
267
+ *
268
+ * Deliberately does NOT take the block write latch: this runs on the vote path, ahead of the
269
+ * commit that will take it, so taking it here would serialize voting behind commits and risks
270
+ * deadlocking against commit's sorted up-front multi-block latch acquisition. The price is that a
271
+ * concurrent commit can move `latest` mid-preview; the caller's checkable rule (base-independent,
272
+ * or `baseRev` agreement) makes a torn read at worst an abstain, never a false reject of honest
273
+ * content.
274
+ *
275
+ * `rev` is accepted for parity/logging with the commit that would follow; materialization does not
276
+ * depend on it (internalCommit only records it).
277
+ *
278
+ * Returns `undefined` when this node holds no pending transform for the action (it never saw the
279
+ * pend) — distinct from a defined preview with `digest: undefined` (see {@link CommitDigestPreview}).
280
+ */
281
+ previewCommitDigest(blockId: BlockId, actionId: ActionId, rev: number): Promise<CommitDigestPreview | undefined>;
282
+ /**
283
+ * See {@link IRevisionActionReader}. Reads the block's revision index directly
284
+ * (`listRevisions(rev, rev)` — both bounds inclusive per the `IBlockStorage` contract); an empty
285
+ * range means this node holds no record for that revision.
286
+ */
287
+ getRevisionAction(blockId: BlockId, rev: number): Promise<ActionId | undefined>;
288
+ /**
289
+ * The {@link BlockCommitProof} this node retained for `blockId` at `rev`, or `undefined` when it
290
+ * kept none — a revision committed before proofs were persisted, a member whose materialization
291
+ * diverged from the declared digest (see {@link persistProofIfContentMatches}), or simply a
292
+ * revision this node never landed.
293
+ *
294
+ * Public because a peer answering a block-repair fetch serves the proof alongside the revision
295
+ * (`serveBlockArchive`), which is the only way a requester can check a lone holder's claim
296
+ * without a second holder to corroborate it. Read-only and unlatched: a proof is written once
297
+ * and never mutated, so a concurrent commit can only make this return a proof for a revision
298
+ * that just became stale — which the caller pairs with the revision it actually read.
165
299
  */
166
- saveReplicatedBlock(blockId: BlockId, block: IBlock, source?: ActionRev): Promise<void>;
300
+ getBlockProof(blockId: BlockId, rev: number): Promise<BlockCommitProof | undefined>;
167
301
  private internalCommit;
302
+ /**
303
+ * Retain `proof` for a block this call found ALREADY committed at `(rev, actionId)` — the paths
304
+ * that land (or find already landed) a revision without running {@link internalCommit}, and would
305
+ * otherwise never retain a proof: the idempotent re-commit partition, the Crash-D3 `recover()`
306
+ * partition, and {@link saveReplicatedBlock}'s monotonic no-op on a certified push. Strictly
307
+ * additive: an existing proof is left alone, and the same digest-match rule as the fresh-commit
308
+ * site decides retention.
309
+ *
310
+ * `rev`/`actionId` are passed separately rather than as a `CommitRequest` because the replica
311
+ * caller has no commit request — it has the `(rev, actionId)` the push and the held revision
312
+ * agree on.
313
+ *
314
+ * Callers must hold the block's write latch (`latch`). `getBlock` is local-only and can throw on
315
+ * an unmaterializable or uncovered base — treated as "no local content", i.e. the proof is withheld.
316
+ */
317
+ private backFillProof;
318
+ /**
319
+ * The single retention rule for {@link BlockCommitProof}s, shared by the fresh-commit site
320
+ * ({@link internalCommit}, after `setLatest`) and the already-landed back-fill
321
+ * ({@link backFillProof}):
322
+ *
323
+ * > **A member persists the proof only when its own materialization matches the digest the
324
+ * > commit operation declared for this block.**
325
+ *
326
+ * One rule covers every awkward case without a second flag: a DIVERGED member (committed onto a
327
+ * lagging base) computes a different hash, stores no proof, and falls back to corroboration
328
+ * exactly as today — the `commit:proof-digest-mismatch` log line is also the first signal this
329
+ * system has ever had that a member diverged. A member that abstained at vote time still checks
330
+ * here (by commit time it HAS materialized) and legitimately keeps the proof on agreement. A
331
+ * tombstone (no `block`) and a commit with no `blockDigests` (pre-upgrade client) declare no
332
+ * digest and store no proof (`commit:proof-undeclared`).
333
+ *
334
+ * Never throws: the commit this proof describes already durably landed, so a proof-persist
335
+ * fault must not turn `commit()` into `success:false` for a landed commit — it is logged and
336
+ * the proof simply is not retained (repair falls back to corroboration).
337
+ *
338
+ * NOTE: one commit of N blocks stores the SAME proof under each block's `(blockId, rev)` proofs-store key, and
339
+ * the proof itself carries the commit op's N `blockIds`/`blockDigests` — so bytes retained per
340
+ * commit grow with N². Measured base cost is ~4.6 KB for a 10-peer 2-block commit
341
+ * (`test/commit-proof.spec.ts` "size"), and nothing today bounds `CommitRequest.blockIds`. Fine
342
+ * at the handful-of-blocks batches the transactor produces now; if per-coordinator batches ever
343
+ * grow large, store the proof once under its `messageHash` and key each revision to a pointer.
344
+ */
345
+ private persistProofIfContentMatches;
168
346
  /**
169
347
  * The materialization this commit builds on: the block at `latest`, or `undefined` when the block
170
348
  * holds no committed revision yet (the normal insert case).
@@ -1 +1 @@
1
- {"version":3,"file":"storage-repo.d.ts","sourceRoot":"","sources":["../../../src/storage/storage-repo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EACzG,SAAS,EACH,MAAM,EAAE,SAAS,EACjC,kBAAkB,EAClB,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAE5D,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAK/E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,MAAyC,CAAC;AAE5F;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAO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