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>
12 #include "logger/logger_fwd.hpp"
13 
14 namespace iroha {
15  namespace ametsuchi {
16  class PostgresWsvQuery : public WsvQuery {
17  public:
18  PostgresWsvQuery(soci::session &sql, logger::LoggerPtr log);
19 
20  PostgresWsvQuery(std::unique_ptr<soci::session> sql,
21  logger::LoggerPtr log);
22 
23  boost::optional<std::vector<shared_model::interface::types::PubkeyType>>
25  &account_id) override;
26 
27  boost::optional<
28  std::vector<std::shared_ptr<shared_model::interface::Peer>>>
29  getPeers() override;
30 
31  boost::optional<std::shared_ptr<shared_model::interface::Peer>>
33  &public_key) override;
34 
35  private:
40  template <typename T, typename F>
41  auto execute(F &&f) -> boost::optional<soci::rowset<T>>;
42 
43  // TODO andrei 24.09.2018: IR-1718 Consistent soci::session fields in
44  // storage classes
45  std::unique_ptr<soci::session> psql_;
46  soci::session &sql_;
47  logger::LoggerPtr log_;
48  };
49  } // namespace ametsuchi
50 } // namespace iroha
51 
52 #endif // IROHA_POSTGRES_WSV_QUERY_HPP
boost::optional< std::vector< std::shared_ptr< shared_model::interface::Peer > > > getPeers() override
Definition: postgres_wsv_query.cpp:76
PostgresWsvQuery(soci::session &sql, logger::LoggerPtr log)
Definition: postgres_wsv_query.cpp:41
boost::optional< std::shared_ptr< shared_model::interface::Peer > > getPeerByPublicKey(const shared_model::interface::types::PubkeyType &public_key) override
Definition: postgres_wsv_query.cpp:88
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:14
std::string AccountIdType
Type of account id.
Definition: types.hpp:39
boost::optional< std::vector< shared_model::interface::types::PubkeyType > > getSignatories(const shared_model::interface::types::AccountIdType &account_id) override
Definition: postgres_wsv_query.cpp:59
Definition: postgres_wsv_query.hpp:16
Definition: wsv_query.hpp:19
Definition: public_key.hpp:16