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
Trait Implementations§
Source§impl Debug for TransactionManagerStatus
impl Debug for TransactionManagerStatus
Auto Trait Implementations§
impl Freeze for TransactionManagerStatus
impl RefUnwindSafe for TransactionManagerStatus
impl Send for TransactionManagerStatus
impl Sync for TransactionManagerStatus
impl Unpin for TransactionManagerStatus
impl UnwindSafe for TransactionManagerStatus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.