KVStore

Struct KVStore 

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

A Compute KV Store.

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

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Delete a value in the KV Store.

Returns Ok(()) if delete is successful.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

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<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 = 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> ErasedDestructor for T
where T: 'static,