@optimystic/db-core 1.21.0 → 1.22.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/btree/btree.d.ts +36 -4
- package/dist/src/btree/btree.d.ts.map +1 -1
- package/dist/src/btree/btree.js +86 -18
- package/dist/src/btree/btree.js.map +1 -1
- package/dist/src/collection/collection.d.ts +43 -5
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +60 -13
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/collection/struct.d.ts +6 -0
- package/dist/src/collection/struct.d.ts.map +1 -1
- package/dist/src/collection/struct.js.map +1 -1
- package/dist/src/collections/tree/tree.d.ts +3 -1
- package/dist/src/collections/tree/tree.d.ts.map +1 -1
- package/dist/src/collections/tree/tree.js +11 -5
- package/dist/src/collections/tree/tree.js.map +1 -1
- package/dist/src/network/struct.d.ts +15 -0
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/network/struct.js.map +1 -1
- package/dist/src/testing/test-transactor.js +6 -2
- package/dist/src/testing/test-transactor.js.map +1 -1
- package/dist/src/transaction/coordinator.d.ts +6 -0
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +6 -0
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +1 -0
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/package.json +1 -1
- package/src/btree/btree.ts +92 -18
- package/src/collection/collection.ts +3098 -3039
- package/src/collection/struct.ts +463 -456
- package/src/collections/tree/tree.ts +15 -7
- package/src/network/struct.ts +770 -755
- package/src/testing/test-transactor.ts +5 -2
- package/src/transaction/coordinator.ts +6 -0
- package/src/transactor/network-transactor.ts +1897 -1896
|
@@ -1016,12 +1016,15 @@ function committedAt(blockState: BlockState, pin: number | undefined): { block:
|
|
|
1016
1016
|
return block ? { block, rev: blockState.latestRev } : undefined;
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
-
/** Returns the
|
|
1020
|
-
* that revision — the caller reports it as {@link GetBlockResult.materialized}
|
|
1019
|
+
/** Returns the block as it stood at the highest revision ≤ the given revision that committed it,
|
|
1020
|
+
* together with that revision — the caller reports it as {@link GetBlockResult.materialized} — or
|
|
1021
|
+
* `undefined` when that revision deleted it, as storage answers a tombstone: a committed revision
|
|
1022
|
+
* with no materialized block is a delete, never a reason to serve the content before it. */
|
|
1021
1023
|
function latestMaterializedAt(blockState: BlockState, maxRev: number): { block: IBlock, rev: number } | undefined {
|
|
1022
1024
|
for (let rev = maxRev; rev >= 0; rev--) {
|
|
1023
1025
|
const block = blockState.materializedBlocks.get(rev);
|
|
1024
1026
|
if (block) return { block, rev };
|
|
1027
|
+
if (blockState.revisionActions.has(rev)) return undefined;
|
|
1025
1028
|
}
|
|
1026
1029
|
return undefined;
|
|
1027
1030
|
}
|
|
@@ -1458,6 +1458,12 @@ export class TransactionCoordinator {
|
|
|
1458
1458
|
*
|
|
1459
1459
|
* This clears pending transforms from all collections. Useful for
|
|
1460
1460
|
* cleaning up after validation or when starting a new transaction.
|
|
1461
|
+
*
|
|
1462
|
+
* NOTE: resets each tracker directly, so the collection's `onViewChanged` is not called and a
|
|
1463
|
+
* reader part-way through a descent of one of these collections is not told to read again. Its
|
|
1464
|
+
* one caller is the Quereus validator, which no composition root wires today; if validation ever
|
|
1465
|
+
* runs beside live reads of the same collections, reset through a `Collection` method that
|
|
1466
|
+
* calls `viewChanged` instead.
|
|
1461
1467
|
*/
|
|
1462
1468
|
resetTransforms(): void {
|
|
1463
1469
|
for (const collection of this.collections.values()) {
|