pub struct EventEmitter { /* private fields */ }Expand description
Event emitter - collects and filters events during execution
Supports optional persistence to EventLog (INV-PERSIST-002: Event Immutability). When an EventLog is configured, events are persisted before being added to the in-memory buffer.
Implementations§
Source§impl EventEmitter
impl EventEmitter
Sourcepub fn with_mode(mode: StreamMode) -> Self
pub fn with_mode(mode: StreamMode) -> Self
Create a new EventEmitter with a specific mode
Sourcepub fn with_persistence(
event_log: Arc<EventLog>,
execution_id: ExecutionId,
) -> Self
pub fn with_persistence( event_log: Arc<EventLog>, execution_id: ExecutionId, ) -> Self
Create an EventEmitter with persistence support
Events will be persisted to the EventLog before being added to the buffer. This ensures durability (INV-PERSIST-002).
Sourcepub fn set_mode(&mut self, mode: StreamMode)
pub fn set_mode(&mut self, mode: StreamMode)
Set the stream mode
Sourcepub fn set_event_log(
&mut self,
event_log: Arc<EventLog>,
execution_id: ExecutionId,
)
pub fn set_event_log( &mut self, event_log: Arc<EventLog>, execution_id: ExecutionId, )
Enable persistence with an event log
Sourcepub fn emit(&self, event: StreamEvent)
pub fn emit(&self, event: StreamEvent)
Emit an event (filtered by mode)
If persistence is configured, the event is persisted to the EventLog BEFORE being added to the in-memory buffer. This ensures durability.
Sourcepub fn emit_force(&self, event: StreamEvent)
pub fn emit_force(&self, event: StreamEvent)
Emit an event unconditionally (ignores mode)
Sourcepub fn drain(&self) -> Vec<StreamEvent>
pub fn drain(&self) -> Vec<StreamEvent>
Get all collected events
Sourcepub fn mode(&self) -> StreamMode
pub fn mode(&self) -> StreamMode
Get the current stream mode
Trait Implementations§
Source§impl Clone for EventEmitter
impl Clone for EventEmitter
Source§fn clone(&self) -> EventEmitter
fn clone(&self) -> EventEmitter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more