hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
block_query.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_BLOCK_QUERY_HPP
7 #define IROHA_BLOCK_QUERY_HPP
8 
9 #include <boost/optional.hpp>
11 #include "common/result.hpp"
13 
14 namespace iroha {
15 
16  namespace ametsuchi {
20  class BlockQuery {
21  public:
22  struct GetBlockError {
23  enum class Code {
24  kNoBlock,
26  };
28  std::string message;
29  };
30 
31  using BlockResult =
32  expected::Result<std::unique_ptr<shared_model::interface::Block>,
34 
35  virtual ~BlockQuery() = default;
36 
42  virtual BlockResult getBlock(
44 
50  getTopBlockHeight() = 0;
51 
60  virtual boost::optional<TxCacheStatusType> checkTxPresence(
61  const shared_model::crypto::Hash &hash) = 0;
62  };
63  } // namespace ametsuchi
64 } // namespace iroha
65 
66 #endif // IROHA_BLOCK_QUERY_HPP
std::string message
Definition: block_query.hpp:28
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:43
Definition: hash.hpp:18
Definition: block_query.hpp:20
expected::Result< std::unique_ptr< shared_model::interface::Block >, GetBlockError > BlockResult
Definition: block_query.hpp:33
virtual shared_model::interface::types::HeightType getTopBlockHeight()=0
Definition: block_query.hpp:14
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
virtual BlockResult getBlock(shared_model::interface::types::HeightType height)=0
virtual boost::optional< TxCacheStatusType > checkTxPresence(const shared_model::crypto::Hash &hash)=0
Definition: block_query.hpp:22
virtual ~BlockQuery()=default
Code code
Definition: block_query.hpp:27
Code
Definition: block_query.hpp:23