pub struct DebugEventStore { /* private fields */ }Expand description
Event store for debug sessions with subscription support.
Uses interior mutability (Mutex) so it can be shared via Arc
between the executor (which owns the DebugAwareEventStore) and
the protocol handler.
Implementations§
Source§impl DebugEventStore
impl DebugEventStore
Sourcepub fn new(session_id: String) -> Self
pub fn new(session_id: String) -> Self
Creates a new DebugEventStore with the given session ID and default capacity.
Sourcepub fn with_capacity(session_id: String, max_events: usize) -> Self
pub fn with_capacity(session_id: String, max_events: usize) -> Self
Creates a new DebugEventStore with the given session ID and max event capacity.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Returns the session ID.
Sourcepub fn max_events(&self) -> usize
pub fn max_events(&self) -> usize
Returns the max event capacity.
Sourcepub fn append(&self, event: NetEvent)
pub fn append(&self, event: NetEvent)
Appends an event, evicting oldest if at capacity, and broadcasts to subscribers.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Total number of events ever appended (including evicted).
Sourcepub fn evicted_count(&self) -> usize
pub fn evicted_count(&self) -> usize
Number of events evicted from the store.
Sourcepub fn subscribe(&self) -> (Receiver<NetEvent>, Subscription)
pub fn subscribe(&self) -> (Receiver<NetEvent>, Subscription)
Subscribe to receive events as they occur.
Returns a crossbeam_channel::Receiver for receiving events
and a Subscription handle for cancellation.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Number of active subscribers.
Sourcepub fn events_from(&self, from_index: usize) -> Vec<NetEvent>
pub fn events_from(&self, from_index: usize) -> Vec<NetEvent>
Returns events starting from a specific global index.
Sourcepub fn events_since(&self, from: u64) -> Vec<NetEvent>
pub fn events_since(&self, from: u64) -> Vec<NetEvent>
Returns all events since the specified timestamp.