Skip to main content

Store

Trait Store 

Source
pub trait Store {
    // Required methods
    fn get(&self, key: &[u8]) -> Option<Vec<u8>>;
    fn insert(&mut self, key: &[u8], value: &[u8]);
    fn remove(&mut self, key: &[u8]);
    fn iter(&self) -> Box<dyn Iterator + '_>;
    fn prefetch_prefixes(&mut self, prefixes: Vec<Prefix>, limit: u16);
}
Expand description

A key-value store.

Required Methods§

Source

fn get(&self, key: &[u8]) -> Option<Vec<u8>>

Fetch entry with given key.

Source

fn insert(&mut self, key: &[u8], value: &[u8])

Update entry with given key to the given value.

Source

fn remove(&mut self, key: &[u8])

Remove entry with given key.

Source

fn iter(&self) -> Box<dyn Iterator + '_>

Returns an iterator over the tree.

Source

fn prefetch_prefixes(&mut self, prefixes: Vec<Prefix>, limit: u16)

Populate the in-memory tree with nodes for keys starting with given prefixes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: Store + ?Sized> Store for &mut S

Source§

fn get(&self, key: &[u8]) -> Option<Vec<u8>>

Source§

fn insert(&mut self, key: &[u8], value: &[u8])

Source§

fn remove(&mut self, key: &[u8])

Source§

fn iter(&self) -> Box<dyn Iterator + '_>

Source§

fn prefetch_prefixes(&mut self, prefixes: Vec<Prefix>, limit: u16)

Source§

impl<S: Store + ?Sized> Store for Box<S>

Source§

fn get(&self, key: &[u8]) -> Option<Vec<u8>>

Source§

fn insert(&mut self, key: &[u8], value: &[u8])

Source§

fn remove(&mut self, key: &[u8])

Source§

fn iter(&self) -> Box<dyn Iterator + '_>

Source§

fn prefetch_prefixes(&mut self, prefixes: Vec<Prefix>, limit: u16)

Implementors§

Source§

impl Store for HostStore

Source§

impl<M: MKVS> Store for MKVSStore<M>

Source§

impl<S: Store, D: Digest> Store for HashedStore<S, D>

Source§

impl<S: Store, P: AsRef<[u8]>> Store for PrefixStore<S, P>

Source§

impl<S: Store> Store for ConfidentialStore<S>

Source§

impl<S: Store> Store for OverlayStore<S>