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