Trait ReadableKeyValueStore

Source
pub trait ReadableKeyValueStore:
    WithError
    + Send
    + Sync {
    const MAX_KEY_SIZE: usize;

    // Required methods
    fn max_stream_queries(&self) -> usize;
    fn read_value_bytes(
        &self,
        key: &[u8],
    ) -> impl Future<Output = Result<Option<Vec<u8>>, Self::Error>> + Send + Sync;
    fn contains_key(
        &self,
        key: &[u8],
    ) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync;
    fn contains_keys(
        &self,
        keys: Vec<Vec<u8>>,
    ) -> impl Future<Output = Result<Vec<bool>, Self::Error>> + Send + Sync;
    fn read_multi_values_bytes(
        &self,
        keys: Vec<Vec<u8>>,
    ) -> impl Future<Output = Result<Vec<Option<Vec<u8>>>, Self::Error>> + Send + Sync;
    fn find_keys_by_prefix(
        &self,
        key_prefix: &[u8],
    ) -> impl Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + Sync;
    fn find_key_values_by_prefix(
        &self,
        key_prefix: &[u8],
    ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>, Self::Error>> + Send + Sync;

    // Provided methods
    fn read_value<V: DeserializeOwned>(
        &self,
        key: &[u8],
    ) -> impl Future<Output = Result<Option<V>, Self::Error>> + Send + Sync { ... }
    fn read_multi_values<V: DeserializeOwned + Send + Sync>(
        &self,
        keys: Vec<Vec<u8>>,
    ) -> impl Future<Output = Result<Vec<Option<V>>, Self::Error>> + Send + Sync { ... }
}
Expand description

Asynchronous read key-value operations.

Required Associated Constants§

Source

const MAX_KEY_SIZE: usize

The maximal size of keys that can be stored.

Required Methods§

Source

fn max_stream_queries(&self) -> usize

Retrieve the number of stream queries.

Source

fn read_value_bytes( &self, key: &[u8], ) -> impl Future<Output = Result<Option<Vec<u8>>, Self::Error>> + Send + Sync

Retrieves a Vec<u8> from the database using the provided key.

Source

fn contains_key( &self, key: &[u8], ) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync

Tests whether a key exists in the database

Source

fn contains_keys( &self, keys: Vec<Vec<u8>>, ) -> impl Future<Output = Result<Vec<bool>, Self::Error>> + Send + Sync

Tests whether a list of keys exist in the database

Source

fn read_multi_values_bytes( &self, keys: Vec<Vec<u8>>, ) -> impl Future<Output = Result<Vec<Option<Vec<u8>>>, Self::Error>> + Send + Sync

Retrieves multiple Vec<u8> from the database using the provided keys.

Source

fn find_keys_by_prefix( &self, key_prefix: &[u8], ) -> impl Future<Output = Result<Vec<Vec<u8>>, Self::Error>> + Send + Sync

Finds the key matching the prefix. The prefix is not included in the returned keys.

Source

fn find_key_values_by_prefix( &self, key_prefix: &[u8], ) -> impl Future<Output = Result<Vec<(Vec<u8>, Vec<u8>)>, Self::Error>> + Send + Sync

Finds the (key,value) pairs matching the prefix. The prefix is not included in the returned keys.

Provided Methods§

Source

fn read_value<V: DeserializeOwned>( &self, key: &[u8], ) -> impl Future<Output = Result<Option<V>, Self::Error>> + Send + Sync

Reads a single key and deserializes the result if present.

Source

fn read_multi_values<V: DeserializeOwned + Send + Sync>( &self, keys: Vec<Vec<u8>>, ) -> impl Future<Output = Result<Vec<Option<V>>, Self::Error>> + Send + Sync

Reads multiple keys and deserializes the results if present.

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.

Implementors§

Source§

impl ReadableKeyValueStore for DynamoDbStoreInternal

Source§

const MAX_KEY_SIZE: usize = 1_024usize

Source§

impl ReadableKeyValueStore for MemoryStore

Source§

const MAX_KEY_SIZE: usize = 18_446_744_073_709_551_615usize

Source§

impl ReadableKeyValueStore for RocksDbStoreInternal

Source§

const MAX_KEY_SIZE: usize = 8_388_208usize

Source§

impl ReadableKeyValueStore for ScyllaDbStoreInternal

Source§

const MAX_KEY_SIZE: usize = 10_240usize

Source§

impl ReadableKeyValueStore for LimitedTestMemoryStore

Source§

const MAX_KEY_SIZE: usize = 18_446_744_073_709_551_615usize

Source§

impl ReadableKeyValueStore for InactiveStore

Source§

const MAX_KEY_SIZE: usize = 0usize

Source§

impl<C: Context> ReadableKeyValueStore for ViewContainer<C>

Source§

const MAX_KEY_SIZE: usize = <C::Store as ReadableKeyValueStore>::MAX_KEY_SIZE

Source§

impl<K> ReadableKeyValueStore for LruCachingStore<K>

Source§

const MAX_KEY_SIZE: usize = K::MAX_KEY_SIZE

Source§

impl<S1, S2> ReadableKeyValueStore for DualStore<S1, S2>

Source§

impl<S> ReadableKeyValueStore for JournalingKeyValueStore<S>

Source§

const MAX_KEY_SIZE: usize = S::MAX_KEY_SIZE

Source§

impl<S> ReadableKeyValueStore for MeteredStore<S>

Source§

const MAX_KEY_SIZE: usize = S::MAX_KEY_SIZE

Source§

impl<S> ReadableKeyValueStore for ValueSplittingStore<S>
where S: ReadableKeyValueStore, S::Error: 'static,