[][src]Trait bm::Backend

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

Get the intermediate value of given left and right child.

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

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

fn get(
    &self,
    key: &IntermediateOf<Self>
) -> Result<(ValueOf<Self>, ValueOf<Self>), Self::Error>

Get an internal item by key.

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

Rootify a key.

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

Unrootify a key.

fn insert(
    &mut self,
    key: IntermediateOf<Self>,
    value: (ValueOf<Self>, ValueOf<Self>)
) -> Result<(), Self::Error>

Insert a new internal item.

Loading content...

Implementors

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

type Intermediate = DB::Intermediate

type End = DB::End

type Error = DB::Error

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

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

type End = V

type Error = NoopBackendError

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

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

type End = V

type Error = InMemoryBackendError

Loading content...