Skip to main content

SagaTransaction

Trait SagaTransaction 

Source
pub trait SagaTransaction {
    type Err: Into<Error> + From<Error>;

    // Required methods
    fn get_saga<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        operation_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Saga>, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_saga_for_update<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        operation_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Acquired<Saga>>, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_saga<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        saga: &'life1 Saga,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_acquired_saga<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        saga: &'life1 mut Acquired<Saga>,
        new_state: SagaStateEnum,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_acquired_saga_with_finalization_data<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        saga: &'life1 mut Acquired<Saga>,
        new_state: SagaStateEnum,
        finalization_data: Option<&'life2 MeltFinalizationData>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete_saga<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        operation_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Saga Transaction trait

Required Associated Types§

Source

type Err: Into<Error> + From<Error>

Saga Database Error

Required Methods§

Source

fn get_saga<'life0, 'life1, 'async_trait>( &'life0 mut self, operation_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Saga>, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get saga by operation_id

Source

fn get_saga_for_update<'life0, 'life1, 'async_trait>( &'life0 mut self, operation_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Acquired<Saga>>, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a saga by operation ID and mark it as acquired for mutation.

Implementations must lock the returned row for the lifetime of the transaction. Saga mutation methods require this marker so callers cannot update a stale snapshot loaded outside the transaction.

Source

fn add_saga<'life0, 'life1, 'async_trait>( &'life0 mut self, saga: &'life1 Saga, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add saga

Source

fn update_acquired_saga<'life0, 'life1, 'async_trait>( &'life0 mut self, saga: &'life1 mut Acquired<Saga>, new_state: SagaStateEnum, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update the state of an acquired saga.

Source

fn update_acquired_saga_with_finalization_data<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, saga: &'life1 mut Acquired<Saga>, new_state: SagaStateEnum, finalization_data: Option<&'life2 MeltFinalizationData>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update an acquired saga state and optional finalization metadata.

Source

fn delete_saga<'life0, 'life1, 'async_trait>( &'life0 mut self, operation_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete saga

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§