Trait common_meta::kv_backend::KvBackend

source ·
pub trait KvBackend: TxnService
where Self::Error: ErrorExt,
{
Show 13 methods // Required methods fn name(&self) -> &str; fn as_any(&self) -> &dyn Any; fn range<'life0, 'async_trait>( &'life0 self, req: RangeRequest, ) -> Pin<Box<dyn Future<Output = Result<RangeResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn put<'life0, 'async_trait>( &'life0 self, req: PutRequest, ) -> Pin<Box<dyn Future<Output = Result<PutResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn batch_put<'life0, 'async_trait>( &'life0 self, req: BatchPutRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchPutResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn batch_get<'life0, 'async_trait>( &'life0 self, req: BatchGetRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchGetResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_range<'life0, 'async_trait>( &'life0 self, req: DeleteRangeRequest, ) -> Pin<Box<dyn Future<Output = Result<DeleteRangeResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn batch_delete<'life0, 'async_trait>( &'life0 self, req: BatchDeleteRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResponse, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<KeyValue>, Self::Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn compare_and_put<'life0, 'async_trait>( &'life0 self, req: CompareAndPutRequest, ) -> Pin<Box<dyn Future<Output = Result<CompareAndPutResponse, Self::Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn put_conditionally<'life0, 'async_trait>( &'life0 self, key: Vec<u8>, value: Vec<u8>, if_not_exists: bool, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], prev_kv: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<KeyValue>, Self::Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}

Required Methods§

source

fn name(&self) -> &str

source

fn as_any(&self) -> &dyn Any

source

fn range<'life0, 'async_trait>( &'life0 self, req: RangeRequest, ) -> Pin<Box<dyn Future<Output = Result<RangeResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn put<'life0, 'async_trait>( &'life0 self, req: PutRequest, ) -> Pin<Box<dyn Future<Output = Result<PutResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn batch_put<'life0, 'async_trait>( &'life0 self, req: BatchPutRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchPutResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn batch_get<'life0, 'async_trait>( &'life0 self, req: BatchGetRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchGetResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn delete_range<'life0, 'async_trait>( &'life0 self, req: DeleteRangeRequest, ) -> Pin<Box<dyn Future<Output = Result<DeleteRangeResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn batch_delete<'life0, 'async_trait>( &'life0 self, req: BatchDeleteRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<KeyValue>, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn compare_and_put<'life0, 'async_trait>( &'life0 self, req: CompareAndPutRequest, ) -> Pin<Box<dyn Future<Output = Result<CompareAndPutResponse, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

CAS: Compares the value at the key with the given value, and if they are equal, puts the new value at the key.

source

fn put_conditionally<'life0, 'async_trait>( &'life0 self, key: Vec<u8>, value: Vec<u8>, if_not_exists: bool, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Puts a value at a key. If if_not_exists is true, the operation ensures the key does not exist before applying the PUT operation. Otherwise, it simply applies the PUT operation without checking for the key’s existence.

source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if the key exists, not returning the value. If the value is large, this method is more efficient than get.

source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], prev_kv: bool, ) -> Pin<Box<dyn Future<Output = Result<Option<KeyValue>, Self::Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns previous key-value pair if prev_kv is true.

Implementors§