EventStore

Trait EventStore 

Source
pub trait EventStore {
    // Required methods
    fn append_events<'life0, 'async_trait>(
        &'life0 self,
        events: Vec<DomainEvent>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_events<'life0, 'async_trait>(
        &'life0 self,
        query: EventStreamQuery,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DomainEvent>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_latest_sequence<'life0, 'life1, 'async_trait>(
        &'life0 self,
        aggregate_id: &'life1 AggregateId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<EventSequence>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_snapshot<'life0, 'async_trait>(
        &'life0 self,
        snapshot: AggregateSnapshot,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn load_snapshot<'life0, 'life1, 'async_trait>(
        &'life0 self,
        aggregate_id: &'life1 AggregateId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<AggregateSnapshot>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn aggregate_exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        aggregate_id: &'life1 AggregateId,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for event store implementations

Required Methods§

Source

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

Append events to the store

Source

fn read_events<'life0, 'async_trait>( &'life0 self, query: EventStreamQuery, ) -> Pin<Box<dyn Future<Output = Result<Vec<DomainEvent>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read events from the store

Source

fn get_latest_sequence<'life0, 'life1, 'async_trait>( &'life0 self, aggregate_id: &'life1 AggregateId, ) -> Pin<Box<dyn Future<Output = Result<Option<EventSequence>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the latest sequence number for an aggregate

Source

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

Save a snapshot

Source

fn load_snapshot<'life0, 'life1, 'async_trait>( &'life0 self, aggregate_id: &'life1 AggregateId, ) -> Pin<Box<dyn Future<Output = Result<Option<AggregateSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load the latest snapshot for an aggregate

Source

fn aggregate_exists<'life0, 'life1, 'async_trait>( &'life0 self, aggregate_id: &'life1 AggregateId, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if aggregate exists

Implementors§