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 
13 #include "ordering.grpc.pb.h"
14 
15 namespace iroha {
16  namespace ordering {
17  namespace transport {
18 
23  public:
24  using TransportFactoryType =
27  iroha::protocol::Proposal>;
28  using TimepointType = std::chrono::system_clock::time_point;
29  using TimeoutType = std::chrono::milliseconds;
30 
36  std::unique_ptr<proto::OnDemandOrdering::StubInterface> stub,
38  async_call,
39  std::shared_ptr<TransportFactoryType> proposal_factory,
40  std::function<TimepointType()> time_provider,
41  std::chrono::milliseconds proposal_request_timeout,
42  logger::Logger log = logger::log("OnDemandOsClientGrpc"));
43 
44  void onBatches(consensus::Round round, CollectionType batches) override;
45 
46  boost::optional<ProposalType> onRequestProposal(
47  consensus::Round round) override;
48 
49  private:
50  logger::Logger log_;
51  std::unique_ptr<proto::OnDemandOrdering::StubInterface> stub_;
52  std::shared_ptr<network::AsyncGrpcClient<google::protobuf::Empty>>
53  async_call_;
54  std::shared_ptr<TransportFactoryType> proposal_factory_;
55  std::function<TimepointType()> time_provider_;
56  std::chrono::milliseconds proposal_request_timeout_;
57  };
58 
60  public:
64  async_call,
65  std::shared_ptr<TransportFactoryType> proposal_factory,
66  std::function<OnDemandOsClientGrpc::TimepointType()> time_provider,
67  OnDemandOsClientGrpc::TimeoutType proposal_request_timeout);
68 
75  std::unique_ptr<OdOsNotification> create(
76  const shared_model::interface::Peer &to) override;
77 
78  private:
79  std::shared_ptr<network::AsyncGrpcClient<google::protobuf::Empty>>
80  async_call_;
81  std::shared_ptr<TransportFactoryType> proposal_factory_;
82  std::function<OnDemandOsClientGrpc::TimepointType()> time_provider_;
83  std::chrono::milliseconds proposal_request_timeout_;
84  };
85 
86  } // namespace transport
87  } // namespace ordering
88 } // namespace iroha
89 
90 #endif // IROHA_ON_DEMAND_OS_TRANSPORT_CLIENT_GRPC_HPP
Definition: peer.hpp:18
shared_model::interface::AbstractTransportFactory< shared_model::interface::Proposal, iroha::protocol::Proposal > TransportFactoryType
Definition: on_demand_os_client_grpc.hpp:27
Definition: proposal.hpp:17
std::shared_ptr< spdlog::logger > Logger
Definition: logger.hpp:26
Definition: on_demand_os_transport.hpp:72
Definition: on_demand_os_client_grpc.hpp:22
Definition: block_query.hpp:16
std::chrono::system_clock::time_point TimepointType
Definition: on_demand_os_client_grpc.hpp:28
std::chrono::milliseconds TimeoutType
Definition: on_demand_os_client_grpc.hpp:29
Definition: on_demand_os_transport.hpp:31
Logger log(const std::string &tag)
Definition: logger.cpp:48
boost::optional< ProposalType > onRequestProposal(consensus::Round round) override
Definition: on_demand_os_client_grpc.cpp:54
void onBatches(consensus::Round round, CollectionType batches) override
Definition: on_demand_os_client_grpc.cpp:33
OnDemandOsClientGrpc(std::unique_ptr< proto::OnDemandOrdering::StubInterface > stub, std::shared_ptr< network::AsyncGrpcClient< google::protobuf::Empty >> async_call, std::shared_ptr< TransportFactoryType > proposal_factory, std::function< TimepointType()> time_provider, std::chrono::milliseconds proposal_request_timeout, logger::Logger log=logger::log("OnDemandOsClientGrpc"))
Definition: on_demand_os_client_grpc.cpp:18
Definition: round.hpp:31
Definition: async_grpc_client.hpp:25
std::vector< TransactionBatchType > CollectionType
Definition: on_demand_os_transport.hpp:47
Definition: on_demand_os_client_grpc.hpp:59