pub struct Event {
pub event_id: u64,
pub source_event_id: Option<u64>,
pub instance_id: String,
pub execution_id: u64,
pub timestamp_ms: u64,
pub duroxide_version: String,
pub kind: EventKind,
}Expand description
Unified event with common metadata and type-specific payload.
All events have common fields (event_id, source_event_id, instance_id, etc.)
plus type-specific data in the kind field.
Events are append-only history entries persisted by a provider and consumed during replay.
The event_id is a monotonically increasing position in history.
Scheduling and completion events are linked via source_event_id.
Fields§
§event_id: u64Sequential position in history (monotonically increasing per execution)
source_event_id: Option<u64>For completion events: references the scheduling event this completes. None for lifecycle events (OrchestrationStarted, etc.) and scheduling events. Some(id) for completion events (ActivityCompleted, TimerFired, etc.).
instance_id: StringInstance this event belongs to. Denormalized from DB key for self-contained events.
execution_id: u64Execution this event belongs to. Denormalized from DB key for self-contained events.
timestamp_ms: u64Timestamp when event was created (milliseconds since Unix epoch).
duroxide_version: StringCrate semver version that generated this event. Format: “0.1.0”, “0.2.0”, etc.
kind: EventKindEvent type and associated data.
Implementations§
Source§impl Event
impl Event
Sourcepub fn with_event_id(
event_id: u64,
instance_id: impl Into<String>,
execution_id: u64,
source_event_id: Option<u64>,
kind: EventKind,
) -> Self
pub fn with_event_id( event_id: u64, instance_id: impl Into<String>, execution_id: u64, source_event_id: Option<u64>, kind: EventKind, ) -> Self
Create a new event with common fields populated and a specific event_id.
Use this when you know the event_id upfront (e.g., during replay or when creating events inline).
Sourcepub fn new(
instance_id: impl Into<String>,
execution_id: u64,
source_event_id: Option<u64>,
kind: EventKind,
) -> Self
pub fn new( instance_id: impl Into<String>, execution_id: u64, source_event_id: Option<u64>, kind: EventKind, ) -> Self
Create a new event with common fields populated.
The event_id will be 0 and should be set by the history manager.
Sourcepub fn source_event_id(&self) -> Option<u64>
pub fn source_event_id(&self) -> Option<u64>
Get the source_event_id if this is a completion event. Returns None for lifecycle and scheduling events.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this event is a terminal event (ends the orchestration).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
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 Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)