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§
Sourcefn read(&self, key: &str) -> Result<Option<StateRecord>, DataStoreError>
fn read(&self, key: &str) -> Result<Option<StateRecord>, DataStoreError>
Sourcefn write(&mut self, record: StateRecord) -> Result<(), DataStoreError>
fn write(&mut self, record: StateRecord) -> Result<(), DataStoreError>
Writes a stamped state record.
§Errors
Returns DataStoreError when the adapter cannot persist the record.
Sourcefn delete(&mut self, key: &str) -> Result<(), DataStoreError>
fn delete(&mut self, key: &str) -> Result<(), DataStoreError>
Deletes a stored state record.
§Errors
Returns DataStoreError when the adapter cannot delete the key.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".