Trait cqrs_es2::IEventStore [−][src]
pub trait IEventStore<C: ICommand, E: IEvent, A: IAggregate<C, E>> { fn load_events(
&mut self,
aggregate_id: &str,
with_metadata: bool
) -> Result<Vec<EventContext<C, E>>, AggregateError>; fn load_aggregate(
&mut self,
aggregate_id: &str
) -> Result<AggregateContext<C, E, A>, AggregateError>; fn commit(
&mut self,
events: Vec<E>,
context: AggregateContext<C, E, A>,
metadata: HashMap<String, String>
) -> Result<Vec<EventContext<C, E>>, AggregateError>; fn wrap_events(
&self,
aggregate_id: &str,
current_sequence: usize,
events: Vec<E>,
metadata: HashMap<String, String>
) -> Vec<EventContext<C, E>> { ... } }
Expand description
The abstract central source for loading past events and committing new events.
Required methods
fn load_events(
&mut self,
aggregate_id: &str,
with_metadata: bool
) -> Result<Vec<EventContext<C, E>>, AggregateError>
fn load_events(
&mut self,
aggregate_id: &str,
with_metadata: bool
) -> Result<Vec<EventContext<C, E>>, AggregateError>
Load all events for a particular aggregate_id
fn load_aggregate(
&mut self,
aggregate_id: &str
) -> Result<AggregateContext<C, E, A>, AggregateError>
fn load_aggregate(
&mut self,
aggregate_id: &str
) -> Result<AggregateContext<C, E, A>, AggregateError>
Load aggregate at current state
fn commit(
&mut self,
events: Vec<E>,
context: AggregateContext<C, E, A>,
metadata: HashMap<String, String>
) -> Result<Vec<EventContext<C, E>>, AggregateError>
fn commit(
&mut self,
events: Vec<E>,
context: AggregateContext<C, E, A>,
metadata: HashMap<String, String>
) -> Result<Vec<EventContext<C, E>>, AggregateError>
Commit new events
Provided methods
fn wrap_events(
&self,
aggregate_id: &str,
current_sequence: usize,
events: Vec<E>,
metadata: HashMap<String, String>
) -> Vec<EventContext<C, E>>
fn wrap_events(
&self,
aggregate_id: &str,
current_sequence: usize,
events: Vec<E>,
metadata: HashMap<String, String>
) -> Vec<EventContext<C, E>>
Method to wrap a set of events with the additional metadata needed for persistence and publishing