[][src]Trait blockchain::traits::ChainQuery

pub trait ChainQuery: Backend {
    fn genesis(&self) -> <Self::Block as Block>::Identifier;
fn head(&self) -> <Self::Block as Block>::Identifier;
fn contains(
        &self,
        hash: &<Self::Block as Block>::Identifier
    ) -> Result<bool, Self::Error>;
fn is_canon(
        &self,
        hash: &<Self::Block as Block>::Identifier
    ) -> Result<bool, Self::Error>;
fn lookup_canon_depth(
        &self,
        depth: usize
    ) -> Result<Option<<Self::Block as Block>::Identifier>, Self::Error>;
fn auxiliary(
        &self,
        key: &<Self::Auxiliary as Auxiliary<Self::Block>>::Key
    ) -> Result<Option<Self::Auxiliary>, Self::Error>;
fn depth_at(
        &self,
        hash: &<Self::Block as Block>::Identifier
    ) -> Result<usize, Self::Error>;
fn children_at(
        &self,
        hash: &<Self::Block as Block>::Identifier
    ) -> Result<Vec<<Self::Block as Block>::Identifier>, Self::Error>;
fn state_at(
        &self,
        hash: &<Self::Block as Block>::Identifier
    ) -> Result<Self::State, Self::Error>;
fn block_at(
        &self,
        hash: &<Self::Block as Block>::Identifier
    ) -> Result<Self::Block, Self::Error>; }

Chain query interface for a backend.

Required methods

fn genesis(&self) -> <Self::Block as Block>::Identifier

Get the genesis hash of the chain.

fn head(&self) -> <Self::Block as Block>::Identifier

Get the head of the chain.

fn contains(
    &self,
    hash: &<Self::Block as Block>::Identifier
) -> Result<bool, Self::Error>

Check whether a hash is contained in the chain.

fn is_canon(
    &self,
    hash: &<Self::Block as Block>::Identifier
) -> Result<bool, Self::Error>

Check whether a block is canonical.

fn lookup_canon_depth(
    &self,
    depth: usize
) -> Result<Option<<Self::Block as Block>::Identifier>, Self::Error>

Look up a canonical block via its depth.

fn auxiliary(
    &self,
    key: &<Self::Auxiliary as Auxiliary<Self::Block>>::Key
) -> Result<Option<Self::Auxiliary>, Self::Error>

Get the auxiliary value by key.

fn depth_at(
    &self,
    hash: &<Self::Block as Block>::Identifier
) -> Result<usize, Self::Error>

Get the depth of a block.

fn children_at(
    &self,
    hash: &<Self::Block as Block>::Identifier
) -> Result<Vec<<Self::Block as Block>::Identifier>, Self::Error>

Get children of a block.

fn state_at(
    &self,
    hash: &<Self::Block as Block>::Identifier
) -> Result<Self::State, Self::Error>

Get the state object of a block.

fn block_at(
    &self,
    hash: &<Self::Block as Block>::Identifier
) -> Result<Self::Block, Self::Error>

Get the object of a block.

Loading content...

Implementors

impl<B: Block, A: Auxiliary<B>, S: Clone> ChainQuery for MemoryBackend<B, A, S>[src]

Loading content...