Trait wasmcloud_runtime::capability::keyvalue::batch::Host
source · pub trait Host: Send {
// Required methods
fn get_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<Vec<Option<(String, Vec<u8>)>>, Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
key_values: Vec<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Required Methods§
sourcefn get_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<Vec<Option<(String, Vec<u8>)>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<Vec<Option<(String, Vec<u8>)>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs.
If any of the keys do not exist in the store, it returns a none
value for that pair in the
list.
MAY show an out-of-date value if there are concurrent writes to the store.
If any other error occurs, it returns an Err(error)
.
sourcefn set_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
key_values: Vec<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
key_values: Vec<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the values associated with the keys in the store. If the key already exists in the store, it overwrites the value.
Note that the key-value pairs are not guaranteed to be set in the order they are provided.
If any of the keys do not exist in the store, it creates a new key-value pair.
If any other error occurs, it returns an Err(error)
. When an error occurs, it does not
rollback the key-value pairs that were already set. Thus, this batch operation does not
guarantee atomicity, implying that some key-value pairs could be set while others might
fail.
Other concurrent operations may also be able to see the partial results.
sourcefn delete_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete the key-value pairs associated with the keys in the store.
Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.
If any of the keys do not exist in the store, it skips the key.
If any other error occurs, it returns an Err(error)
. When an error occurs, it does not
rollback the key-value pairs that were already deleted. Thus, this batch operation does not
guarantee atomicity, implying that some key-value pairs could be deleted while others might
fail.
Other concurrent operations may also be able to see the partial results.
Implementations on Foreign Types§
source§impl<_T: Host + ?Sized + Send> Host for &mut _T
impl<_T: Host + ?Sized + Send> Host for &mut _T
source§fn get_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<Vec<Option<(String, Vec<u8>)>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<Vec<Option<(String, Vec<u8>)>>, Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs.
If any of the keys do not exist in the store, it returns a none
value for that pair in the
list.
MAY show an out-of-date value if there are concurrent writes to the store.
If any other error occurs, it returns an Err(error)
.
source§fn set_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
key_values: Vec<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
key_values: Vec<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the values associated with the keys in the store. If the key already exists in the store, it overwrites the value.
Note that the key-value pairs are not guaranteed to be set in the order they are provided.
If any of the keys do not exist in the store, it creates a new key-value pair.
If any other error occurs, it returns an Err(error)
. When an error occurs, it does not
rollback the key-value pairs that were already set. Thus, this batch operation does not
guarantee atomicity, implying that some key-value pairs could be set while others might
fail.
Other concurrent operations may also be able to see the partial results.
source§fn delete_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_many<'life0, 'async_trait>(
&'life0 mut self,
bucket: Resource<Bucket>,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Result<(), Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete the key-value pairs associated with the keys in the store.
Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.
If any of the keys do not exist in the store, it skips the key.
If any other error occurs, it returns an Err(error)
. When an error occurs, it does not
rollback the key-value pairs that were already deleted. Thus, this batch operation does not
guarantee atomicity, implying that some key-value pairs could be deleted while others might
fail.
Other concurrent operations may also be able to see the partial results.