Skip to main content

VersionedKeyValueStore

Trait VersionedKeyValueStore 

Source
pub trait VersionedKeyValueStore<K: Send + Sync, V: Send>: StateStore {
    // Required methods
    fn put<'life0, 'async_trait>(
        &'life0 mut self,
        key: K,
        value: Option<V>,
        timestamp: i64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        key: &'life1 K,
        timestamp: i64,
    ) -> Pin<Box<dyn Future<Output = Option<VersionedRecord<V>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 K,
    ) -> Pin<Box<dyn Future<Output = Option<VersionedRecord<V>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_as_of<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 K,
        as_of: i64,
    ) -> Pin<Box<dyn Future<Output = Option<VersionedRecord<V>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Typed versioned store surface.

Required Methods§

Source

fn put<'life0, 'async_trait>( &'life0 mut self, key: K, value: Option<V>, timestamp: i64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inserts a version at validFrom = timestamp.

A value == None is a tombstone version. The store inserts out-of-order timestamps mid-chain. The latest pointer only advances when timestamp >= the current max. The store drops a timestamp older than the retention horizon.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 mut self, key: &'life1 K, timestamp: i64, ) -> Pin<Box<dyn Future<Output = Option<VersionedRecord<V>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Inserts a tombstone version at timestamp.

Returns the record that was valid at timestamp just before the delete, if there was a live value.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, ) -> Pin<Box<dyn Future<Output = Option<VersionedRecord<V>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the latest live version.

Returns None if the key is absent, or if the latest version is a tombstone.

Source

fn get_as_of<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 K, as_of: i64, ) -> Pin<Box<dyn Future<Output = Option<VersionedRecord<V>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the version valid at as_of.

Returns None if the key is absent, if that version is a tombstone, or if as_of predates the oldest retained version.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<K: Send + Sync + 'static, V: Send + 'static> VersionedKeyValueStore<K, V> for VersionedBytesStore<K, V>