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
impl StoreHandle
Sourcepub fn as_u32(&self) -> u32
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.
Sourcepub fn open(name: &str) -> Result<Option<StoreHandle>, KVStoreError>
pub fn open(name: &str) -> Result<Option<StoreHandle>, KVStoreError>
Open a handle to the KV Store with the given name.
Sourcepub fn lookup(
&self,
key: impl AsRef<[u8]>,
) -> Result<PendingLookupHandle, KVStoreError>
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.
Sourcepub fn pending_lookup_wait(
&self,
pending_lookup_handle: PendingLookupHandle,
) -> Result<LookupResponse, KVStoreError>
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.
Sourcepub 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>
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.
Sourcepub fn pending_insert_wait(
&self,
pending_insert_handle: PendingInsertHandle,
) -> Result<(), KVStoreError>
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
Sourcepub fn delete(
&self,
key: impl AsRef<str>,
) -> Result<PendingDeleteHandle, KVStoreError>
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.
Sourcepub fn pending_delete_wait(
&self,
pending_delete_handle: PendingDeleteHandle,
) -> Result<(), KVStoreError>
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
Sourcepub fn list(
&self,
mode: ListMode,
cursor: Option<String>,
limit: Option<u32>,
prefix: Option<String>,
) -> Result<PendingListHandle, KVStoreError>
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.
Sourcepub fn pending_list_wait(
&self,
pending_list_handle: PendingListHandle,
) -> Result<ListResponse<'_>, KVStoreError>
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
impl Debug for StoreHandle
impl Eq for StoreHandle
Source§impl Hash for StoreHandle
impl Hash for StoreHandle
Source§impl PartialEq for StoreHandle
impl PartialEq for StoreHandle
impl StructuralPartialEq for StoreHandle
Auto Trait Implementations§
impl Freeze for StoreHandle
impl RefUnwindSafe for StoreHandle
impl Send for StoreHandle
impl Sync for StoreHandle
impl Unpin for StoreHandle
impl UnsafeUnpin for StoreHandle
impl UnwindSafe for StoreHandle
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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