pub trait EventRepository<C, E, Version, Error> {
    // Required methods
    fn fetch_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        command: &'life1 C
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(E, Version)>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        events: &'life1 [E],
        latest_version: &'life2 Option<Version>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(E, Version)>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Event Repository trait

Generic parameters:

  • C - Command
  • E - Event
  • Version - Version/Offset/Sequence number
  • Error - Error

Required Methods§

source

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

Fetches current events, based on the command.

source

fn save<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, events: &'life1 [E], latest_version: &'life2 Option<Version> ) -> Pin<Box<dyn Future<Output = Result<Vec<(E, Version)>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Saves events.

Implementors§

source§

impl<C, S, E, Repository, Decider, Version, Error> EventRepository<C, E, Version, Error> for EventSourcedAggregate<C, S, E, Repository, Decider, Version, Error>
where Repository: EventRepository<C, E, Version, Error> + Sync, Decider: EventComputation<C, S, E> + Sync, C: Sync, S: Sync, E: Sync, Version: Sync, Error: Sync,