pub struct EventStorage { /* private fields */ }Expand description
SQLite storage for buffering telemetry events
Implementations§
Source§impl EventStorage
impl EventStorage
Sourcepub fn new(db_path: impl Into<PathBuf>) -> Result<Self>
pub fn new(db_path: impl Into<PathBuf>) -> Result<Self>
Create a new event storage
Creates the storage directory and initializes the database schema.
Sourcepub fn get_unsynced(&self, limit: usize) -> Result<Vec<Event>>
pub fn get_unsynced(&self, limit: usize) -> Result<Vec<Event>>
Get unsynced events (up to a limit)
Sourcepub fn mark_synced(&self, event_ids: &[Uuid]) -> Result<()>
pub fn mark_synced(&self, event_ids: &[Uuid]) -> Result<()>
Mark events as synced
Sourcepub fn increment_retry(&self, event_ids: &[Uuid]) -> Result<()>
pub fn increment_retry(&self, event_ids: &[Uuid]) -> Result<()>
Increment retry count for events
Sourcepub fn unsynced_count(&self) -> Result<usize>
pub fn unsynced_count(&self) -> Result<usize>
Get count of unsynced events
Sourcepub fn cleanup_old_events(&self) -> Result<usize>
pub fn cleanup_old_events(&self) -> Result<usize>
Delete old synced events (older than 7 days)
Sourcepub fn total_count(&self) -> Result<usize>
pub fn total_count(&self) -> Result<usize>
Get total event count
Trait Implementations§
impl Send for EventStorage
impl Sync for EventStorage
Auto Trait Implementations§
impl !Freeze for EventStorage
impl !RefUnwindSafe for EventStorage
impl Unpin for EventStorage
impl !UnwindSafe for EventStorage
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