MySQL 26.7.0
Source Code Documentation
mysql::scheduler::Task_schedule Class Referenceabstract

Represents task schedule. More...

#include <task_schedule.h>

Inheritance diagram for mysql::scheduler::Task_schedule:
[legend]

Public Member Functions

 Task_schedule ()
 Constructor sets the task delay to a given value. More...
 
bool has_higher_priority (const Task_schedule &arg, int phase) const
 Compare two task schedules to indicate which task should run first. More...
 
virtual bool next ()=0
 Determines whether to re-execute this schedule. More...
 
virtual const Scheduler_clock_ptrget_clock () const =0
 Obtain task clock. More...
 
virtual const Task_idget_id () const =0
 Obtain task id. More...
 
virtual const Time_delay_typeget_task_delay () const =0
 Obtains task execution point as a delay from the clock start. More...
 
virtual bool is_finished () const =0
 
virtual ~Task_schedule ()=default
 Destructor. More...
 
virtual const Scheduler_clock_ptrget_phase_clock (unsigned int) const
 Obtain task clock for the given phase (current one by default) More...
 
virtual const Time_delay_typeget_phase_delay (unsigned int) const
 Obtains task execution point as a delay from the clock start, but for the given phase (current one by default) More...
 
virtual unsigned int get_phase_id () const
 Returns current phase id (sequence number), 0 by default. More...
 
void set_enqueued_by_scheduler ()
 Sets the flag indicating that the task was enqueued by the scheduler. More...
 
bool is_enqueued_by_scheduler () const
 Checks if the task was enqueued by the scheduler. More...
 
bool is_phase_ready () const
 Checks if the current phase is ready for execution. More...
 
void set_phase_ready ()
 Sets the phase ready flag to true. More...
 

Private Attributes

std::atomic< bool > m_phase_ready {false}
 Flag indicating that a phase is ready to be executed. More...
 
bool m_enqueued_by_worker {true}
 Flag inicating that phase will be enqueued by worker. More...
 

Detailed Description

Represents task schedule.

This is the base class for a schedule

Constructor & Destructor Documentation

◆ Task_schedule()

mysql::scheduler::Task_schedule::Task_schedule ( )

Constructor sets the task delay to a given value.

◆ ~Task_schedule()

virtual mysql::scheduler::Task_schedule::~Task_schedule ( )
virtualdefault

Destructor.

Member Function Documentation

◆ get_clock()

virtual const Scheduler_clock_ptr & mysql::scheduler::Task_schedule::get_clock ( ) const
pure virtual

◆ get_id()

virtual const Task_id & mysql::scheduler::Task_schedule::get_id ( ) const
pure virtual

◆ get_phase_clock()

virtual const Scheduler_clock_ptr & mysql::scheduler::Task_schedule::get_phase_clock ( unsigned int  ) const
inlinevirtual

Obtain task clock for the given phase (current one by default)

Returns
Phase clock reference

Reimplemented in mysql::scheduler::Transaction_order_schedule.

◆ get_phase_delay()

virtual const Time_delay_type & mysql::scheduler::Task_schedule::get_phase_delay ( unsigned int  ) const
inlinevirtual

Obtains task execution point as a delay from the clock start, but for the given phase (current one by default)

Gets information about task execution time - task delay since the beginning of a schedule

Note
TBI in derived

Reimplemented in mysql::scheduler::Transaction_order_schedule.

◆ get_phase_id()

virtual unsigned int mysql::scheduler::Task_schedule::get_phase_id ( ) const
inlinevirtual

Returns current phase id (sequence number), 0 by default.

Returns
Phase sequence number

Reimplemented in mysql::scheduler::Transaction_order_schedule.

◆ get_task_delay()

virtual const Time_delay_type & mysql::scheduler::Task_schedule::get_task_delay ( ) const
pure virtual

Obtains task execution point as a delay from the clock start.

Gets information about task execution time - task delay since the beginning of a schedule

Note
TBI in derived

Implemented in mysql::scheduler::Delayed_schedule, and mysql::scheduler::Transaction_order_schedule.

◆ has_higher_priority()

bool mysql::scheduler::Task_schedule::has_higher_priority ( const Task_schedule arg,
int  phase 
) const

Compare two task schedules to indicate which task should run first.

Checks whether THIS task has higher priority than a given task in terms of time left to the execution

Parameters
argTask to compare against
phaseCompares task priority for a given phase (phase seqnence number)
Returns
true - this task has higher priority than arg task, false - this task has lower or equal priority than given task

◆ is_enqueued_by_scheduler()

bool mysql::scheduler::Task_schedule::is_enqueued_by_scheduler ( ) const
inline

Checks if the task was enqueued by the scheduler.

Returns
true if enqueued by the scheduler, false otherwise.

◆ is_finished()

virtual bool mysql::scheduler::Task_schedule::is_finished ( ) const
pure virtual

◆ is_phase_ready()

bool mysql::scheduler::Task_schedule::is_phase_ready ( ) const
inline

Checks if the current phase is ready for execution.

Returns
true if phase is ready, false otherwise.

◆ next()

virtual bool mysql::scheduler::Task_schedule::next ( )
pure virtual

Determines whether to re-execute this schedule.

This function modifies the state of the schedule to next state

Returns
true - Task will be executed in the future, false - task fulfilled its schedule and won't be executed
Note
TBI in derived

Implemented in mysql::scheduler::Delayed_schedule, and mysql::scheduler::Transaction_order_schedule.

◆ set_enqueued_by_scheduler()

void mysql::scheduler::Task_schedule::set_enqueued_by_scheduler ( )
inline

Sets the flag indicating that the task was enqueued by the scheduler.

◆ set_phase_ready()

void mysql::scheduler::Task_schedule::set_phase_ready ( )
inline

Sets the phase ready flag to true.

Member Data Documentation

◆ m_enqueued_by_worker

bool mysql::scheduler::Task_schedule::m_enqueued_by_worker {true}
private

Flag inicating that phase will be enqueued by worker.

◆ m_phase_ready

std::atomic<bool> mysql::scheduler::Task_schedule::m_phase_ready {false}
private

Flag indicating that a phase is ready to be executed.


The documentation for this class was generated from the following files: