Kagome
Polkadot Runtime Engine in C++17
timer.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_TIMER_HPP
7 #define KAGOME_TIMER_HPP
8 
9 #include <functional>
10 #include <system_error>
11 
12 #include "clock/clock.hpp"
13 
14 namespace kagome::clock {
18  struct Timer {
19  virtual ~Timer() = default;
20 
25  virtual void expiresAt(clock::SystemClock::TimePoint at) = 0;
26 
31  virtual void expiresAfter(clock::SystemClock::Duration duration) = 0;
32 
36  virtual void cancel() = 0;
37 
43  virtual void asyncWait(
44  const std::function<void(const std::error_code &)> &h) = 0;
45  };
46 } // namespace kagome::clock
47 
48 #endif // KAGOME_TIMER_HPP
virtual void asyncWait(const std::function< void(const std::error_code &)> &h)=0
virtual void expiresAt(clock::SystemClock::TimePoint at)=0
virtual void expiresAfter(clock::SystemClock::Duration duration)=0
virtual void cancel()=0
typename ClockType::duration Duration
Definition: clock.hpp:23
virtual ~Timer()=default
typename ClockType::time_point TimePoint
Definition: clock.hpp:27