Rollback-safe direct transaction operations and bounded whole-callback retry.
MVCC is experimental upstream and provides snapshot isolation. Concurrent
transactions use tested BEGIN CONCURRENT SQL because Turso 0.7.2 has no
public Rust TransactionBehavior::Concurrent variant.
Summary
Functions
Begins a transaction in the selected mode.
Runs a tested WAL/MVCC checkpoint pragma and returns its ordered rows.
Commits the active transaction.
Retries a complete transaction callback only after retryable engine errors.
Rolls back the active transaction.
Sets and verifies the experimental MVCC checkpoint threshold.
Runs a callback and commits only its successful return value.
Functions
@spec begin( Tursox.Connection.t(), keyword() ) :: :ok | {:error, Tursox.Error.t()}
Begins a transaction in the selected mode.
@spec checkpoint(Tursox.Connection.t(), :passive | :full | :restart | :truncate) :: {:ok, [[term()]]} | {:error, Tursox.Error.t()}
Runs a tested WAL/MVCC checkpoint pragma and returns its ordered rows.
@spec commit(Tursox.Connection.t()) :: :ok | {:error, Tursox.Error.t()}
Commits the active transaction.
@spec retry_transaction(Tursox.Connection.t(), (-> term()), keyword()) :: {:ok, term()} | {:error, term() | Tursox.Error.t()}
Retries a complete transaction callback only after retryable engine errors.
@spec rollback(Tursox.Connection.t()) :: :ok | {:error, Tursox.Error.t()}
Rolls back the active transaction.
@spec set_mvcc_checkpoint_threshold(Tursox.Connection.t(), non_neg_integer()) :: {:ok, non_neg_integer()} | {:error, Tursox.Error.t()}
Sets and verifies the experimental MVCC checkpoint threshold.
@spec transaction(Tursox.Connection.t(), (-> term()), keyword()) :: {:ok, term()} | {:error, term() | Tursox.Error.t()} | no_return()
Runs a callback and commits only its successful return value.
{:error, reason}, exceptions, throws, and exits roll back. Raised/thrown/exited
control flow is re-raised after rollback.