| 
    rippled
    
   | 
 
Simulated discrete-event scheduler. More...
#include <Scheduler.h>

Classes | |
| struct | cancel_token | 
| struct | event | 
| class | event_impl | 
| class | queue_type | 
Public Types | |
| using | clock_type = beast::manual_clock< std::chrono::steady_clock > | 
| using | duration = typename clock_type::duration | 
| using | time_point = typename clock_type::time_point | 
Public Member Functions | |
| Scheduler (Scheduler const &)=delete | |
| Scheduler & | operator= (Scheduler const &)=delete | 
| Scheduler () | |
| clock_type & | clock () const | 
| Return the clock.   | |
| time_point | now () const | 
| Return the current network time.   | |
| template<class Function > | |
| cancel_token | at (time_point const &when, Function &&f) | 
| Schedule an event at a specific time.   | |
| template<class Function > | |
| cancel_token | in (duration const &delay, Function &&f) | 
| Schedule an event after a specified duration passes.   | |
| void | cancel (cancel_token const &token) | 
| Cancel a timer.   | |
| bool | step_one () | 
| Run the scheduler for up to one event.   | |
| bool | step () | 
| Run the scheduler until no events remain.   | |
| template<class Function > | |
| bool | step_while (Function &&func) | 
| Run the scheduler while a condition is true.   | |
| bool | step_until (time_point const &until) | 
| Run the scheduler until the specified time.   | |
| template<class Period , class Rep > | |
| bool | step_for (std::chrono::duration< Period, Rep > const &amount) | 
| Run the scheduler until time has elapsed.   | |
| template<class Function > | |
| auto | at (time_point const &when, Function &&f) -> cancel_token | 
| template<class Function > | |
| auto | in (duration const &delay, Function &&f) -> cancel_token | 
Private Types | |
| using | by_when_hook = boost::intrusive::set_base_hook< boost::intrusive::link_mode< boost::intrusive::normal_link > > | 
Private Attributes | |
| boost::container::pmr::monotonic_buffer_resource | alloc_ {kilobytes(256)} | 
| queue_type | queue_ | 
| clock_type | clock_ | 
Simulated discrete-event scheduler.
Simulates the behavior of events using a single common clock.
An event is modeled using a lambda function and is scheduled to occur at a specific time. Events may be canceled using a token returned when the event is scheduled.
The caller uses one or more of the step, step_one, step_for, step_until and step_while functions to process scheduled events.
Definition at line 28 of file src/test/csf/Scheduler.h.
Definition at line 31 of file src/test/csf/Scheduler.h.
| using ripple::test::csf::Scheduler::duration = typename clock_type::duration | 
Definition at line 33 of file src/test/csf/Scheduler.h.
| using ripple::test::csf::Scheduler::time_point = typename clock_type::time_point | 
Definition at line 35 of file src/test/csf/Scheduler.h.
      
  | 
  private | 
Definition at line 38 of file src/test/csf/Scheduler.h.
      
  | 
  delete | 
| ripple::test::csf::Scheduler::Scheduler | ( | ) | 
Definition at line 335 of file src/test/csf/Scheduler.h.
| auto ripple::test::csf::Scheduler::clock | ( | ) | const | 
Return the clock.
(aged_containers want a non-const ref =(
Definition at line 340 of file src/test/csf/Scheduler.h.
| auto ripple::test::csf::Scheduler::now | ( | ) | const | 
Return the current network time.
Definition at line 346 of file src/test/csf/Scheduler.h.
| cancel_token ripple::test::csf::Scheduler::at | ( | time_point const & | when, | 
| Function && | f | ||
| ) | 
Schedule an event at a specific time.
Effects:
When the network time is reached, the function will be called with no arguments.
| cancel_token ripple::test::csf::Scheduler::in | ( | duration const & | delay, | 
| Function && | f | ||
| ) | 
Schedule an event after a specified duration passes.
Effects:
When the specified time has elapsed, the function will be called with no arguments.
| void ripple::test::csf::Scheduler::cancel | ( | cancel_token const & | token | ) | 
Cancel a timer.
Preconditions:
`token` was the return value of a call timer() which has not yet been invoked.
Definition at line 366 of file src/test/csf/Scheduler.h.
| bool ripple::test::csf::Scheduler::step_one | ( | ) | 
Run the scheduler for up to one event.
Effects:
The clock is advanced to the time of the last delivered event.
true if an event was processed. Definition at line 372 of file src/test/csf/Scheduler.h.
| bool ripple::test::csf::Scheduler::step | ( | ) | 
Run the scheduler until no events remain.
Effects:
The clock is advanced to the time of the last event.
true if an event was processed. Definition at line 384 of file src/test/csf/Scheduler.h.
| bool ripple::test::csf::Scheduler::step_while | ( | Function && | func | ) | 
Run the scheduler while a condition is true.
Function takes no arguments and will be called repeatedly after each event is processed to decide whether to continue.
Effects:
The clock is advanced to the time of the last delivered event.
true if any event was processed. Definition at line 396 of file src/test/csf/Scheduler.h.
| bool ripple::test::csf::Scheduler::step_until | ( | time_point const & | until | ) | 
Run the scheduler until the specified time.
Effects:
The clock is advanced to the specified time.
true if any event remain. Definition at line 405 of file src/test/csf/Scheduler.h.
| bool ripple::test::csf::Scheduler::step_for | ( | std::chrono::duration< Period, Rep > const & | amount | ) | 
Run the scheduler until time has elapsed.
Effects:
The clock is advanced by the specified duration.
true if any event remain. Definition at line 430 of file src/test/csf/Scheduler.h.
| auto ripple::test::csf::Scheduler::at | ( | time_point const & | when, | 
| Function && | f | ||
| ) | -> cancel_token | 
Definition at line 353 of file src/test/csf/Scheduler.h.
| auto ripple::test::csf::Scheduler::in | ( | duration const & | delay, | 
| Function && | f | ||
| ) | -> cancel_token | 
Definition at line 360 of file src/test/csf/Scheduler.h.
      
  | 
  private | 
Definition at line 129 of file src/test/csf/Scheduler.h.
      
  | 
  private | 
Definition at line 130 of file src/test/csf/Scheduler.h.
      
  | 
  mutableprivate | 
Definition at line 133 of file src/test/csf/Scheduler.h.