hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
timer_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_TIMER_IMPL_HPP
7 #define IROHA_TIMER_IMPL_HPP
8 
9 #include <mutex>
10 
11 #include <rxcpp/rx-lite.hpp>
12 #include "consensus/yac/timer.hpp"
13 
14 #include <rxcpp/operators/rx-observe_on.hpp>
15 
16 namespace iroha {
17  namespace consensus {
18  namespace yac {
19  class TimerImpl : public Timer {
20  public:
26  TimerImpl(std::chrono::milliseconds delay_milliseconds,
27  rxcpp::observe_on_one_worker coordination);
28  TimerImpl(const TimerImpl &) = delete;
29  TimerImpl &operator=(const TimerImpl &) = delete;
30 
31  void invokeAfterDelay(std::function<void()> handler) override;
32  void deny() override;
33 
34  ~TimerImpl() override;
35 
36  private:
37  std::mutex timer_lifetime_mutex;
38  std::chrono::milliseconds delay_milliseconds_;
39  rxcpp::composite_subscription coordinator_lifetime_;
40  rxcpp::observe_on_one_worker coordination_;
41  rxcpp::composite_subscription timer_lifetime_;
42  };
43  } // namespace yac
44  } // namespace consensus
45 } // namespace iroha
46 
47 #endif // IROHA_TIMER_IMPL_HPP
void invokeAfterDelay(std::function< void()> handler) override
Definition: timer_impl.cpp:19
Definition: timer.hpp:18
TimerImpl & operator=(const TimerImpl &)=delete
TimerImpl(std::chrono::milliseconds delay_milliseconds, rxcpp::observe_on_one_worker coordination)
Definition: timer_impl.cpp:12
Definition: block_query.hpp:15
~TimerImpl() override
Definition: timer_impl.cpp:39
Definition: timer_impl.hpp:19
void deny() override
Definition: timer_impl.cpp:30