[][src]Trait merkletree::store::Store

pub trait Store<E: Element>: Deref<Target = [E]> + Debug + Clone + Send + Sync {
    fn new_with_config(size: usize, config: StoreConfig) -> Result<Self>;
fn new(size: usize) -> Result<Self>;
fn new_from_slice_with_config(
        size: usize,
        data: &[u8],
        config: StoreConfig
    ) -> Result<Self>;
fn new_from_slice(size: usize, data: &[u8]) -> Result<Self>;
fn new_from_disk(size: usize, config: &StoreConfig) -> Result<Self>;
fn write_at(&mut self, el: E, index: usize);
fn copy_from_slice(&mut self, buf: &[u8], start: usize);
fn compact(&mut self, config: StoreConfig) -> Result<bool>;
fn delete(config: StoreConfig) -> Result<()>;
fn read_at(&self, index: usize) -> E;
fn read_range(&self, r: Range<usize>) -> Vec<E>;
fn read_into(&self, pos: usize, buf: &mut [u8]);
fn read_range_into(&self, start: usize, end: usize, buf: &mut [u8]);
fn len(&self) -> usize;
fn loaded_from_disk(&self) -> bool;
fn is_empty(&self) -> bool;
fn push(&mut self, el: E); fn sync(&self) { ... } }

Backing store of the merkle tree.

Required methods

fn new_with_config(size: usize, config: StoreConfig) -> Result<Self>

Creates a new store which can store up to size elements.

fn new(size: usize) -> Result<Self>

fn new_from_slice_with_config(
    size: usize,
    data: &[u8],
    config: StoreConfig
) -> Result<Self>

fn new_from_slice(size: usize, data: &[u8]) -> Result<Self>

fn new_from_disk(size: usize, config: &StoreConfig) -> Result<Self>

fn write_at(&mut self, el: E, index: usize)

fn copy_from_slice(&mut self, buf: &[u8], start: usize)

fn compact(&mut self, config: StoreConfig) -> Result<bool>

fn delete(config: StoreConfig) -> Result<()>

fn read_at(&self, index: usize) -> E

fn read_range(&self, r: Range<usize>) -> Vec<E>

fn read_into(&self, pos: usize, buf: &mut [u8])

fn read_range_into(&self, start: usize, end: usize, buf: &mut [u8])

fn len(&self) -> usize

fn loaded_from_disk(&self) -> bool

fn is_empty(&self) -> bool

fn push(&mut self, el: E)

Loading content...

Provided methods

fn sync(&self)

Loading content...

Implementors

impl<E: Element> Store<E> for DiskStore<E>[src]

impl<E: Element> Store<E> for LevelCacheStore<E>[src]

impl<E: Element> Store<E> for VecStore<E>[src]

Loading content...