oca_rs::data_storage

Trait DataStorage

Source
pub trait DataStorage: DynClone + Send {
    // Required methods
    fn get(
        &self,
        namespace: Namespace,
        key: &str,
    ) -> Result<Option<Vec<u8>>, String>;
    fn get_all(
        &self,
        namespace: Namespace,
    ) -> Result<HashMap<String, Vec<u8>>, String>;
    fn insert(
        &mut self,
        namespace: Namespace,
        key: &str,
        value: &[u8],
    ) -> Result<(), String>;
    fn new() -> Self
       where Self: Sized;
    fn config(&self, config: HashMap<String, String>) -> Self
       where Self: Sized;

    // Provided method
    fn open(_path: &str) -> Self
       where Self: Sized { ... }
}

Required Methods§

Source

fn get( &self, namespace: Namespace, key: &str, ) -> Result<Option<Vec<u8>>, String>

Source

fn get_all( &self, namespace: Namespace, ) -> Result<HashMap<String, Vec<u8>>, String>

Source

fn insert( &mut self, namespace: Namespace, key: &str, value: &[u8], ) -> Result<(), String>

Source

fn new() -> Self
where Self: Sized,

Source

fn config(&self, config: HashMap<String, String>) -> Self
where Self: Sized,

Provided Methods§

Source

fn open(_path: &str) -> Self
where Self: Sized,

Implementors§