OpenSDN source code
TaskEntry Class Reference

A class maintaning information for every <task, instance> More...

Collaboration diagram for TaskEntry:

Public Member Functions

 TaskEntry (int task_id)
 
 TaskEntry (int task_id, int task_instance)
 
 ~TaskEntry ()
 
void AddPolicy (TaskEntry *entry)
 
size_t WaitQSize () const
 
void AddToWaitQ (Task *t)
 
bool DeleteFromWaitQ (Task *t)
 
void AddToDeferQ (TaskEntry *entry)
 Adds a task to deferq_. Only one task of a given instance goes into deferq_ for its policies. More...
 
void DeleteFromDeferQ (TaskEntry &entry)
 Deletes a task from deferq_. More...
 
TaskEntry * ActiveEntryInPolicy ()
 
bool DeferOnPolicyFail (Task *t)
 
void RunTask (Task *t)
 Starts a task. If there are more entries in waitq_ add them to deferq_. More...
 
void RunDeferQ ()
 Starts executing tasks from deferq_ of a TaskEntry. More...
 
void RunCombinedDeferQ ()
 Starts executing tasks from deferq_ of TaskEntry and TaskGroup in the temporal order. More...
 
void RunWaitQ ()
 
void RunDeferEntry ()
 
void RunDeferQForGroupEnable ()
 Starts executing tasks from deferq_ of TaskEntries which are enabled. More...
 
void TaskExited (Task *t, TaskGroup *group)
 
TaskStats * GetTaskStats ()
 
void ClearTaskStats ()
 
void ClearQueues ()
 
boost::optional< uint64_t > GetTaskDeferEntrySeqno () const
 Addition/deletion of TaskEntry in the deferq_ is based on the seqno. seqno of the first Task in the waitq_ is used as the key. This function would be invoked by the comparison function during addition/deletion of TaskEntry in the deferq_. More...
 
int task_code_id () const
 Returns the code ID of this task entry. More...
 
int task_data_id () const
 Returns the data ID of this task entry. More...
 
int GetRunCount () const
 Returns the count of runs for this task entry. More...
 
void SetDisable (bool disable)
 Disables this task entry. More...
 
bool IsDisabled ()
 
void GetSandeshData (SandeshTaskEntry *resp) const
 

Private Types

typedef boost::intrusive::member_hook< Task, boost::intrusive::list_member_hook<>, &Task::waitq_hook_ > WaitQHook
 List of Task's in waitq_. More...
 
typedef boost::intrusive::list< Task, WaitQHook > TaskWaitQ
 
typedef boost::intrusive::member_hook< TaskEntry, boost::intrusive::set_member_hook<>, &TaskEntry::task_defer_node > TaskDeferListOption
 
typedef boost::intrusive::set< TaskEntry, TaskDeferListOption, boost::intrusive::compare< TaskDeferEntryCmp > > TaskDeferList
 It is a tree of TaskEntries deferred and waiting on the containing task to exit. The tree is sorted by seqno_ of first task in the TaskEntry. More...
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (TaskEntry)
 

Private Attributes

boost::intrusive::set_member_hook task_defer_node
 
int task_code_id_
 
int task_data_id_
 
int run_count_
 No. of tasks running. More...
 
Task * run_task_
 Task currently running. More...
 
TaskWaitQ waitq_
 Tasks waiting to run on some condition. More...
 
TaskEntryList policyq_
 Policy rules for a task. More...
 
TaskDeferList * deferq_
 Tasks deferred for this to exit. More...
 
TaskEntry * deferq_task_entry_
 
TaskGroup * deferq_task_group_
 
bool disable_
 
TaskStats stats_
 Cummulative Maintenance stats. More...
 

Friends

class TaskGroup
 
class TaskScheduler
 

Detailed Description

A class maintaning information for every <task, instance>

policyq_ : contains,

  • Policies configured for a task
  • Complementary policies for a task. Example, if a policy is of form <tid0> => <tid1, inst1> <tid2, -1> <tid1, inst1> cannot run if <tid0, inst1> is running <tid2, *> cannot run when <tid0, *> are running. These become complementary rule

waitq_ : Tasks of this instance created and waiting to be executed. Tasks are stored and executed in order of their creation Task can be added here on Enqueue if policy conditions are not met. Its taken out from waitq_ only when its about to Run

deferq_ : Tree of TaskEntry waiting on this task instance. The TaskEntry. This tree is populated if all conditions are met

  • This TaskEntry has tasks created
  • The TaskEntry in deferq_ has tasks created
  • The Tree is sorted on task seqno_

run_task_ : Task running in context of this TaskEntry. Only entries in task_entry_db_ have this set. Entries in task_db_ will always have this as NULL Running task is not in waitq_ or deferq_

run_count_: Number of running tasks for this TaskEntry

Definition at line 107 of file task.cc.

Member Typedef Documentation

◆ TaskDeferList

It is a tree of TaskEntries deferred and waiting on the containing task to exit. The tree is sorted by seqno_ of first task in the TaskEntry.

Definition at line 189 of file task.cc.

◆ TaskDeferListOption

typedef boost::intrusive::member_hook<TaskEntry, boost::intrusive::set_member_hook<>, &TaskEntry::task_defer_node> TaskEntry::TaskDeferListOption
private

Definition at line 183 of file task.cc.

◆ TaskWaitQ

typedef boost::intrusive::list<Task, WaitQHook> TaskEntry::TaskWaitQ
private

Definition at line 178 of file task.cc.

◆ WaitQHook

typedef boost::intrusive::member_hook<Task, boost::intrusive::list_member_hook<>, &Task::waitq_hook_> TaskEntry::WaitQHook
private

List of Task's in waitq_.

Definition at line 177 of file task.cc.

Constructor & Destructor Documentation

◆ TaskEntry() [1/2]

TaskEntry::TaskEntry ( int  task_id)

Definition at line 1253 of file task.cc.

◆ TaskEntry() [2/2]

TaskEntry::TaskEntry ( int  task_id,
int  task_instance 
)

Definition at line 1239 of file task.cc.

◆ ~TaskEntry()

TaskEntry::~TaskEntry ( )

Definition at line 1261 of file task.cc.

Member Function Documentation

◆ ActiveEntryInPolicy()

TaskEntry * TaskEntry::ActiveEntryInPolicy ( )

Definition at line 1272 of file task.cc.

◆ AddPolicy()

void TaskEntry::AddPolicy ( TaskEntry *  entry)

Definition at line 1268 of file task.cc.

◆ AddToDeferQ()

void TaskEntry::AddToDeferQ ( TaskEntry *  entry)

Adds a task to deferq_. Only one task of a given instance goes into deferq_ for its policies.

Definition at line 1316 of file task.cc.

◆ AddToWaitQ()

void TaskEntry::AddToWaitQ ( Task *  t)

Definition at line 1300 of file task.cc.

Here is the call graph for this function:

◆ ClearQueues()

void TaskEntry::ClearQueues ( )

Definition at line 1479 of file task.cc.

◆ ClearTaskStats()

void TaskEntry::ClearTaskStats ( )

Definition at line 1485 of file task.cc.

◆ DeferOnPolicyFail()

bool TaskEntry::DeferOnPolicyFail ( Task *  t)

Definition at line 1283 of file task.cc.

Here is the call graph for this function:

◆ DeleteFromDeferQ()

void TaskEntry::DeleteFromDeferQ ( TaskEntry &  entry)

Deletes a task from deferq_.

Definition at line 1323 of file task.cc.

◆ DeleteFromWaitQ()

bool TaskEntry::DeleteFromWaitQ ( Task *  t)

Definition at line 1310 of file task.cc.

◆ DISALLOW_COPY_AND_ASSIGN()

TaskEntry::DISALLOW_COPY_AND_ASSIGN ( TaskEntry  )
private

◆ GetRunCount()

int TaskEntry::GetRunCount ( ) const
inline

Returns the count of runs for this task entry.

Definition at line 164 of file task.cc.

◆ GetSandeshData()

void TaskEntry::GetSandeshData ( SandeshTaskEntry *  resp) const

Definition at line 1547 of file task.cc.

◆ GetTaskDeferEntrySeqno()

boost::optional< uint64_t > TaskEntry::GetTaskDeferEntrySeqno ( ) const

Addition/deletion of TaskEntry in the deferq_ is based on the seqno. seqno of the first Task in the waitq_ is used as the key. This function would be invoked by the comparison function during addition/deletion of TaskEntry in the deferq_.

Definition at line 1493 of file task.cc.

◆ GetTaskStats()

TaskStats * TaskEntry::GetTaskStats ( )

Definition at line 1489 of file task.cc.

◆ IsDisabled()

bool TaskEntry::IsDisabled ( )
inline

Definition at line 168 of file task.cc.

◆ RunCombinedDeferQ()

void TaskEntry::RunCombinedDeferQ ( )

Starts executing tasks from deferq_ of TaskEntry and TaskGroup in the temporal order.

Definition at line 1424 of file task.cc.

Here is the call graph for this function:

◆ RunDeferEntry()

void TaskEntry::RunDeferEntry ( )

Definition at line 1372 of file task.cc.

Here is the call graph for this function:

◆ RunDeferQ()

void TaskEntry::RunDeferQ ( )

Starts executing tasks from deferq_ of a TaskEntry.

Definition at line 1394 of file task.cc.

Here is the call graph for this function:

◆ RunDeferQForGroupEnable()

void TaskEntry::RunDeferQForGroupEnable ( )

Starts executing tasks from deferq_ of TaskEntries which are enabled.

Definition at line 1408 of file task.cc.

Here is the call graph for this function:

◆ RunTask()

void TaskEntry::RunTask ( Task *  t)

Starts a task. If there are more entries in waitq_ add them to deferq_.

Definition at line 1329 of file task.cc.

Here is the call graph for this function:

◆ RunWaitQ()

void TaskEntry::RunWaitQ ( )

Definition at line 1345 of file task.cc.

Here is the call graph for this function:

◆ SetDisable()

void TaskEntry::SetDisable ( bool  disable)
inline

Disables this task entry.

Definition at line 167 of file task.cc.

◆ task_code_id()

int TaskEntry::task_code_id ( ) const
inline

Returns the code ID of this task entry.

Definition at line 158 of file task.cc.

◆ task_data_id()

int TaskEntry::task_data_id ( ) const
inline

Returns the data ID of this task entry.

Definition at line 161 of file task.cc.

◆ TaskExited()

void TaskEntry::TaskExited ( Task *  t,
TaskGroup *  group 
)

Definition at line 1458 of file task.cc.

Here is the call graph for this function:

◆ WaitQSize()

size_t TaskEntry::WaitQSize ( ) const
inline

Definition at line 114 of file task.cc.

Friends And Related Function Documentation

◆ TaskGroup

friend class TaskGroup
friend

Definition at line 172 of file task.cc.

◆ TaskScheduler

friend class TaskScheduler
friend

Definition at line 173 of file task.cc.

Member Data Documentation

◆ deferq_

TaskDeferList* TaskEntry::deferq_
private

Tasks deferred for this to exit.

Definition at line 207 of file task.cc.

◆ deferq_task_entry_

TaskEntry* TaskEntry::deferq_task_entry_
private

Definition at line 208 of file task.cc.

◆ deferq_task_group_

TaskGroup* TaskEntry::deferq_task_group_
private

Definition at line 209 of file task.cc.

◆ disable_

bool TaskEntry::disable_
private

Definition at line 210 of file task.cc.

◆ policyq_

TaskEntryList TaskEntry::policyq_
private

Policy rules for a task.

Definition at line 204 of file task.cc.

◆ run_count_

int TaskEntry::run_count_
private

No. of tasks running.

Definition at line 195 of file task.cc.

◆ run_task_

Task* TaskEntry::run_task_
private

Task currently running.

Definition at line 198 of file task.cc.

◆ stats_

TaskStats TaskEntry::stats_
private

Cummulative Maintenance stats.

Definition at line 213 of file task.cc.

◆ task_code_id_

int TaskEntry::task_code_id_
private

Definition at line 191 of file task.cc.

◆ task_data_id_

int TaskEntry::task_data_id_
private

Definition at line 192 of file task.cc.

◆ task_defer_node

boost::intrusive::set_member_hook TaskEntry::task_defer_node
private

Definition at line 180 of file task.cc.

◆ waitq_

TaskWaitQ TaskEntry::waitq_
private

Tasks waiting to run on some condition.

Definition at line 201 of file task.cc.


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