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>
10 #include <rxcpp/rx.hpp>
12 #include "common/result.hpp"
15 
16 namespace iroha {
17 
18  namespace ametsuchi {
22  class BlockQuery {
23  protected:
24  using wTransaction =
25  std::shared_ptr<shared_model::interface::Transaction>;
26  using wBlock = std::shared_ptr<shared_model::interface::Block>;
27 
28  public:
29  virtual ~BlockQuery() = default;
30 
37  virtual std::vector<wBlock> getBlocks(
39  uint32_t count) = 0;
40 
46  virtual std::vector<wBlock> getBlocksFrom(
48 
54  virtual std::vector<wBlock> getTopBlocks(uint32_t count) = 0;
55 
60  virtual uint32_t getTopBlockHeight() = 0;
61 
70  virtual boost::optional<TxCacheStatusType> checkTxPresence(
71  const shared_model::crypto::Hash &hash) = 0;
72 
77  virtual expected::Result<wBlock, std::string> getTopBlock() = 0;
78  };
79  } // namespace ametsuchi
80 } // namespace iroha
81 
82 #endif // IROHA_BLOCK_QUERY_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:39
Definition: hash.hpp:18
std::shared_ptr< shared_model::interface::Block > wBlock
Definition: block_query.hpp:26
Definition: block_query.hpp:22
virtual std::vector< wBlock > getTopBlocks(uint32_t count)=0
std::shared_ptr< shared_model::interface::Transaction > wTransaction
Definition: block_query.hpp:25
virtual expected::Result< wBlock, std::string > getTopBlock()=0
Definition: block_query.hpp:16
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
virtual std::vector< wBlock > getBlocks(shared_model::interface::types::HeightType height, uint32_t count)=0
virtual boost::optional< TxCacheStatusType > checkTxPresence(const shared_model::crypto::Hash &hash)=0
virtual uint32_t getTopBlockHeight()=0
virtual ~BlockQuery()=default
virtual std::vector< wBlock > getBlocksFrom(shared_model::interface::types::HeightType height)=0