typed_store::traits

Trait Map

Source
pub trait Map<'a, K, V>{
    type Error: Error;

Show 14 methods // Required methods fn contains_key(&self, key: &K) -> Result<bool, Self::Error>; fn get(&self, key: &K) -> Result<Option<V>, Self::Error>; fn insert(&self, key: &K, value: &V) -> Result<(), Self::Error>; fn remove(&self, key: &K) -> Result<(), Self::Error>; fn schedule_delete_all(&self) -> Result<(), TypedStoreError>; fn is_empty(&self) -> bool; fn safe_iter(&'a self) -> DbIterator<'a, (K, V)>; fn safe_iter_with_bounds( &'a self, lower_bound: Option<K>, upper_bound: Option<K>, ) -> DbIterator<'a, (K, V)>; fn safe_range_iter( &'a self, range: impl RangeBounds<K>, ) -> DbIterator<'a, (K, V)>; fn try_catch_up_with_primary(&self) -> Result<(), Self::Error>; // Provided methods fn multi_contains_keys<J>( &self, keys: impl IntoIterator<Item = J>, ) -> Result<Vec<bool>, Self::Error> where J: Borrow<K> { ... } fn multi_get<J>( &self, keys: impl IntoIterator<Item = J>, ) -> Result<Vec<Option<V>>, Self::Error> where J: Borrow<K> { ... } fn multi_insert<J, U>( &self, key_val_pairs: impl IntoIterator<Item = (J, U)>, ) -> Result<(), Self::Error> where J: Borrow<K>, U: Borrow<V> { ... } fn multi_remove<J>( &self, keys: impl IntoIterator<Item = J>, ) -> Result<(), Self::Error> where J: Borrow<K> { ... }
}

Required Associated Types§

Required Methods§

Source

fn contains_key(&self, key: &K) -> Result<bool, Self::Error>

Returns true if the map contains a value for the specified key.

Source

fn get(&self, key: &K) -> Result<Option<V>, Self::Error>

Returns the value for the given key from the map, if it exists.

Source

fn insert(&self, key: &K, value: &V) -> Result<(), Self::Error>

Inserts the given key-value pair into the map.

Source

fn remove(&self, key: &K) -> Result<(), Self::Error>

Removes the entry for the given key from the map.

Source

fn schedule_delete_all(&self) -> Result<(), TypedStoreError>

Uses delete range on the entire key range

Source

fn is_empty(&self) -> bool

Returns true if the map is empty, otherwise false.

Source

fn safe_iter(&'a self) -> DbIterator<'a, (K, V)>

Same as iter but performs status check.

Source

fn safe_iter_with_bounds( &'a self, lower_bound: Option<K>, upper_bound: Option<K>, ) -> DbIterator<'a, (K, V)>

Source

fn safe_range_iter( &'a self, range: impl RangeBounds<K>, ) -> DbIterator<'a, (K, V)>

Source

fn try_catch_up_with_primary(&self) -> Result<(), Self::Error>

Try to catch up with primary when running as secondary

Provided Methods§

Source

fn multi_contains_keys<J>( &self, keys: impl IntoIterator<Item = J>, ) -> Result<Vec<bool>, Self::Error>
where J: Borrow<K>,

Returns true if the map contains a value for the specified key.

Source

fn multi_get<J>( &self, keys: impl IntoIterator<Item = J>, ) -> Result<Vec<Option<V>>, Self::Error>
where J: Borrow<K>,

Returns a vector of values corresponding to the keys provided, non-atomically.

Source

fn multi_insert<J, U>( &self, key_val_pairs: impl IntoIterator<Item = (J, U)>, ) -> Result<(), Self::Error>
where J: Borrow<K>, U: Borrow<V>,

Inserts key-value pairs, non-atomically.

Source

fn multi_remove<J>( &self, keys: impl IntoIterator<Item = J>, ) -> Result<(), Self::Error>
where J: Borrow<K>,

Removes keys, non-atomically.

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<'a, K, V> Map<'a, K, V> for DBMap<K, V>