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 <rxcpp/rx.hpp>
10 #include "consensus/yac/timer.hpp"
11 
12 namespace iroha {
13  namespace consensus {
14  namespace yac {
15  class TimerImpl : public Timer {
16  public:
18  using TimeoutType = long;
19 
24  explicit TimerImpl(
25  std::function<rxcpp::observable<TimeoutType>()> invoke_delay);
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::function<rxcpp::observable<TimeoutType>()> invoke_delay_;
36  rxcpp::composite_subscription handle_;
37  };
38  } // namespace yac
39  } // namespace consensus
40 } // namespace iroha
41 
42 #endif // IROHA_TIMER_IMPL_HPP
void invokeAfterDelay(std::function< void()> handler) override
Definition: timer_impl.cpp:16
TimerImpl(std::function< rxcpp::observable< TimeoutType >()> invoke_delay)
Definition: timer_impl.cpp:12
Definition: timer.hpp:18
TimerImpl & operator=(const TimerImpl &)=delete
Definition: block_query.hpp:16
long TimeoutType
Delay observable type.
Definition: timer_impl.hpp:18
~TimerImpl() override
Definition: timer_impl.cpp:26
Definition: timer_impl.hpp:15
void deny() override
Definition: timer_impl.cpp:22