Module eventually::aggregate
source · Expand description
Module containing support for the Aggregate pattern.
§What is an Aggregate?
An Aggregate is the most important concept in your domain.
It represents the entities your business domain is composed of, and the business logic your domain is exposing.
For example: in an Order Management bounded-context (e.g. a microservice), the concepts of Order or Customer are two potential Aggregates.
Aggregates expose mutations with the concept of commands: from the previous example, an Order might expose some commands such as “Add Order Item”, or “Remove Order Item”, or “Place Order” to close the transaction.
In Event Sourcing, the Aggregate state is modified by the usage of Domain Events, which carry some or all the fields in the state in a certain logical meaning.
As such, commands in Event Sourcing will produce Domain Events.
Aggregates should provide a way to fold Domain Events on the current value of the state, to produce the next state.
Re-exports§
pub use repository::EventSourced as EventSourcedRepository;
pub use repository::Repository;
Modules§
- Module containing the definition of a Repository, to fetch and store Aggregate Roots from a data store.
Structs§
- An Aggregate Root represents the Domain Entity object used to load and save an Aggregate from and to a Repository, and to perform actions that may result in new Domain Events to change the state of the Aggregate.
Enums§
- List of possible errors that can be returned by
Root::rehydrate_async
.
Traits§
- An Aggregate represents a Domain Model that, through an Aggregate Root, acts as a transactional boundary.