pub trait IndexBackend<K: Clone + Eq + Hash, V: Clone>: Send + Sync {
// Required methods
fn size(&self) -> usize;
fn has(&self, primary: &K) -> bool;
fn get(&self, primary: &K) -> Option<V>;
fn get_row(&self, primary: &K) -> Option<IndexRow<K, V>>;
fn upsert(&mut self, primary: K, secondary: String, value: V) -> bool;
fn upsert_many(&mut self, rows: Vec<(K, String, V)>) -> usize;
fn delete(&mut self, primary: &K) -> bool;
fn delete_many(&mut self, primaries: &[K]) -> usize;
fn clear(&mut self) -> usize;
fn to_ordered(&self) -> Vec<IndexRow<K, V>>;
fn to_primary_map(&self) -> Vec<(K, V)>;
}Expand description
Storage backend for crate::ReactiveIndex.
Required Methods§
fn size(&self) -> usize
fn has(&self, primary: &K) -> bool
fn get(&self, primary: &K) -> Option<V>
Sourcefn get_row(&self, primary: &K) -> Option<IndexRow<K, V>>
fn get_row(&self, primary: &K) -> Option<IndexRow<K, V>>
Get the full row (primary + secondary + value) by primary key.
Sourcefn upsert(&mut self, primary: K, secondary: String, value: V) -> bool
fn upsert(&mut self, primary: K, secondary: String, value: V) -> bool
Returns true if inserted (new key), false if updated.