pub struct EventStore { /* private fields */ }Expand description
Store for capturing and querying tracer events
EventStore provides thread-safe storage for tracer events with support for:
- Callbacks triggered on each stored event
- Filtering by event type
- Filtering by time range
- Custom filter predicates
- Query for last N events
Implementations§
Source§impl EventStore
impl EventStore
Sourcepub fn new(on_store_callback: Option<EventCallback>) -> Self
pub fn new(on_store_callback: Option<EventCallback>) -> Self
Create a new event store
§Arguments
on_store_callback- Optional callback function called whenever an event is stored
Sourcepub fn store(&self, event: Box<dyn TracerEvent>)
pub fn store(&self, event: Box<dyn TracerEvent>)
Store an event in the event store
If a callback is configured, it will be called with the stored event.
§Arguments
event- The event to store
Sourcepub fn count_events(
&self,
start_time: Option<f64>,
end_time: Option<f64>,
filter_func: Option<&dyn EventFilterFn>,
) -> usize
pub fn count_events( &self, start_time: Option<f64>, end_time: Option<f64>, filter_func: Option<&dyn EventFilterFn>, ) -> usize
Sourcepub fn get_event_summaries(
&self,
start_time: Option<f64>,
end_time: Option<f64>,
filter_func: Option<&dyn EventFilterFn>,
) -> Vec<String>
pub fn get_event_summaries( &self, start_time: Option<f64>, end_time: Option<f64>, filter_func: Option<&dyn EventFilterFn>, ) -> Vec<String>
Get summaries of events matching filters
Returns printable summaries instead of cloning events
§Arguments
start_time- Include events with timestamp >= start_timeend_time- Include events with timestamp <= end_timefilter_func- Custom filter function to apply to events
§Returns
Vector of event summaries matching the filter criteria
Sourcepub fn get_last_n_summaries(
&self,
n: usize,
filter_func: Option<&dyn EventFilterFn>,
) -> Vec<String>
pub fn get_last_n_summaries( &self, n: usize, filter_func: Option<&dyn EventFilterFn>, ) -> Vec<String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventStore
impl !RefUnwindSafe for EventStore
impl Send for EventStore
impl Sync for EventStore
impl Unpin for EventStore
impl !UnwindSafe for EventStore
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
Mutably borrows from an owned value. Read more