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  // TODO 30.01.2019 lebdron: IR-266 Remove PeerQueryFactory
37  PeerProviderFactory peer_factory,
38  rxcpp::observe_on_one_worker emit_worker,
39  const GossipPropagationStrategyParams &params);
40 
42 
43  // ------------------| PropagationStrategy override |------------------
44 
45  rxcpp::observable<PropagationData> emitter() override;
46 
47  // --------------------------| end override |---------------------------
48  private:
52  PeerProviderFactory peer_factory;
53 
57  PropagationData last_data;
58 
62  std::vector<size_t> non_visited;
63 
67  rxcpp::observe_on_one_worker emit_worker;
68 
69  /*
70  * Observable for the emitting propagated data
71  */
72  rxcpp::observable<PropagationData> emitent;
73 
74  /*
75  * Mutex for handling observable stopping
76  */
77  std::mutex m;
78 
83  bool initQueue();
84 
89  OptPeer visit();
90  };
91 } // namespace iroha
92 
93 #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