hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
on_demand_connection_manager.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_ON_DEMAND_CONNECTION_MANAGER_HPP
7 #define IROHA_ON_DEMAND_CONNECTION_MANAGER_HPP
8 
10 
11 #include <shared_mutex>
12 
13 #include <rxcpp/rx.hpp>
14 #include "logger/logger_fwd.hpp"
15 
16 namespace iroha {
17  namespace ordering {
18 
23  public:
31  enum PeerType {
38  };
39 
41  template <typename T>
42  using PeerCollectionType = std::array<T, kCount>;
43 
48  struct CurrentPeers {
51  };
52 
54  std::shared_ptr<transport::OdOsNotificationFactory> factory,
55  rxcpp::observable<CurrentPeers> peers,
56  logger::LoggerPtr log);
57 
59  std::shared_ptr<transport::OdOsNotificationFactory> factory,
60  rxcpp::observable<CurrentPeers> peers,
61  CurrentPeers initial_peers,
62  logger::LoggerPtr log);
63 
64  ~OnDemandConnectionManager() override;
65 
66  void onBatches(CollectionType batches) override;
67 
68  boost::optional<std::shared_ptr<const ProposalType>> onRequestProposal(
69  consensus::Round round) override;
70 
71  private:
76  struct CurrentConnections {
78  };
79 
84  void initializeConnections(const CurrentPeers &peers);
85 
86  logger::LoggerPtr log_;
87  std::shared_ptr<transport::OdOsNotificationFactory> factory_;
88  rxcpp::composite_subscription subscription_;
89 
90  CurrentConnections connections_;
91 
92  std::shared_timed_mutex mutex_;
93  };
94 
95  } // namespace ordering
96 } // namespace iroha
97 
98 #endif // IROHA_ON_DEMAND_CONNECTION_MANAGER_HPP
Definition: on_demand_connection_manager.hpp:48
Definition: on_demand_connection_manager.hpp:37
~OnDemandConnectionManager() override
Definition: on_demand_connection_manager.cpp:35
PeerType
Definition: on_demand_connection_manager.hpp:31
void onBatches(CollectionType batches) override
Definition: on_demand_connection_manager.cpp:39
Definition: on_demand_connection_manager.hpp:33
boost::optional< std::shared_ptr< const ProposalType > > onRequestProposal(consensus::Round round) override
Definition: on_demand_connection_manager.cpp:65
std::shared_ptr< Logger > LoggerPtr
Definition: logger_fwd.hpp:22
Definition: on_demand_connection_manager.hpp:22
std::array< T, kCount > PeerCollectionType
Collection with value types which represent peers.
Definition: on_demand_connection_manager.hpp:42
Definition: block_query.hpp:16
PeerCollectionType< std::shared_ptr< shared_model::interface::Peer > > peers
Definition: on_demand_connection_manager.hpp:50
Definition: on_demand_connection_manager.hpp:35
Definition: on_demand_connection_manager.hpp:32
Definition: on_demand_os_transport.hpp:31
OnDemandConnectionManager(std::shared_ptr< transport::OdOsNotificationFactory > factory, rxcpp::observable< CurrentPeers > peers, logger::LoggerPtr log)
Definition: on_demand_connection_manager.cpp:16
Definition: on_demand_connection_manager.hpp:36
Definition: round.hpp:31
std::vector< TransactionBatchType > CollectionType
Definition: on_demand_os_transport.hpp:47
Definition: on_demand_connection_manager.hpp:34