Kagome
Polkadot Runtime Engine in C++17
kagome::blockchain::BlockHeaderRepository Class Referenceabstract

#include <block_header_repository.hpp>

Inheritance diagram for kagome::blockchain::BlockHeaderRepository:
Collaboration diagram for kagome::blockchain::BlockHeaderRepository:

Public Member Functions

virtual ~BlockHeaderRepository ()=default
 
virtual outcome::result< primitives::BlockNumbergetNumberByHash (const common::Hash256 &hash) const =0
 
virtual outcome::result< common::Hash256getHashByNumber (const primitives::BlockNumber &number) const =0
 
virtual outcome::result< primitives::BlockHeadergetBlockHeader (const primitives::BlockId &id) const =0
 
virtual outcome::result< kagome::blockchain::BlockStatusgetBlockStatus (const primitives::BlockId &id) const =0
 
outcome::result< primitives::BlockNumbergetNumberById (const primitives::BlockId &id) const
 
outcome::result< common::Hash256getHashById (const primitives::BlockId &id) const
 

Detailed Description

An interface to a storage with block headers that provides several convenience methods, such as getting bloch number by its hash and vice versa or getting a block status

Definition at line 29 of file block_header_repository.hpp.

Constructor & Destructor Documentation

virtual kagome::blockchain::BlockHeaderRepository::~BlockHeaderRepository ( )
virtualdefault

Member Function Documentation

virtual outcome::result<primitives::BlockHeader> kagome::blockchain::BlockHeaderRepository::getBlockHeader ( const primitives::BlockId id) const
pure virtual
Returns
block header with corresponding id or an error

Implemented in kagome::blockchain::BlockHeaderRepositoryImpl.

virtual outcome::result<kagome::blockchain::BlockStatus> kagome::blockchain::BlockHeaderRepository::getBlockStatus ( const primitives::BlockId id) const
pure virtual
Parameters
idof a block which status is returned
Returns
status of a block or a storage error

Implemented in kagome::blockchain::BlockHeaderRepositoryImpl.

outcome::result<common::Hash256> kagome::blockchain::BlockHeaderRepository::getHashById ( const primitives::BlockId id) const
inline
Parameters
idof a block which hash is returned
Returns
block hash or a none optional if the corresponding block header is not in storage or a storage error

Definition at line 82 of file block_header_repository.hpp.

virtual outcome::result<common::Hash256> kagome::blockchain::BlockHeaderRepository::getHashByNumber ( const primitives::BlockNumber number) const
pure virtual
Parameters
number- the number of a block, contained in a block header
Returns
the hash of the block with the provided number in case one is in the storage or an error

Implemented in kagome::blockchain::BlockHeaderRepositoryImpl.

virtual outcome::result<primitives::BlockNumber> kagome::blockchain::BlockHeaderRepository::getNumberByHash ( const common::Hash256 hash) const
pure virtual
Parameters
hash- a blake2_256 hash of an SCALE encoded block header
Returns
the number of the block with the provided hash in case one is in the storage or an error

Implemented in kagome::blockchain::BlockHeaderRepositoryImpl.

outcome::result<primitives::BlockNumber> kagome::blockchain::BlockHeaderRepository::getNumberById ( const primitives::BlockId id) const
inline
Parameters
idof a block which number is returned
Returns
block number or a none optional if the corresponding block header is not in storage or a storage error

Definition at line 67 of file block_header_repository.hpp.


The documentation for this class was generated from the following file: