Skip to main content

Transaction

Trait Transaction 

Source
pub trait Transaction<Error>:
    DbTransactionFinalizer<Err = Error>
    + QuotesTransaction<Err = Error>
    + SignaturesTransaction<Err = Error>
    + ProofsTransaction<Err = Error>
    + KVStoreTransaction<Error>
    + SagaTransaction<Err = Error>
    + CompletedOperationsTransaction<Err = Error> {
    // Provided methods
    fn lock_quotes<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _quote_ids: &'life1 [QuoteId],
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn try_lock_quotes<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _quote_ids: &'life1 [QuoteId],
    ) -> Pin<Box<dyn Future<Output = Result<QuoteLockAttempt, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Base database writer

Quote advisory locks coordinate operations whose critical section extends beyond an existing row lock. Callers must acquire all quote locks before taking row locks, and implementations must acquire a batch in stable order. Locks are held until the transaction commits or rolls back.

Provided Methods§

Source

fn lock_quotes<'life0, 'life1, 'async_trait>( &'life0 mut self, _quote_ids: &'life1 [QuoteId], ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lock a set of quote identifiers for this transaction.

Returns true when the backend acquired a cross-process lock. Backends that serialize writes without a lock that can span the required critical section return false, allowing callers to retain a process-local guard.

Source

fn try_lock_quotes<'life0, 'life1, 'async_trait>( &'life0 mut self, _quote_ids: &'life1 [QuoteId], ) -> Pin<Box<dyn Future<Output = Result<QuoteLockAttempt, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Non-blocking variant of Transaction::lock_quotes.

Returns QuoteLockAttempt::Contended when another transaction holds any of the locks, instead of waiting for it. Any partial acquisitions are held until the transaction ends, so callers should roll back on Contended.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§