hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
on_demand_os_client_grpc.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ON_DEMAND_OS_TRANSPORT_CLIENT_GRPC_HPP
7 #define IROHA_ON_DEMAND_OS_TRANSPORT_CLIENT_GRPC_HPP
8 
10 
11 #include "common/result.hpp"
13 #include "logger/logger_fwd.hpp"
15 #include "ordering.grpc.pb.h"
16 
17 namespace iroha {
18  namespace network {
19  template <typename Service>
20  class ClientFactory;
21  }
22  namespace ordering {
23  namespace transport {
24 
29  public:
30  using TransportFactoryType =
33  iroha::protocol::Proposal>;
34  using TimepointType = std::chrono::system_clock::time_point;
35  using TimeoutType = std::chrono::milliseconds;
36 
42  std::shared_ptr<proto::OnDemandOrdering::StubInterface> stub,
44  async_call,
45  std::shared_ptr<TransportFactoryType> proposal_factory,
46  std::function<TimepointType()> time_provider,
47  std::chrono::milliseconds proposal_request_timeout,
48  logger::LoggerPtr log);
49 
50  void onBatches(CollectionType batches) override;
51 
52  boost::optional<std::shared_ptr<const ProposalType>> onRequestProposal(
53  consensus::Round round) override;
54 
55  private:
56  logger::LoggerPtr log_;
57  std::shared_ptr<proto::OnDemandOrdering::StubInterface> stub_;
58  std::shared_ptr<network::AsyncGrpcClient<google::protobuf::Empty>>
59  async_call_;
60  std::shared_ptr<TransportFactoryType> proposal_factory_;
61  std::function<TimepointType()> time_provider_;
62  std::chrono::milliseconds proposal_request_timeout_;
63  };
64 
66  public:
67  using Service = proto::OnDemandOrdering;
69 
73  async_call,
74  std::shared_ptr<TransportFactoryType> proposal_factory,
75  std::function<OnDemandOsClientGrpc::TimepointType()> time_provider,
76  OnDemandOsClientGrpc::TimeoutType proposal_request_timeout,
77  logger::LoggerPtr client_log,
78  std::unique_ptr<ClientFactory> client_factory);
79 
81  create(const shared_model::interface::Peer &to) override;
82 
83  private:
84  std::shared_ptr<network::AsyncGrpcClient<google::protobuf::Empty>>
85  async_call_;
86  std::shared_ptr<TransportFactoryType> proposal_factory_;
87  std::function<OnDemandOsClientGrpc::TimepointType()> time_provider_;
88  std::chrono::milliseconds proposal_request_timeout_;
89  logger::LoggerPtr client_log_;
90  std::unique_ptr<ClientFactory> client_factory_;
91  };
92 
93  } // namespace transport
94  } // namespace ordering
95 } // namespace iroha
96 
97 #endif // IROHA_ON_DEMAND_OS_TRANSPORT_CLIENT_GRPC_HPP
Definition: peer.hpp:20
Definition: result_fwd.hpp:27
Definition: proposal.hpp:17
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: on_demand_os_transport.hpp:88
Definition: on_demand_os_client_grpc.hpp:28
Definition: block_query.hpp:15
std::chrono::system_clock::time_point TimepointType
Definition: on_demand_os_client_grpc.hpp:34
std::chrono::milliseconds TimeoutType
Definition: on_demand_os_client_grpc.hpp:35
Definition: on_demand_os_transport.hpp:35
proto::OnDemandOrdering Service
Definition: on_demand_os_client_grpc.hpp:67
Definition: round.hpp:31
Definition: on_demand_ordering_init.hpp:44
std::vector< TransactionBatchType > CollectionType
Definition: on_demand_os_transport.hpp:65
Definition: mst_transport_grpc.hpp:29
Definition: on_demand_ordering_init.hpp:33
Definition: on_demand_os_client_grpc.hpp:65