[−][src]Trait eventually_core::aggregate::Aggregate
An Aggregate manages a domain entity State
, acting as a transaction boundary.
It allows state mutations through the use of Command
s, which the
Aggregate instance handles and emits a number of Domain Event
s.
Associated Types
type State: Identifiable
State of the Aggregate: this should represent the Domain Entity data structure.
type Event
Represents a specific, domain-related change to the Aggregate State
.
type Command
Commands are all the possible operations available on an Aggregate.
Use Commands to model business use-cases or State
mutations.
type Error
Required methods
fn apply(
state: Self::State,
event: Self::Event
) -> Result<Self::State, Self::Error>
state: Self::State,
event: Self::Event
) -> Result<Self::State, Self::Error>
Applies an Event
to the current Aggregate State
.
To enforce immutability, this method takes ownership of the previous State
and the current Event
to apply, and returns the new version of the State
or an error.
fn handle<'a, 's: 'a>(
&'a self,
state: &'s Self::State,
command: Self::Command
) -> BoxFuture<'a, Result<Vec<Self::Event>, Self::Error>> where
Self: Sized,
&'a self,
state: &'s Self::State,
command: Self::Command
) -> BoxFuture<'a, Result<Vec<Self::Event>, Self::Error>> where
Self: Sized,
Implementations on Foreign Types
impl<T> Aggregate for Arc<T> where
T: Aggregate,
[src]
T: Aggregate,
type State = T::State
type Event = T::Event
type Command = T::Command
type Error = T::Error
fn apply(
state: Self::State,
event: Self::Event
) -> Result<Self::State, Self::Error>
[src]
state: Self::State,
event: Self::Event
) -> Result<Self::State, Self::Error>
fn handle<'agg, 'st: 'agg>(
&'agg self,
state: &'st Self::State,
command: Self::Command
) -> BoxFuture<'agg, Result<Vec<Self::Event>, Self::Error>> where
Self: Sized,
[src]
&'agg self,
state: &'st Self::State,
command: Self::Command
) -> BoxFuture<'agg, Result<Vec<Self::Event>, Self::Error>> where
Self: Sized,