KVStore

Structin kv_storefastly 0.13.1View source
pub struct KVStore { /* private fields */ }

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

Methods

build_delete

View source
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.

Parameters

self: &Self

Returns

build_insert

View source
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.

Parameters

self: &Self

Returns

build_list

View source
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.

Parameters

self: &Self

Returns

build_lookup

View source
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.

Parameters

self: &Self

Returns

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

Delete a value in the KV Store.

Returns Ok(()) if delete is successful.

Parameters

self: &Self
key: &str

Returns

Result<(), KVStoreError>
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.

Parameters

self: &Self
key: &str
value: impl Into<Body>

Returns

Result<(), KVStoreError>
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.

Parameters

self: &Self

Returns

Result<ListPage, KVStoreError>
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.

Parameters

self: &Self
key: &str

Returns

Result<LookupResponse, KVStoreError>
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).

Parameters

name: &str

Returns

Result<Option<Self>, KVStoreError>

pending_delete_wait

View source
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.

Parameters

self: &Self
pending_delete_handle: PendingDeleteHandle

Returns

Result<(), KVStoreError>

pending_insert_wait

View source
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.

Parameters

self: &Self
pending_insert_handle: PendingInsertHandle

Returns

Result<(), KVStoreError>

pending_list_wait

View source
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.

Parameters

self: &Self
pending_request_handle: PendingListHandle

Returns

Result<ListPage, KVStoreError>

pending_lookup_wait

View source
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.

Parameters

self: &Self
pending_request_handle: PendingLookupHandle

Returns

Result<LookupResponse, KVStoreError>

Auto trait implementations

Blanket implementations