pub struct OutboundQueue {
dir: PathBuf,
}Expand description
Disk-backed queue handle. Cheap to clone via Arc.
Fields§
§dir: PathBufImplementations§
Source§impl OutboundQueue
impl OutboundQueue
Sourcepub fn enqueue(&self, event: &QueuedEvent) -> Result<PathBuf>
pub fn enqueue(&self, event: &QueuedEvent) -> Result<PathBuf>
Atomically persist an event. fsync before rename ensures the
payload bytes hit disk before the directory entry flips; a
crash between fsync and rename leaves a .tmp file that the
drainer ignores.
Sourcepub fn scan_pending(&self) -> Result<Vec<QueuedEvent>>
pub fn scan_pending(&self) -> Result<Vec<QueuedEvent>>
All pending events, sorted ascending by seq. Filenames sort lexicographically thanks to the 20-char zero-padded seq prefix; the BTreeMap-by-seq pass below is belt-and-braces in case the scan picks up files with unexpected sort order (rare on POSIX but defensible).
Sourcepub fn mark_sent(&self, event: &QueuedEvent) -> Result<()>
pub fn mark_sent(&self, event: &QueuedEvent) -> Result<()>
Delete the on-disk file for event. Called after a successful
POST to /v1/agent/events.
pub fn dir(&self) -> &Path
Trait Implementations§
Source§impl Clone for OutboundQueue
impl Clone for OutboundQueue
Source§fn clone(&self) -> OutboundQueue
fn clone(&self) -> OutboundQueue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OutboundQueue
impl RefUnwindSafe for OutboundQueue
impl Send for OutboundQueue
impl Sync for OutboundQueue
impl Unpin for OutboundQueue
impl UnwindSafe for OutboundQueue
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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