pub struct EventStore { /* private fields */ }Expand description
Bounded ring-buffer that stores the most recent traffic events.
Implementations§
Source§impl EventStore
impl EventStore
pub fn new(capacity: usize) -> Self
Sourcepub fn push(&self, event: TrafficEvent)
pub fn push(&self, event: TrafficEvent)
Push an event into the store, evicting the oldest if at capacity.
Sourcepub fn query(&self, filter: &EventFilter) -> Vec<TrafficEvent>
pub fn query(&self, filter: &EventFilter) -> Vec<TrafficEvent>
Query events with optional filters.
Sourcepub fn all(&self) -> Vec<TrafficEvent>
pub fn all(&self) -> Vec<TrafficEvent>
Get all events (up to the buffer capacity).
pub fn is_empty(&self) -> bool
Sourcepub fn total_pushed(&self) -> u64
pub fn total_pushed(&self) -> u64
Total events ever pushed (including evicted).
Sourcepub fn stats(&self) -> StoreStats
pub fn stats(&self) -> StoreStats
Get store statistics.
Auto Trait Implementations§
impl !Freeze for EventStore
impl RefUnwindSafe for EventStore
impl Send for EventStore
impl Sync for EventStore
impl Unpin for EventStore
impl UnsafeUnpin 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