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::interface {
22  template <typename Interface, typename Transport>
23  class AbstractTransportFactory;
24 } // namespace shared_model::interface
25 
26 namespace iroha::torii {
32  class QueryService : public iroha::protocol::QueryService_v1::Service {
33  public:
40  iroha::protocol::BlocksQuery>;
41 
42  QueryService(std::shared_ptr<iroha::torii::QueryProcessor> query_processor,
43  std::shared_ptr<QueryFactoryType> query_factory,
44  std::shared_ptr<BlocksQueryFactoryType> blocks_query_factory,
45  logger::LoggerPtr log);
46 
47  QueryService(const QueryService &) = delete;
48  QueryService &operator=(const QueryService &) = delete;
49 
55  void Find(iroha::protocol::Query const &request,
57 
58  grpc::Status Find(grpc::ServerContext *context,
59  const iroha::protocol::Query *request,
60  iroha::protocol::QueryResponse *response) override;
61 
62  grpc::Status FetchCommits(
63  grpc::ServerContext *context,
64  const iroha::protocol::BlocksQuery *request,
65  grpc::ServerWriter<::iroha::protocol::BlockQueryResponse> *writer)
66  override;
67 
68  private:
69  std::shared_ptr<iroha::torii::QueryProcessor> query_processor_;
70  std::shared_ptr<QueryFactoryType> query_factory_;
71  std::shared_ptr<BlocksQueryFactoryType> blocks_query_factory_;
72 
73  // TODO 18.02.2019 lebdron: IR-336 Replace cache
75  int,
77  cache_;
78 
79  logger::LoggerPtr log_;
80  };
81 } // namespace iroha::torii
82 
83 #endif // TORII_QUERY_SERVICE_HPP
Definition: hash.hpp:18
Definition: query.hpp:36
Definition: blocks_query.hpp:20
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
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: command_executor.hpp:14
Definition: query_service.hpp:32
Definition: application.hpp:79
Definition: cache.hpp:28
Definition: hash.hpp:23
Status
Definition: status.hpp:12