pub trait BlockStorage<N: Network>: Clone + Sync {
    type IDMap: for<'a> Map<'a, u32, N::BlockHash>;
    type ReverseIDMap: for<'a> Map<'a, N::BlockHash, u32>;
    type HeaderMap: for<'a> Map<'a, N::BlockHash, Header<N>>;
    type TransactionsMap: for<'a> Map<'a, N::BlockHash, Vec<N::TransactionID>>;
    type ReverseTransactionsMap: for<'a> Map<'a, N::TransactionID, N::BlockHash>;
    type TransactionStorage: TransactionStorage<N, TransitionStorage = Self::TransitionStorage>;
    type TransitionStorage: TransitionStorage<N>;
    type SignatureMap: for<'a> Map<'a, N::BlockHash, Signature<N>>;

Show 22 methods fn open() -> Result<Self>; fn id_map(&self) -> &Self::IDMap; fn reverse_id_map(&self) -> &Self::ReverseIDMap; fn header_map(&self) -> &Self::HeaderMap; fn transactions_map(&self) -> &Self::TransactionsMap; fn reverse_transactions_map(&self) -> &Self::ReverseTransactionsMap; fn transaction_store(
        &self
    ) -> &TransactionStore<N, Self::TransactionStorage>; fn signature_map(&self) -> &Self::SignatureMap; fn start_atomic(&self) { ... } fn is_atomic_in_progress(&self) -> bool { ... } fn abort_atomic(&self) { ... } fn finish_atomic(&self) -> Result<()> { ... } fn insert(&self, block: &Block<N>) -> Result<()> { ... } fn remove(&self, block_hash: &N::BlockHash) -> Result<()> { ... } fn find_block_hash(
        &self,
        transaction_id: &N::TransactionID
    ) -> Result<Option<N::BlockHash>> { ... } fn get_previous_block_hash(
        &self,
        height: u32
    ) -> Result<Option<N::BlockHash>> { ... } fn get_block_hash(&self, height: u32) -> Result<Option<N::BlockHash>> { ... } fn get_block_height(&self, block_hash: &N::BlockHash) -> Result<Option<u32>> { ... } fn get_block_header(
        &self,
        block_hash: &N::BlockHash
    ) -> Result<Option<Header<N>>> { ... } fn get_block_transactions(
        &self,
        block_hash: &N::BlockHash
    ) -> Result<Option<Transactions<N>>> { ... } fn get_block_signature(
        &self,
        block_hash: &N::BlockHash
    ) -> Result<Option<Signature<N>>> { ... } fn get_block(&self, block_hash: &N::BlockHash) -> Result<Option<Block<N>>> { ... }
}
Expand description

A trait for block storage.

Required Associated Types

The mapping of block height to block hash.

The mapping of block hash to block height.

The mapping of block hash to block header.

The mapping of block hash to [transaction ID].

The mapping of transaction ID to block hash.

The transaction storage.

The transition storage.

The mapping of block hash to block signature.

Required Methods

Initializes the block storage.

Returns the ID map.

Returns the reverse ID map.

Returns the header map.

Returns the transactions map.

Returns the reverse transactions map.

Returns the transaction store.

Returns the signature map.

Provided Methods

Starts an atomic batch write operation.

Checks if an atomic batch is in progress.

Aborts an atomic batch write operation.

Finishes an atomic batch write operation.

Stores the given block into storage.

Removes the block for the given block hash.

Returns the block hash that contains the given transaction ID.

Returns the previous block hash of the given block height.

Returns the block hash for the given block height.

Returns the block height for the given block hash.

Returns the block header for the given block hash.

Returns the block transactions for the given block hash.

Returns the block signature for the given block hash.

Returns the block for the given block hash.

Implementors