Struct EventHeader
Source #[repr(C, align(64))]pub struct EventHeader {
pub event_id: EventId,
pub correlation_id: EventId,
pub timestamp: i64,
pub position: DagPosition,
pub payload_size: u32,
pub event_kind: EventKind,
pub flags: EventFlags,
pub random_seed: Option<u64>,
pub causality: Option<Causality>,
_reserved: [u8; 5],
}Expand description
Event header with all metadata needed for processing.
This structure is 64 bytes and cache-line aligned for optimal performance. The payload is stored separately and referenced by the header.
Layout (64 bytes total, ordered by alignment to minimize padding):
- event_id: 16 bytes (UUIDv7)
- correlation_id: 16 bytes (UUIDv7)
- timestamp: 8 bytes (microseconds since epoch)
- position: 12 bytes (DagPosition)
- payload_size: 4 bytes (u32)
- event_kind: 2 bytes (EventKind)
- flags: 1 byte (EventFlags)
- _reserved: 5 bytes (padding to 64)
Fields§
§event_id: EventIdUnique event identifier (UUIDv7 for timestamp-sortable IDs)
correlation_id: EventIdCorrelation ID for tracing related events
timestamp: i64Timestamp in microseconds since Unix epoch
position: DagPositionPosition in the event DAG
payload_size: u32Size of the payload in bytes
event_kind: EventKindEvent kind (category + type)
flags: EventFlagsProcessing flags
random_seed: Option<u64>Random seed captured at emit time for deterministic replay
causality: Option<Causality>Optional causality context for distributed tracing.
When present, links this event to an OpenTelemetry trace via W3C
Trace Context. Populated by the CausalitySpanLinker in the
telemetry layer; omitted from serialization when absent.
_reserved: [u8; 5]Implementations§
Source§impl EventHeader
impl EventHeader
Sourcepub fn new(
event_id: EventId,
correlation_id: EventId,
timestamp: i64,
position: DagPosition,
payload_size: u32,
event_kind: EventKind,
flags: EventFlags,
random_seed: Option<u64>,
) -> EventHeader
pub fn new( event_id: EventId, correlation_id: EventId, timestamp: i64, position: DagPosition, payload_size: u32, event_kind: EventKind, flags: EventFlags, random_seed: Option<u64>, ) -> EventHeader
Create a new event header.
Sourcepub fn with_causality(self, causality: Causality) -> EventHeader
pub fn with_causality(self, causality: Causality) -> EventHeader
Attach a causality context to this header for distributed tracing.
Sourcepub fn requires_ack(&self) -> bool
pub fn requires_ack(&self) -> bool
Check if this event requires acknowledgment.
Sourcepub fn is_transactional(&self) -> bool
pub fn is_transactional(&self) -> bool
Check if this event is part of a transaction.
Sourcepub fn is_acknowledged(&self) -> bool
pub fn is_acknowledged(&self) -> bool
Check if this event has been acknowledged.
Sourcepub fn is_critical(&self) -> bool
pub fn is_critical(&self) -> bool
Check if this event is critical.
Sourcepub fn acknowledge(&mut self)
pub fn acknowledge(&mut self)
Mark this event as acknowledged.
Sourcepub fn age_micros(&self, now_micros: i64) -> i64
pub fn age_micros(&self, now_micros: i64) -> i64
Get the event age in microseconds from a reference time.
Trait Implementations§
Source§impl Clone for EventHeader
impl Clone for EventHeader
Source§fn clone(&self) -> EventHeader
fn clone(&self) -> EventHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventHeader
impl Debug for EventHeader
Source§impl<'de> Deserialize<'de> for EventHeader
impl<'de> Deserialize<'de> for EventHeader
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventHeader, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EventHeader, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for EventHeader
impl PartialEq for EventHeader
Source§impl Serialize for EventHeader
impl Serialize for EventHeader
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl ToSchema for EventHeader
impl ToSchema for EventHeader
impl Eq for EventHeader
impl StructuralPartialEq for EventHeader
Auto Trait Implementations§
impl Freeze for EventHeader
impl RefUnwindSafe for EventHeader
impl Send for EventHeader
impl Sync for EventHeader
impl Unpin for EventHeader
impl UnwindSafe for EventHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.