Skip to main content

Transactional

Trait Transactional 

Source
pub trait Transactional: Store {
    // Required methods
    fn begin_tx<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn TxHandle>, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn commit_tx<'life0, 'async_trait>(
        &'life0 self,
        tx: Box<dyn TxHandle>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rollback_tx<'life0, 'async_trait>(
        &'life0 self,
        tx: Box<dyn TxHandle>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn enqueue_tx<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tx: &'life1 mut dyn TxHandle,
        batch: &'life2 [Envelope],
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn complete_tx_with_actual_weight<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tx: &'life1 mut dyn TxHandle,
        lease: &'life2 LeaseRef,
        actual_weight: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn claim_effect<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tx: &'life1 mut dyn TxHandle,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn checkpoint_tx<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tx: &'life1 mut dyn TxHandle,
        lease: &'life2 LeaseRef,
        cp: &'life3 Checkpoint,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn complete_tx<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tx: &'life1 mut dyn TxHandle,
        lease: &'life2 LeaseRef,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}

Required Methods§

Source

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

Open a store transaction for the dyn path (transactional API). Callers holding their own driver transaction wrap it instead (caller-owned transaction contract) — this is for code that only knows dyn Transactional, like [Job.Once]-style helpers.

Source

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

Source

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

Source

fn enqueue_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tx: &'life1 mut dyn TxHandle, batch: &'life2 [Envelope], ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn complete_tx_with_actual_weight<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tx: &'life1 mut dyn TxHandle, lease: &'life2 LeaseRef, actual_weight: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Transactional completion with the same surveyed policy behavior post-hoc correction as ack. This exists separately because once completes inside the caller’s transaction; reconciling outside it could charge an effect whose fenced completion rolled back.

Source

fn claim_effect<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tx: &'life1 mut dyn TxHandle, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

transactional effects claim an effect key inside the caller’s transaction. false means the key was already claimed by a COMMITTED transaction — the effect ran; skip the work. The claim commits (or vanishes) with everything else in the transaction, which is the entire mechanism behind at-most-once effects.

Source

fn checkpoint_tx<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tx: &'life1 mut dyn TxHandle, lease: &'life2 LeaseRef, cp: &'life3 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

step replay × transactional effects write the checkpoint inside the caller’s transaction, fence-verified. This is what makes a step’s effects and its completion marker ONE commit: a step-scoped once claims {job}/{step}, does its writes, and records the step complete — atomically. A superseded holder fails here and everything rolls back.

Provided Methods§

Source

fn complete_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tx: &'life1 mut dyn TxHandle, lease: &'life2 LeaseRef, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§