pub struct KeyValueDispatch { /* private fields */ }
Implementations§
Source§impl KeyValueDispatch
impl KeyValueDispatch
pub fn new( allowed_stores: HashSet<String>, manager: Arc<dyn StoreManager>, ) -> Self
pub fn new_with_capacity( allowed_stores: HashSet<String>, manager: Arc<dyn StoreManager>, capacity: u32, ) -> Self
pub fn get_store<T: 'static>( &self, store: Resource<T>, ) -> Result<&Arc<dyn Store>>
pub fn get_cas<T: 'static>(&self, cas: Resource<T>) -> Result<&Arc<dyn Cas>>
pub fn allowed_stores(&self) -> &HashSet<String>
pub fn get_store_wasi<T: 'static>( &self, store: Resource<T>, ) -> Result<&Arc<dyn Store>, Error>
pub fn get_cas_wasi<T: 'static>( &self, cas: Resource<T>, ) -> Result<&Arc<dyn Cas>, Error>
Trait Implementations§
Source§impl Host for KeyValueDispatch
impl Host for KeyValueDispatch
Source§impl Host for KeyValueDispatch
impl Host for KeyValueDispatch
Source§async fn get_many(
&mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Result<Vec<(String, Option<Vec<u8>>)>, Error>
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§impl Host for KeyValueDispatch
impl Host for KeyValueDispatch
fn convert_cas_error(&mut self, error: CasError) -> Result<CasError, Error>
Source§impl Host for KeyValueDispatch
impl Host for KeyValueDispatch
Source§async fn open(&mut self, name: String) -> Result<Result<u32, LegacyError>>
async fn open(&mut self, name: String) -> Result<Result<u32, LegacyError>>
Open the store with the specified name. Read more
Source§async fn set(
&mut self,
store: u32,
key: String,
value: Vec<u8>,
) -> Result<Result<(), LegacyError>>
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 moreSource§impl HostBucket for KeyValueDispatch
impl HostBucket for KeyValueDispatch
Source§async fn get(
&mut self,
self_: Resource<Bucket>,
key: String,
) -> Result<Option<Vec<u8>>, Error>
async fn get( &mut self, self_: Resource<Bucket>, key: String, ) -> Result<Option<Vec<u8>>, Error>
Get the value associated with the specified
key
Read moreSource§async fn set(
&mut self,
self_: Resource<Bucket>,
key: String,
value: Vec<u8>,
) -> Result<(), Error>
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>
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>
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>
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 moreasync fn drop(&mut self, rep: Resource<Bucket>) -> Result<()>
Source§impl HostCas for KeyValueDispatch
impl HostCas for KeyValueDispatch
Source§async fn new(
&mut self,
bucket: Resource<Bucket>,
key: String,
) -> Result<Resource<Cas>, Error>
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>
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
async fn drop(&mut self, rep: Resource<Cas>) -> Result<()>
Source§impl HostStore for KeyValueDispatch
impl HostStore for KeyValueDispatch
Source§async fn open(&mut self, name: String) -> Result<Result<Resource<Store>, Error>>
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>>
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 moreSource§async fn set(
&mut self,
store: Resource<Store>,
key: String,
value: Vec<u8>,
) -> Result<Result<(), Error>>
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>>
async fn delete( &mut self, store: Resource<Store>, key: String, ) -> Result<Result<(), Error>>
Delete the tuple with the specified
key
Read moreSource§async fn exists(
&mut self,
store: Resource<Store>,
key: String,
) -> Result<Result<bool, Error>>
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>>
async fn get_keys( &mut self, store: Resource<Store>, ) -> Result<Result<Vec<String>, Error>>
Return a list of all the keys
async fn drop(&mut self, store: Resource<Store>) -> Result<()>
impl Host for KeyValueDispatch
Auto Trait Implementations§
impl Freeze for KeyValueDispatch
impl !RefUnwindSafe for KeyValueDispatch
impl Send for KeyValueDispatch
impl Sync for KeyValueDispatch
impl Unpin for KeyValueDispatch
impl !UnwindSafe for KeyValueDispatch
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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