Skip to main content

KeyValueStorage

Trait KeyValueStorage 

Source
pub trait KeyValueStorage: Storage {
    // Required methods
    fn get_bytes<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn set_bytes<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
        value: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn iter_prefix<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        prefix: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_range<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        start: &'life2 str,
        end: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn merge<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
        value: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Key-value storage operations (for Sled)

Required Methods§

Source

fn get_bytes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get value by key as bytes

Source

fn set_bytes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, value: Vec<u8>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set value as bytes

Source

fn iter_prefix<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, prefix: &'life2 str, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Iterate over all keys with prefix

Source

fn get_range<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, table: &'life1 str, start: &'life2 str, end: &'life3 str, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Get range of keys

Source

fn merge<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, value: Vec<u8>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Merge value (append for log-structured merge trees)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§