pub struct KvClient { /* private fields */ }Expand description
Key-value store client interface
Implements CRUD operations with configurable consistency levels. All write operations use strong consistency.
Implementations§
Source§impl KvClient
impl KvClient
Sourcepub async fn put(
&self,
key: impl AsRef<[u8]>,
value: impl AsRef<[u8]>,
) -> Result<()>
pub async fn put( &self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>, ) -> Result<()>
§Errors
Error::FailedToSendWriteRequestErroron network failuresError::InvalidResponsefor malformed server responses
Sourcepub async fn delete(&self, key: impl AsRef<[u8]>) -> Result<()>
pub async fn delete(&self, key: impl AsRef<[u8]>) -> Result<()>
Deletes a key with strong consistency guarantees
Permanently removes the specified key and its associated value from the store.
§Parameters
key: The byte-serialized key to delete. Supports any type implementingAsRef<[u8]>(e.g.String,&str,Vec<u8>)
§Errors
Error::FailedToSendWriteRequestErrorif unable to reach the leader nodeError::InvalidResponsefor malformed server responses
Sourcepub async fn get(
&self,
key: impl AsRef<[u8]>,
linear: bool,
) -> Result<Option<ClientResult>>
pub async fn get( &self, key: impl AsRef<[u8]>, linear: bool, ) -> Result<Option<ClientResult>>
Sourcepub async fn get_multi(
&self,
keys: impl IntoIterator<Item = impl AsRef<[u8]>>,
linear: bool,
) -> Result<Vec<Option<ClientResult>>>
pub async fn get_multi( &self, keys: impl IntoIterator<Item = impl AsRef<[u8]>>, linear: bool, ) -> Result<Vec<Option<ClientResult>>>
Fetches values for multiple keys from the cluster
§Parameters
keys: Iterable collection of keys to fetchlinear: Whether to use linearizable read consistency
§Returns
Ordered list of results matching input keys. Missing keys return None.
§Errors
Error::EmptyKeysif no keys providedError::FailedToSendReadRequestErroron network failures
Auto Trait Implementations§
impl Freeze for KvClient
impl !RefUnwindSafe for KvClient
impl Send for KvClient
impl Sync for KvClient
impl Unpin for KvClient
impl !UnwindSafe for KvClient
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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
T in a tonic::Request