@optimystic/db-core 0.25.0 → 0.26.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 (104) hide show
  1. package/dist/src/cohort-topic/membership/verifier.d.ts +8 -0
  2. package/dist/src/cohort-topic/membership/verifier.d.ts.map +1 -1
  3. package/dist/src/cohort-topic/membership/verifier.js +17 -0
  4. package/dist/src/cohort-topic/membership/verifier.js.map +1 -1
  5. package/dist/src/cohort-topic/promotion.d.ts +25 -0
  6. package/dist/src/cohort-topic/promotion.d.ts.map +1 -1
  7. package/dist/src/cohort-topic/promotion.js +58 -11
  8. package/dist/src/cohort-topic/promotion.js.map +1 -1
  9. package/dist/src/cohort-topic/wire/primitives.d.ts +6 -0
  10. package/dist/src/cohort-topic/wire/primitives.d.ts.map +1 -1
  11. package/dist/src/cohort-topic/wire/primitives.js +6 -0
  12. package/dist/src/cohort-topic/wire/primitives.js.map +1 -1
  13. package/dist/src/cohort-topic/wire/types.d.ts +5 -0
  14. package/dist/src/cohort-topic/wire/types.d.ts.map +1 -1
  15. package/dist/src/cohort-topic/wire/validate.d.ts.map +1 -1
  16. package/dist/src/cohort-topic/wire/validate.js +10 -19
  17. package/dist/src/cohort-topic/wire/validate.js.map +1 -1
  18. package/dist/src/collection/collection.d.ts +8 -1
  19. package/dist/src/collection/collection.d.ts.map +1 -1
  20. package/dist/src/collection/collection.js +19 -3
  21. package/dist/src/collection/collection.js.map +1 -1
  22. package/dist/src/matchmaking/wire.d.ts +2 -2
  23. package/dist/src/matchmaking/wire.d.ts.map +1 -1
  24. package/dist/src/matchmaking/wire.js +3 -3
  25. package/dist/src/matchmaking/wire.js.map +1 -1
  26. package/dist/src/network/struct.d.ts +5 -5
  27. package/dist/src/network/struct.d.ts.map +1 -1
  28. package/dist/src/testing/index.d.ts +1 -0
  29. package/dist/src/testing/index.d.ts.map +1 -1
  30. package/dist/src/testing/index.js +1 -0
  31. package/dist/src/testing/index.js.map +1 -1
  32. package/dist/src/testing/refresh-probe.d.ts +31 -0
  33. package/dist/src/testing/refresh-probe.d.ts.map +1 -0
  34. package/dist/src/testing/refresh-probe.js +39 -0
  35. package/dist/src/testing/refresh-probe.js.map +1 -0
  36. package/dist/src/testing/test-transactor.d.ts +58 -5
  37. package/dist/src/testing/test-transactor.d.ts.map +1 -1
  38. package/dist/src/testing/test-transactor.js +87 -4
  39. package/dist/src/testing/test-transactor.js.map +1 -1
  40. package/dist/src/transaction/coordinator.d.ts +90 -6
  41. package/dist/src/transaction/coordinator.d.ts.map +1 -1
  42. package/dist/src/transaction/coordinator.js +311 -90
  43. package/dist/src/transaction/coordinator.js.map +1 -1
  44. package/dist/src/transaction/errors.d.ts +42 -0
  45. package/dist/src/transaction/errors.d.ts.map +1 -1
  46. package/dist/src/transaction/errors.js +50 -0
  47. package/dist/src/transaction/errors.js.map +1 -1
  48. package/dist/src/transaction/index.d.ts +1 -1
  49. package/dist/src/transaction/index.d.ts.map +1 -1
  50. package/dist/src/transaction/index.js +1 -1
  51. package/dist/src/transaction/index.js.map +1 -1
  52. package/dist/src/transaction/session.d.ts +7 -3
  53. package/dist/src/transaction/session.d.ts.map +1 -1
  54. package/dist/src/transaction/session.js +7 -3
  55. package/dist/src/transaction/session.js.map +1 -1
  56. package/dist/src/transaction/transaction.d.ts +12 -2
  57. package/dist/src/transaction/transaction.d.ts.map +1 -1
  58. package/dist/src/transaction/transaction.js.map +1 -1
  59. package/dist/src/transactor/network-transactor.d.ts +1 -1
  60. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  61. package/dist/src/transactor/network-transactor.js +6 -26
  62. package/dist/src/transactor/network-transactor.js.map +1 -1
  63. package/dist/src/transactor/transactor-source.d.ts +4 -6
  64. package/dist/src/transactor/transactor-source.d.ts.map +1 -1
  65. package/dist/src/transactor/transactor-source.js +4 -6
  66. package/dist/src/transactor/transactor-source.js.map +1 -1
  67. package/dist/src/transform/atomic.d.ts.map +1 -1
  68. package/dist/src/transform/atomic.js +7 -0
  69. package/dist/src/transform/atomic.js.map +1 -1
  70. package/dist/src/transform/base-pins.d.ts +48 -0
  71. package/dist/src/transform/base-pins.d.ts.map +1 -0
  72. package/dist/src/transform/base-pins.js +65 -0
  73. package/dist/src/transform/base-pins.js.map +1 -0
  74. package/dist/src/transform/digest.d.ts +4 -2
  75. package/dist/src/transform/digest.d.ts.map +1 -1
  76. package/dist/src/transform/digest.js +14 -19
  77. package/dist/src/transform/digest.js.map +1 -1
  78. package/dist/src/transform/tracker.d.ts +31 -3
  79. package/dist/src/transform/tracker.d.ts.map +1 -1
  80. package/dist/src/transform/tracker.js +105 -13
  81. package/dist/src/transform/tracker.js.map +1 -1
  82. package/package.json +1 -1
  83. package/src/cohort-topic/membership/verifier.ts +487 -461
  84. package/src/cohort-topic/promotion.ts +86 -14
  85. package/src/cohort-topic/wire/primitives.ts +195 -188
  86. package/src/cohort-topic/wire/types.ts +480 -475
  87. package/src/cohort-topic/wire/validate.ts +504 -512
  88. package/src/collection/collection.ts +19 -3
  89. package/src/matchmaking/wire.ts +605 -603
  90. package/src/network/struct.ts +5 -5
  91. package/src/testing/index.ts +1 -0
  92. package/src/testing/refresh-probe.ts +52 -0
  93. package/src/testing/test-transactor.ts +100 -4
  94. package/src/transaction/coordinator.ts +312 -99
  95. package/src/transaction/errors.ts +141 -91
  96. package/src/transaction/index.ts +1 -1
  97. package/src/transaction/session.ts +7 -3
  98. package/src/transaction/transaction.ts +12 -2
  99. package/src/transactor/network-transactor.ts +1025 -1045
  100. package/src/transactor/transactor-source.ts +170 -172
  101. package/src/transform/atomic.ts +6 -0
  102. package/src/transform/base-pins.ts +83 -0
  103. package/src/transform/digest.ts +14 -19
  104. package/src/transform/tracker.ts +108 -15
@@ -1,11 +1,29 @@
1
1
  import { applyOperation, applyOperations, applyTransform, emptyTransforms, blockIdsForTransforms, transformForBlockId } from "./helpers.js";
2
+ import { BasePins } from "./base-pins.js";
2
3
  import { ensured } from "../utility/ensured.js";
4
+ /** The base a source can answer from memory, with the committed revision of that content — the
5
+ * shared probe behind both {@link Tracker.probeBase} (pin time) and {@link Tracker.peekMaterialized}
6
+ * (declare time), so the two can never disagree about what "locally answerable" means. Duck-typed,
7
+ * because Tracker layers over test doubles as well as CacheSource.
8
+ *
9
+ * Returns undefined unless BOTH probes answer: an LRU-evicted id can leave a stale cached revision
10
+ * behind (see the NOTE on CacheSource's `revisions` map), and `peek` returning undefined for that id
11
+ * is what keeps the stale revision from pairing with a block. */
12
+ function cachedBase(source, id) {
13
+ const src = source;
14
+ if (typeof src.peek !== 'function' || typeof src.getCachedRevision !== 'function')
15
+ return undefined;
16
+ const block = src.peek(id); // already a clone (peek contract)
17
+ const rev = src.getCachedRevision(id);
18
+ return block === undefined || rev === undefined ? undefined : { block, rev };
19
+ }
3
20
  /** A block store that collects transformations, without applying them to the underlying source.
4
21
  * Transformations are also applied to the retrieved blocks, making it seem like the source has been modified.
5
22
  */
6
23
  export class Tracker {
7
24
  source;
8
25
  transforms;
26
+ pins;
9
27
  /** Per-id memo of the materialized (source block + all `updates[id]` ops) result, so a
10
28
  * repeated read of a hot op-carrying block is O(block size) instead of O(block size + ops).
11
29
  * Kept fresh incrementally on {@link update}, dropped on {@link insert}/{@link delete}/{@link reset},
@@ -16,15 +34,57 @@ export class Tracker {
16
34
  materialized = new Map();
17
35
  constructor(source,
18
36
  /** The collected set of transformations to be applied. Treat as immutable */
19
- transforms = emptyTransforms()) {
37
+ transforms = emptyTransforms(),
38
+ /** Committed bases pinned at the moment each update was staged, so the digest pass can
39
+ * describe every updated block even after the read cache evicts its base. Shared by
40
+ * reference across the trackers of one transaction (see {@link BasePins}); pass an
41
+ * existing store to join a transaction, omit for a private one. */
42
+ pins = new BasePins()) {
20
43
  this.source = source;
21
44
  this.transforms = transforms;
45
+ this.pins = pins;
46
+ // A pin's `gen` and `rev` are counters PRIVATE to one base source, so a store may only be
47
+ // shared between trackers that bottom out at the same one. Binding here turns the otherwise
48
+ // silent failure (a pin from cache A passing the freshness check against cache B, which
49
+ // numbers generations from 0 independently, and declaring A's content for B's block) into a
50
+ // throw at the moment the stores are joined.
51
+ pins.bindAuthority(this.baseSource());
52
+ }
53
+ /** The non-Tracker source at the bottom of the tracker stack. Single authority for everything
54
+ * pin-related: an Atomic layers over a Collection's tracker, which layers over the read cache,
55
+ * and only that cache can report a base, its committed revision, and its drift generation. */
56
+ baseSource() {
57
+ let src = this.source;
58
+ while (src instanceof Tracker)
59
+ src = src.source;
60
+ return src;
22
61
  }
23
62
  /** The source's generation for an id, or undefined if the source cannot report drift. */
24
63
  sourceGeneration(id) {
25
64
  const src = this.source;
26
65
  return typeof src.getGeneration === 'function' ? src.getGeneration(id) : undefined;
27
66
  }
67
+ /** The drift generation from the same authority {@link probeBase} pins from — the base source,
68
+ * so an Atomic validates its pins against the collection's read cache rather than against the
69
+ * drift-blind tracker in between. */
70
+ baseGeneration(id) {
71
+ const src = this.baseSource();
72
+ return typeof src.getGeneration === 'function' ? src.getGeneration(id) : undefined;
73
+ }
74
+ /** The committed base for `id` as the base source can report it, plus that source's revision and
75
+ * drift generation. Duck-typed (CacheSource supplies all three) and taken from
76
+ * {@link baseSource}, so an Atomic staged over a Collection's tracker pins from the collection's
77
+ * read cache instead of finding nothing. Returns undefined unless ALL THREE probes are
78
+ * available, which keeps drift-blind sources (test doubles) on exactly the pre-pin behaviour.
79
+ * Recency-neutral: uses CacheSource.peek. */
80
+ probeBase(id) {
81
+ const src = this.baseSource();
82
+ // Without a drift signal a pin could never be proven fresh, so never take one.
83
+ if (typeof src.getGeneration !== 'function')
84
+ return undefined;
85
+ const base = cachedBase(src, id);
86
+ return base && { ...base, gen: src.getGeneration(id) };
87
+ }
28
88
  async tryGet(id, purpose = 'value') {
29
89
  // NOTE: precedence here is insert > delete > source+updates. In a well-formed transform an id is
30
90
  // never in both `inserts` and `deletes` (insert/delete each clear the other), so order is moot. It
@@ -64,8 +124,9 @@ export class Tracker {
64
124
  }
65
125
  /** The block `id` materializes to under the staged transforms, computed WITHOUT loading from the
66
126
  * source, plus the committed revision of the base used. `undefined` when not computable here —
67
- * nothing staged for the id, the result is a delete, or an update's base is not locally cached
68
- * (a commit must not pay a network round trip to describe itself).
127
+ * nothing staged for the id, the result is a delete, or an update's base is neither pinned
128
+ * (see {@link pins}) nor locally cached (a commit must not pay a network round trip to
129
+ * describe itself).
69
130
  *
70
131
  * Materializes with the canonical {@link applyTransform} — the exact function the member side
71
132
  * uses at commit — so client and member can never disagree on semantics (insert replaces the
@@ -89,17 +150,26 @@ export class Tracker {
89
150
  const block = applyTransform(undefined, transform);
90
151
  return block ? { block } : undefined;
91
152
  }
92
- const src = this.source;
93
- if (typeof src.peek !== 'function' || typeof src.getCachedRevision !== 'function')
94
- return undefined;
95
- const base = src.peek(id);
96
- const baseRev = src.getCachedRevision(id);
97
- // Require BOTH: an LRU-evicted id can leave a stale cached revision behind (see the NOTE on
98
- // CacheSource's revisions map); peek returning undefined keeps it from pairing with a block.
99
- if (base === undefined || baseRev === undefined)
153
+ // Prefer the base pinned when the update was staged — it survives read-cache eviction, which
154
+ // is what keeps digest coverage a function of the transaction rather than of cache residency.
155
+ // The freshness check is correctness-critical, not an optimisation: a stale pin would declare
156
+ // a digest the member disagrees with, turning a blind-but-passing vote into a REJECT — an
157
+ // inaccurate declaration is strictly worse than no declaration, so a drifted pin falls through
158
+ // to the live peek below (which re-answers from the refreshed cache, or omits). The clone on
159
+ // use is also required, not defensive: applyTransform mutates, and syncAttempts re-runs the
160
+ // digest pass on every retry attempt against the same pin.
161
+ const pin = this.pins.get(id);
162
+ if (pin && pin.gen === this.baseGeneration(id)) {
163
+ const block = applyTransform(structuredClone(pin.block), transform);
164
+ return block ? { block, baseRev: pin.rev } : undefined;
165
+ }
166
+ // Unpinned fallback: the IMMEDIATE source, not {@link baseSource} — a drift-blind source that
167
+ // can still peek keeps exactly its pre-pin behaviour here.
168
+ const base = cachedBase(this.source, id);
169
+ if (!base)
100
170
  return undefined;
101
- const block = applyTransform(base, transform); // base already a clone (peek contract)
102
- return block ? { block, baseRev } : undefined;
171
+ const block = applyTransform(base.block, transform); // base already a clone (peek contract)
172
+ return block ? { block, baseRev: base.rev } : undefined;
103
173
  }
104
174
  /** Forward a leaf-value upgrade down to the source's read collector (duck-typed: only the
105
175
  * CacheSource layer implements it). Lets the B-tree point-lookup descent, which reads through
@@ -119,6 +189,8 @@ export class Tracker {
119
189
  inserts[block.header.id] = structuredClone(block);
120
190
  // Served from `inserts` now, not source+updates — the materialized memo no longer applies.
121
191
  this.materialized.delete(block.header.id);
192
+ // An insert makes the materialized result base-independent, so any pinned base is moot.
193
+ this.pins.delete(block.header.id);
122
194
  const deletes = this.transforms.deletes;
123
195
  const deleteIndex = deletes?.indexOf(block.header.id) ?? -1;
124
196
  if (deleteIndex >= 0) {
@@ -141,6 +213,21 @@ export class Tracker {
141
213
  if (memo) {
142
214
  applyOperation(memo.block, op);
143
215
  }
216
+ // Pin the committed base NOW — the caller just read this block, so it is resident — and
217
+ // only when there is no still-fresh pin, so a block updated 50 times pays one base clone.
218
+ // A generation change (an external commit folded into the cache) re-pins against the new
219
+ // base, which is the base the member will apply the whole op list to.
220
+ // NOTE: read-far-then-update stays unpinned — a block read, then evicted by 128+ other
221
+ // reads, and only then updated, probes an already-evicted cache here and is omitted from
222
+ // the digest (pre-existing behaviour; digest.spec.ts pins it). If a workload ever reads a
223
+ // large batch before writing any of it, the closure is to pin on READ for ids that later
224
+ // get updated, at retention proportional to reads rather than to writes.
225
+ const existing = this.pins.get(blockId);
226
+ if (!existing || existing.gen !== this.baseGeneration(blockId)) {
227
+ const pin = this.probeBase(blockId);
228
+ if (pin)
229
+ this.pins.set(blockId, pin);
230
+ }
144
231
  }
145
232
  }
146
233
  delete(blockId) {
@@ -149,6 +236,8 @@ export class Tracker {
149
236
  if (this.transforms.updates)
150
237
  delete this.transforms.updates[blockId];
151
238
  this.materialized.delete(blockId);
239
+ // A delete materializes to nothing (delete-last-wins), so the pinned base is moot.
240
+ this.pins.delete(blockId);
152
241
  const deletes = this.transforms.deletes ??= [];
153
242
  deletes.push(blockId);
154
243
  }
@@ -156,6 +245,9 @@ export class Tracker {
156
245
  const oldTransform = this.transforms;
157
246
  this.transforms = newTransform;
158
247
  this.materialized.clear();
248
+ // The single reclamation point for pins: a plain reset clears them (empty updates), a
249
+ // rollback-style reset(transforms) keeps exactly the pins for ids still staged as updates.
250
+ this.pins.retainOnly(Object.keys(newTransform.updates ?? {}));
159
251
  return oldTransform;
160
252
  }
161
253
  transformedBlockIds() {
@@ -1 +1 @@
1
- {"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../../src/transform/tracker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC5I,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,OAAO;IAWD;IAEV;IAZR;;;;;;yDAMqD;IAC7C,YAAY,GAAG,IAAI,GAAG,EAAsC,CAAC;IAErE,YACkB,MAAuB;IACxC,6EAA6E;IACtE,aAAa,eAAe,EAAE;QAFpB,WAAM,GAAN,MAAM,CAAiB;QAEjC,eAAU,GAAV,UAAU,CAAoB;IAClC,CAAC;IAEL,yFAAyF;IACjF,gBAAgB,CAAC,EAAW;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAqD,CAAC;QACvE,OAAO,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAW,EAAE,UAAuB,OAAO;QACvD,iGAAiG;QACjG,mGAAmG;QACnG,uGAAuG;QACvG,gGAAgG;QAChG,mGAAmG;QACnG,oGAAoG;QACpG,kGAAkG;QAClG,0EAA0E;QAC1E,IAAI,IAA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U,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC;QAC/B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,sFAAsF;QACtF,2FAA2F;QAC3F,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9D,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,mBAAmB;QAClB,OAAO,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED,SAAS,CAAC,QAAsB;QAC/B,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimystic/db-core",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "description": "Core database functionality for Optimystic",
6
6
  "main": "dist/src/index.js",