Trait cqrs_es2_store::IEventStore [−][src]
pub trait IEventStore<C: ICommand, E: IEvent, A: IAggregate<C, E>> {
fn save_events(
&mut self,
contexts: &Vec<EventContext<C, E>>
) -> Result<(), Error>;
fn load_events(
&mut self,
aggregate_id: &str
) -> Result<Vec<EventContext<C, E>>, Error>;
fn save_aggregate_snapshot(
&mut self,
context: AggregateContext<C, E, A>
) -> Result<(), Error>;
fn load_aggregate_from_snapshot(
&mut self,
aggregate_id: &str
) -> Result<AggregateContext<C, E, A>, Error>;
}
Expand description
The abstract central source for loading past events and committing new events.
Required methods
fn save_events(
&mut self,
contexts: &Vec<EventContext<C, E>>
) -> Result<(), Error>
fn save_events(
&mut self,
contexts: &Vec<EventContext<C, E>>
) -> Result<(), Error>
Save new events
fn load_events(
&mut self,
aggregate_id: &str
) -> Result<Vec<EventContext<C, E>>, Error>
fn load_events(
&mut self,
aggregate_id: &str
) -> Result<Vec<EventContext<C, E>>, Error>
Load all events for a particular aggregate_id
fn save_aggregate_snapshot(
&mut self,
context: AggregateContext<C, E, A>
) -> Result<(), Error>
fn save_aggregate_snapshot(
&mut self,
context: AggregateContext<C, E, A>
) -> Result<(), Error>
save a new aggregate snapshot
fn load_aggregate_from_snapshot(
&mut self,
aggregate_id: &str
) -> Result<AggregateContext<C, E, A>, Error>
fn load_aggregate_from_snapshot(
&mut self,
aggregate_id: &str
) -> Result<AggregateContext<C, E, A>, Error>
Load aggregate at current state from snapshots