[][src]Trait cqrs::EntityStore

pub trait EntityStore<A, E, M>: EntitySource<A, E> + EntitySink<A, E, M> where
    A: Aggregate,
    E: AggregateEvent<A>, 
{ fn load_or_default_exec_and_persist<I, C>(
        &self,
        id: &I,
        command: C,
        precondition: Option<Precondition>,
        metadata: M
    ) -> Result<HydratedAggregate<A>, EntityError<Self::Error, Self::Error, A, C, Self::Error, Self::Error>>
    where
        I: AggregateId<A>,
        C: AggregateCommand<A, Event = E>,
        C::Events: Events<E>
, { ... }
fn load_exec_and_persist<I, C>(
        &self,
        id: &I,
        command: C,
        precondition: Option<Precondition>,
        metadata: M
    ) -> Result<Option<HydratedAggregate<A>>, EntityError<Self::Error, Self::Error, A, C, Self::Error, Self::Error>>
    where
        I: AggregateId<A>,
        C: AggregateCommand<A, Event = E>,
        C::Events: Events<E>
, { ... } }

A generalized entity store that can perform operations on its entities.

Provided methods

fn load_or_default_exec_and_persist<I, C>(
    &self,
    id: &I,
    command: C,
    precondition: Option<Precondition>,
    metadata: M
) -> Result<HydratedAggregate<A>, EntityError<Self::Error, Self::Error, A, C, Self::Error, Self::Error>> where
    I: AggregateId<A>,
    C: AggregateCommand<A, Event = E>,
    C::Events: Events<E>, 

Attempts to load an aggregate, using the default instance if the aggregate does not yet exist, executes a command and persists any new events, possibly peristing a new snapshot if necessary.

fn load_exec_and_persist<I, C>(
    &self,
    id: &I,
    command: C,
    precondition: Option<Precondition>,
    metadata: M
) -> Result<Option<HydratedAggregate<A>>, EntityError<Self::Error, Self::Error, A, C, Self::Error, Self::Error>> where
    I: AggregateId<A>,
    C: AggregateCommand<A, Event = E>,
    C::Events: Events<E>, 

Loads an aggregate, executes a command and persists any new events, possibly persisting a new snapshot if necessary.

If the aggregate does not exist, returns Ok(None).

Loading content...

Implementors

impl<A, E, M, T> EntityStore<A, E, M> for T where
    A: Aggregate,
    E: AggregateEvent<A>,
    T: EntitySource<A, E> + EntitySink<A, E, M>, 
[src]

Loading content...