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>
12 #include <boost/optional.hpp>
14 #include "logger/logger_fwd.hpp"
15 
16 namespace iroha {
17  namespace ametsuchi {
18 
22  class PostgresBlockQuery : public BlockQuery {
23  public:
24  PostgresBlockQuery(soci::session &sql,
25  BlockStorage &block_storage,
26  logger::LoggerPtr log);
27 
28  PostgresBlockQuery(std::unique_ptr<soci::session> sql,
29  BlockStorage &block_storage,
30  logger::LoggerPtr log);
31 
34 
36 
37  boost::optional<TxCacheStatusType> checkTxPresence(
38  const shared_model::crypto::Hash &hash) override;
39 
40  private:
41  std::unique_ptr<soci::session> psql_;
42  soci::session &sql_;
43  BlockStorage &block_storage_;
44  logger::LoggerPtr log_;
45  };
46  } // namespace ametsuchi
47 } // namespace iroha
48 
49 #endif // IROHA_POSTGRES_BLOCK_QUERY_HPP
uint64_t HeightType
Type of height (for Block, Proposal etc)
Definition: types.hpp:43
Definition: hash.hpp:18
Definition: block_storage.hpp:22
Definition: block_query.hpp:20
shared_model::interface::types::HeightType getTopBlockHeight() override
Definition: postgres_block_query.cpp:42
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
expected::Result< std::unique_ptr< shared_model::interface::Block >, GetBlockError > BlockResult
Definition: block_query.hpp:33
boost::optional< TxCacheStatusType > checkTxPresence(const shared_model::crypto::Hash &hash) override
Definition: postgres_block_query.cpp:46
PostgresBlockQuery(soci::session &sql, BlockStorage &block_storage, logger::LoggerPtr log)
Definition: postgres_block_query.cpp:16
Definition: postgres_block_query.hpp:22
Definition: block_query.hpp:14
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:29