[][src]Struct substrate_client::in_mem::Blockchain

pub struct Blockchain<Block: BlockT> { /* fields omitted */ }

In-memory blockchain. Supports concurrent reads.

Methods

impl<Block: BlockT> Blockchain<Block>[src]

pub fn id(&self, id: BlockId<Block>) -> Option<Block::Hash>[src]

Get header hash of given block.

pub fn new() -> Blockchain<Block>[src]

Create new in-memory blockchain storage.

pub fn insert(
    &self,
    hash: Block::Hash,
    header: <Block as BlockT>::Header,
    justification: Option<Justification>,
    body: Option<Vec<<Block as BlockT>::Extrinsic>>,
    new_state: NewBlockState
) -> Result<()>
[src]

Insert a block header and associated data.

pub fn blocks_count(&self) -> usize[src]

Get total number of blocks.

pub fn equals_to(&self, other: &Self) -> bool[src]

Compare this blockchain with another in-mem blockchain

pub fn canon_equals_to(&self, other: &Self) -> bool[src]

Compare canonical chain to other canonical chain.

pub fn insert_cht_root(&self, block: NumberFor<Block>, cht_root: Block::Hash)[src]

Insert header CHT root.

pub fn set_head(&self, id: BlockId<Block>) -> Result<()>[src]

Set an existing block as head.

Trait Implementations

impl<Block: BlockT> HeaderBackend<Block> for Blockchain<Block>[src]

impl<Block: BlockT> Backend<Block> for Blockchain<Block>[src]

impl<Block: BlockT> ProvideCache<Block> for Blockchain<Block>[src]

impl<Block: BlockT> AuxStore for Blockchain<Block>[src]

impl<Block: BlockT> Storage<Block> for Blockchain<Block> where
    Block::Hash: From<[u8; 32]>, 
[src]

impl<Block: BlockT + Clone> Clone for Blockchain<Block>[src]

impl<Block: BlockT> HeaderMetadata<Block> for Blockchain<Block>[src]

type Error = Error

Error used in case the header metadata is not found.

Auto Trait Implementations

impl<Block> Send for Blockchain<Block> where
    <Block as Block>::Hash: Send + Sync,
    <Block as Block>::Header: Header + Send + Sync,
    <<Block as Block>::Header as Header>::Number: Send + Sync

impl<Block> Sync for Blockchain<Block> where
    <Block as Block>::Hash: Send + Sync,
    <Block as Block>::Header: Header + Send + Sync,
    <<Block as Block>::Header as Header>::Number: Send + Sync

impl<Block> Unpin for Blockchain<Block>

impl<Block> !UnwindSafe for Blockchain<Block>

impl<Block> !RefUnwindSafe for Blockchain<Block>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Erased for T[src]

impl<T> CheckedConversion for T[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]

impl<T> SaturatedConversion for T[src]