pub struct PersistentEventQueue { /* private fields */ }Expand description
redb-backed event queue. Send + Sync — internal Mutex wraps
the Database handle so adapter UI-thread pushes and worker-
thread drains don’t conflict.
Implementations§
Source§impl PersistentEventQueue
impl PersistentEventQueue
Sourcepub fn open(path: impl Into<PathBuf>) -> Result<Self, PersistentQueueError>
pub fn open(path: impl Into<PathBuf>) -> Result<Self, PersistentQueueError>
Open or create the queue file at path. Parent directory is
created if missing.
Sourcepub fn open_with(
path: impl Into<PathBuf>,
capacity: usize,
max_age: Duration,
) -> Result<Self, PersistentQueueError>
pub fn open_with( path: impl Into<PathBuf>, capacity: usize, max_age: Duration, ) -> Result<Self, PersistentQueueError>
Like open but with explicit capacity (events
past which the oldest is dropped) and max_age (events older
than this are dropped on next push or drain).
pub fn path(&self) -> &Path
Trait Implementations§
Source§impl Debug for PersistentEventQueue
impl Debug for PersistentEventQueue
Source§impl EventQueue for PersistentEventQueue
impl EventQueue for PersistentEventQueue
Source§fn push(&self, event: OwnedEvent)
fn push(&self, event: OwnedEvent)
Append an event to the tail. If the queue is at capacity,
the oldest entry is dropped (FIFO eviction).
Source§fn drain_batch(&self, n: usize) -> Vec<OwnedEvent>
fn drain_batch(&self, n: usize) -> Vec<OwnedEvent>
Take up to
n events from the head, removing them. Used by
adapter workers to assemble batches for HTTP transmission.Source§fn discard_all(&self)
fn discard_all(&self)
Drop everything without sending. Called on consent revocation
and on
UsageReporter::erase_remote_data. Implementations
MUST guarantee no buffered event escapes after this returns.Source§fn peek_recent(&self, n: usize) -> Vec<OwnedEvent>
fn peek_recent(&self, n: usize) -> Vec<OwnedEvent>
Snapshot the head of the queue (clone). Used by the
PrivacySettings “Inspect data sent” view. Best-effort — the
returned events may have been drained by the time the caller
reads them.fn is_empty(&self) -> bool
Auto Trait Implementations§
impl !Freeze for PersistentEventQueue
impl RefUnwindSafe for PersistentEventQueue
impl Send for PersistentEventQueue
impl Sync for PersistentEventQueue
impl Unpin for PersistentEventQueue
impl UnsafeUnpin for PersistentEventQueue
impl UnwindSafe for PersistentEventQueue
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