hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
command_service_transport_grpc.hpp
Go to the documentation of this file.
1 
6 #ifndef TORII_COMMAND_SERVICE_TRANSPORT_GRPC_HPP
7 #define TORII_COMMAND_SERVICE_TRANSPORT_GRPC_HPP
8 
10 
11 #include <rxcpp/rx-lite.hpp>
12 #include "endpoint.grpc.pb.h"
13 #include "endpoint.pb.h"
16 #include "logger/logger_fwd.hpp"
17 
18 namespace iroha {
19  namespace torii {
20  class StatusBus;
21  }
22 } // namespace iroha
23 
24 namespace shared_model {
25  namespace interface {
26  class TxStatusFactory;
27  class TransactionBatchParser;
28  class TransactionBatchFactory;
29  } // namespace interface
30 } // namespace shared_model
31 
32 namespace iroha {
33  namespace torii {
35  : public iroha::protocol::CommandService_v1::Service {
36  public:
37  using TransportFactoryType =
41 
42  struct ConsensusGateEvent {};
43 
58  std::shared_ptr<CommandService> command_service,
59  std::shared_ptr<iroha::torii::StatusBus> status_bus,
60  std::shared_ptr<shared_model::interface::TxStatusFactory>
61  status_factory,
62  std::shared_ptr<TransportFactoryType> transaction_factory,
63  std::shared_ptr<shared_model::interface::TransactionBatchParser>
64  batch_parser,
65  std::shared_ptr<shared_model::interface::TransactionBatchFactory>
66  transaction_batch_factory,
67  rxcpp::observable<ConsensusGateEvent> consensus_gate_objects,
68  int maximum_rounds_without_update,
69  logger::LoggerPtr log);
70 
78  grpc::Status Torii(grpc::ServerContext *context,
79  const iroha::protocol::Transaction *request,
80  google::protobuf::Empty *response) override;
81 
89  grpc::Status ListTorii(grpc::ServerContext *context,
90  const iroha::protocol::TxList *request,
91  google::protobuf::Empty *response) override;
92 
102  grpc::Status Status(grpc::ServerContext *context,
103  const iroha::protocol::TxStatusRequest *request,
104  iroha::protocol::ToriiResponse *response) override;
105 
115  grpc::Status StatusStream(
116  grpc::ServerContext *context,
117  const iroha::protocol::TxStatusRequest *request,
118  grpc::ServerWriter<iroha::protocol::ToriiResponse> *response_writer)
119  override;
120 
121  private:
126  deserializeTransactions(const iroha::protocol::TxList *request);
127 
128  std::shared_ptr<CommandService> command_service_;
129  std::shared_ptr<iroha::torii::StatusBus> status_bus_;
130  std::shared_ptr<shared_model::interface::TxStatusFactory> status_factory_;
131  std::shared_ptr<TransportFactoryType> transaction_factory_;
132  std::shared_ptr<shared_model::interface::TransactionBatchParser>
133  batch_parser_;
134  std::shared_ptr<shared_model::interface::TransactionBatchFactory>
135  batch_factory_;
136  logger::LoggerPtr log_;
137 
138  rxcpp::observable<ConsensusGateEvent> consensus_gate_objects_;
139  const int maximum_rounds_without_update_;
140  };
141  } // namespace torii
142 } // namespace iroha
143 
144 #endif // TORII_COMMAND_SERVICE_TRANSPORT_GRPC_HPP
Definition: command_client.hpp:16
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: block_query.hpp:14
Definition: command_service_transport_grpc.hpp:42
Definition: command_executor.hpp:12
Definition: transaction.hpp:23
Definition: command_service_transport_grpc.hpp:34
std::vector< std::shared_ptr< Transaction >> SharedTxsCollectionType
Definition: transaction_sequence_common.hpp:27