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 methods
    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 { ... }
    fn recovered_boot_nonce<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64, 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(()).

Source

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

Journal-derived boot nonce, meaningful only after recover_from_journal.

The nonce scopes context command IDs per boot against the durable dedup store so re-issued process-local command IDs are never suppressed as duplicates of an earlier boot’s recorded IDs. The default Ok(0) applies to stores without durable journal support.

Err means the deterministic nonce space is exhausted (an adversarial recorded command ID): the error message names the offending recorded ID and instructs the operator to clean or rotate the journal.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§