pub enum TransactionManagerStatus {
Valid(ValidTransactionManagerStatus),
InError,
}
Expand description
Status of the transaction manager
Variants§
Valid(ValidTransactionManagerStatus)
Valid status, the manager can run operations
InError
Error status, probably following a broken connection. The manager will no longer run operations
Implementations§
source§impl TransactionManagerStatus
impl TransactionManagerStatus
sourcepub fn transaction_depth(&self) -> QueryResult<Option<NonZeroU32>>
pub fn transaction_depth(&self) -> QueryResult<Option<NonZeroU32>>
Returns the transaction depth if the transaction manager’s status is valid, or returns
Error::BrokenTransactionManager
if the transaction manager is in error.
sourcepub fn set_requires_rollback_maybe_up_to_top_level(&mut self, to: bool)
Available on (crate features i-implement-a-third-party-backend-and-opt-into-breaking-changes
or postgres
or mysql
) and crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.
pub fn set_requires_rollback_maybe_up_to_top_level(&mut self, to: bool)
i-implement-a-third-party-backend-and-opt-into-breaking-changes
or postgres
or mysql
) and crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.If in transaction and transaction manager is not broken, registers that it’s possible that the connection can not be used anymore until top-level transaction is rolled back.
If that is registered, savepoints rollbacks will still be attempted, but failure to do so will not result in an error. (Some may succeed, some may not.)
sourcepub fn set_in_error(&mut self)
pub fn set_in_error(&mut self)
Sets the transaction manager status to InError
Subsequent attempts to use transaction-related features will result in a
Error::BrokenTransactionManager
error
sourcepub fn transaction_state(
&mut self
) -> QueryResult<&mut ValidTransactionManagerStatus>
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.
pub fn transaction_state( &mut self ) -> QueryResult<&mut ValidTransactionManagerStatus>
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Expose access to the inner transaction state
This function returns an error if the Transaction manager is in a broken state
sourcepub fn set_test_transaction_flag(&mut self)
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.
pub fn set_test_transaction_flag(&mut self)
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.This function allows to flag a transaction manager in such a way that it contains a test transaction.
This will disable some checks in regards to open transactions
to allow Connection::begin_test_transaction
to work with
pooled connections as well