Trait shuttle::scheduler::Scheduler [−][src]
A Scheduler
is an oracle that decides the order in which to execute concurrent tasks and the
data to return to calls for random values.
TheScheduler
lives across multiple executions of the test case, allowing it to retain some
state and strategically explore different schedules. At the start of each test execution, the
executor calls new_execution()
to inform the scheduler that a new execution is starting. Then,
for each scheduling decision, the executor calls next_task
to determine which task to run.
Required methods
fn new_execution(&mut self) -> Option<Schedule>
[src]
Inform the Scheduler
that a new execution is about to begin. If this function returns
None, the test will end rather than performing another execution. If it returns
Some(schedule)
, the returned Schedule
can be used to initialize a ReplayScheduler
for
deterministic replay.
fn next_task(
&mut self,
runnable_tasks: &[TaskId],
current_task: Option<TaskId>
) -> Option<TaskId>
[src]
&mut self,
runnable_tasks: &[TaskId],
current_task: Option<TaskId>
) -> Option<TaskId>
Decide which task to run next, given a list of runnable tasks and the currently running
tasks. If current_task
is None
, the execution has not yet begun. The list of runnable
tasks is guaranteed to be non-empty. This method returns Some(task)
where task
is
the runnable task to be executed next; it may also return None
, indicating that the
execution engine should stop exploring the current schedule.
fn next_u64(&mut self) -> u64
[src]
Choose the next u64 value to return to the currently running task.
Implementations on Foreign Types
impl Scheduler for Box<dyn Scheduler + Send>
[src]
fn new_execution(&mut self) -> Option<Schedule>
[src]
fn next_task(
&mut self,
runnable_tasks: &[TaskId],
current_task: Option<TaskId>
) -> Option<TaskId>
[src]
&mut self,
runnable_tasks: &[TaskId],
current_task: Option<TaskId>
) -> Option<TaskId>
fn next_u64(&mut self) -> u64
[src]
Implementors
impl Scheduler for DFSScheduler
[src]
fn new_execution(&mut self) -> Option<Schedule>
[src]
fn next_task(
&mut self,
runnable: &[TaskId],
_current: Option<TaskId>
) -> Option<TaskId>
[src]
&mut self,
runnable: &[TaskId],
_current: Option<TaskId>
) -> Option<TaskId>
fn next_u64(&mut self) -> u64
[src]
impl Scheduler for PCTScheduler
[src]
fn new_execution(&mut self) -> Option<Schedule>
[src]
fn next_task(
&mut self,
runnable: &[TaskId],
current: Option<TaskId>
) -> Option<TaskId>
[src]
&mut self,
runnable: &[TaskId],
current: Option<TaskId>
) -> Option<TaskId>
fn next_u64(&mut self) -> u64
[src]
impl Scheduler for RandomScheduler
[src]
fn new_execution(&mut self) -> Option<Schedule>
[src]
fn next_task(
&mut self,
runnable: &[TaskId],
_current: Option<TaskId>
) -> Option<TaskId>
[src]
&mut self,
runnable: &[TaskId],
_current: Option<TaskId>
) -> Option<TaskId>
fn next_u64(&mut self) -> u64
[src]
impl Scheduler for ReplayScheduler
[src]
fn new_execution(&mut self) -> Option<Schedule>
[src]
fn next_task(
&mut self,
runnable: &[TaskId],
_current: Option<TaskId>
) -> Option<TaskId>
[src]
&mut self,
runnable: &[TaskId],
_current: Option<TaskId>
) -> Option<TaskId>