hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
block_query_base.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_BLOCK_QUERY_BASE_HPP
7 #define IROHA_BLOCK_QUERY_BASE_HPP
8 
9 #include <soci/soci.h>
10 
13 #include "logger/logger_fwd.hpp"
14 
15 namespace iroha::ametsuchi {
16 
20  class BlockQueryBase : public BlockQuery {
21  public:
22  BlockQueryBase(BlockStorage &block_storage, logger::LoggerPtr log);
23 
26 
28 
29  void reloadBlockstore() override;
30 
31  std::optional<TxCacheStatusType> checkTxPresence(
32  const shared_model::crypto::Hash &hash) override;
33 
34  // res > 0 => Committed
35  // res == 0 => Rejected
36  // res < 0 => Missing
37  virtual std::optional<int32_t> getTxStatus(
38  const shared_model::crypto::Hash &hash) = 0;
39 
40  protected:
43  };
44 
45 } // namespace iroha::ametsuchi
46 
47 #endif // IROHA_POSTGRES_BLOCK_QUERY_HPP
BlockStorage & block_storage_
Definition: block_query_base.hpp:41
Definition: block_query.hpp:17
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
Definition: hash.hpp:18
logger::LoggerPtr log_
Definition: block_query_base.hpp:42
void reloadBlockstore() override
Definition: block_query_base.cpp:34
std::optional< TxCacheStatusType > checkTxPresence(const shared_model::crypto::Hash &hash) override
Definition: block_query_base.cpp:38
Definition: block_storage.hpp:23
Definition: block_query.hpp:21
Definition: block_query_base.hpp:20
Definition: result_fwd.hpp:27
BlockQueryBase(BlockStorage &block_storage, logger::LoggerPtr log)
Definition: block_query_base.cpp:14
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
BlockResult getBlock(shared_model::interface::types::HeightType height) override
Definition: block_query_base.cpp:18
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
shared_model::interface::types::HeightType getTopBlockHeight() override
Definition: block_query_base.cpp:30
virtual std::optional< int32_t > getTxStatus(const shared_model::crypto::Hash &hash)=0