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>
15 #include "logger/logger_fwd.hpp"
16 
17 namespace iroha {
18  namespace ametsuchi {
19 
23  class PostgresBlockQuery : public BlockQuery {
24  public:
26  soci::session &sql,
27  KeyValueStorage &file_store,
28  std::shared_ptr<shared_model::interface::BlockJsonDeserializer>
29  converter,
30  logger::LoggerPtr log);
31 
33  std::unique_ptr<soci::session> sql,
34  KeyValueStorage &file_store,
35  std::shared_ptr<shared_model::interface::BlockJsonDeserializer>
36  converter,
37  logger::LoggerPtr log);
38 
41 
43 
44  boost::optional<TxCacheStatusType> checkTxPresence(
45  const shared_model::crypto::Hash &hash) override;
46 
47  private:
48  std::unique_ptr<soci::session> psql_;
49  soci::session &sql_;
50 
51  KeyValueStorage &block_store_;
52  std::shared_ptr<shared_model::interface::BlockJsonDeserializer>
53  converter_;
54 
55  logger::LoggerPtr log_;
56  };
57  } // namespace ametsuchi
58 } // namespace iroha
59 
60 #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_query.hpp:20
shared_model::interface::types::HeightType getTopBlockHeight() override
Definition: postgres_block_query.cpp:50
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
boost::optional< TxCacheStatusType > checkTxPresence(const shared_model::crypto::Hash &hash) override
Definition: postgres_block_query.cpp:54
Definition: postgres_block_query.hpp:23
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:38
PostgresBlockQuery(soci::session &sql, KeyValueStorage &file_store, std::shared_ptr< shared_model::interface::BlockJsonDeserializer > converter, logger::LoggerPtr log)
Definition: postgres_block_query.cpp:15
expected::Result< std::unique_ptr< shared_model::interface::Block >, std::string > BlockResult
Definition: block_query.hpp:24
Definition: key_value_storage.hpp:20