hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
postgres_block_query.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_POSTGRES_BLOCK_QUERY_HPP
7 #define IROHA_POSTGRES_BLOCK_QUERY_HPP
8 
10 
11 #include <soci/soci.h>
13 #include "logger/logger_fwd.hpp"
14 
15 namespace iroha {
16  namespace ametsuchi {
17 
21  class PostgresBlockQuery : public BlockQuery {
22  public:
23  PostgresBlockQuery(soci::session &sql,
24  BlockStorage &block_storage,
25  logger::LoggerPtr log);
26 
27  PostgresBlockQuery(std::unique_ptr<soci::session> sql,
28  BlockStorage &block_storage,
29  logger::LoggerPtr log);
30 
33 
35 
36  std::optional<TxCacheStatusType> checkTxPresence(
37  const shared_model::crypto::Hash &hash) override;
38 
39  private:
40  std::unique_ptr<soci::session> psql_;
41  soci::session &sql_;
42  BlockStorage &block_storage_;
43  logger::LoggerPtr log_;
44  };
45  } // namespace ametsuchi
46 } // namespace iroha
47 
48 #endif // IROHA_POSTGRES_BLOCK_QUERY_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:48
Definition: hash.hpp:18
Definition: block_storage.hpp:22
Definition: block_query.hpp:21
Definition: result_fwd.hpp:27
shared_model::interface::types::HeightType getTopBlockHeight() override
Definition: postgres_block_query.cpp:43
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
PostgresBlockQuery(soci::session &sql, BlockStorage &block_storage, logger::LoggerPtr log)
Definition: postgres_block_query.cpp:17
Definition: postgres_block_query.hpp:21
Definition: block_query.hpp:15
hash256_t hash(const T &pb)
Definition: pb_common.hpp:43
BlockResult getBlock(shared_model::interface::types::HeightType height) override
Definition: postgres_block_query.cpp:30
std::optional< TxCacheStatusType > checkTxPresence(const shared_model::crypto::Hash &hash) override
Definition: postgres_block_query.cpp:47