Trait linera_views::store::ReadableKeyValueStore

source ·
pub trait ReadableKeyValueStore: WithError + Send {
    type Keys: KeyIterable<Self::Error>;
    type KeyValues: KeyValueIterable<Self::Error>;

    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;
    fn contains_key(
        &self,
        key: &[u8],
    ) -> impl Future<Output = Result<bool, Self::Error>> + Send;
    fn contains_keys(
        &self,
        keys: Vec<Vec<u8>>,
    ) -> impl Future<Output = Result<Vec<bool>, Self::Error>> + Send;
    fn read_multi_values_bytes(
        &self,
        keys: Vec<Vec<u8>>,
    ) -> impl Future<Output = Result<Vec<Option<Vec<u8>>>, Self::Error>> + Send;
    fn find_keys_by_prefix(
        &self,
        key_prefix: &[u8],
    ) -> impl Future<Output = Result<Self::Keys, Self::Error>> + Send;
    fn find_key_values_by_prefix(
        &self,
        key_prefix: &[u8],
    ) -> impl Future<Output = Result<Self::KeyValues, Self::Error>> + Send;

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

Low-level, asynchronous read key-value operations. Useful for storage APIs not based on views.

Required Associated Types§

source

type Keys: KeyIterable<Self::Error>

Returns type for key search operations.

source

type KeyValues: KeyValueIterable<Self::Error>

Returns type for key-value search 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

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

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

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

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<Self::Keys, Self::Error>> + Send

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<Self::KeyValues, Self::Error>> + Send

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
where Self: Sync,

Reads a single key and deserializes the result if present.

source

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

Reads multiple keys and deserializes the results if present.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl ReadableKeyValueStore for DynamoDbStoreInternal

source§

impl ReadableKeyValueStore for MemoryStore

source§

const MAX_KEY_SIZE: usize = 18_446_744_073_709_551_615usize

§

type Keys = Vec<Vec<u8>>

§

type KeyValues = Vec<(Vec<u8>, Vec<u8>)>

source§

impl ReadableKeyValueStore for RocksDbStoreInternal

source§

const MAX_KEY_SIZE: usize = 8_388_208usize

§

type Keys = Vec<Vec<u8>>

§

type KeyValues = Vec<(Vec<u8>, Vec<u8>)>

source§

impl ReadableKeyValueStore for ScyllaDbStoreInternal

source§

const MAX_KEY_SIZE: usize = 10_240usize

§

type Keys = Vec<Vec<u8>>

§

type KeyValues = Vec<(Vec<u8>, Vec<u8>)>

source§

impl ReadableKeyValueStore for LimitedTestMemoryStore

source§

const MAX_KEY_SIZE: usize = 18_446_744_073_709_551_615usize

§

type Keys = Vec<Vec<u8>>

§

type KeyValues = Vec<(Vec<u8>, Vec<u8>)>

source§

impl<C> ReadableKeyValueStore for ViewContainer<C>
where C: Context + Sync + Send + Clone, ViewError: From<C::Error>,

source§

const MAX_KEY_SIZE: usize = C::MAX_KEY_SIZE

§

type Keys = Vec<Vec<u8>>

§

type KeyValues = Vec<(Vec<u8>, Vec<u8>)>

source§

impl<K> ReadableKeyValueStore for JournalingKeyValueStore<K>

source§

impl<K> ReadableKeyValueStore for LruCachingStore<K>

source§

impl<K> ReadableKeyValueStore for MeteredStore<K>

source§

impl<K> ReadableKeyValueStore for ValueSplittingStore<K>
where K: ReadableKeyValueStore + Send + Sync, K::Error: 'static,

source§

const MAX_KEY_SIZE: usize = _

§

type Keys = Vec<Vec<u8>>

§

type KeyValues = Vec<(Vec<u8>, Vec<u8>)>

source§

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