pub struct StoredEvent {
pub sequence: u64,
pub event_id: EventId,
pub account_id: AccountId,
pub case_key: CaseKey,
pub case_revision: CaseRevision,
pub command_id: CommandId,
pub event_type: String,
pub payload: Value,
pub occurred_at: DateTime<Utc>,
pub redaction: Option<EventRedaction>,
}Expand description
A committed event as persisted (spec §22.2, tf_domain_events).
Fields§
§sequence: u64Store-assigned position in the journal, strictly increasing in append order across the whole store — not per case and not per account.
It is a position, not a count: nothing promises it has no gaps, only
that a later append gets a higher one. EventCursor pages by it; see
the module documentation for why the revision cannot.
event_id: EventIdIdentifier in the ledger.
account_id: AccountIdOwning tenant.
case_key: CaseKeyThe case.
case_revision: CaseRevisionRevision of the case produced by the commit that emitted the event.
command_id: CommandIdCommand whose execution produced it.
event_type: StringStable event type label.
payload: ValueType-erased payload, or JSON null once it has been erased.
Self::redaction is what says which of the two it is; a domain whose
event type legitimately serializes to null is not misread.
occurred_at: DateTime<Utc>When it was committed.
redaction: Option<EventRedaction>Present once the payload has been erased, saying when and on whose authority — never what was removed.
It defaults to absent, so a record written before this field existed reads back as an event whose payload is intact, which it is.
Implementations§
Source§impl StoredEvent
impl StoredEvent
Sourcepub fn to_committed(&self) -> CommittedEvent<Value>
pub fn to_committed(&self) -> CommittedEvent<Value>
The core view of the event.
The payload comes back as it is stored, so an erased event yields a
null payload here. Use Self::to_receipt_event wherever the caller
has to tell the two apart, which is everywhere a receipt is rendered.
Sourcepub fn is_redacted(&self) -> bool
pub fn is_redacted(&self) -> bool
Returns true when the payload has been erased.
Sourcepub fn to_receipt_event(&self) -> ReceiptEvent<Value>
pub fn to_receipt_event(&self) -> ReceiptEvent<Value>
The event in the form a receipt renderer takes, which distinguishes a payload that is there from one that was erased.
Trait Implementations§
Source§impl Clone for StoredEvent
impl Clone for StoredEvent
Source§impl Debug for StoredEvent
impl Debug for StoredEvent
Source§impl<'de> Deserialize<'de> for StoredEvent
impl<'de> Deserialize<'de> for StoredEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for StoredEvent
Source§impl PartialEq for StoredEvent
impl PartialEq for StoredEvent
Source§impl Serialize for StoredEvent
impl Serialize for StoredEvent
impl StructuralPartialEq for StoredEvent
Auto Trait Implementations§
impl Freeze for StoredEvent
impl RefUnwindSafe for StoredEvent
impl Send for StoredEvent
impl Sync for StoredEvent
impl Unpin for StoredEvent
impl UnsafeUnpin for StoredEvent
impl UnwindSafe for StoredEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.