KVClient

Trait KVClient 

Source
pub trait KVClient {
    // Required methods
    fn delete_with_options<'life0, 'async_trait>(
        &'life0 mut self,
        key: ByteSequence,
        options: DeleteOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Response<DeleteRangeResponse>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn put_with_options<'life0, 'async_trait>(
        &'life0 mut self,
        key: ByteSequence,
        value: ByteSequence,
        options: PutOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Response<PutResponse>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_with_options<'life0, 'async_trait>(
        &'life0 mut self,
        key: ByteSequence,
        options: GetOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Response<RangeResponse>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_options(&self) -> &KVOptions;

    // Provided methods
    fn delete<'life0, 'async_trait>(
        &'life0 mut self,
        key: ByteSequence,
    ) -> Pin<Box<dyn Future<Output = Result<Response<DeleteRangeResponse>, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn put<'life0, 'async_trait>(
        &'life0 mut self,
        key: ByteSequence,
        value: ByteSequence,
    ) -> Pin<Box<dyn Future<Output = Result<Response<PutResponse>, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn get<'life0, 'async_trait>(
        &'life0 mut self,
        key: ByteSequence,
    ) -> Pin<Box<dyn Future<Output = Result<Response<RangeResponse>, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn get_all<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Response<RangeResponse>, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

KVClient defines the interface for interacting with the key-value store. It provides methods to perform range queries with various options.

Required Methods§

Source

fn delete_with_options<'life0, 'async_trait>( &'life0 mut self, key: ByteSequence, options: DeleteOptions, ) -> Pin<Box<dyn Future<Output = Result<Response<DeleteRangeResponse>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deletes a key-value pair from the store with the specified options.

§Arguments
  • key - The key to delete.
  • options - The options to customize the delete operation.
§Returns
  • Result<Response<etcdserverpb::DeleteRangeResponse>, error::Error> - The response containing the delete result or an error.
§Examples
use rcfe_core::kv::KVClient;
use rcfe_core::ByteSequence;
use rcfe_core::error::Error;
use tonic::Response;
use rcfe_core::etcdserverpb::DeleteRangeResponse;
use rcfe_core::options::kv::DeleteOptions;
async fn example<KV: KVClient>(kv_client: &mut KV, key: ByteSequence, options: DeleteOptions) -> Result<Response<DeleteRangeResponse>, Error> {
    kv_client.delete_with_options(key, options).await
}
Source

fn put_with_options<'life0, 'async_trait>( &'life0 mut self, key: ByteSequence, value: ByteSequence, options: PutOptions, ) -> Pin<Box<dyn Future<Output = Result<Response<PutResponse>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puts a key-value pair into the store with the specified options.

§Arguments
  • key - The key to put.
  • value - The value to associate with the key.
  • options - The options to customize the put operation.
§Returns
  • Result<Response<etcdserverpb::PutResponse>, error::Error> - The response containing the put result or an error.
§Examples
use rcfe_core::kv::KVClient;
use rcfe_core::ByteSequence;
use rcfe_core::error::Error;
use tonic::Response;
use rcfe_core::etcdserverpb::PutResponse;
use rcfe_core::options::kv::PutOptions;

async fn example<KV: KVClient>(kv_client: &mut KV, key: ByteSequence, value: ByteSequence, options: PutOptions) -> Result<Response<PutResponse>, Error> {
    kv_client.put_with_options(key, value, options).await
}
Source

fn get_with_options<'life0, 'async_trait>( &'life0 mut self, key: ByteSequence, options: GetOptions, ) -> Pin<Box<dyn Future<Output = Result<Response<RangeResponse>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Performs a range query with the specified key and options.

§Arguments
  • key - The key to query.
  • options - The options to customize the range query.
§Returns
  • Result<Response<etcdserverpb::RangeResponse>, error::Error> - The response containing the range results or an error.
§Examples
use rcfe_core::kv::KVClient;
use rcfe_core::ByteSequence;
use rcfe_core::error::Error;
use tonic::Response;
use rcfe_core::etcdserverpb::RangeResponse;
use rcfe_core::options::kv::GetOptions;

async fn example<KV: KVClient>(kv_client: &mut KV, key: ByteSequence, options: GetOptions) -> Result<Response<RangeResponse>, Error> {
    kv_client.get_with_options(key, options).await
}
Source

fn get_options(&self) -> &KVOptions

Retrieves the KV options associated with this client.

§Returns
  • &KVOptions - A reference to the KVOptions.

Provided Methods§

Source

fn delete<'life0, 'async_trait>( &'life0 mut self, key: ByteSequence, ) -> Pin<Box<dyn Future<Output = Result<Response<DeleteRangeResponse>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source

fn put<'life0, 'async_trait>( &'life0 mut self, key: ByteSequence, value: ByteSequence, ) -> Pin<Box<dyn Future<Output = Result<Response<PutResponse>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Puts a key-value pair into the store.

§Arguments
  • key - The key to put.
  • value - The value to associate with the key.
§Returns
  • Result<Response<etcdserverpb::PutResponse>, error::Error> - The response containing the put result or an error.
§Examples
use rcfe_core::kv::KVClient;
use rcfe_core::ByteSequence;
use rcfe_core::error::Error;
use tonic::Response;
use rcfe_core::etcdserverpb::PutResponse;

async fn example<KV: KVClient>(kv_client: &mut KV, key: ByteSequence, value: ByteSequence) -> Result<Response<PutResponse>, Error> {
    kv_client.put(key, value).await
}
Source

fn get<'life0, 'async_trait>( &'life0 mut self, key: ByteSequence, ) -> Pin<Box<dyn Future<Output = Result<Response<RangeResponse>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Performs a range query with the specified key.

§Arguments
  • key - The key to query.
§Returns
  • Result<Response<etcdserverpb::RangeResponse>, error::Error> - The response containing the range results or an error.
§Examples
use rcfe_core::kv::KVClient;
use rcfe_core::ByteSequence;
use rcfe_core::error::Error;
use tonic::Response;
use rcfe_core::etcdserverpb::RangeResponse;

async fn example<KV: KVClient>(kv_client: &mut KV, key: ByteSequence) -> Result<Response<RangeResponse>, Error> {
    kv_client.get(key).await
}
Source

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

Performs a range query to retrieve all key-value pairs in the store.

§Returns
  • Result<Response<etcdserverpb::RangeResponse>, error::Error> - The response containing all key-value pairs or an error.
§Examples
use rcfe_core::kv::KVClient;
use rcfe_core::error::Error;
use tonic::Response;
use rcfe_core::etcdserverpb::RangeResponse;

async fn example<KV: KVClient>(kv_client: &mut KV) -> Result<Response<RangeResponse>, Error> {
    kv_client.get_all().await
}

Implementors§