hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
query_service.hpp
Go to the documentation of this file.
1 
6 #ifndef TORII_QUERY_SERVICE_HPP
7 #define TORII_QUERY_SERVICE_HPP
8 
9 #include <unordered_map>
10 #include "endpoint.grpc.pb.h"
11 #include "endpoint.pb.h"
12 #include "qry_responses.pb.h"
13 
17 #include "cache/cache.hpp"
18 #include "logger/logger_fwd.hpp"
20 
21 namespace shared_model {
22  namespace interface {
23  template <typename Interface, typename Transport>
25  }
26 } // namespace shared_model
27 
28 namespace iroha {
29  namespace torii {
35  class QueryService : public iroha::protocol::QueryService_v1::Service {
36  public:
37  using QueryFactoryType =
44  iroha::protocol::BlocksQuery>;
45 
47  std::shared_ptr<iroha::torii::QueryProcessor> query_processor,
48  std::shared_ptr<QueryFactoryType> query_factory,
49  std::shared_ptr<BlocksQueryFactoryType> blocks_query_factory,
50  logger::LoggerPtr log);
51 
52  QueryService(const QueryService &) = delete;
53  QueryService &operator=(const QueryService &) = delete;
54 
60  void Find(iroha::protocol::Query const &request,
62 
63  grpc::Status Find(grpc::ServerContext *context,
64  const iroha::protocol::Query *request,
65  iroha::protocol::QueryResponse *response) override;
66 
67  grpc::Status FetchCommits(
68  grpc::ServerContext *context,
69  const iroha::protocol::BlocksQuery *request,
70  grpc::ServerWriter<::iroha::protocol::BlockQueryResponse> *writer)
71  override;
72 
73  private:
74  std::shared_ptr<iroha::torii::QueryProcessor> query_processor_;
75  std::shared_ptr<QueryFactoryType> query_factory_;
76  std::shared_ptr<BlocksQueryFactoryType> blocks_query_factory_;
77 
78  // TODO 18.02.2019 lebdron: IR-336 Replace cache
80  int,
82  cache_;
83 
84  logger::LoggerPtr log_;
85  };
86  } // namespace torii
87 } // namespace iroha
88 
89 #endif // TORII_QUERY_SERVICE_HPP
Definition: hash.hpp:18
Definition: command_client.hpp:16
Definition: query.hpp:34
Definition: blocks_query.hpp:20
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:16
Definition: query_service.hpp:35
static const model::converters::PbQueryFactory query_factory(std::make_shared< logger::LoggerSpdlog >("QueryFactory", std::make_shared< logger::LoggerConfig >(logger::LoggerConfig{logger::kDefaultLogLevel, logger::getDefaultLogPatterns()})))
Definition: cache.hpp:25
Definition: command_executor.hpp:12
Definition: hash.hpp:23