@optimystic/db-core 1.0.0-beta.3 → 1.0.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/cluster/structs.d.ts +30 -6
- package/dist/src/cluster/structs.d.ts.map +1 -1
- package/dist/src/cluster/structs.js +5 -3
- package/dist/src/cluster/structs.js.map +1 -1
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts +2 -1
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts.map +1 -1
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js +10 -3
- package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js.map +1 -1
- package/dist/src/cohort-topic/wire/codec.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/codec.js +8 -2
- package/dist/src/cohort-topic/wire/codec.js.map +1 -1
- package/dist/src/collection/collection.d.ts +439 -34
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +843 -148
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/collection/struct.d.ts +109 -4
- package/dist/src/collection/struct.d.ts.map +1 -1
- package/dist/src/collection/struct.js +88 -1
- package/dist/src/collection/struct.js.map +1 -1
- package/dist/src/collections/diary/diary.d.ts +6 -2
- package/dist/src/collections/diary/diary.d.ts.map +1 -1
- package/dist/src/collections/diary/diary.js +5 -2
- package/dist/src/collections/diary/diary.js.map +1 -1
- package/dist/src/collections/tree/struct.d.ts +124 -16
- package/dist/src/collections/tree/struct.d.ts.map +1 -1
- package/dist/src/collections/tree/struct.js +86 -11
- package/dist/src/collections/tree/struct.js.map +1 -1
- package/dist/src/collections/tree/tree.d.ts +13 -3
- package/dist/src/collections/tree/tree.d.ts.map +1 -1
- package/dist/src/collections/tree/tree.js +106 -40
- package/dist/src/collections/tree/tree.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/matchmaking/wire.d.ts.map +1 -1
- package/dist/src/matchmaking/wire.js +8 -2
- package/dist/src/matchmaking/wire.js.map +1 -1
- package/dist/src/network/durability.d.ts +45 -0
- package/dist/src/network/durability.d.ts.map +1 -0
- package/dist/src/network/durability.js +114 -0
- package/dist/src/network/durability.js.map +1 -0
- package/dist/src/network/i-key-network.d.ts +14 -6
- package/dist/src/network/i-key-network.d.ts.map +1 -1
- package/dist/src/network/index.d.ts +3 -0
- package/dist/src/network/index.d.ts.map +1 -1
- package/dist/src/network/index.js +3 -0
- package/dist/src/network/index.js.map +1 -1
- package/dist/src/network/lineage.d.ts +39 -0
- package/dist/src/network/lineage.d.ts.map +1 -0
- package/dist/src/network/lineage.js +61 -0
- package/dist/src/network/lineage.js.map +1 -0
- package/dist/src/network/routing-key.d.ts +24 -0
- package/dist/src/network/routing-key.d.ts.map +1 -0
- package/dist/src/network/routing-key.js +9 -0
- package/dist/src/network/routing-key.js.map +1 -0
- package/dist/src/network/stale-failure.d.ts +5 -1
- package/dist/src/network/stale-failure.d.ts.map +1 -1
- package/dist/src/network/stale-failure.js +5 -1
- package/dist/src/network/stale-failure.js.map +1 -1
- package/dist/src/network/struct.d.ts +151 -8
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/network/struct.js.map +1 -1
- package/dist/src/reactivity/wire.d.ts.map +1 -1
- package/dist/src/reactivity/wire.js +8 -2
- package/dist/src/reactivity/wire.js.map +1 -1
- package/dist/src/testing/test-transactor.d.ts +64 -7
- package/dist/src/testing/test-transactor.d.ts.map +1 -1
- package/dist/src/testing/test-transactor.js +150 -23
- package/dist/src/testing/test-transactor.js.map +1 -1
- package/dist/src/transaction/coordinator.d.ts +141 -21
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +408 -122
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transaction/errors.d.ts +39 -10
- package/dist/src/transaction/errors.d.ts.map +1 -1
- package/dist/src/transaction/errors.js +34 -9
- package/dist/src/transaction/errors.js.map +1 -1
- package/dist/src/transaction/index.d.ts +1 -0
- package/dist/src/transaction/index.d.ts.map +1 -1
- package/dist/src/transaction/index.js.map +1 -1
- package/dist/src/transactor/block-floors.d.ts +78 -0
- package/dist/src/transactor/block-floors.d.ts.map +1 -0
- package/dist/src/transactor/block-floors.js +62 -0
- package/dist/src/transactor/block-floors.js.map +1 -0
- package/dist/src/transactor/change-notifier.d.ts +43 -0
- package/dist/src/transactor/change-notifier.d.ts.map +1 -1
- package/dist/src/transactor/change-notifier.js +3 -0
- package/dist/src/transactor/change-notifier.js.map +1 -1
- package/dist/src/transactor/index.d.ts +1 -0
- package/dist/src/transactor/index.d.ts.map +1 -1
- package/dist/src/transactor/index.js +1 -0
- package/dist/src/transactor/index.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts +43 -6
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +279 -86
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/dist/src/transactor/transactor-source.d.ts +94 -4
- package/dist/src/transactor/transactor-source.d.ts.map +1 -1
- package/dist/src/transactor/transactor-source.js +120 -42
- package/dist/src/transactor/transactor-source.js.map +1 -1
- package/dist/src/transactor/transactor.d.ts +14 -1
- package/dist/src/transactor/transactor.d.ts.map +1 -1
- package/dist/src/transform/atomic.d.ts.map +1 -1
- package/dist/src/transform/atomic.js +12 -9
- package/dist/src/transform/atomic.js.map +1 -1
- package/dist/src/transform/base-pins.d.ts +50 -17
- package/dist/src/transform/base-pins.d.ts.map +1 -1
- package/dist/src/transform/base-pins.js +58 -11
- package/dist/src/transform/base-pins.js.map +1 -1
- package/dist/src/transform/cache-source.d.ts +75 -11
- package/dist/src/transform/cache-source.d.ts.map +1 -1
- package/dist/src/transform/cache-source.js +162 -36
- package/dist/src/transform/cache-source.js.map +1 -1
- package/dist/src/transform/digest.d.ts +8 -1
- package/dist/src/transform/digest.d.ts.map +1 -1
- package/dist/src/transform/digest.js +19 -9
- package/dist/src/transform/digest.js.map +1 -1
- package/dist/src/transform/helpers.d.ts +6 -2
- package/dist/src/transform/helpers.d.ts.map +1 -1
- package/dist/src/transform/helpers.js +8 -3
- package/dist/src/transform/helpers.js.map +1 -1
- package/dist/src/transform/tracker.d.ts +94 -14
- package/dist/src/transform/tracker.d.ts.map +1 -1
- package/dist/src/transform/tracker.js +222 -68
- package/dist/src/transform/tracker.js.map +1 -1
- package/dist/src/utility/structural-equals.d.ts +38 -0
- package/dist/src/utility/structural-equals.d.ts.map +1 -0
- package/dist/src/utility/structural-equals.js +77 -0
- package/dist/src/utility/structural-equals.js.map +1 -0
- package/package.json +2 -2
- package/src/cluster/structs.ts +28 -7
- package/src/cohort-topic/antidos/bootstrap-evidence-envelope.ts +260 -253
- package/src/cohort-topic/wire/codec.ts +222 -216
- package/src/collection/collection.ts +960 -157
- package/src/collection/struct.ts +99 -4
- package/src/collections/diary/diary.ts +71 -68
- package/src/collections/tree/struct.ts +155 -23
- package/src/collections/tree/tree.ts +127 -40
- package/src/index.ts +1 -1
- package/src/matchmaking/wire.ts +8 -2
- package/src/network/durability.ts +123 -0
- package/src/network/i-key-network.ts +60 -52
- package/src/network/index.ts +10 -7
- package/src/network/lineage.ts +80 -0
- package/src/network/routing-key.ts +27 -0
- package/src/network/stale-failure.ts +5 -1
- package/src/network/struct.ts +156 -8
- package/src/reactivity/wire.ts +230 -224
- package/src/testing/test-transactor.ts +152 -24
- package/src/transaction/coordinator.ts +470 -131
- package/src/transaction/errors.ts +34 -9
- package/src/transaction/index.ts +1 -0
- package/src/transactor/block-floors.ts +105 -0
- package/src/transactor/change-notifier.ts +129 -80
- package/src/transactor/index.ts +1 -0
- package/src/transactor/network-transactor.ts +297 -89
- package/src/transactor/transactor-source.ts +131 -42
- package/src/transactor/transactor.ts +13 -1
- package/src/transform/atomic.ts +25 -22
- package/src/transform/base-pins.ts +76 -18
- package/src/transform/cache-source.ts +327 -194
- package/src/transform/digest.ts +21 -10
- package/src/transform/helpers.ts +8 -3
- package/src/transform/tracker.ts +423 -270
- package/src/utility/structural-equals.ts +72 -0
- package/dist/src/utility/block-id-to-bytes.d.ts +0 -3
- package/dist/src/utility/block-id-to-bytes.d.ts.map +0 -1
- package/dist/src/utility/block-id-to-bytes.js +0 -7
- package/dist/src/utility/block-id-to-bytes.js.map +0 -1
- package/src/utility/block-id-to-bytes.ts +0 -8
|
@@ -2,6 +2,25 @@ import type { ITransactor, CollectionId, Transforms } from "../index.js";
|
|
|
2
2
|
import type { Transaction, ExecutionResult, ITransactionEngine, CollectionActions, ReadDependency } from "./transaction.js";
|
|
3
3
|
import type { Collection } from "../collection/collection.js";
|
|
4
4
|
import type { SyncOptions } from "../collection/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* What a pend this coordinator sends carries for the receiving cluster members to re-check.
|
|
7
|
+
*
|
|
8
|
+
* - `'transaction'` (default): the transaction and the hash of every operation it produced — the
|
|
9
|
+
* session-mode shape. A member with a transaction validator re-executes the statements and
|
|
10
|
+
* compares hashes; the aged retry priority rides inside the transaction.
|
|
11
|
+
* - `'none'`: bare transforms, exactly the shape a single-collection `Collection.sync` pend has.
|
|
12
|
+
* For a commit that has no statements to re-execute — the Quereus adapter's legacy multi-tree
|
|
13
|
+
* commit, whose rows were staged directly into the trees — a validating member would otherwise
|
|
14
|
+
* refuse the pend as a validator fault. The aged priority then rides on the pend itself
|
|
15
|
+
* (`PendRequest.priority`), which is the other carrier a member's race resolution reads, so a
|
|
16
|
+
* repeatedly-losing commit still ages. Members configured `unvalidatablePendPolicy: 'reject'`
|
|
17
|
+
* refuse these pends, as they refuse every unvalidatable pend.
|
|
18
|
+
*/
|
|
19
|
+
export type PendValidationMode = 'transaction' | 'none';
|
|
20
|
+
export interface CoordinatorOptions {
|
|
21
|
+
/** See {@link PendValidationMode}. Default `'transaction'`. */
|
|
22
|
+
pendValidation?: PendValidationMode;
|
|
23
|
+
}
|
|
5
24
|
/**
|
|
6
25
|
* Coordinates multi-collection transactions.
|
|
7
26
|
*
|
|
@@ -50,7 +69,19 @@ export declare class TransactionCoordinator {
|
|
|
50
69
|
* appears in `this.collections` (see {@link captureUncaptured}), so a collection registered
|
|
51
70
|
* mid-transaction is still captured before anything stages into it. */
|
|
52
71
|
private stampData;
|
|
53
|
-
|
|
72
|
+
/** See {@link PendValidationMode}; fixed for the coordinator's lifetime, so every pend it
|
|
73
|
+
* sends has one shape. */
|
|
74
|
+
private readonly pendValidation;
|
|
75
|
+
constructor(transactor: ITransactor, collections: Map<CollectionId, Collection<any>>, options?: CoordinatorOptions);
|
|
76
|
+
/**
|
|
77
|
+
* The validation pair every pend of this attempt carries, or `undefined` when this coordinator
|
|
78
|
+
* sends unvalidated pends (see {@link PendValidationMode}). Built once per attempt, AFTER the
|
|
79
|
+
* log append: the hash covers ALL operations across ALL collections, which a validator
|
|
80
|
+
* recomputes from its own re-execution and compares. The shared operations-hash module
|
|
81
|
+
* canonicalises (sort + canonical JSON), so the fingerprint is order-independent. Skipped
|
|
82
|
+
* entirely — not computed and discarded — when no pend will carry it.
|
|
83
|
+
*/
|
|
84
|
+
private pendValidationFor;
|
|
54
85
|
/**
|
|
55
86
|
* Apply actions to collections (called by engines during statement execution).
|
|
56
87
|
*
|
|
@@ -110,30 +141,110 @@ export declare class TransactionCoordinator {
|
|
|
110
141
|
/**
|
|
111
142
|
* Commit a transaction with a bounded, jittered backoff retry around a CLEAN stale loss.
|
|
112
143
|
*
|
|
113
|
-
* The single-attempt work lives in {@link commitOnce};
|
|
114
|
-
* fails as a clean optimistic-concurrency loss ({@link CoordinatorStaleLossError} —
|
|
115
|
-
* durably committed, every tracker restored to its pre-append state). Before each
|
|
116
|
-
* re-reads each collection to fresh revisions (so the retry pends against current
|
|
117
|
-
* than immediately re-failing stale), then backs off with the same jitter policy as
|
|
144
|
+
* The single-attempt work lives in {@link commitOnce}; {@link commitAttempts} re-drives it when
|
|
145
|
+
* the attempt fails as a clean optimistic-concurrency loss ({@link CoordinatorStaleLossError} —
|
|
146
|
+
* nothing durably committed, every tracker restored to its pre-append state). Before each
|
|
147
|
+
* re-attempt it re-reads each collection to fresh revisions (so the retry pends against current
|
|
148
|
+
* state rather than immediately re-failing stale), then backs off with the same jitter policy as
|
|
118
149
|
* {@link Collection.sync}. Retry is bounded by `maxAttempts` and an optional wall-clock
|
|
119
150
|
* `deadlineMs`, and honours an abort `signal`.
|
|
120
151
|
*
|
|
121
|
-
* A
|
|
122
|
-
* is
|
|
123
|
-
*
|
|
124
|
-
*
|
|
152
|
+
* A PARTIAL landing — some collection durably committed while a sibling's commit was refused —
|
|
153
|
+
* is re-driven too when every refusal was a returned one (a member behind on the block's base,
|
|
154
|
+
* a rival that took the revision slot): the committed collections are recorded as saved and the
|
|
155
|
+
* next attempt commits only what is still staged, so the durable half is never re-logged and the
|
|
156
|
+
* refused collection gets the same refresh-and-finish recovery a clean loss gets. A caller must
|
|
157
|
+
* still never re-drive a partial landing itself. A partial landing on a HARD failure (the
|
|
158
|
+
* transport budget spent, a structural rejection) escapes at once as
|
|
159
|
+
* {@link CoordinatorPartialCommitError}, and any other failure (expired transaction,
|
|
160
|
+
* unavailable transactor, unreachable cluster) also propagates without retry.
|
|
161
|
+
*
|
|
162
|
+
* A participant can also be SAVED between attempts: an attempt that reported a loss may still
|
|
163
|
+
* have stored that participant's log tail, and the refresh before the next attempt then finishes
|
|
164
|
+
* and consumes the participant's own entry (see {@link refreshBetweenAttempts}). From that moment
|
|
165
|
+
* the commit can no longer fail cleanly, so EVERY failure that escapes afterwards — a torn sibling,
|
|
166
|
+
* a sibling that keeps losing until the budget runs out, an abort, an expiry, a hard error — is
|
|
167
|
+
* rethrown as {@link CoordinatorPartialCommitError}, counting the refresh-saved participants as
|
|
168
|
+
* committed and carrying the original error as its `reason` (see {@link reportSaved}). A commit in
|
|
169
|
+
* which nothing was saved fails with exactly the error it failed with.
|
|
125
170
|
*
|
|
126
171
|
* Defaults are safe out of the box: a caller that passes no options gets bounded, jittered retry.
|
|
127
172
|
*
|
|
173
|
+
* NOTE: this returns nothing, so a multi-collection commit reports NO durability — unlike
|
|
174
|
+
* `Collection.sync`, which now answers with the {@link WriteDurability} of what it committed. The
|
|
175
|
+
* gap is deliberate and tracked in `tickets/backlog/feat-multi-collection-commit-reports-durability.md`:
|
|
176
|
+
* folding a class across collections that may individually have committed or been dropped (see
|
|
177
|
+
* {@link CoordinatorPartialCommitError}) is its own design problem, not a pass-through. Until that
|
|
178
|
+
* lands, a caller that needs to know whether a write is fully held has to use the single-collection
|
|
179
|
+
* path; do not infer one here from a plain successful return.
|
|
180
|
+
*
|
|
128
181
|
* @param transaction - The transaction to commit
|
|
129
182
|
* @param options - Retry knobs; shares the {@link SyncOptions} vocabulary with `Collection.sync`.
|
|
130
183
|
*/
|
|
131
184
|
commit(transaction: Transaction, options?: SyncOptions): Promise<void>;
|
|
185
|
+
/** The retry loop behind {@link commit}: every attempt, and the refresh between them. Records
|
|
186
|
+
* what it learns in `cycle`; {@link commit} owns turning a failure into the right report. */
|
|
187
|
+
private commitAttempts;
|
|
188
|
+
/**
|
|
189
|
+
* Refresh every registered collection between attempts, recording in `cycle.saved` each one
|
|
190
|
+
* whose refresh finished this transaction's own log entry (see {@link Collection.refreshInFlight}).
|
|
191
|
+
*
|
|
192
|
+
* Visits EVERY collection even after one throws. Stopping at the first throw would leave a
|
|
193
|
+
* participant later in the map unfinished whenever an earlier one is torn — its log tail stored
|
|
194
|
+
* and its other blocks never landed, the silent loss `Collection.completeOwnEntry` exists to
|
|
195
|
+
* prevent — and unreported. Each refresh is independent (its own latch, its own instance state),
|
|
196
|
+
* so one failing says nothing about the next.
|
|
197
|
+
*
|
|
198
|
+
* NOTE: refreshes EVERY registered collection, not only the participants of this transaction.
|
|
199
|
+
* Not free: a non-participant's refresh throws CollectionHeaderVanishedError if its header
|
|
200
|
+
* momentarily reads absent while it holds a committed revision, aborting this retry. And because
|
|
201
|
+
* a throw no longer stops the round, an unreachable cluster costs one failed read per registered
|
|
202
|
+
* collection rather than one. The registered set is small today; if that (or retry latency) ever
|
|
203
|
+
* bites, narrow this to the transaction's participants.
|
|
204
|
+
*
|
|
205
|
+
* @param lastChance - this is the round that spends the last of the retry budget, so a
|
|
206
|
+
* participant whose half-landed write is refused again settles it (`Collection.completeOwnEntry`)
|
|
207
|
+
* rather than asking for a round it will not get; the error returned then carries `final`.
|
|
208
|
+
* @returns the first `completion-refused` {@link TornActionError} when that is the only way any
|
|
209
|
+
* refresh failed — the round is worth retrying; `undefined` when every refresh succeeded.
|
|
210
|
+
* @throws the first other error, once every collection has been visited.
|
|
211
|
+
*/
|
|
212
|
+
private refreshBetweenAttempts;
|
|
213
|
+
/** Every registered collection with something to push — the participants an attempt starting
|
|
214
|
+
* now would commit. The predicate is {@link Collection.hasUnsyncedChanges}, the one
|
|
215
|
+
* `Collection.sync` loops on: staged actions OR uncommitted tracker transforms. Not the
|
|
216
|
+
* transforms alone: an action can be staged and have changed no block — a delete of an index
|
|
217
|
+
* entry this instance's stale view never held (the shape `blind-index-delete-is-logged-but-
|
|
218
|
+
* never-applied` fixed for the single-collection path) — and such a collection MUST still take
|
|
219
|
+
* part. Its stale pend is refused, and the refresh between attempts replays the action against
|
|
220
|
+
* the adopted revision, where it finds the entry and produces the delete the retry commits.
|
|
221
|
+
* Filtering on transforms dropped it from the batch entirely, so the row went and its index
|
|
222
|
+
* entry stayed behind, on every node. */
|
|
223
|
+
private stagedCollections;
|
|
224
|
+
/**
|
|
225
|
+
* What a failure escaping {@link commit} must be reported as. When nothing is saved, the error
|
|
226
|
+
* itself, untouched. When a refresh between attempts already saved a participant, the commit
|
|
227
|
+
* half-landed whatever the error says — a {@link CoordinatorStaleLossError}'s "nothing durably
|
|
228
|
+
* committed, safe to re-drive" would be false, and a re-drive would apply the saved half twice —
|
|
229
|
+
* so it becomes a {@link CoordinatorPartialCommitError}:
|
|
230
|
+
*
|
|
231
|
+
* - `committedCollections`: every refresh-saved participant, plus the committed set of `err`
|
|
232
|
+
* when it is itself a partial landing (merged, never wrapped twice — its `reason` is kept);
|
|
233
|
+
* - `failedCollections`: every other participant of any attempt. Empty when a failure came after
|
|
234
|
+
* every participant was saved (a refresh that finished its entry and then threw, say);
|
|
235
|
+
* - `reason`: the original error.
|
|
236
|
+
*
|
|
237
|
+
* Local state already matches that report: a saved participant was consumed by its refresh, and
|
|
238
|
+
* an unsaved one kept its staged actions (a failed finish throws before touching anything, and
|
|
239
|
+
* commitOnceLatched restores every participant it did not commit). The stamp is released, as on
|
|
240
|
+
* the existing partial path, because the transaction can no longer be cleanly rolled back.
|
|
241
|
+
*/
|
|
242
|
+
private reportSaved;
|
|
132
243
|
/**
|
|
133
244
|
* Commit a transaction (single attempt): materialise a log entry from each collection's staged
|
|
134
245
|
* pending actions, then orchestrate the distributed consensus (GATHER/PEND/COMMIT).
|
|
135
246
|
*
|
|
136
|
-
* Called by {@link
|
|
247
|
+
* Called by {@link commitAttempts} (the backoff+jitter retry loop behind {@link commit}). The
|
|
137
248
|
* staged mutations already live in each collection's tracker — applied either via
|
|
138
249
|
* applyActions() (engine-driven path) or directly via Collection.act()/Tree.stage
|
|
139
250
|
* (the vtab's deferred-DML path) — but in BOTH cases without a log entry yet, so
|
|
@@ -141,16 +252,18 @@ export declare class TransactionCoordinator {
|
|
|
141
252
|
* and folds the committed transforms back into each collection's read cache.
|
|
142
253
|
*
|
|
143
254
|
* On a clean stale loss (nothing durable, every tracker restored) it throws
|
|
144
|
-
* {@link CoordinatorStaleLossError} so the caller can retry
|
|
255
|
+
* {@link CoordinatorStaleLossError} so the caller can retry. On a partial landing it throws the
|
|
256
|
+
* same, after recording the committed collections in `cycle.saved`, when every refusal was a
|
|
257
|
+
* returned one (the retry finishes the refused collection); on a hard failure it throws
|
|
145
258
|
* {@link CoordinatorPartialCommitError} (not retryable).
|
|
146
259
|
*
|
|
147
260
|
* @param transaction - The transaction to commit
|
|
148
|
-
* @param
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
261
|
+
* @param cycle - The state this commit keeps across attempts (see {@link CommitCycle}). This
|
|
262
|
+
* attempt adds its participants to `cycle.participants` and one disposer per participant it marks
|
|
263
|
+
* in flight under this transaction's id (see {@link Collection.beginInFlightAction}) to
|
|
264
|
+
* `cycle.inFlightDisposers`. REQUIRED, so a future caller cannot silently reintroduce the
|
|
265
|
+
* unmarked refresh the disposers exist to prevent, nor lose track of who took part. The caller
|
|
266
|
+
* owns clearing the marks, because they have to survive past this attempt.
|
|
154
267
|
*/
|
|
155
268
|
private commitOnce;
|
|
156
269
|
/**
|
|
@@ -159,6 +272,10 @@ export declare class TransactionCoordinator {
|
|
|
159
272
|
* participant's latch — every Collection member it touches (snapshotPending, getPendingActions,
|
|
160
273
|
* recordCommitted, applyCommittedToCache, restorePending, clearPendingActions, tracker.reset)
|
|
161
274
|
* is latch-free by contract.
|
|
275
|
+
*
|
|
276
|
+
* `cycle` is written only on a partial landing that is retried forward: the participants this
|
|
277
|
+
* attempt committed go into `cycle.saved`, so the retry loop reports every later failure as the
|
|
278
|
+
* partial landing it is (see {@link reportSaved}).
|
|
162
279
|
*/
|
|
163
280
|
private commitOnceLatched;
|
|
164
281
|
/**
|
|
@@ -225,7 +342,8 @@ export declare class TransactionCoordinator {
|
|
|
225
342
|
* Coordinate a transaction across multiple collections.
|
|
226
343
|
*
|
|
227
344
|
* @param transaction - The transaction to coordinate
|
|
228
|
-
* @param
|
|
345
|
+
* @param validation - What every pend carries for members to re-check, or undefined for an
|
|
346
|
+
* unvalidated pend (see {@link pendValidationFor})
|
|
229
347
|
* @param collectionTransforms - Map of collectionId to its transforms
|
|
230
348
|
* @param criticalBlocks - Map of collectionId to its log tail blockId
|
|
231
349
|
* @param pendedRevs - Per collection, the revision its log entry was stamped with (from
|
|
@@ -245,8 +363,10 @@ export declare class TransactionCoordinator {
|
|
|
245
363
|
/**
|
|
246
364
|
* PEND phase: Distribute transaction to all affected block clusters.
|
|
247
365
|
*
|
|
248
|
-
* @param transaction - The
|
|
249
|
-
*
|
|
366
|
+
* @param transaction - The transaction being pended (its id names the action; its aged
|
|
367
|
+
* priority rides on an unvalidated pend)
|
|
368
|
+
* @param validation - What every pend carries for members to re-check, or undefined for an
|
|
369
|
+
* unvalidated pend (see {@link pendValidationFor})
|
|
250
370
|
* @param collectionTransforms - Map of collectionId to its transforms
|
|
251
371
|
* @param pendedRevs - Per collection, the revision its log entry was stamped with — the pend
|
|
252
372
|
* request repeats it verbatim rather than recomputing from the collection (a recompute after
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../src/transaction/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAW,YAAY,EAAE,UAAU,EAAwC,MAAM,aAAa,CAAC;AACxH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG5H,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../src/transaction/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAW,YAAY,EAAE,UAAU,EAAwC,MAAM,aAAa,CAAC;AACxH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG5H,OAAO,KAAK,EAAE,UAAU,EAAqC,MAAM,6BAA6B,CAAC;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAwE1D;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,kBAAkB;IAClC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACpC;A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