pub struct EventEnvelope {
pub schema_version: String,
pub session_id: Uuid,
pub seq: u64,
pub timestamp: DateTime<Utc>,
pub kind: String,
pub payload: Value,
pub prev_hash: Option<String>,
pub hash: String,
}Expand description
One append-only, hash-chained session event.
Fields§
§schema_version: StringExternal schema version.
session_id: UuidSession identifier.
seq: u64Zero-based monotonic event sequence.
timestamp: DateTime<Utc>Event timestamp.
kind: StringExtensible dotted event name.
payload: ValueEvent-specific public payload.
prev_hash: Option<String>Hash of the previous event, absent for the genesis event.
hash: StringBLAKE3 digest of canonical hash material.
Implementations§
Source§impl EventEnvelope
impl EventEnvelope
Sourcepub fn new(
session_id: Uuid,
seq: u64,
kind: impl Into<String>,
payload: Value,
prev_hash: Option<String>,
) -> Self
pub fn new( session_id: Uuid, seq: u64, kind: impl Into<String>, payload: Value, prev_hash: Option<String>, ) -> Self
Creates an event using the current UTC time.
Sourcepub fn new_at(
session_id: Uuid,
seq: u64,
timestamp: DateTime<Utc>,
kind: impl Into<String>,
payload: Value,
prev_hash: Option<String>,
) -> Self
pub fn new_at( session_id: Uuid, seq: u64, timestamp: DateTime<Utc>, kind: impl Into<String>, payload: Value, prev_hash: Option<String>, ) -> Self
Creates an event at a supplied time, primarily for deterministic fixtures.
Sourcepub fn verify_hash(&self) -> bool
pub fn verify_hash(&self) -> bool
Verifies this event’s digest without looking at neighbors.
Trait Implementations§
Source§impl Clone for EventEnvelope
impl Clone for EventEnvelope
Source§fn clone(&self) -> EventEnvelope
fn clone(&self) -> EventEnvelope
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EventEnvelope
impl Debug for EventEnvelope
Source§impl<'de> Deserialize<'de> for EventEnvelope
impl<'de> Deserialize<'de> for EventEnvelope
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for EventEnvelope
impl PartialEq for EventEnvelope
Source§impl Serialize for EventEnvelope
impl Serialize for EventEnvelope
impl StructuralPartialEq for EventEnvelope
Auto Trait Implementations§
impl Freeze for EventEnvelope
impl RefUnwindSafe for EventEnvelope
impl Send for EventEnvelope
impl Sync for EventEnvelope
impl Unpin for EventEnvelope
impl UnsafeUnpin for EventEnvelope
impl UnwindSafe for EventEnvelope
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