Class: TransactionEngine
Defined in: packages/client/src/core/transaction-engine/index.ts:63
Named write transactions for one stack (ADR-0039).
Enabled per stack by transactions: true in its configuration - the flag only
unlocks begin; direct writes stay immediate, and the framework's own
writers (scheduler, jobs, sync) always write directly. The stage lives above the
plugin: nothing a transaction does touches the database until commit, and commit
is exactly one stack.db.bulkDocs through the full authoring pipeline.
Constructors
Constructor
new TransactionEngine(stack, enabled): TransactionEngine;
Defined in: packages/client/src/core/transaction-engine/index.ts:70
Parameters
| Parameter | Type |
|---|---|
stack | ClientStack |
enabled | boolean |
Returns
TransactionEngine
Methods
begin()
begin(): TransactionHandle;
Defined in: packages/client/src/core/transaction-engine/index.ts:84
Returns
commit()
commit(t): Promise<TransactionCommitReport>;
Defined in: packages/client/src/core/transaction-engine/index.ts:136
Flushes a transaction's journal as one batch through the stack's authoring pipeline. Refusals - validation, or a staged document whose base revision moved - throw with nothing persisted and the transaction still open.
Parameters
| Parameter | Type |
|---|---|
t | string | TransactionHandle |
Returns
Promise<TransactionCommitReport>
discard()
discard(t): void;
Defined in: packages/client/src/core/transaction-engine/index.ts:117
Drops a transaction's journal. Idempotent, and a no-op on a handle already in a terminal state - discarding what is already gone is not an error.
Parameters
| Parameter | Type |
|---|---|
t | string | TransactionHandle |
Returns
void
discardAll()
discardAll(): void;
Defined in: packages/client/src/core/transaction-engine/index.ts:127
Discards every open transaction - what close() and reset() do.
Returns
void
isEnabled()
isEnabled(): boolean;
Defined in: packages/client/src/core/transaction-engine/index.ts:75
Returns
boolean
openCount()
openCount(): number;
Defined in: packages/client/src/core/transaction-engine/index.ts:80
How many transactions are currently open (or partial).
Returns
number