Trait esrs::store::EventStore[][src]

pub trait EventStore<Event: Serialize + DeserializeOwned + Send + Sync, Error> {
    fn by_aggregate_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StoreEvent<Event>>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn persist<'life0, 'async_trait>(
        &'life0 self,
        aggregate_id: Uuid,
        events: Vec<Event>,
        starting_sequence_number: SequenceNumber
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StoreEvent<Event>>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn close<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }
Expand description

An EventStore is responsible for persisting events that an aggregate emits into a database, and loading the events that represent an aggregate’s history from the database.

Required methods

Loads the events that an aggregate instance has emitted in the past.

Persists multiple events into the database. This should be done transactionally - either all the events are persisted correctly, or none are.

Persisting events may additionally trigger configured Policies or Projectors.

Implementors