Module krill::commons::eventsourcing
source · Expand description
Event sourcing support for Krill
Macros
- Macro to provide a safe way to create a
&Namespace
at compile-time. - Macro to provide a safe way to create a
&Segment
at compile-time.
Structs
- This type is responsible for managing aggregates.
- Example listener that simply counts all events
- A string slice representing a namespace.
- Used to scope a
Key
. Consists of a vector of zero or moreSegmentBuf
s. - A nonempty string slice that does not start or end with whitespace and does not contain any instances of
Scope::SEPARATOR
. - A nonempty string that does not start or end with whitespace and does not contain any instances of
Scope::SEPARATOR
. - Convenience wrapper so that implementations can just implement [‘CommandDetails’] and leave the id and version boilerplate.
- Convenience wrapper so that implementations can just implement [‘InitCommandDetails’] and leave the id and version boilerplate.
- A description of a command that was processed, and the events / or error that followed. Commands that turn out to be no-ops (no events, no errors) should not be stored.
- Helper to create StoredCommand instances that will contain the atomic change sets for Aggregates.
- Describes a set of “write-ahead” changes affecting the specified revision. Meaning that it can only be applied if the type is of the given revision, and it will get this revision + 1 after it has been applied.
- This type is responsible for loading / saving and updating
WalSupport
capable types.
Enums
- This type defines possible Errors for the AggregateStore
- This type defines possible Errors for KeyStore
- This type defines possible Errors for the AggregateStore
Traits
- This trait defines an Aggregate for use with the event sourcing framework.
- Commands are used to send an intent to change an aggregate.
- Implement this for an enum with CommandDetails, so you you can reuse the id and version boilerplate from [‘SentCommand’].
- The InitCommand is used to create an aggregate.
- Implement this for an enum with CommandDetails, so you you can reuse the id and version boilerplate from [‘SentCommand’].
- This trait defines a listener for events which is designed to receive them after the updated Aggregate is saved. Because the updates already happened EventListeners of this type are not allowed to fail.
- This trait defines a listener for events which is designed to receive the events before the Aggregate is saved. Thus, they are allowed to return an error in case of issues, which will then roll back the intended change to an aggregate.
- Implement this trait to get write-ahead logging support for a type.
- Must be implemented for all ‘StorableDetails’ used in Commands.