Trait storage_proofs_core::merkle::Store

source ·
pub trait Store<E>: Sized + Debug + Send + Sync
where E: Element,
{
Show 23 methods // Required methods fn new_with_config( size: usize, branches: usize, config: StoreConfig, ) -> Result<Self, Error>; fn new(size: usize) -> Result<Self, Error>; fn new_from_slice_with_config( size: usize, branches: usize, data: &[u8], config: StoreConfig, ) -> Result<Self, Error>; fn new_from_slice(size: usize, data: &[u8]) -> Result<Self, Error>; fn new_from_disk( size: usize, branches: usize, config: &StoreConfig, ) -> Result<Self, Error>; fn write_at(&mut self, el: E, index: usize) -> Result<(), Error>; fn copy_from_slice(&mut self, buf: &[u8], start: usize) -> Result<(), Error>; fn compact( &mut self, branches: usize, config: StoreConfig, store_version: u32, ) -> Result<bool, Error>; fn delete(config: StoreConfig) -> Result<(), Error>; fn read_at(&self, index: usize) -> Result<E, Error>; fn read_range(&self, r: Range<usize>) -> Result<Vec<E>, Error>; fn read_into(&self, pos: usize, buf: &mut [u8]) -> Result<(), Error>; fn read_range_into( &self, start: usize, end: usize, buf: &mut [u8], ) -> Result<(), Error>; fn len(&self) -> usize; fn loaded_from_disk(&self) -> bool; fn is_empty(&self) -> bool; fn push(&mut self, el: E) -> Result<(), Error>; // Provided methods fn reinit(&mut self) -> Result<(), Error> { ... } fn last(&self) -> Result<E, Error> { ... } fn sync(&self) -> Result<(), Error> { ... } fn build_small_tree<A, U>( &mut self, leafs: usize, row_count: usize, ) -> Result<E, Error> where A: Algorithm<E>, U: Unsigned { ... } fn process_layer<A, U>( &mut self, width: usize, level: usize, read_start: usize, write_start: usize, ) -> Result<(), Error> where A: Algorithm<E>, U: Unsigned { ... } fn build<A, U>( &mut self, leafs: usize, row_count: usize, _config: Option<StoreConfig>, ) -> Result<E, Error> where A: Algorithm<E>, U: Unsigned { ... }
}
Expand description

Backing store of the merkle tree.

Required Methods§

source

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

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

source

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

source

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

source

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

source

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

This constructor is used for instantiating stores ONLY from existing (potentially read-only) files

source

fn write_at(&mut self, el: E, index: usize) -> Result<(), Error>

source

fn copy_from_slice(&mut self, buf: &[u8], start: usize) -> Result<(), Error>

source

fn compact( &mut self, branches: usize, config: StoreConfig, store_version: u32, ) -> Result<bool, Error>

source

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

source

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

source

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

source

fn read_into(&self, pos: usize, buf: &mut [u8]) -> Result<(), Error>

source

fn read_range_into( &self, start: usize, end: usize, buf: &mut [u8], ) -> Result<(), Error>

source

fn len(&self) -> usize

source

fn loaded_from_disk(&self) -> bool

source

fn is_empty(&self) -> bool

source

fn push(&mut self, el: E) -> Result<(), Error>

Provided Methods§

source

fn reinit(&mut self) -> Result<(), Error>

source

fn last(&self) -> Result<E, Error>

source

fn sync(&self) -> Result<(), Error>

source

fn build_small_tree<A, U>( &mut self, leafs: usize, row_count: usize, ) -> Result<E, Error>
where A: Algorithm<E>, U: Unsigned,

source

fn process_layer<A, U>( &mut self, width: usize, level: usize, read_start: usize, write_start: usize, ) -> Result<(), Error>
where A: Algorithm<E>, U: Unsigned,

source

fn build<A, U>( &mut self, leafs: usize, row_count: usize, _config: Option<StoreConfig>, ) -> Result<E, Error>
where A: Algorithm<E>, U: Unsigned,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<E> Store<E> for MmapStore<E>
where E: Element,

source§

impl<E> Store<E> for VecStore<E>
where E: Element,

source§

impl<E> Store<E> for DiskStore<E>
where E: Element,

source§

impl<E, R> Store<E> for LevelCacheStore<E, R>
where E: Element, R: Read + Send + Sync,