pub trait ReadableKeyValueStore:
WithError
+ Send
+ Sync {
const MAX_KEY_SIZE: usize;
// Required methods
fn max_stream_queries(&self) -> usize;
fn root_key(&self) -> Result<Vec<u8>, Self::Error>;
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<u8>],
) -> impl Future<Output = Result<Vec<bool>, Self::Error>> + Send + Sync;
fn read_multi_values_bytes(
&self,
keys: &[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<u8>],
) -> impl Future<Output = Result<Vec<Option<V>>, Self::Error>> + Send + Sync { ... }
}Expand description
Asynchronous read key-value operations.
Required Associated Constants§
Sourceconst MAX_KEY_SIZE: usize
const MAX_KEY_SIZE: usize
The maximal size of keys that can be stored.
Required Methods§
Sourcefn max_stream_queries(&self) -> usize
fn max_stream_queries(&self) -> usize
Retrieve the number of stream queries.
Sourcefn read_value_bytes(
&self,
key: &[u8],
) -> impl Future<Output = Result<Option<Vec<u8>>, Self::Error>> + Send + Sync
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.
Sourcefn contains_key(
&self,
key: &[u8],
) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync
fn contains_key( &self, key: &[u8], ) -> impl Future<Output = Result<bool, Self::Error>> + Send + Sync
Tests whether a key exists in the database
Sourcefn contains_keys(
&self,
keys: &[Vec<u8>],
) -> impl Future<Output = Result<Vec<bool>, Self::Error>> + Send + Sync
fn contains_keys( &self, keys: &[Vec<u8>], ) -> impl Future<Output = Result<Vec<bool>, Self::Error>> + Send + Sync
Tests whether a list of keys exist in the database
Sourcefn read_multi_values_bytes(
&self,
keys: &[Vec<u8>],
) -> impl Future<Output = Result<Vec<Option<Vec<u8>>>, Self::Error>> + Send + Sync
fn read_multi_values_bytes( &self, keys: &[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.
Provided Methods§
Sourcefn read_value<V: DeserializeOwned>(
&self,
key: &[u8],
) -> impl Future<Output = Result<Option<V>, Self::Error>> + Send + Sync
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.
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
impl ReadableKeyValueStore for DynamoDbStoreInternal
const MAX_KEY_SIZE: usize = MAX_KEY_SIZE
Source§impl ReadableKeyValueStore for MemoryStore
impl ReadableKeyValueStore for MemoryStore
const MAX_KEY_SIZE: usize = usize::MAX
Source§impl ReadableKeyValueStore for RocksDbStoreInternal
impl ReadableKeyValueStore for RocksDbStoreInternal
const MAX_KEY_SIZE: usize = MAX_KEY_SIZE
Source§impl ReadableKeyValueStore for ScyllaDbStoreInternal
impl ReadableKeyValueStore for ScyllaDbStoreInternal
const MAX_KEY_SIZE: usize = MAX_KEY_SIZE
Source§impl ReadableKeyValueStore for LimitedTestMemoryStore
Available on with_testing only.
impl ReadableKeyValueStore for LimitedTestMemoryStore
Available on
with_testing only.const MAX_KEY_SIZE: usize = usize::MAX
Source§impl ReadableKeyValueStore for InactiveStore
impl ReadableKeyValueStore for InactiveStore
const MAX_KEY_SIZE: usize = 0
Source§impl<C: Context> ReadableKeyValueStore for ViewContainer<C>
Available on with_testing only.
impl<C: Context> ReadableKeyValueStore for ViewContainer<C>
Available on
with_testing only.