project.transaction
Begin, commit, cancel, and renew project transactions.
5 functions / 1 types
Index
| Function | Description |
|---|---|
| begin | Opens a transaction and returns its id. An expired lease discards its writes. Call RenewLease before expiry to keep the transaction open. |
| cancel | Ends the transaction matching id as canceled, discarding its writes. Errors when no transaction with that id is open, or when a concurrent Commit or Cancel already finalized it. |
| commit | Ends the transaction matching id as committed. Errors when no transaction with that id is open, or when a concurrent Commit or Cancel already finalized it. |
| forceCancel | Cancels the open transaction without its id. This can cancel another caller’s transaction. Errors when no transaction is open. Prefer Cancel when the id is known. |
| renewLease | Extends an unexpired transaction by its original lease duration. |
| Type | Description |
|---|---|
| TransactionMode | Policy for operations submitted while a transaction is open. |
begin
begin(args: { leaseSeconds?: number; mode: ProjectTransactionTransactionMode }, transactionId?: string): Promise<string>Opens a transaction and returns its id. An expired lease discards its writes.
Call RenewLease before expiry to keep the transaction open.
Returns Promise<string>.
leaseSeconds optional : number
Lease duration in seconds. Defaults to 60. Must be finite and between 0.001 and 86400.
mode : ProjectTransactionTransactionMode
Whether untagged operations are absorbed by this transaction.
transactionId optional : string
cancel
cancel(args: { id: string }, transactionId?: string): Promise<void>Ends the transaction matching id as canceled, discarding its writes. Errors when no
transaction with that id is open, or when a concurrent Commit or Cancel already finalized it.
Returns Promise<void>.
id : string
The transaction to end (hyphenated UUID string).
transactionId optional : string
commit
commit(args: { id: string }, transactionId?: string): Promise<void>Ends the transaction matching id as committed. Errors when no transaction with that id is
open, or when a concurrent Commit or Cancel already finalized it.
Returns Promise<void>.
id : string
The transaction to end (hyphenated UUID string).
transactionId optional : string
forceCancel
forceCancel(transactionId?: string): Promise<void>Cancels the open transaction without its id. This can cancel another caller’s transaction.
Errors when no transaction is open. Prefer Cancel when the id is known.
Returns Promise<void>.
transactionId optional : string
renewLease
renewLease(args: { id: string }, transactionId?: string): Promise<void>Extends an unexpired transaction by its original lease duration.
Returns Promise<void>.
id : string
transactionId optional : string
TransactionMode
Enum
Policy for operations submitted while a transaction is open.
Shared (default) includes every operation. Private accepts only operations tagged with
this transaction’s ID and rejects others with StatementError.TransactionNotAdmitted.
Private = 1
Shared = 0