pub struct GrpcClient { /* private fields */ }Expand description
gRPC-based key-value store client
Implements remote CRUD operations via gRPC protocol. All write operations use strong consistency.
Implementations§
Source§impl GrpcClient
impl GrpcClient
pub async fn get_linearizable( &self, key: impl AsRef<[u8]>, ) -> Result<Option<ClientResult>, ClientApiError>
pub async fn get_lease( &self, key: impl AsRef<[u8]>, ) -> Result<Option<ClientResult>, ClientApiError>
pub async fn get_eventual( &self, key: impl AsRef<[u8]>, ) -> Result<Option<ClientResult>, ClientApiError>
Sourcepub async fn get_with_policy(
&self,
key: impl AsRef<[u8]>,
consistency_policy: Option<ReadConsistencyPolicy>,
) -> Result<Option<ClientResult>, ClientApiError>
pub async fn get_with_policy( &self, key: impl AsRef<[u8]>, consistency_policy: Option<ReadConsistencyPolicy>, ) -> Result<Option<ClientResult>, ClientApiError>
Retrieves a single key’s value with explicit consistency policy
Allows client to override server’s default consistency policy for this specific request. If server’s allow_client_override is false, the override will be ignored.
§Parameters
key- The key to retrieve, accepts any type implementingAsRef<[u8]>policy- Explicit consistency policy for this request
Sourcepub async fn get_multi_with_policy(
&self,
keys: impl IntoIterator<Item = impl AsRef<[u8]>>,
consistency_policy: Option<ReadConsistencyPolicy>,
) -> Result<Vec<Option<ClientResult>>, ClientApiError>
pub async fn get_multi_with_policy( &self, keys: impl IntoIterator<Item = impl AsRef<[u8]>>, consistency_policy: Option<ReadConsistencyPolicy>, ) -> Result<Vec<Option<ClientResult>>, ClientApiError>
Fetches multiple keys with explicit consistency policy override
Allows client to override server’s default consistency policy for this batch request. If server’s allow_client_override is false, the override will be ignored.
Sourcepub async fn watch(
&self,
key: impl AsRef<[u8]>,
) -> ClientApiResult<Streaming<WatchResponse>>
pub async fn watch( &self, key: impl AsRef<[u8]>, ) -> ClientApiResult<Streaming<WatchResponse>>
Watch for changes to a specific key
Returns a stream of watch events when the key’s value changes. The stream will continue until explicitly closed or a connection error occurs.
§Arguments
key- The key to watch
§Returns
A streaming response that yields WatchResponse events
§Errors
Returns error if unable to establish watch connection
Trait Implementations§
Source§impl ClientApi for GrpcClient
impl ClientApi for GrpcClient
Source§fn put<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
value: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
value: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn put_with_ttl<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
value: impl 'async_trait + AsRef<[u8]> + Send,
ttl_secs: u64,
) -> Pin<Box<dyn Future<Output = ClientApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put_with_ttl<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
value: impl 'async_trait + AsRef<[u8]> + Send,
ttl_secs: u64,
) -> Pin<Box<dyn Future<Output = ClientApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_multi<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [Bytes],
) -> Pin<Box<dyn Future<Output = ClientApiResult<Vec<Option<Bytes>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_multi<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [Bytes],
) -> Pin<Box<dyn Future<Output = ClientApiResult<Vec<Option<Bytes>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn delete<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn compare_and_swap<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
expected_value: Option<impl 'async_trait + AsRef<[u8]> + Send>,
new_value: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn compare_and_swap<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
expected_value: Option<impl 'async_trait + AsRef<[u8]> + Send>,
new_value: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn list_members<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Vec<NodeMeta>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_members<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Vec<NodeMeta>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_leader_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_leader_id<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Option<u32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_multi_with_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [Bytes],
consistency_policy: Option<ReadConsistencyPolicy>,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Vec<Option<Bytes>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_multi_with_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [Bytes],
consistency_policy: Option<ReadConsistencyPolicy>,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Vec<Option<Bytes>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_linearizable<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_linearizable<'life0, 'async_trait>(
&'life0 self,
key: impl 'async_trait + AsRef<[u8]> + Send,
) -> Pin<Box<dyn Future<Output = ClientApiResult<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Clone for GrpcClient
impl Clone for GrpcClient
Source§fn clone(&self) -> GrpcClient
fn clone(&self) -> GrpcClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GrpcClient
impl !RefUnwindSafe for GrpcClient
impl Send for GrpcClient
impl Sync for GrpcClient
impl Unpin for GrpcClient
impl UnsafeUnpin for GrpcClient
impl !UnwindSafe for GrpcClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request