Kagome
Polkadot Runtime Engine in C++17
block_header_repository_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_BLOCKCHAIN_BLOCKHEADERREPOSITORYIMPL
7 #define KAGOME_BLOCKCHAIN_BLOCKHEADERREPOSITORYIMPL
8 
10 
12 #include "crypto/hasher.hpp"
13 
14 namespace kagome::blockchain {
15 
17  public:
18  BlockHeaderRepositoryImpl(std::shared_ptr<storage::BufferStorage> map,
19  std::shared_ptr<crypto::Hasher> hasher);
20 
21  ~BlockHeaderRepositoryImpl() override = default;
22 
23  outcome::result<primitives::BlockNumber> getNumberByHash(
24  const common::Hash256 &hash) const override;
25 
26  outcome::result<common::Hash256> getHashByNumber(
27  const primitives::BlockNumber &number) const override;
28 
29  outcome::result<primitives::BlockHeader> getBlockHeader(
30  const primitives::BlockId &id) const override;
31 
32  outcome::result<blockchain::BlockStatus> getBlockStatus(
33  const primitives::BlockId &id) const override;
34 
35  private:
36  std::shared_ptr<storage::BufferStorage> map_;
37  std::shared_ptr<crypto::Hasher> hasher_;
38  };
39 
40 } // namespace kagome::blockchain
41 
42 #endif // KAGOME_BLOCKCHAIN_BLOCKHEADERREPOSITORYIMPL
std::shared_ptr< storage::BufferStorage > map_
outcome::result< primitives::BlockNumber > getNumberByHash(const common::Hash256 &hash) const override
uint32_t BlockNumber
Definition: common.hpp:18
BlockHeaderRepositoryImpl(std::shared_ptr< storage::BufferStorage > map, std::shared_ptr< crypto::Hasher > hasher)
outcome::result< common::Hash256 > getHashByNumber(const primitives::BlockNumber &number) const override
boost::variant< BlockHash, BlockNumber > BlockId
Block id is the variant over BlockHash and BlockNumber.
Definition: block_id.hpp:18
outcome::result< blockchain::BlockStatus > getBlockStatus(const primitives::BlockId &id) const override
outcome::result< primitives::BlockHeader > getBlockHeader(const primitives::BlockId &id) const override