[][src]Trait bm_le::Backend

pub trait Backend {
    type Intermediate: Clone;
    type End: Clone + Default;
    type Error;
    fn intermediate_of(
        &self,
        left: &Value<Self::Intermediate, Self::End>,
        right: &Value<Self::Intermediate, Self::End>
    ) -> Self::Intermediate;
fn empty_at(
        &mut self,
        depth_to_bottom: usize
    ) -> Result<Value<Self::Intermediate, Self::End>, Self::Error>;
fn get(
        &self,
        key: &Self::Intermediate
    ) -> Result<(Value<Self::Intermediate, Self::End>, Value<Self::Intermediate, Self::End>), Self::Error>;
fn rootify(&mut self, key: &Self::Intermediate) -> Result<(), Self::Error>;
fn unrootify(&mut self, key: &Self::Intermediate) -> Result<(), Self::Error>;
fn insert(
        &mut self,
        key: Self::Intermediate,
        value: (Value<Self::Intermediate, Self::End>, Value<Self::Intermediate, Self::End>)
    ) -> Result<(), Self::Error>; }

Traits for a merkle database.

Associated Types

type Intermediate: Clone

Intermediate value stored in this merkle database.

type End: Clone + Default

End value stored in this merkle database.

type Error

Error type for DB access.

Loading content...

Required methods

fn intermediate_of(
    &self,
    left: &Value<Self::Intermediate, Self::End>,
    right: &Value<Self::Intermediate, Self::End>
) -> Self::Intermediate

Get the intermediate value of given left and right child.

fn empty_at(
    &mut self,
    depth_to_bottom: usize
) -> Result<Value<Self::Intermediate, Self::End>, Self::Error>

Get or create the empty value at given depth-to-bottom.

fn get(
    &self,
    key: &Self::Intermediate
) -> Result<(Value<Self::Intermediate, Self::End>, Value<Self::Intermediate, Self::End>), Self::Error>

Get an internal item by key.

fn rootify(&mut self, key: &Self::Intermediate) -> Result<(), Self::Error>

Rootify a key.

fn unrootify(&mut self, key: &Self::Intermediate) -> Result<(), Self::Error>

Unrootify a key.

fn insert(
    &mut self,
    key: Self::Intermediate,
    value: (Value<Self::Intermediate, Self::End>, Value<Self::Intermediate, Self::End>)
) -> Result<(), Self::Error>

Insert a new internal item.

Loading content...

Implementations on Foreign Types

impl<'a, DB> Backend for ProvingBackend<'a, DB> where
    DB: Backend,
    <DB as Backend>::Intermediate: Eq,
    <DB as Backend>::Intermediate: Hash
[src]

type Intermediate = <DB as Backend>::Intermediate

type End = <DB as Backend>::End

type Error = <DB as Backend>::Error

Loading content...

Implementors

impl<D, V> Backend for InMemoryBackend<D, V> where
    D: Digest,
    V: Clone + Default + AsRef<[u8]>, 
[src]

type Intermediate = GenericArray<u8, <D as Digest>::OutputSize>

type End = V

type Error = InMemoryBackendError

impl<D, V> Backend for NoopBackend<D, V> where
    D: Digest,
    V: Clone + Default + AsRef<[u8]>, 
[src]

type Intermediate = GenericArray<u8, <D as Digest>::OutputSize>

type End = V

type Error = NoopBackendError

Loading content...