Trait Host

Source
pub trait Host:
    Send
    + HostCas
    + Sized
    + Send {
    // Required methods
    fn increment(
        &mut self,
        bucket: Resource<Bucket>,
        key: String,
        delta: i64,
    ) -> impl Future<Output = Result<i64, Error>> + Send;
    fn swap(
        &mut self,
        cas: Resource<Cas>,
        value: Vec<u8>,
    ) -> impl Future<Output = Result<(), CasError>> + Send;
    fn convert_cas_error(&mut self, err: CasError) -> Result<CasError>;
}

Required Methods§

Source

fn increment( &mut self, bucket: Resource<Bucket>, key: String, delta: i64, ) -> impl Future<Output = Result<i64, Error>> + Send

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

If the key does not exist in the store, it creates a new key-value pair with the value set to the given delta.

If any other error occurs, it returns an Err(error).

Source

fn swap( &mut self, cas: Resource<Cas>, value: Vec<u8>, ) -> impl Future<Output = Result<(), CasError>> + Send

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

Source

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

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 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.

If the key does not exist in the store, it creates a new key-value pair with the value set to the given delta.

If any other error occurs, it returns an Err(error).

Source§

async fn swap( &mut self, cas: 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§

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

Implementors§