Request to begin a transaction.
(&mut self)
| 408 | |
| 409 | /// Request to begin a transaction. |
| 410 | pub async fn begin_transaction(&mut self) -> Result<Bytes> { |
| 411 | let cmd = ActionBeginTransactionRequest {}; |
| 412 | let action = Action { |
| 413 | r#type: BEGIN_TRANSACTION.to_string(), |
| 414 | body: cmd.as_any().encode_to_vec().into(), |
| 415 | }; |
| 416 | let req = self.set_request_headers(action.into_request())?; |
| 417 | let mut result = self.flight_client.do_action(req).await?.into_inner(); |
| 418 | let result = result.message().await?.unwrap(); |
| 419 | let any = Any::decode(&*result.body)?; |
| 420 | let begin_result: ActionBeginTransactionResult = any.unpack()?.unwrap(); |
| 421 | Ok(begin_result.transaction_id) |
| 422 | } |
| 423 | |
| 424 | /// Request to commit/rollback a transaction. |
| 425 | pub async fn end_transaction( |