Kagome
Polkadot Runtime Engine in C++17
kagome::blockchain::BlockHeaderRepositoryImpl Class Reference

#include <block_header_repository_impl.hpp>

Inheritance diagram for kagome::blockchain::BlockHeaderRepositoryImpl:
Collaboration diagram for kagome::blockchain::BlockHeaderRepositoryImpl:

Public Member Functions

 BlockHeaderRepositoryImpl (std::shared_ptr< storage::BufferStorage > map, std::shared_ptr< crypto::Hasher > hasher)
 
 ~BlockHeaderRepositoryImpl () override=default
 
outcome::result< primitives::BlockNumbergetNumberByHash (const common::Hash256 &hash) const override
 
outcome::result< common::Hash256getHashByNumber (const primitives::BlockNumber &number) const override
 
outcome::result< primitives::BlockHeadergetBlockHeader (const primitives::BlockId &id) const override
 
outcome::result< blockchain::BlockStatusgetBlockStatus (const primitives::BlockId &id) const override
 
- Public Member Functions inherited from kagome::blockchain::BlockHeaderRepository
virtual ~BlockHeaderRepository ()=default
 
outcome::result< primitives::BlockNumbergetNumberById (const primitives::BlockId &id) const
 
outcome::result< common::Hash256getHashById (const primitives::BlockId &id) const
 

Private Attributes

std::shared_ptr< storage::BufferStoragemap_
 
std::shared_ptr< crypto::Hasherhasher_
 

Detailed Description

Definition at line 16 of file block_header_repository_impl.hpp.

Constructor & Destructor Documentation

kagome::blockchain::BlockHeaderRepositoryImpl::BlockHeaderRepositoryImpl ( std::shared_ptr< storage::BufferStorage map,
std::shared_ptr< crypto::Hasher hasher 
)

Definition at line 24 of file block_header_repository_impl.cpp.

kagome::blockchain::BlockHeaderRepositoryImpl::~BlockHeaderRepositoryImpl ( )
overridedefault

Member Function Documentation

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

Implements kagome::blockchain::BlockHeaderRepository.

Definition at line 48 of file block_header_repository_impl.cpp.

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

Implements kagome::blockchain::BlockHeaderRepository.

Definition at line 56 of file block_header_repository_impl.cpp.

outcome::result< common::Hash256 > kagome::blockchain::BlockHeaderRepositoryImpl::getHashByNumber ( const primitives::BlockNumber number) const
overridevirtual
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

Implements kagome::blockchain::BlockHeaderRepository.

Definition at line 40 of file block_header_repository_impl.cpp.

outcome::result< BlockNumber > kagome::blockchain::BlockHeaderRepositoryImpl::getNumberByHash ( const common::Hash256 hash) const
overridevirtual
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

Implements kagome::blockchain::BlockHeaderRepository.

Definition at line 31 of file block_header_repository_impl.cpp.

Member Data Documentation

std::shared_ptr<crypto::Hasher> kagome::blockchain::BlockHeaderRepositoryImpl::hasher_
private

Definition at line 37 of file block_header_repository_impl.hpp.

std::shared_ptr<storage::BufferStorage> kagome::blockchain::BlockHeaderRepositoryImpl::map_
private

Definition at line 36 of file block_header_repository_impl.hpp.


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