Struct cqrs_es::EventEnvelope
source · pub struct EventEnvelope<A>where
A: Aggregate,{
pub aggregate_id: String,
pub sequence: usize,
pub payload: A::Event,
pub metadata: HashMap<String, String>,
}
Expand description
EventEnvelope
is a data structure that encapsulates an event with its pertinent
information.
All of the associated data will be transported and persisted together and will be available
for queries.
Within any system an event must be unique based on the compound key composed of its:
aggregate_type
aggregate_id
sequence
Thus an EventEnvelope
provides a uniqueness value along with an event payload
and
metadata
.
Fields§
§aggregate_id: String
The id of the aggregate instance.
sequence: usize
The sequence number for an aggregate instance.
payload: A::Event
The event payload with all business information.
metadata: HashMap<String, String>
Additional metadata for use in auditing, logging or debugging purposes.
Trait Implementations§
source§impl<A: Aggregate> Clone for EventEnvelope<A>
impl<A: Aggregate> Clone for EventEnvelope<A>
source§impl<A> Debug for EventEnvelope<A>
impl<A> Debug for EventEnvelope<A>
source§impl<A: Aggregate> TryFrom<&EventEnvelope<A>> for SerializedEvent
impl<A: Aggregate> TryFrom<&EventEnvelope<A>> for SerializedEvent
§type Error = PersistenceError
type Error = PersistenceError
The type returned in the event of a conversion error.
source§impl<A: Aggregate> TryFrom<SerializedEvent> for EventEnvelope<A>
impl<A: Aggregate> TryFrom<SerializedEvent> for EventEnvelope<A>
§type Error = PersistenceError
type Error = PersistenceError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<A> RefUnwindSafe for EventEnvelope<A>
impl<A> Send for EventEnvelope<A>
impl<A> Sync for EventEnvelope<A>
impl<A> Unpin for EventEnvelope<A>
impl<A> UnwindSafe for EventEnvelope<A>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more