Trait Host

Source
pub trait Host: Send + Send {
    // Required methods
    fn get_many(
        &mut self,
        bucket: Resource<Bucket>,
        keys: Vec<String>,
    ) -> impl Future<Output = Result<Vec<(String, Option<Vec<u8>>)>, Error>> + Send;
    fn set_many(
        &mut self,
        bucket: Resource<Bucket>,
        key_values: Vec<(String, Vec<u8>)>,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn delete_many(
        &mut self,
        bucket: Resource<Bucket>,
        keys: Vec<String>,
    ) -> impl Future<Output = Result<(), Error>> + Send;
}

Required Methods§

Source

fn get_many( &mut self, bucket: Resource<Bucket>, keys: Vec<String>, ) -> impl Future<Output = Result<Vec<(String, Option<Vec<u8>>)>, Error>> + Send

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( &mut self, bucket: Resource<Bucket>, key_values: Vec<(String, Vec<u8>)>, ) -> impl Future<Output = Result<(), Error>> + Send

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( &mut self, bucket: Resource<Bucket>, keys: Vec<String>, ) -> impl Future<Output = Result<(), Error>> + Send

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized + Send> Host for &mut _T

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.

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§

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.

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§

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.

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.

Implementors§