pub trait Store {
// Required methods
async fn append(&mut self, record: &[u8]) -> Result<()>;
async fn peek(&self) -> Result<Option<Vec<u8>>>;
async fn pop(&mut self) -> Result<Option<Vec<u8>>>;
async fn len(&self) -> Result<usize>;
// Provided method
async fn is_empty(&self) -> Result<bool> { ... }
}Expand description
A durable, first-in first-out queue for store-and-forward buffering.
Records are appended while a device is offline and drained in order when a link becomes available, letting applications tolerate intermittent connectivity without losing data.
Required Methods§
Sourceasync fn peek(&self) -> Result<Option<Vec<u8>>>
async fn peek(&self) -> Result<Option<Vec<u8>>>
Returns the oldest record without removing it.
This lets a forwarder send a record before committing to its removal, so a failed send can leave the record buffered in order rather than dropping it.
§Returns
Some(record) containing the oldest buffered bytes, or None if the queue
is empty.
§Errors
Returns Error::Io if the queue cannot be read.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".