Struct etcd_client::KvClient
source · pub struct KvClient { /* private fields */ }
Expand description
Client for KV operations.
Implementations§
source§impl KvClient
impl KvClient
sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
sourcepub async fn put(
&mut self,
key: impl Into<Vec<u8>>,
value: impl Into<Vec<u8>>,
options: Option<PutOptions>,
) -> Result<PutResponse, Error>
pub async fn put( &mut self, key: impl Into<Vec<u8>>, value: impl Into<Vec<u8>>, options: Option<PutOptions>, ) -> Result<PutResponse, Error>
Puts the given key into the key-value store. A put request increments the revision of the key-value store and generates one event in the event history.
sourcepub async fn get(
&mut self,
key: impl Into<Vec<u8>>,
options: Option<GetOptions>,
) -> Result<GetResponse, Error>
pub async fn get( &mut self, key: impl Into<Vec<u8>>, options: Option<GetOptions>, ) -> Result<GetResponse, Error>
Gets the key or a range of keys from the store.
sourcepub async fn delete(
&mut self,
key: impl Into<Vec<u8>>,
options: Option<DeleteOptions>,
) -> Result<DeleteResponse, Error>
pub async fn delete( &mut self, key: impl Into<Vec<u8>>, options: Option<DeleteOptions>, ) -> Result<DeleteResponse, Error>
Deletes the given key or a range of keys from the key-value store.
sourcepub async fn compact(
&mut self,
revision: i64,
options: Option<CompactionOptions>,
) -> Result<CompactionResponse, Error>
pub async fn compact( &mut self, revision: i64, options: Option<CompactionOptions>, ) -> Result<CompactionResponse, Error>
Compacts the event history in the etcd key-value store. The key-value store should be periodically compacted or the event history will continue to grow indefinitely.
sourcepub async fn txn(&mut self, txn: Txn) -> Result<TxnResponse, Error>
pub async fn txn(&mut self, txn: Txn) -> Result<TxnResponse, Error>
Processes multiple operations in a single transaction. A txn request increments the revision of the key-value store and generates events with the same revision for every completed operation. It is not allowed to modify the same key several times within one txn.
Trait Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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