Skip to main content

TransactionSink

Trait TransactionSink 

Source
pub trait TransactionSink:
    Send
    + Sync
    + 'static {
    // Required methods
    fn new_transaction<'a, 'async_trait>(
        self: Arc<Self>,
        txn_locks: LockKeys,
        options: Options<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<Transaction<'a>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn check_space<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn reserve(
        &self,
        owner_object_id: Option<u64>,
        amount: u64,
    ) -> Option<Reservation>;
    fn commit<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        transaction: &'life1 mut Transaction<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn commit_with_callback<'a, 'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        transaction: &'life1 mut Transaction<'life2>,
        callback: Box<dyn FnOnce(u64) + Send + 'a>,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn downgrade_locks(&self, lock_keys: &LockKeys);
    fn drop_transaction(&self, transaction: &mut Transaction<'_>);
    fn lock_manager(&self) -> &LockManager;
    fn transaction_limiter(&self) -> &TransactionConcurrencyLimiter;

    // Provided methods
    fn image_builder_mode(&self) -> bool { ... }
    fn metadata_reservation(&self) -> Option<&Reservation> { ... }
    fn is_system_store(&self, _store_id: u64) -> bool { ... }
}
Expand description

An object into which transactions are committed. Usually, this is the journal.

This exists as an abstraction for remotely mounted volumes, which need to submit transactions to the remote filesystem rather than directly writing into the journal.

Required Methods§

Source

fn new_transaction<'a, 'async_trait>( self: Arc<Self>, txn_locks: LockKeys, options: Options<'a>, ) -> Pin<Box<dyn Future<Output = Result<Transaction<'a>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Creates a new transaction, acquiring txn_locks. See Options for details.

Source

fn check_space<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks that there is sufficient space in the journal to write a transaction, blocking if necessary until space is available.

Source

fn reserve( &self, owner_object_id: Option<u64>, amount: u64, ) -> Option<Reservation>

Reserves space for a transaction’s metadata. Returns None if there is insufficient space.

Source

fn commit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, transaction: &'life1 mut Transaction<'life2>, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Commits a transaction. Returns a monotonically increasing offset (usually, the journal offset of the transaction) on success.

Source

fn commit_with_callback<'a, 'life0, 'life1, 'life2, 'async_trait>( &'life0 self, transaction: &'life1 mut Transaction<'life2>, callback: Box<dyn FnOnce(u64) + Send + 'a>, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Like Self::commit, but invokes a callback upon completion, before dropping locks.

Source

fn downgrade_locks(&self, lock_keys: &LockKeys)

Downgrades locks from the WriteLock state to Locked state. This will panic if the locks are not in the WriteLock state.

Source

fn drop_transaction(&self, transaction: &mut Transaction<'_>)

A function to be called by Transaction::drop, allowing for additional work to be performed on drop.

Source

fn lock_manager(&self) -> &LockManager

Returns the lock manager instance.

Source

fn transaction_limiter(&self) -> &TransactionConcurrencyLimiter

Returns the transaction concurrency limiter.

Provided Methods§

Source

fn image_builder_mode(&self) -> bool

Returns true if the sink is in image builder mode.

Source

fn metadata_reservation(&self) -> Option<&Reservation>

Returns the global metadata reservation if supported by this sink.

Source

fn is_system_store(&self, _store_id: u64) -> bool

Returns true if store_id is a system store (root_store or root_parent_store).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§