@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.
- package/dist/src/cohort-topic/membership/verifier.d.ts +8 -0
- package/dist/src/cohort-topic/membership/verifier.d.ts.map +1 -1
- package/dist/src/cohort-topic/membership/verifier.js +17 -0
- package/dist/src/cohort-topic/membership/verifier.js.map +1 -1
- package/dist/src/cohort-topic/promotion.d.ts +25 -0
- package/dist/src/cohort-topic/promotion.d.ts.map +1 -1
- package/dist/src/cohort-topic/promotion.js +58 -11
- package/dist/src/cohort-topic/promotion.js.map +1 -1
- package/dist/src/cohort-topic/wire/primitives.d.ts +6 -0
- package/dist/src/cohort-topic/wire/primitives.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/primitives.js +6 -0
- package/dist/src/cohort-topic/wire/primitives.js.map +1 -1
- package/dist/src/cohort-topic/wire/types.d.ts +5 -0
- package/dist/src/cohort-topic/wire/types.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/validate.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/validate.js +10 -19
- package/dist/src/cohort-topic/wire/validate.js.map +1 -1
- package/dist/src/collection/collection.d.ts +8 -1
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +19 -3
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/matchmaking/wire.d.ts +2 -2
- package/dist/src/matchmaking/wire.d.ts.map +1 -1
- package/dist/src/matchmaking/wire.js +3 -3
- package/dist/src/matchmaking/wire.js.map +1 -1
- package/dist/src/network/struct.d.ts +5 -5
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/testing/index.d.ts +1 -0
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -0
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/testing/refresh-probe.d.ts +31 -0
- package/dist/src/testing/refresh-probe.d.ts.map +1 -0
- package/dist/src/testing/refresh-probe.js +39 -0
- package/dist/src/testing/refresh-probe.js.map +1 -0
- package/dist/src/testing/test-transactor.d.ts +58 -5
- package/dist/src/testing/test-transactor.d.ts.map +1 -1
- package/dist/src/testing/test-transactor.js +87 -4
- package/dist/src/testing/test-transactor.js.map +1 -1
- package/dist/src/transaction/coordinator.d.ts +90 -6
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +311 -90
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transaction/errors.d.ts +42 -0
- package/dist/src/transaction/errors.d.ts.map +1 -1
- package/dist/src/transaction/errors.js +50 -0
- package/dist/src/transaction/errors.js.map +1 -1
- package/dist/src/transaction/index.d.ts +1 -1
- package/dist/src/transaction/index.d.ts.map +1 -1
- package/dist/src/transaction/index.js +1 -1
- package/dist/src/transaction/index.js.map +1 -1
- package/dist/src/transaction/session.d.ts +7 -3
- package/dist/src/transaction/session.d.ts.map +1 -1
- package/dist/src/transaction/session.js +7 -3
- package/dist/src/transaction/session.js.map +1 -1
- package/dist/src/transaction/transaction.d.ts +12 -2
- package/dist/src/transaction/transaction.d.ts.map +1 -1
- package/dist/src/transaction/transaction.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts +1 -1
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +6 -26
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/dist/src/transactor/transactor-source.d.ts +4 -6
- package/dist/src/transactor/transactor-source.d.ts.map +1 -1
- package/dist/src/transactor/transactor-source.js +4 -6
- package/dist/src/transactor/transactor-source.js.map +1 -1
- package/dist/src/transform/atomic.d.ts.map +1 -1
- package/dist/src/transform/atomic.js +7 -0
- package/dist/src/transform/atomic.js.map +1 -1
- package/dist/src/transform/base-pins.d.ts +48 -0
- package/dist/src/transform/base-pins.d.ts.map +1 -0
- package/dist/src/transform/base-pins.js +65 -0
- package/dist/src/transform/base-pins.js.map +1 -0
- package/dist/src/transform/digest.d.ts +4 -2
- package/dist/src/transform/digest.d.ts.map +1 -1
- package/dist/src/transform/digest.js +14 -19
- package/dist/src/transform/digest.js.map +1 -1
- package/dist/src/transform/tracker.d.ts +31 -3
- package/dist/src/transform/tracker.d.ts.map +1 -1
- package/dist/src/transform/tracker.js +105 -13
- package/dist/src/transform/tracker.js.map +1 -1
- package/package.json +1 -1
- package/src/cohort-topic/membership/verifier.ts +487 -461
- package/src/cohort-topic/promotion.ts +86 -14
- package/src/cohort-topic/wire/primitives.ts +195 -188
- package/src/cohort-topic/wire/types.ts +480 -475
- package/src/cohort-topic/wire/validate.ts +504 -512
- package/src/collection/collection.ts +19 -3
- package/src/matchmaking/wire.ts +605 -603
- package/src/network/struct.ts +5 -5
- package/src/testing/index.ts +1 -0
- package/src/testing/refresh-probe.ts +52 -0
- package/src/testing/test-transactor.ts +100 -4
- package/src/transaction/coordinator.ts +312 -99
- package/src/transaction/errors.ts +141 -91
- package/src/transaction/index.ts +1 -1
- package/src/transaction/session.ts +7 -3
- package/src/transaction/transaction.ts +12 -2
- package/src/transactor/network-transactor.ts +1025 -1045
- package/src/transactor/transactor-source.ts +170 -172
- package/src/transform/atomic.ts +6 -0
- package/src/transform/base-pins.ts +83 -0
- package/src/transform/digest.ts +14 -19
- package/src/transform/tracker.ts +108 -15
|
@@ -835,7 +835,14 @@ export class Collection<TAction> implements ICollection<TAction> {
|
|
|
835
835
|
* (log append → pend → commit → local fold), keeping any refresh of this instance from
|
|
836
836
|
* interleaving with a mid-flight commit. `Latches` is non-reentrant: while holding this,
|
|
837
837
|
* the holder must not call any of those latched methods on this instance. The caller
|
|
838
|
-
* MUST call the release exactly once, in a `finally`.
|
|
838
|
+
* MUST call the release exactly once, in a `finally`.
|
|
839
|
+
*
|
|
840
|
+
* NOTE: the commit paths are the ONLY callers — {@link act}, {@link update} and {@link sync}
|
|
841
|
+
* take the same mutex through `Latches.acquire` directly, never through here. The acquisition
|
|
842
|
+
* -order cases in `test/coordinator-latch-span.spec.ts` rely on that: they shadow this method
|
|
843
|
+
* to record the span's order, so routing a refresh path through it would silently fold
|
|
844
|
+
* refreshes into those recordings and weaken the assertions rather than fail them. Route a new
|
|
845
|
+
* refresh caller here only alongside a filter in that spy. */
|
|
839
846
|
acquireLatch(): Promise<() => void> {
|
|
840
847
|
return Latches.acquire(this.latchId);
|
|
841
848
|
}
|
|
@@ -936,9 +943,18 @@ export class Collection<TAction> implements ICollection<TAction> {
|
|
|
936
943
|
// Snapshot the pending actions so that any new actions aren't assumed to be part of this action
|
|
937
944
|
const pending = [...this.pending];
|
|
938
945
|
|
|
939
|
-
// Create a snapshot tracker for the action, so that we can ditch the log changes if we have to retry the action
|
|
946
|
+
// Create a snapshot tracker for the action, so that we can ditch the log changes if we have to retry the action.
|
|
947
|
+
// It SHARES the live tracker's pin store: the snapshot inherits transforms by copy and never
|
|
948
|
+
// stages the data-block updates itself, so without the shared pins the digest pass below
|
|
949
|
+
// could only describe bases still resident in the read cache.
|
|
950
|
+
// NOTE: an attempt that ends in a stale failure is abandoned WITHOUT reset(), so the log
|
|
951
|
+
// tail/header bases its append pinned stay in the shared store until the live tracker's
|
|
952
|
+
// next reset. Bounded and harmless — a few log blocks per attempt, capped by maxAttempts,
|
|
953
|
+
// each re-validated against the source generation before any use — but if this loop ever
|
|
954
|
+
// grows a per-attempt footprint beyond the log blocks, reset the abandoned tracker on the
|
|
955
|
+
// stale-failure branch instead of letting the residue ride to the end of the sync.
|
|
940
956
|
const snapshot = copyTransforms(this.tracker.transforms);
|
|
941
|
-
const tracker = new Tracker(this.sourceCache, snapshot);
|
|
957
|
+
const tracker = new Tracker(this.sourceCache, snapshot, this.tracker.pins);
|
|
942
958
|
|
|
943
959
|
// Add the action to the log (in local tracking space)
|
|
944
960
|
const collectionLog = await Log.open<Action<TAction>>(tracker, this.id);
|