Trait Database

Source
pub trait Database: Send + Sync {
    // Required methods
    fn set<'a>(
        &'a self,
        key: &'a str,
        val: &'a [u8],
    ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<(), String>> + 'a>>;
    fn get<'a>(
        &'a self,
        key: &'a str,
    ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<Option<Vec<u8>>, String>> + 'a>>;
    fn remove<'a>(
        &'a self,
        key: &'a str,
    ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<(), String>> + 'a>>;
    fn compare_and_swap<'a>(
        &'a self,
        key: &'a str,
        old: &'a [u8],
        new: &'a [u8],
    ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<bool, String>> + 'a>>;
    fn release<'a>(
        &'a self,
    ) -> Pin<Box<dyn Send + Sync + Future<Output = ()> + 'a>>;
}

Required Methods§

Source

fn set<'a>( &'a self, key: &'a str, val: &'a [u8], ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<(), String>> + 'a>>

Source

fn get<'a>( &'a self, key: &'a str, ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<Option<Vec<u8>>, String>> + 'a>>

Source

fn remove<'a>( &'a self, key: &'a str, ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<(), String>> + 'a>>

Source

fn compare_and_swap<'a>( &'a self, key: &'a str, old: &'a [u8], new: &'a [u8], ) -> Pin<Box<dyn Send + Sync + Future<Output = Result<bool, String>> + 'a>>

Source

fn release<'a>(&'a self) -> Pin<Box<dyn Send + Sync + Future<Output = ()> + 'a>>

Implementors§