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

View State Repository trait

Generic parameters:

  • E - Event
  • S - State
  • Error - Error

Required Methods§

source

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

Fetches current state, based on the event.

source

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

Saves the new state.

Implementors§

source§

impl<S, E, Repository, View, Error> ViewStateRepository<E, S, Error> for MaterializedView<S, E, Repository, View, Error>
where Repository: ViewStateRepository<E, S, Error> + Sync, View: ViewStateComputation<E, S> + Sync, E: Sync, S: Sync, Error: Sync,