OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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...
 
TaskEntryActiveEntryInPolicy ()
 
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)
 
TaskStatsGetTaskStats ()
 
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 GetTaskId () const
 
int GetTaskInstance () const
 
int GetRunCount () const
 
void SetDisable (bool disable)
 
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_id_
 
int task_instance_
 
int run_count_
 No. of tasks running. More...
 
Taskrun_task_
 Task currently running. More...
 
TaskWaitQ waitq_
 Tasks waiting to run on some condition. More...
 
TaskEntryList policyq_
 Policy rules for a task. More...
 
TaskDeferListdeferq_
 Tasks deferred for this to exit. More...
 
TaskEntrydeferq_task_entry_
 
TaskGroupdeferq_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 95 of file task.cc.

Member Typedef Documentation

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 170 of file task.cc.

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

Definition at line 164 of file task.cc.

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

Definition at line 159 of file task.cc.

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 158 of file task.cc.

Constructor & Destructor Documentation

TaskEntry::TaskEntry ( int  task_id)

Definition at line 1277 of file task.cc.

TaskEntry::TaskEntry ( int  task_id,
int  task_instance 
)

Definition at line 1263 of file task.cc.

TaskEntry::~TaskEntry ( )

Definition at line 1285 of file task.cc.

Member Function Documentation

TaskEntry * TaskEntry::ActiveEntryInPolicy ( )

Definition at line 1296 of file task.cc.

void TaskEntry::AddPolicy ( TaskEntry entry)

Definition at line 1292 of file task.cc.

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 1340 of file task.cc.

void TaskEntry::AddToWaitQ ( Task t)

Definition at line 1324 of file task.cc.

Here is the call graph for this function:

void TaskEntry::ClearQueues ( )

Definition at line 1503 of file task.cc.

void TaskEntry::ClearTaskStats ( )

Definition at line 1509 of file task.cc.

bool TaskEntry::DeferOnPolicyFail ( Task t)

Definition at line 1307 of file task.cc.

Here is the call graph for this function:

void TaskEntry::DeleteFromDeferQ ( TaskEntry entry)

Deletes a task from deferq_.

Definition at line 1347 of file task.cc.

bool TaskEntry::DeleteFromWaitQ ( Task t)

Definition at line 1334 of file task.cc.

TaskEntry::DISALLOW_COPY_AND_ASSIGN ( TaskEntry  )
private
int TaskEntry::GetRunCount ( ) const
inline

Definition at line 147 of file task.cc.

void TaskEntry::GetSandeshData ( SandeshTaskEntry *  resp) const

Definition at line 1576 of file task.cc.

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 1517 of file task.cc.

Here is the call graph for this function:

int TaskEntry::GetTaskId ( ) const
inline

Definition at line 145 of file task.cc.

int TaskEntry::GetTaskInstance ( ) const
inline

Definition at line 146 of file task.cc.

TaskStats * TaskEntry::GetTaskStats ( )

Definition at line 1513 of file task.cc.

bool TaskEntry::IsDisabled ( )
inline

Definition at line 149 of file task.cc.

void TaskEntry::RunCombinedDeferQ ( )

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

Definition at line 1448 of file task.cc.

Here is the call graph for this function:

void TaskEntry::RunDeferEntry ( )

Definition at line 1396 of file task.cc.

Here is the call graph for this function:

void TaskEntry::RunDeferQ ( )

Starts executing tasks from deferq_ of a TaskEntry.

Definition at line 1418 of file task.cc.

Here is the call graph for this function:

void TaskEntry::RunDeferQForGroupEnable ( )

Starts executing tasks from deferq_ of TaskEntries which are enabled.

Definition at line 1432 of file task.cc.

Here is the call graph for this function:

void TaskEntry::RunTask ( Task t)

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

Definition at line 1353 of file task.cc.

Here is the call graph for this function:

void TaskEntry::RunWaitQ ( )

Definition at line 1369 of file task.cc.

Here is the call graph for this function:

void TaskEntry::SetDisable ( bool  disable)
inline

Definition at line 148 of file task.cc.

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

Definition at line 1482 of file task.cc.

Here is the call graph for this function:

size_t TaskEntry::WaitQSize ( ) const
inline

Definition at line 102 of file task.cc.

Friends And Related Function Documentation

friend class TaskGroup
friend

Definition at line 153 of file task.cc.

friend class TaskScheduler
friend

Definition at line 154 of file task.cc.

Member Data Documentation

TaskDeferList* TaskEntry::deferq_
private

Tasks deferred for this to exit.

Definition at line 188 of file task.cc.

TaskEntry* TaskEntry::deferq_task_entry_
private

Definition at line 189 of file task.cc.

TaskGroup* TaskEntry::deferq_task_group_
private

Definition at line 190 of file task.cc.

bool TaskEntry::disable_
private

Definition at line 191 of file task.cc.

TaskEntryList TaskEntry::policyq_
private

Policy rules for a task.

Definition at line 185 of file task.cc.

int TaskEntry::run_count_
private

No. of tasks running.

Definition at line 176 of file task.cc.

Task* TaskEntry::run_task_
private

Task currently running.

Definition at line 179 of file task.cc.

TaskStats TaskEntry::stats_
private

Cummulative Maintenance stats.

Definition at line 194 of file task.cc.

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

Definition at line 161 of file task.cc.

int TaskEntry::task_id_
private

Definition at line 172 of file task.cc.

int TaskEntry::task_instance_
private

Definition at line 173 of file task.cc.

TaskWaitQ TaskEntry::waitq_
private

Tasks waiting to run on some condition.

Definition at line 182 of file task.cc.


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