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

Executes 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