Struct KeyValueDispatch

Source
pub struct KeyValueDispatch { /* private fields */ }

Implementations§

Source§

impl KeyValueDispatch

Source

pub fn new( allowed_stores: HashSet<String>, manager: Arc<dyn StoreManager>, ) -> Self

Source

pub fn new_with_capacity( allowed_stores: HashSet<String>, manager: Arc<dyn StoreManager>, capacity: u32, ) -> Self

Source

pub fn get_store<T: 'static>( &self, store: Resource<T>, ) -> Result<&Arc<dyn Store>>

Source

pub fn get_cas<T: 'static>(&self, cas: Resource<T>) -> Result<&Arc<dyn Cas>>

Source

pub fn allowed_stores(&self) -> &HashSet<String>

Source

pub fn get_store_wasi<T: 'static>( &self, store: Resource<T>, ) -> Result<&Arc<dyn Store>, Error>

Source

pub fn get_cas_wasi<T: 'static>( &self, cas: Resource<T>, ) -> Result<&Arc<dyn Cas>, Error>

Trait Implementations§

Source§

impl Host for KeyValueDispatch

Source§

async fn open(&mut self, identifier: String) -> Result<Resource<Bucket>, Error>

Get the bucket with the specified identifier. Read more
Source§

fn convert_error(&mut self, error: Error) -> Result<Error, Error>

Source§

impl Host for KeyValueDispatch

Source§

async fn get_many( &mut self, bucket: Resource<Bucket>, keys: Vec<String>, ) -> Result<Vec<(String, Option<Vec<u8>>)>, Error>

Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs. Read more
Source§

async fn set_many( &mut self, bucket: Resource<Bucket>, key_values: Vec<(String, Vec<u8>)>, ) -> Result<(), Error>

Set the values associated with the keys in the store. If the key already exists in the store, it overwrites the value. Read more
Source§

async fn delete_many( &mut self, bucket: Resource<Bucket>, keys: Vec<String>, ) -> Result<(), Error>

Delete the key-value pairs associated with the keys in the store. Read more
Source§

impl Host for KeyValueDispatch

Source§

fn convert_cas_error(&mut self, error: CasError) -> Result<CasError, Error>

Source§

async fn increment( &mut self, bucket: Resource<Bucket>, key: String, delta: i64, ) -> Result<i64, Error>

Atomically increment the value associated with the key in the store by the given delta. It returns the new value. Read more
Source§

async fn swap( &mut self, cas_res: Resource<Cas>, value: Vec<u8>, ) -> Result<(), CasError>

Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if the CAS operation failed.
Source§

impl Host for KeyValueDispatch

Source§

async fn open(&mut self, name: String) -> Result<Result<u32, LegacyError>>

Open the store with the specified name. Read more
Source§

async fn get( &mut self, store: u32, key: String, ) -> Result<Result<Vec<u8>, LegacyError>>

Get the value associated with the specified key from the specified store. Read more
Source§

async fn set( &mut self, store: u32, key: String, value: Vec<u8>, ) -> Result<Result<(), LegacyError>>

Set the value associated with the specified key in the specified store, overwriting any existing value. Read more
Source§

async fn delete( &mut self, store: u32, key: String, ) -> Result<Result<(), LegacyError>>

Delete the tuple with the specified key from the specified store. Read more
Source§

async fn exists( &mut self, store: u32, key: String, ) -> Result<Result<bool, LegacyError>>

Return whether a tuple exists for the specified key in the specified store. Read more
Source§

async fn get_keys( &mut self, store: u32, ) -> Result<Result<Vec<String>, LegacyError>>

Return a list of all the keys in the specified store. Read more
Source§

async fn close(&mut self, store: u32) -> Result<()>

Close the specified store. Read more
Source§

impl HostBucket for KeyValueDispatch

Source§

async fn get( &mut self, self_: Resource<Bucket>, key: String, ) -> Result<Option<Vec<u8>>, Error>

Get the value associated with the specified key Read more
Source§

async fn set( &mut self, self_: Resource<Bucket>, key: String, value: Vec<u8>, ) -> Result<(), Error>

Set the value associated with the key in the store. If the key already exists in the store, it overwrites the value. Read more
Source§

async fn delete( &mut self, self_: Resource<Bucket>, key: String, ) -> Result<(), Error>

Delete the key-value pair associated with the key in the store. Read more
Source§

async fn exists( &mut self, self_: Resource<Bucket>, key: String, ) -> Result<bool, Error>

Check if the key exists in the store. Read more
Source§

async fn list_keys( &mut self, self_: Resource<Bucket>, cursor: Option<String>, ) -> Result<KeyResponse, Error>

Get all the keys in the store with an optional cursor (for use in pagination). It returns a list of keys. Please note that for most KeyValue implementations, this is a can be a very expensive operation and so it should be used judiciously. Implementations can return any number of keys in a single response, but they should never attempt to send more data than is reasonable (i.e. on a small edge device, this may only be a few KB, while on a large machine this could be several MB). Any response should also return a cursor that can be used to fetch the next page of keys. See the key-response record for more information. Read more
Source§

async fn drop(&mut self, rep: Resource<Bucket>) -> Result<()>

Source§

impl HostCas for KeyValueDispatch

Source§

async fn new( &mut self, bucket: Resource<Bucket>, key: String, ) -> Result<Resource<Cas>, Error>

Construct a new CAS operation. Implementors can map the underlying functionality (transactions, versions, etc) as desired.
Source§

async fn current( &mut self, cas: Resource<Cas>, ) -> Result<Option<Vec<u8>>, Error>

Get the current value of the key (if it exists). This allows for avoiding reads if all that is needed to ensure the atomicity of the operation
Source§

async fn drop(&mut self, rep: Resource<Cas>) -> Result<()>

Source§

impl HostStore for KeyValueDispatch

Source§

async fn open(&mut self, name: String) -> Result<Result<Resource<Store>, Error>>

Open the store with the specified label. Read more
Source§

async fn get( &mut self, store: Resource<Store>, key: String, ) -> Result<Result<Option<Vec<u8>>, Error>>

Get the value associated with the specified key Read more
Source§

async fn set( &mut self, store: Resource<Store>, key: String, value: Vec<u8>, ) -> Result<Result<(), Error>>

Set the value associated with the specified key overwriting any existing value.
Source§

async fn delete( &mut self, store: Resource<Store>, key: String, ) -> Result<Result<(), Error>>

Delete the tuple with the specified key Read more
Source§

async fn exists( &mut self, store: Resource<Store>, key: String, ) -> Result<Result<bool, Error>>

Return whether a tuple exists for the specified key
Source§

async fn get_keys( &mut self, store: Resource<Store>, ) -> Result<Result<Vec<String>, Error>>

Return a list of all the keys
Source§

async fn drop(&mut self, store: Resource<Store>) -> Result<()>

Source§

impl Host for KeyValueDispatch

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

impl<T> MaybeSendSync for T