TxnStatus¶
Outcome of a multi-record transaction’s commit or abort.
- class aerospike_sdk.txn_status.TxnStatus[source]¶
Bases:
EnumOutcome of
TransactionalSession.commit()orTransactionalSession.abort().A successful commit returns
COMMITTED, a successful abortABORTED. The*_ABANDONEDmembers are also successful outcomes whose cleanup the server finishes on its own; a failure that leaves writes provisional raisesCommitErrorinstead of returning a status.Example:
async with session.transaction() as tx: await tx.upsert(accounts.id("alice")).bin("balance").add(-250).execute() await tx.upsert(accounts.id("bob")).bin("balance").add(250).execute() status = await tx.commit() if status is TxnStatus.ROLL_FORWARD_CLOSE_ABANDONED: log.info("committed; the server will finish closing the transaction")
See also
aerospike_sdk.aio.transactional_session.TransactionalSession.commit()aerospike_sdk.aio.transactional_session.TransactionalSession.abort()CommitError: Raised when a commit stage fails.- COMMITTED = 'committed'¶
Commit succeeded.
- ABORTED = 'aborted'¶
Abort succeeded.
- ALREADY_COMMITTED = 'already_committed'¶
The transaction was already committed.
- ALREADY_ABORTED = 'already_aborted'¶
The transaction was already aborted.
- ROLL_FORWARD_CLOSE_ABANDONED = 'roll_forward_close_abandoned'¶
The transaction was rolled forward, but closing it was abandoned.
The writes are durable; the server will eventually close the transaction.
- ROLL_BACK_ABANDONED = 'roll_back_abandoned'¶
The client abandoned the roll back; the server will eventually abort the transaction.
- ROLL_BACK_CLOSE_ABANDONED = 'roll_back_close_abandoned'¶
The transaction was rolled back, but closing it was abandoned.
The server will eventually close the transaction.