start_transaction

Function start_transaction 

Source
pub fn start_transaction<T, E, F>(f: F) -> Result<T, E>
where F: FnOnce() -> Result<T, E>, E: From<TransactionError>,
Expand description

Begin a transaction in the current fiber.

A transaction is attached to caller fiber, therefore one fiber can have only one active transaction.

  • f - function will be invoked within transaction

Returns result of function f execution. Depending on the function result:

  • will commit - if function completes successfully
  • will rollback - if function completes with any error