pub trait StateRepository<C, S, Version, Error> {
    // Required methods
    fn fetch_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        command: &'life1 C
    ) -> Pin<Box<dyn Future<Output = Result<Option<(S, Version)>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        state: &'life1 S,
        version: &'life2 Option<Version>
    ) -> Pin<Box<dyn Future<Output = Result<(S, Version), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

State Repository trait

Generic parameters:

  • C - Command
  • S - State
  • Version - Version
  • Error - Error

Required Methods§

source

fn fetch_state<'life0, 'life1, 'async_trait>( &'life0 self, command: &'life1 C ) -> Pin<Box<dyn Future<Output = Result<Option<(S, Version)>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches current state, based on the command.

source

fn save<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, state: &'life1 S, version: &'life2 Option<Version> ) -> Pin<Box<dyn Future<Output = Result<(S, Version), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Saves state.

Implementors§

source§

impl<C, S, E, Repository, Decider, Version, Error> StateRepository<C, S, Version, Error> for StateStoredAggregate<C, S, E, Repository, Decider, Version, Error>
where Repository: StateRepository<C, S, Version, Error> + Sync, Decider: StateComputation<C, S, E> + Sync, C: Sync, S: Sync, E: Sync, Version: Sync, Error: Sync,