pub struct K2vClient { /* private fields */ }Expand description
Client used to query a K2V server.
Implementations§
Source§impl K2vClient
impl K2vClient
Sourcepub fn new(config: K2vClientConfig) -> Result<Self, Error>
pub fn new(config: K2vClientConfig) -> Result<Self, Error>
Create a new K2V client.
Sourcepub async fn read_item(
&self,
partition_key: &str,
sort_key: &str,
) -> Result<CausalValue, Error>
pub async fn read_item( &self, partition_key: &str, sort_key: &str, ) -> Result<CausalValue, Error>
Perform a ReadItem request, reading the value(s) stored for a single pk+sk.
Sourcepub async fn poll_item(
&self,
partition_key: &str,
sort_key: &str,
causality: CausalityToken,
timeout: Option<Duration>,
) -> Result<Option<CausalValue>, Error>
pub async fn poll_item( &self, partition_key: &str, sort_key: &str, causality: CausalityToken, timeout: Option<Duration>, ) -> Result<Option<CausalValue>, Error>
Perform a PollItem request, waiting for the value(s) stored for a single pk+sk to be updated.
Sourcepub async fn poll_range(
&self,
partition_key: &str,
filter: Option<PollRangeFilter<'_>>,
seen_marker: Option<&str>,
timeout: Option<Duration>,
) -> Result<Option<(BTreeMap<String, CausalValue>, String)>, Error>
pub async fn poll_range( &self, partition_key: &str, filter: Option<PollRangeFilter<'_>>, seen_marker: Option<&str>, timeout: Option<Duration>, ) -> Result<Option<(BTreeMap<String, CausalValue>, String)>, Error>
Perform a PollRange request, waiting for any change in a given range of keys to occur
Sourcepub async fn insert_item(
&self,
partition_key: &str,
sort_key: &str,
value: Vec<u8>,
causality: Option<CausalityToken>,
) -> Result<(), Error>
pub async fn insert_item( &self, partition_key: &str, sort_key: &str, value: Vec<u8>, causality: Option<CausalityToken>, ) -> Result<(), Error>
Perform an InsertItem request, inserting a value for a single pk+sk.
Sourcepub async fn delete_item(
&self,
partition_key: &str,
sort_key: &str,
causality: CausalityToken,
) -> Result<(), Error>
pub async fn delete_item( &self, partition_key: &str, sort_key: &str, causality: CausalityToken, ) -> Result<(), Error>
Perform a DeleteItem request, deleting the value(s) stored for a single pk+sk.
Sourcepub async fn read_index(
&self,
filter: Filter<'_>,
) -> Result<PaginatedRange<PartitionInfo>, Error>
pub async fn read_index( &self, filter: Filter<'_>, ) -> Result<PaginatedRange<PartitionInfo>, Error>
Perform a ReadIndex request, listing partition key which have at least one associated sort key, and which matches the filter.
Sourcepub async fn insert_batch(
&self,
operations: &[BatchInsertOp<'_>],
) -> Result<(), Error>
pub async fn insert_batch( &self, operations: &[BatchInsertOp<'_>], ) -> Result<(), Error>
Perform an InsertBatch request, inserting multiple values at once. Note: this operation is not atomic: it is possible for some sub-operations to fails and others to success. In that case, failure is reported.
Sourcepub async fn read_batch(
&self,
operations: &[BatchReadOp<'_>],
) -> Result<Vec<PaginatedRange<CausalValue>>, Error>
pub async fn read_batch( &self, operations: &[BatchReadOp<'_>], ) -> Result<Vec<PaginatedRange<CausalValue>>, Error>
Perform a ReadBatch request, reading multiple values or range of values at once.
Sourcepub async fn delete_batch(
&self,
operations: &[BatchDeleteOp<'_>],
) -> Result<Vec<u64>, Error>
pub async fn delete_batch( &self, operations: &[BatchDeleteOp<'_>], ) -> Result<Vec<u64>, Error>
Perform a DeleteBatch request, deleting mutiple values or range of values at once, without providing causality information.
Auto Trait Implementations§
impl !Freeze for K2vClient
impl !RefUnwindSafe for K2vClient
impl Send for K2vClient
impl Sync for K2vClient
impl Unpin for K2vClient
impl !UnwindSafe for K2vClient
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more