Skip to main content

DataStore

Trait DataStore 

Source
pub trait DataStore {
    // Required methods
    fn read(&self, key: &str) -> Result<Option<StateRecord>, DataStoreError>;
    fn write(&mut self, record: StateRecord) -> Result<(), DataStoreError>;
    fn delete(&mut self, key: &str) -> Result<(), DataStoreError>;
    fn list_keys(&self) -> Result<Vec<String>, DataStoreError>;
}

Required Methods§

Source

fn read(&self, key: &str) -> Result<Option<StateRecord>, DataStoreError>

Reads a stored state record.

§Errors

Returns DataStoreError when the adapter cannot read the key.

Source

fn write(&mut self, record: StateRecord) -> Result<(), DataStoreError>

Writes a stamped state record.

§Errors

Returns DataStoreError when the adapter cannot persist the record.

Source

fn delete(&mut self, key: &str) -> Result<(), DataStoreError>

Deletes a stored state record.

§Errors

Returns DataStoreError when the adapter cannot delete the key.

Source

fn list_keys(&self) -> Result<Vec<String>, DataStoreError>

Lists stored state keys.

§Errors

Returns DataStoreError when the adapter cannot enumerate keys.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§