pub struct KVStore { /* private fields */ }Expand description
Keys in the KV Store must follow the following rules:
- Keys can contain any sequence of valid Unicode characters, of length 1-1024 bytes when UTF-8 encoded.
- Keys cannot contain Carriage Return or Line Feed characters.
- Keys cannot start with
.well-known/acme-challenge/. - Keys cannot be named
.or...
Implementations§
Source§impl KVStore
impl KVStore
Sourcepub fn open(name: &str) -> Result<Option<Self>, KVStoreError>
pub fn open(name: &str) -> Result<Option<Self>, KVStoreError>
Open the KV Store with the given name.
If there is no store by that name, this returns Ok(None).
Sourcepub fn lookup(&self, key: &str) -> Result<LookupResponse, KVStoreError>
pub fn lookup(&self, key: &str) -> Result<LookupResponse, KVStoreError>
Look up a value in the KV Store.
Returns Ok(LookupResponse) if the value is retrieved without error, and KVStoreError if the lookup failed.
Sourcepub fn build_lookup(&self) -> LookupBuilder<'_>
pub fn build_lookup(&self) -> LookupBuilder<'_>
Create a buildable lookup request for the KV Store.
When the desired configuration has been set, execute the lookup and wait for the response.
Sourcepub fn pending_lookup_wait(
&self,
pending_request_handle: PendingLookupHandle,
) -> Result<LookupResponse, KVStoreError>
pub fn pending_lookup_wait( &self, pending_request_handle: PendingLookupHandle, ) -> Result<LookupResponse, KVStoreError>
Look up a value in the KV Store.
Returns Ok(LookupResponse) if the value is found, and Err(KVStoreError) if the lookup failed.
Sourcepub fn insert(
&self,
key: &str,
value: impl Into<Body>,
) -> Result<(), KVStoreError>
pub fn insert( &self, key: &str, value: impl Into<Body>, ) -> Result<(), KVStoreError>
Insert a value into the KV Store.
If the store already contained a value for this key, it will be overwritten.
The value may be provided as any type that can be converted to Body, such as &[u8],
Vec<u8>, &str, or String.
§Value sizes
The size of the value must be known when calling this method. In practice, that means that
if a Body value contains an external request or response, it must be encoded with
Content-Length rather than Transfer-Encoding: chunked.
Sourcepub fn build_insert(&self) -> InsertBuilder<'_>
pub fn build_insert(&self) -> InsertBuilder<'_>
Create a buildable insert request for the KV Store.
When the desired configuration has been set, execute the insert and wait for the response.
Sourcepub fn pending_insert_wait(
&self,
pending_insert_handle: PendingInsertHandle,
) -> Result<(), KVStoreError>
pub fn pending_insert_wait( &self, pending_insert_handle: PendingInsertHandle, ) -> Result<(), KVStoreError>
Insert a value in the KV Store.
Returns Ok(()) if the value is found, and KVStoreError if the key was not found.
Sourcepub fn delete(&self, key: &str) -> Result<(), KVStoreError>
pub fn delete(&self, key: &str) -> Result<(), KVStoreError>
Delete a value in the KV Store.
Returns Ok(()) if delete is successful.
Sourcepub fn build_delete(&self) -> DeleteBuilder<'_>
pub fn build_delete(&self) -> DeleteBuilder<'_>
Create a buildable delete request for the KV Store.
When the desired configuration has been set, execute the delete and wait for the response.
Sourcepub fn pending_delete_wait(
&self,
pending_delete_handle: PendingDeleteHandle,
) -> Result<(), KVStoreError>
pub fn pending_delete_wait( &self, pending_delete_handle: PendingDeleteHandle, ) -> Result<(), KVStoreError>
Delete a value in the KV Store.
Returns Ok(()) if the key is deleted, and KVStoreError if the key was not found.
Sourcepub fn list(&self) -> Result<ListPage, KVStoreError>
pub fn list(&self) -> Result<ListPage, KVStoreError>
List keys in the KV Store.
Returns an Ok(ListPage) on success, and Err(KVStoreError) if there was a failure. The
limit of items per page defaults to 100 items, but can be configured through ListBuilder.
Sourcepub fn build_list(&self) -> ListBuilder<'_>
pub fn build_list(&self) -> ListBuilder<'_>
Create a buildable list request for the KV Store.
When the desired configuration has been set, execute the list and wait for the response.
Sourcepub fn pending_list_wait(
&self,
pending_request_handle: PendingListHandle,
) -> Result<ListPage, KVStoreError>
pub fn pending_list_wait( &self, pending_request_handle: PendingListHandle, ) -> Result<ListPage, KVStoreError>
Wait on a pending list operation.
Returns Ok(ListPage) on success, and Err(KVStoreError) if there was a failure.
Auto Trait Implementations§
impl Freeze for KVStore
impl RefUnwindSafe for KVStore
impl Send for KVStore
impl Sync for KVStore
impl Unpin for KVStore
impl UnwindSafe for KVStore
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<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