Skip to main content

KVStoreTransaction

Trait KVStoreTransaction 

Source
pub trait KVStoreTransaction<Error>: DbTransactionFinalizer<Err = Error> {
    // Required methods
    fn kv_read<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        primary_namespace: &'life1 str,
        secondary_namespace: &'life2 str,
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn kv_write<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 mut self,
        primary_namespace: &'life1 str,
        secondary_namespace: &'life2 str,
        key: &'life3 str,
        value: &'life4 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn kv_write_if_absent<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 mut self,
        primary_namespace: &'life1 str,
        secondary_namespace: &'life2 str,
        key: &'life3 str,
        value: &'life4 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn kv_remove<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        primary_namespace: &'life1 str,
        secondary_namespace: &'life2 str,
        key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn kv_write_if_equals<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 mut self,
        primary_namespace: &'life1 str,
        secondary_namespace: &'life2 str,
        key: &'life3 str,
        expected: &'life4 [u8],
        replacement: &'life5 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait;
    fn kv_list<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        primary_namespace: &'life1 str,
        secondary_namespace: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Key-Value Store Transaction trait

Required Methods§

Source

fn kv_read<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, primary_namespace: &'life1 str, secondary_namespace: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Read value from key-value store

Source

fn kv_write<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 mut self, primary_namespace: &'life1 str, secondary_namespace: &'life2 str, key: &'life3 str, value: &'life4 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Write value to key-value store

Source

fn kv_write_if_absent<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 mut self, primary_namespace: &'life1 str, secondary_namespace: &'life2 str, key: &'life3 str, value: &'life4 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Write value to key-value store only when the key does not exist.

Returns true when the value was written and false when the key already exists. Implementations must perform the check-and-insert atomically (for example INSERT ... ON CONFLICT DO NOTHING with a rows-affected check).

Source

fn kv_remove<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, primary_namespace: &'life1 str, secondary_namespace: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Remove value from key-value store

Source

fn kv_write_if_equals<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 mut self, primary_namespace: &'life1 str, secondary_namespace: &'life2 str, key: &'life3 str, expected: &'life4 [u8], replacement: &'life5 [u8], ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Replace a value only when it currently equals expected.

Returns true when the value was replaced and false when the key does not exist or holds a different value. Implementations must perform the check-and-write atomically (for example UPDATE ... WHERE value = ? with a rows-affected check).

Source

fn kv_list<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, primary_namespace: &'life1 str, secondary_namespace: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List keys in a namespace

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§