K2vClient

Struct K2vClient 

Source
pub struct K2vClient { /* private fields */ }
Expand description

Client used to query a K2V server.

Implementations§

Source§

impl K2vClient

Source

pub fn new(config: K2vClientConfig) -> Result<Self, Error>

Create a new K2V client.

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more