Trait wasmcloud_runtime::capability::keyvalue::store::HostBucket
source · pub trait HostBucket {
// Required methods
fn get<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn exists<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<bool, Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_keys<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
cursor: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Result<KeyResponse, Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn drop<'life0, 'async_trait>(
&'life0 mut self,
rep: Resource<Bucket>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Required Methods§
sourcefn get<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the value associated with the specified key
The value is returned as an option. If the key-value pair exists in the
store, it returns Ok(value)
. If the key does not exist in the
store, it returns Ok(none)
.
If any other error occurs, it returns an Err(error)
.
sourcefn set<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the value associated with the key in the store. If the key already exists in the store, it overwrites the value.
If the key does not exist in the store, it creates a new key-value pair.
If any other error occurs, it returns an Err(error)
.
sourcefn delete<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete the key-value pair associated with the key in the store.
If the key does not exist in the store, it does nothing.
If any other error occurs, it returns an Err(error)
.
sourcefn exists<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<bool, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exists<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<bool, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the key exists in the store.
If the key exists in the store, it returns Ok(true)
. If the key does
not exist in the store, it returns Ok(false)
.
If any other error occurs, it returns an Err(error)
.
sourcefn list_keys<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
cursor: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Result<KeyResponse, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_keys<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
cursor: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Result<KeyResponse, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
Note that the keys are not guaranteed to be returned in any particular order.
If the store is empty, it returns an empty list.
MAY show an out-of-date list of keys if there are concurrent writes to the store.
If any error occurs, it returns an Err(error)
.
fn drop<'life0, 'async_trait>(
&'life0 mut self,
rep: Resource<Bucket>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Implementations on Foreign Types§
source§impl<_T: HostBucket + ?Sized + Send> HostBucket for &mut _T
impl<_T: HostBucket + ?Sized + Send> HostBucket for &mut _T
source§fn get<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<Option<Vec<u8>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the value associated with the specified key
The value is returned as an option. If the key-value pair exists in the
store, it returns Ok(value)
. If the key does not exist in the
store, it returns Ok(none)
.
If any other error occurs, it returns an Err(error)
.
source§fn set<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the value associated with the key in the store. If the key already exists in the store, it overwrites the value.
If the key does not exist in the store, it creates a new key-value pair.
If any other error occurs, it returns an Err(error)
.
source§fn delete<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete the key-value pair associated with the key in the store.
If the key does not exist in the store, it does nothing.
If any other error occurs, it returns an Err(error)
.
source§fn exists<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<bool, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exists<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Result<bool, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the key exists in the store.
If the key exists in the store, it returns Ok(true)
. If the key does
not exist in the store, it returns Ok(false)
.
If any other error occurs, it returns an Err(error)
.
source§fn list_keys<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
cursor: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Result<KeyResponse, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_keys<'life0, 'async_trait>(
&'life0 mut self,
self_: Resource<Bucket>,
cursor: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Result<KeyResponse, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
Note that the keys are not guaranteed to be returned in any particular order.
If the store is empty, it returns an empty list.
MAY show an out-of-date list of keys if there are concurrent writes to the store.
If any error occurs, it returns an Err(error)
.