pub struct EventRecorder { /* private fields */ }Expand description
Thread-safe session recorder for time-travel debugging. Records events and state checkpoints during a recording session. Only one session can be active at a time.
Implementations§
Source§impl EventRecorder
impl EventRecorder
Sourcepub fn new(max_events: usize) -> Self
pub fn new(max_events: usize) -> Self
Creates a new recorder with the given maximum event capacity.
use victauri_core::EventRecorder;
let recorder = EventRecorder::new(1000);
assert!(!recorder.is_recording());
assert_eq!(recorder.event_count(), 0);Sourcepub fn start(&self, session_id: String) -> bool
pub fn start(&self, session_id: String) -> bool
Starts a new recording session; returns false if one is already active.
Sourcepub fn stop(&self) -> Option<RecordedSession>
pub fn stop(&self) -> Option<RecordedSession>
Stops the active recording and returns the completed session, or None if not recording.
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Returns true if a recording session is currently active.
Sourcepub fn record_event(&self, event: AppEvent)
pub fn record_event(&self, event: AppEvent)
Appends an event to the active recording, evicting the oldest if at capacity.
Sourcepub fn checkpoint(
&self,
id: String,
label: Option<String>,
state: Value,
) -> bool
pub fn checkpoint( &self, id: String, label: Option<String>, state: Value, ) -> bool
Creates a named state checkpoint at the current event index; returns false if not recording.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Returns the number of events recorded so far, or 0 if not recording.
Sourcepub fn checkpoint_count(&self) -> usize
pub fn checkpoint_count(&self) -> usize
Returns the number of checkpoints created so far, or 0 if not recording.
Sourcepub fn events_since(&self, index: usize) -> Vec<RecordedEvent>
pub fn events_since(&self, index: usize) -> Vec<RecordedEvent>
Returns all events with an index >= the given value.
Sourcepub fn events_between(
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
) -> Vec<RecordedEvent>
pub fn events_between( &self, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Vec<RecordedEvent>
Returns events whose timestamps fall within the given inclusive range.
Sourcepub fn get_checkpoints(&self) -> Vec<StateCheckpoint>
pub fn get_checkpoints(&self) -> Vec<StateCheckpoint>
Returns all checkpoints from the active recording session.
Sourcepub fn events_between_checkpoints(
&self,
from_checkpoint_id: &str,
to_checkpoint_id: &str,
) -> Option<Vec<RecordedEvent>>
pub fn events_between_checkpoints( &self, from_checkpoint_id: &str, to_checkpoint_id: &str, ) -> Option<Vec<RecordedEvent>>
Returns events recorded between two named checkpoints, or None if either ID is unknown.
Sourcepub fn ipc_replay_sequence(&self) -> Vec<IpcCall>
pub fn ipc_replay_sequence(&self) -> Vec<IpcCall>
Extracts IPC calls in order from the recording for replay.
Trait Implementations§
Source§impl Clone for EventRecorder
impl Clone for EventRecorder
Source§fn clone(&self) -> EventRecorder
fn clone(&self) -> EventRecorder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more