hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
gossip_propagation_strategy.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_GOSSIP_PROPAGATION_STRATEGY_HPP
7 #define IROHA_GOSSIP_PROPAGATION_STRATEGY_HPP
8 
9 #include <boost/optional.hpp>
10 #include <chrono>
11 #include <mutex>
12 
16 
17 namespace iroha {
18 
26  public:
27  using PeerProviderFactory = std::shared_ptr<ametsuchi::PeerQueryFactory>;
28  using OptPeer = boost::optional<PropagationData::value_type>;
36  rxcpp::observe_on_one_worker emit_worker,
37  const GossipPropagationStrategyParams &params);
38 
40 
41  // ------------------| PropagationStrategy override |------------------
42 
43  rxcpp::observable<PropagationData> emitter() override;
44 
45  // --------------------------| end override |---------------------------
46  private:
50  PeerProviderFactory peer_factory;
51 
55  PropagationData last_data;
56 
60  std::vector<size_t> non_visited;
61 
65  rxcpp::observe_on_one_worker emit_worker;
66 
67  /*
68  * Observable for the emitting propagated data
69  */
70  rxcpp::observable<PropagationData> emitent;
71 
72  /*
73  * Mutex for handling observable stopping
74  */
75  std::mutex m;
76 
81  bool initQueue();
82 
87  OptPeer visit();
88  };
89 } // namespace iroha
90 
91 #endif // IROHA_GOSSIP_PROPAGATION_STRATEGY_HPP
Definition: mst_propagation_strategy.hpp:18
boost::optional< PropagationData::value_type > OptPeer
Definition: gossip_propagation_strategy.hpp:28
GossipPropagationStrategy(PeerProviderFactory peer_factory, rxcpp::observe_on_one_worker emit_worker, const GossipPropagationStrategyParams &params)
Definition: gossip_propagation_strategy.cpp:22
Definition: block_query.hpp:16
~GossipPropagationStrategy()
Definition: gossip_propagation_strategy.cpp:50
rxcpp::observable< PropagationData > emitter() override
Definition: gossip_propagation_strategy.cpp:46
Definition: gossip_propagation_strategy.hpp:25
Definition: gossip_propagation_strategy_params.hpp:23
std::shared_ptr< ametsuchi::PeerQueryFactory > PeerProviderFactory
Definition: gossip_propagation_strategy.hpp:27
PropagationStrategy::PropagationData PropagationData
Definition: gossip_propagation_strategy.cpp:17