pub trait DataStore {
type Output;
// Required methods
fn has_data(&self) -> bool;
fn reset(&mut self);
fn append(&mut self, data: Value) -> Result<()>;
fn fetch(
&mut self,
count: Option<usize>,
max_bytes: Option<usize>,
) -> Result<Option<DataResult<Self::Output>>>;
fn remove(&mut self, data: &[Box<dyn Equivalent>]) -> Result<()>;
}Expand description
A trait for implementing persistent data stores that support batched operations. Provides a common interface for storing, retrieving, and managing data with support for size limits and batch processing.
Required Associated Types§
Required Methods§
Sourcefn fetch(
&mut self,
count: Option<usize>,
max_bytes: Option<usize>,
) -> Result<Option<DataResult<Self::Output>>>
fn fetch( &mut self, count: Option<usize>, max_bytes: Option<usize>, ) -> Result<Option<DataResult<Self::Output>>>
Fetches a batch of data from the store, respecting optional count and size limits.
§Arguments
count- Optional maximum number of items to fetchmax_bytes- Optional maximum total size in bytes to fetch
Returns the fetched data along with items that can be passed to remove().