txn_abort
Discard a transaction's writes without waiting for its timeout.
async fn txn_abort(&self, request: &TxnAbortRequest) -> Result<TxnAbortResponse>Parameters
ParameterTypeRequired
txn_idUUID bytesrequiredThe transaction to discard.
Returns
FieldTypePresence
txn_idUUID bytesalwaysEchoed back.
operations_discardedintegeralwaysHow many operations were thrown away.
Example
let txn_id = new_id();
client.txn_begin(&TxnBeginRequest { txn_id, timeout_seconds: 30, act_as: None }).await?;
let outcome = async {
write_everything(txn_id).await?;
client.txn_commit(&TxnCommitRequest { txn_id }).await
}
.await;
if outcome.is_err() {
client.txn_abort(&TxnAbortRequest { txn_id }).await?;
}
outcome?;HTTP has no transactions
The HTTP edge exposes no transaction routes. Each HTTP verb is its own unit. If several writes must land together, you need the wire client — see Wire client.
See also
Was this page helpful?