@optimystic/db-core 1.12.1 → 1.14.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/i-cluster.d.ts +16 -1
- package/dist/src/cluster/i-cluster.d.ts.map +1 -1
- package/dist/src/cluster/structs.d.ts +60 -6
- package/dist/src/cluster/structs.d.ts.map +1 -1
- package/dist/src/cluster/structs.js +5 -0
- package/dist/src/cluster/structs.js.map +1 -1
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +5 -3
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/network/durability.d.ts +17 -4
- package/dist/src/network/durability.d.ts.map +1 -1
- package/dist/src/network/durability.js +60 -15
- package/dist/src/network/durability.js.map +1 -1
- package/dist/src/network/i-key-network.d.ts +9 -0
- package/dist/src/network/i-key-network.d.ts.map +1 -1
- package/dist/src/network/struct.d.ts +45 -5
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/network/struct.js.map +1 -1
- package/dist/src/transaction/coordinator.d.ts +23 -14
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +84 -48
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transaction/durability.d.ts +31 -0
- package/dist/src/transaction/durability.d.ts.map +1 -0
- package/dist/src/transaction/durability.js +36 -0
- package/dist/src/transaction/durability.js.map +1 -0
- package/dist/src/transaction/errors.d.ts +14 -6
- package/dist/src/transaction/errors.d.ts.map +1 -1
- package/dist/src/transaction/errors.js +16 -5
- package/dist/src/transaction/errors.js.map +1 -1
- package/dist/src/transaction/index.d.ts +2 -0
- package/dist/src/transaction/index.d.ts.map +1 -1
- package/dist/src/transaction/index.js +1 -0
- package/dist/src/transaction/index.js.map +1 -1
- package/dist/src/transaction/session.d.ts +2 -0
- package/dist/src/transaction/session.d.ts.map +1 -1
- package/dist/src/transaction/session.js +4 -2
- package/dist/src/transaction/session.js.map +1 -1
- package/dist/src/transaction/transaction.d.ts +9 -0
- package/dist/src/transaction/transaction.d.ts.map +1 -1
- package/dist/src/transaction/transaction.js.map +1 -1
- package/dist/src/transactor/change-notifier.d.ts +20 -8
- package/dist/src/transactor/change-notifier.d.ts.map +1 -1
- package/dist/src/transactor/change-notifier.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts +48 -5
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +98 -22
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/dist/src/transactor/owed-cancels.d.ts +96 -0
- package/dist/src/transactor/owed-cancels.d.ts.map +1 -0
- package/dist/src/transactor/owed-cancels.js +211 -0
- package/dist/src/transactor/owed-cancels.js.map +1 -0
- package/dist/src/transactor/transactor-source.d.ts +5 -4
- package/dist/src/transactor/transactor-source.d.ts.map +1 -1
- package/dist/src/transactor/transactor-source.js +11 -6
- package/dist/src/transactor/transactor-source.js.map +1 -1
- package/dist/src/utility/unref-timer.d.ts +9 -0
- package/dist/src/utility/unref-timer.d.ts.map +1 -0
- package/dist/src/utility/unref-timer.js +15 -0
- package/dist/src/utility/unref-timer.js.map +1 -0
- package/package.json +1 -1
- package/src/cluster/i-cluster.ts +13 -2
- package/src/cluster/structs.ts +62 -6
- package/src/collection/collection.ts +5 -3
- package/src/index.ts +1 -0
- package/src/network/durability.ts +63 -15
- package/src/network/i-key-network.ts +10 -0
- package/src/network/struct.ts +45 -5
- package/src/transaction/coordinator.ts +130 -79
- package/src/transaction/durability.ts +60 -0
- package/src/transaction/errors.ts +18 -3
- package/src/transaction/index.ts +2 -0
- package/src/transaction/session.ts +4 -2
- package/src/transaction/transaction.ts +9 -0
- package/src/transactor/change-notifier.ts +20 -8
- package/src/transactor/network-transactor.ts +120 -29
- package/src/transactor/owed-cancels.ts +252 -0
- package/src/transactor/transactor-source.ts +11 -6
- package/src/utility/unref-timer.ts +15 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { CollectionId } from "../collection/index.js";
|
|
2
|
+
import type { WriteDurability } from "../network/struct.js";
|
|
3
|
+
import { type TransactionDurability } from "./durability.js";
|
|
2
4
|
/**
|
|
3
5
|
* Thrown by {@link TransactionCoordinator.commit} when a multi-collection commit
|
|
4
6
|
* fails AFTER at least one collection has already DURABLY committed through the
|
|
@@ -48,11 +50,9 @@ import type { CollectionId } from "../collection/index.js";
|
|
|
48
50
|
* treat it as a clean abort: `committedCollections` are durable and cannot be rolled back,
|
|
49
51
|
* so a whole-transaction retry would double-apply them. Reconcile the named committed set
|
|
50
52
|
* against `failedCollections` (re-drive only the failed collections, or repair the split).
|
|
53
|
+
* `durability` says who holds the committed half, in the same shape a successful commit reports.
|
|
51
54
|
*/
|
|
52
55
|
export declare class CoordinatorPartialCommitError extends Error {
|
|
53
|
-
/** Collections durably committed before the failure (NOT rolled back) — by an attempt, or
|
|
54
|
-
* by the refresh between attempts finishing the collection's own log entry. */
|
|
55
|
-
readonly committedCollections: readonly CollectionId[];
|
|
56
56
|
/** Collections of this transaction that never committed (local state reverted for retry —
|
|
57
57
|
* their staged actions are still in place). Can be empty when the failure came after every
|
|
58
58
|
* collection was already saved. */
|
|
@@ -62,10 +62,18 @@ export declare class CoordinatorPartialCommitError extends Error {
|
|
|
62
62
|
* was committed or saved — a {@link CoordinatorStaleLossError} when the failed collection's
|
|
63
63
|
* refusal never cleared within the retry budget (its own `reason` names the last refusal). */
|
|
64
64
|
readonly reason?: unknown | undefined;
|
|
65
|
-
constructor(
|
|
66
65
|
/** Collections durably committed before the failure (NOT rolled back) — by an attempt, or
|
|
67
|
-
* by the refresh between attempts finishing the collection's own log entry.
|
|
68
|
-
|
|
66
|
+
* by the refresh between attempts finishing the collection's own log entry. Exactly the keys of
|
|
67
|
+
* {@link durability}'s `collections`. */
|
|
68
|
+
readonly committedCollections: readonly CollectionId[];
|
|
69
|
+
/** Who holds the half that DID commit: exactly {@link committedCollections}, each with its class,
|
|
70
|
+
* and `overall` over them (absent when any one's class is unknown). Says nothing about
|
|
71
|
+
* {@link failedCollections}, which wrote nothing. */
|
|
72
|
+
readonly durability: TransactionDurability;
|
|
73
|
+
constructor(
|
|
74
|
+
/** The committed collections with who holds each (`undefined` where that is unknown). Never
|
|
75
|
+
* empty: a commit in which nothing was committed is not a partial commit. */
|
|
76
|
+
committed: ReadonlyMap<CollectionId, WriteDurability | undefined>,
|
|
69
77
|
/** Collections of this transaction that never committed (local state reverted for retry —
|
|
70
78
|
* their staged actions are still in place). Can be empty when the failure came after every
|
|
71
79
|
* collection was already saved. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/transaction/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/transaction/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IActD;;uCAEmC;aACnB,iBAAiB,EAAE,SAAS,YAAY,EAAE;IAC1D;;;kGAG8F;aAC9E,MAAM,CAAC,EAAE,OAAO;IArBjC;;6CAEyC;IACzC,QAAQ,CAAC,oBAAoB,EAAE,SAAS,YAAY,EAAE,CAAC;IACvD;;yDAEqD;IACrD,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;;IAG1C;iFAC6E;IAC7E,SAAS,EAAE,WAAW,CAAC,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;IACjE;;uCAEmC;IACnB,iBAAiB,EAAE,SAAS,YAAY,EAAE;IAC1D;;;kGAG8F;IAC9E,MAAM,CAAC,EAAE,OAAO,YAAA;CAejC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAElD,kGAAkG;aAClF,iBAAiB,EAAE,SAAS,YAAY,EAAE;IAC1D,qFAAqF;aACrE,MAAM,CAAC,EAAE,MAAM;;IAH/B,kGAAkG;IAClF,iBAAiB,EAAE,SAAS,YAAY,EAAE;IAC1D,qFAAqF;IACrE,MAAM,CAAC,EAAE,MAAM,YAAA;CAUhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,+BAAgC,SAAQ,KAAK;IAExD,kDAAkD;aAClC,WAAW,EAAE,MAAM;IACnC,kCAAkC;aAClB,eAAe,EAAE,MAAM;;IAHvC,kDAAkD;IAClC,WAAW,EAAE,MAAM;IACnC,kCAAkC;IAClB,eAAe,EAAE,MAAM;CAYxC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { transactionDurability } from "./durability.js";
|
|
1
2
|
/**
|
|
2
3
|
* Thrown by {@link TransactionCoordinator.commit} when a multi-collection commit
|
|
3
4
|
* fails AFTER at least one collection has already DURABLY committed through the
|
|
@@ -47,15 +48,23 @@
|
|
|
47
48
|
* treat it as a clean abort: `committedCollections` are durable and cannot be rolled back,
|
|
48
49
|
* so a whole-transaction retry would double-apply them. Reconcile the named committed set
|
|
49
50
|
* against `failedCollections` (re-drive only the failed collections, or repair the split).
|
|
51
|
+
* `durability` says who holds the committed half, in the same shape a successful commit reports.
|
|
50
52
|
*/
|
|
51
53
|
export class CoordinatorPartialCommitError extends Error {
|
|
52
|
-
committedCollections;
|
|
53
54
|
failedCollections;
|
|
54
55
|
reason;
|
|
55
|
-
constructor(
|
|
56
56
|
/** Collections durably committed before the failure (NOT rolled back) — by an attempt, or
|
|
57
|
-
* by the refresh between attempts finishing the collection's own log entry.
|
|
58
|
-
|
|
57
|
+
* by the refresh between attempts finishing the collection's own log entry. Exactly the keys of
|
|
58
|
+
* {@link durability}'s `collections`. */
|
|
59
|
+
committedCollections;
|
|
60
|
+
/** Who holds the half that DID commit: exactly {@link committedCollections}, each with its class,
|
|
61
|
+
* and `overall` over them (absent when any one's class is unknown). Says nothing about
|
|
62
|
+
* {@link failedCollections}, which wrote nothing. */
|
|
63
|
+
durability;
|
|
64
|
+
constructor(
|
|
65
|
+
/** The committed collections with who holds each (`undefined` where that is unknown). Never
|
|
66
|
+
* empty: a commit in which nothing was committed is not a partial commit. */
|
|
67
|
+
committed,
|
|
59
68
|
/** Collections of this transaction that never committed (local state reverted for retry —
|
|
60
69
|
* their staged actions are still in place). Can be empty when the failure came after every
|
|
61
70
|
* collection was already saved. */
|
|
@@ -65,15 +74,17 @@ export class CoordinatorPartialCommitError extends Error {
|
|
|
65
74
|
* was committed or saved — a {@link CoordinatorStaleLossError} when the failed collection's
|
|
66
75
|
* refusal never cleared within the retry budget (its own `reason` names the last refusal). */
|
|
67
76
|
reason) {
|
|
77
|
+
const committedCollections = [...committed.keys()];
|
|
68
78
|
super(`Multi-collection commit was not atomic: ${committedCollections.length} collection(s) ` +
|
|
69
79
|
`durably committed via distributed consensus before the commit failed and CANNOT be ` +
|
|
70
80
|
`rolled back — reconciliation is required. ` +
|
|
71
81
|
`Committed (durable, now out of sync with the failed collections): [${committedCollections.join(', ')}]. ` +
|
|
72
82
|
`Failed (never committed; local state reverted for retry): [${failedCollections.join(', ')}]. ` +
|
|
73
83
|
`Underlying failure: ${reason instanceof Error ? reason.message : String(reason)}`);
|
|
74
|
-
this.committedCollections = committedCollections;
|
|
75
84
|
this.failedCollections = failedCollections;
|
|
76
85
|
this.reason = reason;
|
|
86
|
+
this.committedCollections = committedCollections;
|
|
87
|
+
this.durability = transactionDurability(committed);
|
|
77
88
|
this.name = 'CoordinatorPartialCommitError';
|
|
78
89
|
}
|
|
79
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/transaction/errors.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/transaction/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAA8B,MAAM,iBAAiB,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAiBtC;IAKA;IArBjB;;6CAEyC;IAChC,oBAAoB,CAA0B;IACvD;;yDAEqD;IAC5C,UAAU,CAAwB;IAE3C;IACC;iFAC6E;IAC7E,SAAiE;IACjE;;uCAEmC;IACnB,iBAA0C;IAC1D;;;kGAG8F;IAC9E,MAAgB;QAEhC,MAAM,oBAAoB,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,KAAK,CACJ,2CAA2C,oBAAoB,CAAC,MAAM,iBAAiB;YACvF,qFAAqF;YACrF,4CAA4C;YAC5C,sEAAsE,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YAC1G,8DAA8D,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YAC/F,uBAAuB,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAClF,CAAC;QAfc,sBAAiB,GAAjB,iBAAiB,CAAyB;QAK1C,WAAM,GAAN,MAAM,CAAU;QAWhC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC7C,CAAC;CACD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAGlC;IAEA;IAJjB;IACC,kGAAkG;IAClF,iBAA0C;IAC1D,qFAAqF;IACrE,MAAe;QAE/B,0FAA0F;QAC1F,sFAAsF;QACtF,KAAK,CACJ,kDAAkD,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACjF,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9B,CAAC;QATc,sBAAiB,GAAjB,iBAAiB,CAAyB;QAE1C,WAAM,GAAN,MAAM,CAAS;QAQ/B,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IACzC,CAAC;CACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAGxC;IAEA;IAJjB;IACC,kDAAkD;IAClC,WAAmB;IACnC,kCAAkC;IAClB,eAAuB;QAEvC,KAAK,CACJ,qBAAqB,eAAe,uDAAuD;YAC3F,GAAG,WAAW,6EAA6E;YAC3F,mDAAmD,WAAW,2BAA2B;YACzF,uFAAuF;YACvF,uFAAuF;YACvF,uEAAuE,CACvE,CAAC;QAXc,gBAAW,GAAX,WAAW,CAAQ;QAEnB,oBAAe,GAAf,eAAe,CAAQ;QAUvC,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAC/C,CAAC;CACD"}
|
|
@@ -5,6 +5,8 @@ export { ReadDependencyCollector } from './read-dependency-collector.js';
|
|
|
5
5
|
export { TransactionCoordinator } from './coordinator.js';
|
|
6
6
|
export type { CoordinatorOptions, PendValidationMode } from './coordinator.js';
|
|
7
7
|
export { CoordinatorConcurrentStampError, CoordinatorPartialCommitError, CoordinatorStaleLossError } from './errors.js';
|
|
8
|
+
export { transactionDurability, recordCollectionDurability } from './durability.js';
|
|
9
|
+
export type { TransactionDurability } from './durability.js';
|
|
8
10
|
export { TransactionSession } from './session.js';
|
|
9
11
|
export { TransactionValidator } from './validator.js';
|
|
10
12
|
export type { EngineRegistration, ValidationCoordinatorFactory, BlockStateProvider } from './validator.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE3G,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf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B,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -3,6 +3,7 @@ export { ActionsEngine, ACTIONS_ENGINE_ID, } from './actions-engine.js';
|
|
|
3
3
|
export { ReadDependencyCollector } from './read-dependency-collector.js';
|
|
4
4
|
export { TransactionCoordinator } from './coordinator.js';
|
|
5
5
|
export { CoordinatorConcurrentStampError, CoordinatorPartialCommitError, CoordinatorStaleLossError } from './errors.js';
|
|
6
|
+
export { transactionDurability, recordCollectionDurability } from './durability.js';
|
|
6
7
|
export { TransactionSession } from './session.js';
|
|
7
8
|
export { TransactionValidator } from './validator.js';
|
|
8
9
|
export { collectOperations, hashOperations, canonicalStringify, canonicalOperationsPayload, opsHashVersion, OPS_HASH_VERSION, OPS_HASH_PREFIX, } from './operations-hash.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAEpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
|
|
@@ -59,6 +59,8 @@ export declare class TransactionSession {
|
|
|
59
59
|
*
|
|
60
60
|
* @param options - Optional retry knobs forwarded to {@link TransactionCoordinator.commit}
|
|
61
61
|
* (bounded backoff+jitter retry of a clean stale loss). Defaults are safe out of the box.
|
|
62
|
+
* @returns on success, `durability` says who holds what the commit wrote; it is absent when the
|
|
63
|
+
* transaction wrote nothing (see {@link ExecutionResult.durability}).
|
|
62
64
|
*/
|
|
63
65
|
commit(options?: SyncOptions): Promise<ExecutionResult>;
|
|
64
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/transaction/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAe,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGjJ;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,kBAAkB;IAO7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IATzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO;IASP;;;;;;;OAOG;WACU,MAAM,CAClB,WAAW,EAAE,sBAAsB,EACnC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,GAAE,MAAgB,EACxB,UAAU,GAAE,MAAW,EACvB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAW9B;;;;;;;;;OASG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA2C9G
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/transaction/session.ts"],"names":[],"mappings":"AAAA,OAAO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EG;IACH,aAAa,IAAI,SAAS,MAAM,EAAE;IAIlC;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,YAAY,IAAI,OAAO;CAGvB"}
|
|
@@ -101,6 +101,8 @@ export class TransactionSession {
|
|
|
101
101
|
*
|
|
102
102
|
* @param options - Optional retry knobs forwarded to {@link TransactionCoordinator.commit}
|
|
103
103
|
* (bounded backoff+jitter retry of a clean stale loss). Defaults are safe out of the box.
|
|
104
|
+
* @returns on success, `durability` says who holds what the commit wrote; it is absent when the
|
|
105
|
+
* transaction wrote nothing (see {@link ExecutionResult.durability}).
|
|
104
106
|
*/
|
|
105
107
|
async commit(options) {
|
|
106
108
|
if (this.committed) {
|
|
@@ -140,11 +142,11 @@ export class TransactionSession {
|
|
|
140
142
|
}
|
|
141
143
|
// Commit through coordinator (which will orchestrate PEND/COMMIT, with bounded
|
|
142
144
|
// backoff+jitter retry of a clean stale loss)
|
|
143
|
-
await this.coordinator.commit(transaction, options);
|
|
145
|
+
const durability = await this.coordinator.commit(transaction, options);
|
|
144
146
|
// Clear read dependencies after successful commit
|
|
145
147
|
this.coordinator.clearReadDependencies();
|
|
146
148
|
this.committed = true;
|
|
147
|
-
return { success: true };
|
|
149
|
+
return { success: true, ...(durability === undefined ? {} : { durability }) };
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* Rollback the transaction (undo this session's applied actions).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/transaction/session.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE7H;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,kBAAkB;IAOZ;IACA;IAEA;IATD,UAAU,GAAa,EAAE,CAAC;IAC1B,KAAK,CAAmB;IACjC,SAAS,GAAG,KAAK,CAAC;IAClB,UAAU,GA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tB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,QAAQ;QACb,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACpD,CAAC;QAED,+BAA+B;QAC/B,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,UAAU;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,YAAY;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;CACD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockId } from "../blocks/index.js";
|
|
2
2
|
import type { CollectionId } from "../collection/index.js";
|
|
3
|
+
import type { TransactionDurability } from "./durability.js";
|
|
3
4
|
/**
|
|
4
5
|
* Transaction Stamp: Created at BEGIN, stable throughout transaction lifecycle.
|
|
5
6
|
*
|
|
@@ -298,6 +299,14 @@ export type ExecutionResult = {
|
|
|
298
299
|
committedCollections?: CollectionId[];
|
|
299
300
|
/** On a partial multi-collection commit failure, the collections that failed to commit. */
|
|
300
301
|
failedCollections?: CollectionId[];
|
|
302
|
+
/**
|
|
303
|
+
* Who holds what this commit wrote, present whenever something was written: on success, every
|
|
304
|
+
* collection the commit wrote; on a partial failure, exactly {@link committedCollections}. Absent
|
|
305
|
+
* when nothing was written — a failure where nothing landed, or a success with nothing staged.
|
|
306
|
+
* Test it through `isFullyDurable(durability.overall)`; an absent `overall` means a collection is
|
|
307
|
+
* saved but who holds it is unknown, so show the change as pending.
|
|
308
|
+
*/
|
|
309
|
+
durability?: TransactionDurability;
|
|
301
310
|
};
|
|
302
311
|
/**
|
|
303
312
|
* Actions for a specific collection resulting from transaction execution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG7D;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAElB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IAEnB,4DAA4D;IAC5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D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAuHvD,qEAAqE;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAA4B;IACzD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAC7E,OAAO,CAAC,CAAC;IACV,CAAC;IACD,kGAAkG;IAClG,gFAAgF;IAChF,IAAI,QAAQ,IAAI,WAAW,EAAE,CAAC;QAC7B,OAAO,WAAW,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,qDAAqD;AACrD,MAAM,UAAU,oBAAoB,CAAC,KAAuB;IAC3D,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC;AACtC,CAAC;AAKD;;;;;;GA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,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CACrC,OAAe,EACf,UAA6B,EAC7B,KAAgC;IAEhC,MAAM,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAC1B,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;IAC5E,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,kBAAkB,IAAI,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC;AA+HD;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAgC;IACvE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -77,25 +77,37 @@ export declare function isBlockChangeNotifier(x: unknown): x is IBlockChangeNoti
|
|
|
77
77
|
* acknowledged below `full` (`WriteDurability.quorum`) is pending until these events cover its
|
|
78
78
|
* blocks, at which point a host can move it from "pending" to "saved".
|
|
79
79
|
*
|
|
80
|
+
* **Fired only on the node whose ledger recorded the shortfall** — the one a below-`full` answer
|
|
81
|
+
* names as `WriteDurability.recordedBy`. An answer without `recordedBy` is a write no node is
|
|
82
|
+
* tracking, and no event should be expected for it. That node fires the event when its record of a
|
|
83
|
+
* block's shortfall is removed, which happens two ways, each firing exactly once per record: the
|
|
84
|
+
* node's push of the missing copies empties it (the event carries the record's own `rev` and
|
|
85
|
+
* `actionId`), or a later commit of the block that every member confirmed settles it (the event
|
|
86
|
+
* carries that later commit's `rev` and `actionId`).
|
|
87
|
+
*
|
|
80
88
|
* **Keyed by block, deliberately, never by action.** The node's record of what is still owed (the
|
|
81
89
|
* under-replication ledger) keeps ONE entry per block, at the block's highest under-replicated
|
|
82
90
|
* revision: a block written again by a LATER action replaces the earlier entry, so the earlier
|
|
83
91
|
* action's shortfall is cleared by the later action's copies and reported under the later
|
|
84
92
|
* action's `actionId` — the earlier action never fires an event of its own. A host that keys its
|
|
85
|
-
* pending state by action alone therefore waits forever for a superseded write. Hold the
|
|
86
|
-
*
|
|
87
|
-
*
|
|
93
|
+
* pending state by action alone therefore waits forever for a superseded write. Hold the blocks the
|
|
94
|
+
* write's durability names (`WriteDurability.blockRevs`, each with the revision it committed at) and
|
|
95
|
+
* clear a block when an event names it at that revision or a later one; `rev` and `actionId` say
|
|
96
|
+
* which write's copies did the covering. An event can arrive before the write's answer has reached
|
|
97
|
+
* the host, so a host that registers on the answer must also remember events it has already seen.
|
|
88
98
|
*/
|
|
89
99
|
export type BlockDurabilityReachedEvent = {
|
|
90
|
-
/** Blocks that reached full replication in this round.
|
|
91
|
-
* event; the list shape lets a producer report several blocks of one action together. */
|
|
100
|
+
/** Blocks that reached full replication in this round. Both of today's producers report one block
|
|
101
|
+
* per event; the list shape lets a producer report several blocks of one action together. */
|
|
92
102
|
readonly blockIds: readonly BlockId[];
|
|
93
103
|
/** The revision every cohort member now holds — the block's highest under-replicated revision,
|
|
94
|
-
* which supersedes every lower one. */
|
|
104
|
+
* or the fully replicated commit that settled it, either of which supersedes every lower one. */
|
|
95
105
|
readonly rev: number;
|
|
96
|
-
/** The action whose
|
|
106
|
+
/** The action whose copies covered the block: the one whose recorded shortfall cleared, or the
|
|
107
|
+
* fully replicated commit that settled it. See the note above on superseded writes. */
|
|
97
108
|
readonly actionId: ActionId;
|
|
98
|
-
/** Best-effort; absent when the collection could not be resolved from the block's header
|
|
109
|
+
/** Best-effort; absent when the collection could not be resolved from the block's header, and
|
|
110
|
+
* always when a settling commit fired the event (the coordinator does not read the block). */
|
|
99
111
|
readonly collectionId?: CollectionId;
|
|
100
112
|
};
|
|
101
113
|
export type BlockDurabilityListener = (event: BlockDurabilityReachedEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-notifier.d.ts","sourceRoot":"","sources":["../../../src/transactor/change-notifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,qEAAqE;AACrE,MAAM,MAAM,qBAAqB,GAAG;IACnC,mFAAmF;IACnF,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,QAAQ,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,2GAA2G;IAC3G,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAClC,gHAAgH;IAChH,QAAQ,CAAC,OA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AC/C,OAAO,CAAC,CAAC,CAAC,IAAI,OAAQ,CAA0B,CAAC,kBAAkB,KAAK,UAAU,CAAC;AACpF,CAAC;
|
|
1
|
+
{"version":3,"file":"change-notifier.js","sourceRoot":"","sources":["../../../src/transactor/change-notifier.ts"],"names":[],"mappings":"AA6EA,MAAM,UAAU,qBAAqB,CAAC,CAAU;IAC/C,OAAO,CAAC,CAAC,CAAC,IAAI,OAAQ,CAA0B,CAAC,kBAAkB,KAAK,UAAU,CAAC;AACpF,CAAC;AA2DD,MAAM,UAAU,yBAAyB,CAAC,CAAU;IACnD,OAAO,CAAC,CAAC,CAAC,IAAI,OAAQ,CAA8B,CAAC,wBAAwB,KAAK,UAAU,CAAC;AAC9F,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PeerId } from "../network/types.js";
|
|
2
|
-
import type { ActionTransforms, ActionBlocks, ActionLineage, BlockActionStatus, ITransactor, IKeyNetwork, BlockId, GetBlockResults, PendResult, CommitResult, PendRequest, IRepo, BlockGets, CommitRequest, ClusterNomineesResult, CollectionId } from "../index.js";
|
|
2
|
+
import type { ActionTransforms, ActionBlocks, ActionLineage, BlockActionStatus, ITransactor, IKeyNetwork, BlockId, GetBlockResults, PendResult, CommitResult, PendRequest, IRepo, BlockGets, CommitRequest, ActionId, ClusterNomineesResult, CollectionId } from "../index.js";
|
|
3
3
|
import type { IBlockChangeNotifier, CollectionChangeListener } from "./change-notifier.js";
|
|
4
|
+
import { type OwedCancelClock } from "./owed-cancels.js";
|
|
4
5
|
type NetworkTransactorInit = {
|
|
5
6
|
timeoutMs: number;
|
|
6
7
|
abortOrCancelTimeoutMs: number;
|
|
@@ -34,6 +35,12 @@ type NetworkTransactorInit = {
|
|
|
34
35
|
* which is the nearest.
|
|
35
36
|
*/
|
|
36
37
|
localPeerId?: PeerId;
|
|
38
|
+
/**
|
|
39
|
+
* Time for the re-sends of cancels this transactor could not discharge ({@link OwedCancels}).
|
|
40
|
+
* Omit in production (`Date.now` and an unref'd `setTimeout`); a test injects a fake to fire the
|
|
41
|
+
* re-send without waiting on the wall clock.
|
|
42
|
+
*/
|
|
43
|
+
owedCancelClock?: OwedCancelClock;
|
|
37
44
|
};
|
|
38
45
|
export declare class NetworkTransactor implements ITransactor, IBlockChangeNotifier {
|
|
39
46
|
private readonly keyNetwork;
|
|
@@ -63,7 +70,24 @@ export declare class NetworkTransactor implements ITransactor, IBlockChangeNotif
|
|
|
63
70
|
*/
|
|
64
71
|
private readonly txnCoordinatorCache;
|
|
65
72
|
private static readonly MAX_TXN_COORDINATOR_CACHE_ENTRIES;
|
|
73
|
+
/**
|
|
74
|
+
* Cancels {@link dischargeCancel} gave up on, kept and re-sent before this transactor's next pend
|
|
75
|
+
* of their blocks and on a backoff timer, for this transactor's life — see {@link OwedCancels}.
|
|
76
|
+
*/
|
|
77
|
+
private readonly owedCancels;
|
|
66
78
|
constructor(init: NetworkTransactorInit);
|
|
79
|
+
/**
|
|
80
|
+
* Every action this transactor owes a cancel for — one it sent, could not get answered, and is
|
|
81
|
+
* still re-sending — with the blocks still owed. A snapshot, for diagnostics: an embedder about to
|
|
82
|
+
* drop this transactor can see what it would leave standing.
|
|
83
|
+
*/
|
|
84
|
+
owedCancelBlocks(): Map<ActionId, BlockId[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Stops re-sending owed cancels; whatever is still owed is logged (`cancel:owed-abandoned`) and
|
|
87
|
+
* left standing. Call when the node this transactor sends through stops, or its re-send timer keeps
|
|
88
|
+
* the transactor alive, retrying against a node that can no longer answer, for the life of the process.
|
|
89
|
+
*/
|
|
90
|
+
stop(): void;
|
|
67
91
|
/**
|
|
68
92
|
* Subscribe to commits landing on the local node for `collectionId`, delegating
|
|
69
93
|
* to the `localChangeNotifier` supplied at construction. When no notifier was
|
|
@@ -208,8 +232,9 @@ export declare class NetworkTransactor implements ITransactor, IBlockChangeNotif
|
|
|
208
232
|
* Confirmed blocks are excluded only to skip a pointless consensus round — cancelling one would
|
|
209
233
|
* also be a no-op — so an over-broad `confirmed` set costs latency, never correctness.
|
|
210
234
|
*
|
|
211
|
-
* Residuals: the cancel is retried and checked ({@link dischargeCancel})
|
|
212
|
-
*
|
|
235
|
+
* Residuals: the cancel is retried and checked ({@link dischargeCancel}), and one that outlasts its
|
|
236
|
+
* budget is kept and re-sent for this transactor's life ({@link owedCancels}), so only a writer that
|
|
237
|
+
* exits first leaves the record wedged until a node-side backstop sweep exists (backlog:
|
|
213
238
|
* `debt-unpromotable-pending-records-need-a-sweep`); and this covers only the sweep's abandonment
|
|
214
239
|
* — `StorageRepo.commit`'s genuine-fault arm deliberately KEEPS a failed batch's pendings for a
|
|
215
240
|
* retry, so it is a second producer of the same durable state whenever that retry never comes.
|
|
@@ -313,14 +338,32 @@ export declare class NetworkTransactor implements ITransactor, IBlockChangeNotif
|
|
|
313
338
|
* cost latency only. Each round narrows to the blocks still outstanding, so a partially
|
|
314
339
|
* successful round does not re-issue the cancels that already landed.
|
|
315
340
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
341
|
+
* **What happens when the bounds run out.** The blocks still outstanding are handed to
|
|
342
|
+
* {@link owedCancels} before the throw, which re-sends their cancel before this transactor's next
|
|
343
|
+
* pend of any of them and on a backoff timer, for the transactor's life — a fault that outlasts
|
|
344
|
+
* this loop costs the records' holders some refused writes, not the block. Recording it here,
|
|
345
|
+
* from this loop's own outstanding set, is what spares every caller from having to remember to.
|
|
346
|
+
*
|
|
347
|
+
* NOTE: a writer that exits (or stops this transactor, {@link stop}) while a cancel is still owed
|
|
348
|
+
* strands the record, and nothing node-side reclaims it. That residual is the backstop tracked in backlog
|
|
318
349
|
* `debt-unpromotable-pending-records-need-a-sweep`.
|
|
319
350
|
*
|
|
320
351
|
* @param seedBatches Batches to use for round 0 only (see {@link cancelBatch}). Omitted → round
|
|
321
352
|
* 0 resolves coordinators live like every later round.
|
|
322
353
|
*/
|
|
323
354
|
private dischargeCancel;
|
|
355
|
+
/**
|
|
356
|
+
* One cancel round for `blockIds`: batches built from `seedBatches` or resolved live, sent, and
|
|
357
|
+
* judged by which blocks some peer answered for. Never throws — a failed lookup is returned as
|
|
358
|
+
* `error` beside an empty discharged set.
|
|
359
|
+
*/
|
|
360
|
+
private cancelRound;
|
|
361
|
+
/**
|
|
362
|
+
* One re-send of a cancel {@link dischargeCancel} gave up on, for {@link owedCancels}: a single
|
|
363
|
+
* round within `abortOrCancelTimeoutMs`, never the full loop — it runs ahead of a pend, and a
|
|
364
|
+
* cohort that still cannot approve the cancel cannot approve the pend either.
|
|
365
|
+
*/
|
|
366
|
+
private resendOwedCancel;
|
|
324
367
|
/** Renders the batches worth naming in an aggregate error: the ones that never completed, or —
|
|
325
368
|
* when every batch completed and the aggregate is about a non-success RESPONSE rather than a
|
|
326
369
|
* transport fault — all of them. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-transactor.d.ts","sourceRoot":"","sources":["../../../src/transactor/network-transactor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAKlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAA0D,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAc,aAAa,
|
|
1
|
+
{"version":3,"file":"network-transactor.d.ts","sourceRoot":"","sources":["../../../src/transactor/network-transactor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAKlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAA0D,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAc,aAAa,EAAE,QAAQ,EAAqB,qBAAqB,EAAE,YAAY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