hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
postgres_wsv_query.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_POSTGRES_WSV_QUERY_HPP
7 #define IROHA_POSTGRES_WSV_QUERY_HPP
8 
10 
11 #include <soci/soci.h>
13 #include "logger/logger_fwd.hpp"
14 
15 namespace iroha {
16  namespace ametsuchi {
17  class PostgresWsvQuery : public WsvQuery {
18  public:
20  soci::session &sql,
21  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
22  factory,
23  logger::LoggerPtr log);
24 
26  std::unique_ptr<soci::session> sql,
27  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
28  factory,
29  logger::LoggerPtr log);
30 
31  boost::optional<std::vector<shared_model::interface::types::PubkeyType>>
33  &account_id) override;
34 
35  boost::optional<
36  std::vector<std::shared_ptr<shared_model::interface::Peer>>>
37  getPeers() override;
38 
39  private:
48  template <typename T>
49  boost::optional<std::shared_ptr<T>> fromResult(
51  std::unique_ptr<T>> &&result);
52 
57  template <typename T, typename F>
58  auto execute(F &&f) -> boost::optional<soci::rowset<T>>;
59 
60  // TODO andrei 24.09.2018: IR-1718 Consistent soci::session fields in
61  // storage classes
62  std::unique_ptr<soci::session> psql_;
63  soci::session &sql_;
64  std::shared_ptr<shared_model::interface::CommonObjectsFactory> factory_;
65  logger::LoggerPtr log_;
66  };
67  } // namespace ametsuchi
68 } // namespace iroha
69 
70 #endif // IROHA_POSTGRES_WSV_QUERY_HPP
boost::optional< std::vector< std::shared_ptr< shared_model::interface::Peer > > > getPeers() override
Definition: postgres_wsv_query.cpp:77
iroha::expected::Result< T, std::string > FactoryResult
Definition: common_objects_factory.hpp:29
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
PostgresWsvQuery(soci::session &sql, std::shared_ptr< shared_model::interface::CommonObjectsFactory > factory, logger::LoggerPtr log)
Definition: postgres_wsv_query.cpp:21
Definition: block_query.hpp:14
std::string AccountIdType
Type of account id.
Definition: types.hpp:38
boost::optional< std::vector< shared_model::interface::types::PubkeyType > > getSignatories(const shared_model::interface::types::AccountIdType &account_id) override
Definition: postgres_wsv_query.cpp:60
Definition: postgres_wsv_query.hpp:17
Definition: wsv_query.hpp:19