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.hpp>
12 #include "consensus/yac/timer.hpp"
13 
14 namespace iroha {
15  namespace consensus {
16  namespace yac {
17  class TimerImpl : public Timer {
18  public:
24  TimerImpl(std::chrono::milliseconds delay_milliseconds,
25  rxcpp::observe_on_one_worker coordination);
26  TimerImpl(const TimerImpl &) = delete;
27  TimerImpl &operator=(const TimerImpl &) = delete;
28 
29  void invokeAfterDelay(std::function<void()> handler) override;
30  void deny() override;
31 
32  ~TimerImpl() override;
33 
34  private:
35  std::mutex timer_lifetime_mutex;
36  std::chrono::milliseconds delay_milliseconds_;
37  rxcpp::composite_subscription coordinator_lifetime_;
38  rxcpp::observe_on_one_worker coordination_;
39  rxcpp::composite_subscription timer_lifetime_;
40  };
41  } // namespace yac
42  } // namespace consensus
43 } // namespace iroha
44 
45 #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:14
~TimerImpl() override
Definition: timer_impl.cpp:39
Definition: timer_impl.hpp:17
void deny() override
Definition: timer_impl.cpp:30