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§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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,
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