Trait storage_proofs_core::merkle::Store
source · [−]pub trait Store<E>: Debug + Send + Sync where
E: Element, {
Show 23 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, Global>, 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>;
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
fn new_with_config(
size: usize,
branches: usize,
config: StoreConfig
) -> Result<Self, Error>
fn new_with_config(
size: usize,
branches: usize,
config: StoreConfig
) -> Result<Self, Error>
Creates a new store which can store up to size
elements.