pub enum TransactionManagerStatus {
Valid(ValidTransactionManagerStatus),
InError,
}
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.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
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
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>
pub fn transaction_state( &mut self, ) -> QueryResult<&mut ValidTransactionManagerStatus>
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)
pub fn set_test_transaction_flag(&mut self)
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