Skip to main content

DataStore

Trait DataStore 

Source
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§

Source

fn put(&self, key: &CacheKey, data: &Value) -> Result<DataRef>

Store data and return a reference to it.

Source

fn get(&self, data_ref: &DataRef) -> Result<Value>

Retrieve data from a reference.

Source

fn exists(&self, data_ref: &DataRef) -> Result<bool>

Check if data exists at a reference.

Source

fn remove(&self, data_ref: &DataRef) -> Result<()>

Delete data at a reference.

Source

fn config(&self) -> &StorageConfig

Get the storage config.

Provided Methods§

Source

fn get_rows( &self, data_ref: &DataRef, start: usize, len: usize, ) -> Result<Value>

Read a range of rows [start..start+len) from a tensor. Returns a Value::Tensor with shape[0] == len. Default impl downloads the full value and slices in memory.

Source

fn meta(&self, data_ref: &DataRef) -> Result<StoreMeta>

Get metadata about a stored value without reading the data. Default impl downloads the full value to extract metadata.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§