Skip to main content

StoreHandle

Struct StoreHandle 

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

A handle to a key-value store that is open for lookups and inserting.

Implementations§

Source§

impl StoreHandle

Source

pub fn as_u32(&self) -> u32

Get the underlying representation of the handle.

This should only be used when calling the raw ABI directly, and care should be taken not to reuse or alias handle values.

Source

pub fn open(name: &str) -> Result<Option<StoreHandle>, KVStoreError>

Open a handle to the KV Store with the given name.

Source

pub fn lookup( &self, key: impl AsRef<[u8]>, ) -> Result<PendingLookupHandle, KVStoreError>

Look up a value in the KV Store.

Returns Ok(PendingLookupHandle) if the creation of the async request was successful.

Source

pub fn pending_lookup_wait( &self, pending_lookup_handle: PendingLookupHandle, ) -> Result<LookupResponse, KVStoreError>

Wait on the async lookup of a value in the KV Store.

Returns Ok(LookupResponse) if a value is found, and Err(KVStoreError) if an error has occurred.

Source

pub fn insert( &self, key: impl AsRef<str>, value: BodyHandle, mode: InsertMode, background_fetch: bool, if_generation_match: Option<u64>, metadata: impl AsRef<str>, time_to_live_sec: Option<Duration>, ) -> Result<PendingInsertHandle, KVStoreError>

Insert a value into the KV Store.

If the KV Store already contains a value for this key, it will be overwritten.

Source

pub fn pending_insert_wait( &self, pending_insert_handle: PendingInsertHandle, ) -> Result<(), KVStoreError>

Wait on the async insert of a value in the KV Store.

Returns Ok(()) if insert is a success, and KVStoreError on failure

Source

pub fn delete( &self, key: impl AsRef<str>, ) -> Result<PendingDeleteHandle, KVStoreError>

Create async delete of a value in the KV Store.

Returns Ok(PendingDeleteHandle) if the creation of the async request was successful.

Source

pub fn pending_delete_wait( &self, pending_delete_handle: PendingDeleteHandle, ) -> Result<(), KVStoreError>

Wait on the async delete of a value in the KV Store.

Returns Ok(()) if delete is a success, and KVStoreError on failure

Source

pub fn list( &self, mode: ListMode, cursor: Option<String>, limit: Option<u32>, prefix: Option<String>, ) -> Result<PendingListHandle, KVStoreError>

Create async list of keys in the KV Store.

Returns Ok(PendingListHandle) if the creation of the async request was successful.

Source

pub fn pending_list_wait( &self, pending_list_handle: PendingListHandle, ) -> Result<ListResponse<'_>, KVStoreError>

Wait on the async list of keys in the KV Store.

Returns Ok(ListResponse) if the request was successful

Trait Implementations§

Source§

impl Debug for StoreHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for StoreHandle

Source§

impl Hash for StoreHandle

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for StoreHandle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StoreHandle

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.