Struct rbatis::tx::TxManager[][src]

pub struct TxManager {
    pub tx_prefix: String,
    pub tx_context: SyncMap<String, (DBTx, TxState)>,
    pub tx_lock_wait_timeout: Duration,
    pub tx_check_interval: Duration,
    pub alive: AtomicBool,
    pub log_plugin: Option<Arc<Box<dyn LogPlugin>>>,
}

the Transaction manager,It manages the life cycle of transactions and provides access across threads every tx_check_interval check tx is out of time(tx_lock_wait_timeout).if out, rollback tx. if tx manager will be drop, manager will rollback all of tx.

Fields

tx_prefix: Stringtx_context: SyncMap<String, (DBTx, TxState)>tx_lock_wait_timeout: Durationtx_check_interval: Durationalive: AtomicBoollog_plugin: Option<Arc<Box<dyn LogPlugin>>>

Implementations

impl TxManager[src]

pub fn new_arc(
    tx_prefix: &str,
    plugin: Arc<Box<dyn LogPlugin>>,
    tx_lock_wait_timeout: Duration,
    tx_check_interval: Duration
) -> Arc<Self>
[src]

pub fn set_alive(&self, alive: bool)[src]

pub fn get_alive(&self) -> bool[src]

pub fn close(&self)[src]

pub async fn get_mut<'a>(
    &'a self,
    context_id: &str
) -> Option<RefMut<'a, String, (DBTx, TxState)>>
[src]

pub async fn begin(
    &self,
    new_context_id: &str,
    pool: &DBPool
) -> Result<String, Error>
[src]

begin tx,for new conn

pub async fn commit(&self, context_id: &str) -> Result<String, Error>[src]

commit tx,and return conn

pub async fn rollback(&self, context_id: &str) -> Result<String, Error>[src]

rollback tx,and return conn

pub fn is_tx_prifix_id(&self, context_id: &str) -> bool[src]

context_id is ‘tx:’ prifix ?

Trait Implementations

impl Debug for TxManager[src]

impl Drop for TxManager[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,