Skip to main content

AsyncStorageBackend

Trait AsyncStorageBackend 

Source
pub trait AsyncStorageBackend {
    type Batch: AsyncBatchOperations;

    // Required methods
    fn get(&self, key: &[u8]) -> impl Future<Output = Result<Option<Vec<u8>>>>;
    fn insert(
        &self,
        key: &[u8],
        value: &[u8],
    ) -> impl Future<Output = Result<()>>;
    fn remove(&self, key: &[u8]) -> impl Future<Output = Result<()>>;
    fn prefix_scan(
        &self,
        prefix: &[u8],
    ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>>>;
    fn prefix_count(&self, prefix: &[u8]) -> impl Future<Output = Result<usize>>;
    fn prefix_scan_keys(
        &self,
        prefix: &[u8],
    ) -> impl Future<Output = Result<Vec<Vec<u8>>>>;
    fn prefix_scan_batch(
        &self,
        prefix: &[u8],
        batch_size: usize,
        after_key: Option<&[u8]>,
    ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>>>;
    fn range_scan(
        &self,
        start: &[u8],
        end: &[u8],
    ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>>>;
    fn batch(&self) -> Self::Batch;
    fn flush(&self) -> impl Future<Output = Result<()>>;
}

Required Associated Types§

Required Methods§

Source

fn get(&self, key: &[u8]) -> impl Future<Output = Result<Option<Vec<u8>>>>

Source

fn insert(&self, key: &[u8], value: &[u8]) -> impl Future<Output = Result<()>>

Source

fn remove(&self, key: &[u8]) -> impl Future<Output = Result<()>>

Source

fn prefix_scan( &self, prefix: &[u8], ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>>>

Source

fn prefix_count(&self, prefix: &[u8]) -> impl Future<Output = Result<usize>>

Source

fn prefix_scan_keys( &self, prefix: &[u8], ) -> impl Future<Output = Result<Vec<Vec<u8>>>>

Source

fn prefix_scan_batch( &self, prefix: &[u8], batch_size: usize, after_key: Option<&[u8]>, ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>>>

Source

fn range_scan( &self, start: &[u8], end: &[u8], ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>>>

Source

fn batch(&self) -> Self::Batch

Source

fn flush(&self) -> impl Future<Output = Result<()>>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§