pub trait DataStore: Send + Sync {
// Required methods
fn put(&self, key: &CacheKey, data: &Value) -> Result<DataRef>;
fn get(&self, data_ref: &DataRef) -> Result<Value>;
fn exists(&self, data_ref: &DataRef) -> Result<bool>;
fn remove(&self, data_ref: &DataRef) -> Result<()>;
fn config(&self) -> &StorageConfig;
// Provided methods
fn get_rows(
&self,
data_ref: &DataRef,
start: usize,
len: usize,
) -> Result<Value> { ... }
fn meta(&self, data_ref: &DataRef) -> Result<StoreMeta> { ... }
}Expand description
The DataStore trait: put/get/stream data across workers.
Unlike CacheStore (which stores Values by CacheKey), DataStore moves data between locations and supports streaming.
Required Methods§
Sourcefn put(&self, key: &CacheKey, data: &Value) -> Result<DataRef>
fn put(&self, key: &CacheKey, data: &Value) -> Result<DataRef>
Store data and return a reference to it.
Sourcefn config(&self) -> &StorageConfig
fn config(&self) -> &StorageConfig
Get the storage config.