@optimystic/db-core 1.26.0 → 1.28.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/chain/chain.d.ts +4 -0
- package/dist/src/chain/chain.d.ts.map +1 -1
- package/dist/src/chain/chain.js +15 -3
- package/dist/src/chain/chain.js.map +1 -1
- package/dist/src/cluster/membership.d.ts +9 -2
- package/dist/src/cluster/membership.d.ts.map +1 -1
- package/dist/src/cluster/membership.js +51 -11
- package/dist/src/cluster/membership.js.map +1 -1
- package/dist/src/cluster/structs.d.ts +21 -0
- package/dist/src/cluster/structs.d.ts.map +1 -1
- package/dist/src/cohort-topic/willingness.d.ts +12 -11
- package/dist/src/cohort-topic/willingness.d.ts.map +1 -1
- package/dist/src/cohort-topic/willingness.js +21 -11
- package/dist/src/cohort-topic/willingness.js.map +1 -1
- package/dist/src/collection/collection.d.ts +46 -2
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +65 -15
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/collection/segments.d.ts +16 -3
- package/dist/src/collection/segments.d.ts.map +1 -1
- package/dist/src/collection/segments.js +24 -7
- package/dist/src/collection/segments.js.map +1 -1
- package/dist/src/collection/write-attempts.d.ts +5 -3
- package/dist/src/collection/write-attempts.d.ts.map +1 -1
- package/dist/src/collection/write-attempts.js +7 -5
- package/dist/src/collection/write-attempts.js.map +1 -1
- package/dist/src/collections/tree/tree.d.ts +5 -4
- package/dist/src/collections/tree/tree.d.ts.map +1 -1
- package/dist/src/collections/tree/tree.js +1 -1
- package/dist/src/collections/tree/tree.js.map +1 -1
- package/dist/src/network/block-size.d.ts +30 -5
- package/dist/src/network/block-size.d.ts.map +1 -1
- package/dist/src/network/block-size.js +34 -6
- package/dist/src/network/block-size.js.map +1 -1
- package/dist/src/network/i-key-network.d.ts +28 -0
- package/dist/src/network/i-key-network.d.ts.map +1 -1
- package/dist/src/network/i-peer-network.d.ts +5 -0
- package/dist/src/network/i-peer-network.d.ts.map +1 -1
- package/dist/src/network/i-repo.d.ts +4 -0
- package/dist/src/network/i-repo.d.ts.map +1 -1
- package/dist/src/network/promise-shortfall-error.d.ts +5 -1
- package/dist/src/network/promise-shortfall-error.d.ts.map +1 -1
- package/dist/src/network/promise-shortfall-error.js +5 -1
- package/dist/src/network/promise-shortfall-error.js.map +1 -1
- package/dist/src/network/struct.d.ts +5 -1
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/network/struct.js.map +1 -1
- package/dist/src/network/transaction-size.d.ts +37 -8
- package/dist/src/network/transaction-size.d.ts.map +1 -1
- package/dist/src/network/transaction-size.js +36 -7
- package/dist/src/network/transaction-size.js.map +1 -1
- package/dist/src/transaction/coordinator.d.ts +5 -3
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +9 -7
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transform/helpers.d.ts +12 -2
- package/dist/src/transform/helpers.d.ts.map +1 -1
- package/dist/src/transform/helpers.js +18 -2
- package/dist/src/transform/helpers.js.map +1 -1
- package/package.json +1 -1
- package/src/chain/chain.ts +15 -3
- package/src/cluster/membership.ts +129 -87
- package/src/cluster/structs.ts +21 -0
- package/src/cohort-topic/willingness.ts +39 -22
- package/src/collection/collection.ts +78 -14
- package/src/collection/segments.ts +30 -7
- package/src/collection/write-attempts.ts +7 -5
- package/src/collections/tree/tree.ts +5 -4
- package/src/network/block-size.ts +40 -6
- package/src/network/i-key-network.ts +30 -0
- package/src/network/i-peer-network.ts +6 -0
- package/src/network/i-repo.ts +4 -0
- package/src/network/promise-shortfall-error.ts +5 -1
- package/src/network/struct.ts +5 -1
- package/src/network/transaction-size.ts +35 -7
- package/src/transaction/coordinator.ts +9 -6
- package/src/transform/helpers.ts +19 -2
package/src/transform/helpers.ts
CHANGED
|
@@ -162,8 +162,9 @@ export function concatTransforms(...transforms: Transforms[]): Transforms {
|
|
|
162
162
|
* when `updates` ride along) to affect the original Transforms.
|
|
163
163
|
* @see docs/internals.md "Shallow Copy of Transforms" pitfall
|
|
164
164
|
*
|
|
165
|
-
* NOTE: clones unconditionally, even for read-only callers (
|
|
166
|
-
*
|
|
165
|
+
* NOTE: clones unconditionally, even for read-only callers (the reservation reads in
|
|
166
|
+
* `ClusterMember.reservationRequestOf` and `CoordinatorRepo.corroborateHeldBlocks`, both in cohorts of
|
|
167
|
+
* four and up); if they ever show up in a pend profile, give them {@link sharedTransformForBlockId}.
|
|
167
168
|
*/
|
|
168
169
|
export function transformForBlockId(transform: Transforms, blockId: BlockId): Transform {
|
|
169
170
|
return {
|
|
@@ -175,6 +176,22 @@ export function transformForBlockId(transform: Transforms, blockId: BlockId): Tr
|
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
178
|
|
|
179
|
+
/**
|
|
180
|
+
* The transform for one block, SHARING `transform`'s inserted block and update list rather than
|
|
181
|
+
* copying them: for a caller that only reads the result, or serializes it at once, and keeps nothing
|
|
182
|
+
* of it. `StorageRepo.pend` reads it to classify a block and hands it to storage, which encodes it to
|
|
183
|
+
* JSON before returning. Anything that applies, changes or holds on to the result takes
|
|
184
|
+
* {@link transformForBlockId}, whose copy is what makes that safe.
|
|
185
|
+
* @see docs/internals.md "Functions That Share"
|
|
186
|
+
*/
|
|
187
|
+
export function sharedTransformForBlockId(transform: Transforms, blockId: BlockId): Transform {
|
|
188
|
+
return {
|
|
189
|
+
...(transform.inserts && blockId in transform.inserts ? { insert: transform.inserts[blockId]! } : {}),
|
|
190
|
+
...(transform.updates && blockId in transform.updates ? { updates: transform.updates[blockId]! } : {}),
|
|
191
|
+
...(transform.deletes?.includes(blockId) ? { delete: true } : {})
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
178
195
|
export function transformsFromTransform(transform: Transform, blockId: BlockId): Transforms {
|
|
179
196
|
return {
|
|
180
197
|
inserts: transform.insert ? { [blockId]: transform.insert } : {},
|