pub struct PastryClient { /* private fields */ }Expand description
A client for Pastry nodes.
Implementations§
Source§impl PastryClient
impl PastryClient
Sourcepub async fn get_kv(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>
pub async fn get_kv(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>
Retrieves a value associated with the given key stored in the Pastry network.
§Arguments
key- A slice of bytes representing the key for which the value is requested.
§Returns
Returns a Result which is:
Ok(Some(Vec<u8>))if the key exists, containing the associated value.Ok(None)if the key does not exist.Err(e)whereeencapsulates any error encountered during the operation.
Sourcepub async fn set_kv(
&mut self,
key: &[u8],
value: &[u8],
) -> Result<Option<Vec<u8>>>
pub async fn set_kv( &mut self, key: &[u8], value: &[u8], ) -> Result<Option<Vec<u8>>>
Sets a value for a given key in the Pastry network.
§Arguments
key- A slice of bytes representing the key to which the value is to be associated.value- A slice of bytes representing the value to be set.
§Returns
Returns a Result which is:
Ok(Some(Vec<u8>))if the key existed and the value was replaced, containing the old value.Ok(None)if the key did not exist and a new entry was created.Err(e)whereeencapsulates any error encountered during the operation.
Sourcepub async fn delete_kv(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>
pub async fn delete_kv(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>
Deletes the value associated with the given key in the Pastry network.
§Arguments
key- A slice of bytes representing the key whose associated value is to be deleted.
§Returns
Returns a Result which is:
Ok(Some(Vec<u8>))if the key existed and the value was successfully deleted, containing the deleted value.Ok(None)if the key did not exist.Err(e)whereeencapsulates any error encountered during the operation.
Trait Implementations§
Source§impl Clone for PastryClient
impl Clone for PastryClient
Source§fn clone(&self) -> PastryClient
fn clone(&self) -> PastryClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for PastryClient
impl !RefUnwindSafe for PastryClient
impl Send for PastryClient
impl Sync for PastryClient
impl Unpin for PastryClient
impl !UnwindSafe for PastryClient
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> 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>
Wrap the input message
T in a tonic::Request