Skip to main content

RuntimeUnitOfWorkPort

Trait RuntimeUnitOfWorkPort 

Source
pub trait RuntimeUnitOfWorkPort: Send + Sync {
    // Required methods
    fn persist_upsert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        aggregate: RouteRuntimeAggregate,
        expected_version: Option<u64>,
        projection: RouteStatusProjection,
        events: &'life1 [RuntimeEvent],
    ) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn persist_delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        route_id: &'life1 str,
        events: &'life2 [RuntimeEvent],
    ) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn recover_from_journal<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn persist_upsert<'life0, 'life1, 'async_trait>( &'life0 self, aggregate: RouteRuntimeAggregate, expected_version: Option<u64>, projection: RouteStatusProjection, events: &'life1 [RuntimeEvent], ) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomically persist aggregate + projection + events for an upsert transition.

Source

fn persist_delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, route_id: &'life1 str, events: &'life2 [RuntimeEvent], ) -> Pin<Box<dyn Future<Output = Result<(), DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically persist delete transition (remove aggregate/projection + append events).

Provided Methods§

Source

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

Recover in-memory runtime state from durable journal, if available.

Implementations without durable journal support should return Ok(()).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§