MythTV
master
|
Definition for a single task to be run by the HouseKeeper. More...
#include <libmythbase/housekeeper.h>
Public Member Functions | |
HouseKeeperTask (const QString &dbTag, HouseKeeperScope scope=kHKGlobal, HouseKeeperStartup startup=kHKNormal) | |
~HouseKeeperTask () override=default | |
bool | CheckRun (const QDateTime &now) |
bool | Run (void) |
bool | ConfirmRun (void) const |
bool | IsRunning (void) const |
bool | CheckImmediate (void) |
bool | CheckStartup (void) |
QString | GetTag (void) |
QDateTime | GetLastRun (void) |
QDateTime | GetLastSuccess (void) |
HouseKeeperScope | GetScope (void) |
QDateTime | QueryLastRun (void) |
QDateTime | QueryLastSuccess (void) |
QDateTime | UpdateLastRun (bool successful=true) |
virtual QDateTime | UpdateLastRun (const QDateTime &last, bool successful=true) |
virtual void | SetLastRun (const QDateTime &last, bool successful=true) |
virtual bool | DoCheckRun (const QDateTime &) |
virtual bool | DoRun (void) |
virtual void | Terminate (void) |
![]() | |
ReferenceCounter (const QString &debugName, bool logDebug=true) | |
Creates reference counter with an initial value of 1. More... | |
virtual int | IncrRef (void) |
Increments reference count. More... | |
virtual int | DecrRef (void) |
Decrements reference count and deletes on 0. More... | |
Private Member Functions | |
void | QueryLast (void) |
Private Attributes | |
QString | m_dbTag |
bool | m_confirm {false} |
HouseKeeperScope | m_scope |
HouseKeeperStartup | m_startup |
bool | m_running {false} |
QDateTime | m_lastRun |
QDateTime | m_lastSuccess |
QDateTime | m_lastUpdate |
Additional Inherited Members | |
![]() | |
static void | PrintDebug (void) |
Print out any leaks if that level of debugging is enabled. More... | |
![]() | |
virtual | ~ReferenceCounter (void) |
Called on destruction, will warn if object deleted with references in place. More... | |
![]() | |
bool | m_logDebug |
This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More... | |
QAtomicInt | m_referenceCount {1} |
Definition for a single task to be run by the HouseKeeper.
This class contains instructions for tasks to be run periodically by the housekeeper. Each task requires an identification tag, and can be given a two options to control scope and startup behavior. Each child class should override at least two methods: DoCheckRun() and DoRun().
DoCheckRun() is to perform a check as to whether the task should be run, returning a boolean 'true' if it should.
DoRun() actually implements the task to be run.
Child classes can also implement a Terminate() method, which is to be used to stop in-progress tasks when the application is shutting down.
The HouseKeeperScope attribute passed to the class in the constructor controls in what scope the task should operate. kHKGlobal means the task should only operate once globally. If another housekeeper in another or on another machine runs a task, this instance should track that and not run itself until the next time to run comes. kHKLocal has similar meaning, but only on the local machine, rather than the whole MythTV cluster. kHKInst means no communication is necessary, as each process instance is to operate independently.
The HouseKeeperStartup attribute passed to the class in the constructor controls the startup behavior of the task. kHKNormal means the task will never run until application control has passed to the main event loop and the HouseKeeper's check scan has run at least once. kHKRunOnStartup means the task is queued to run when on startup, and will be run as soon as a HouseKeeperThread is started to handle it. kHKRunImmediatelyOnStartup means the task will be run immediately in the primary thread. Do not use this for long tasks as it will delay application startup and handoff to the main event loop.
Definition at line 40 of file housekeeper.h.
|
explicit |
Definition at line 99 of file housekeeper.cpp.
|
overridedefault |
bool HouseKeeperTask::CheckRun | ( | const QDateTime & | now | ) |
Definition at line 109 of file housekeeper.cpp.
bool HouseKeeperTask::Run | ( | void | ) |
Definition at line 143 of file housekeeper.cpp.
Referenced by HouseKeepingThread::run().
|
inline |
Definition at line 49 of file housekeeper.h.
Referenced by HouseKeepingThread::run().
|
inline |
Definition at line 50 of file housekeeper.h.
bool HouseKeeperTask::CheckImmediate | ( | void | ) |
Definition at line 127 of file housekeeper.cpp.
bool HouseKeeperTask::CheckStartup | ( | void | ) |
Definition at line 133 of file housekeeper.cpp.
|
inline |
Definition at line 55 of file housekeeper.h.
Referenced by DailyHouseKeeperTask::CalculateWindow(), CheckRun(), and HouseKeeper::RegisterTask().
|
inline |
Definition at line 56 of file housekeeper.h.
Referenced by PeriodicHouseKeeperTask::CalculateWindow(), DailyHouseKeeperTask::CalculateWindow(), PeriodicHouseKeeperTask::DoCheckRun(), PeriodicHouseKeeperTask::InWindow(), PeriodicHouseKeeperTask::PastWindow(), and HouseKeepingThread::run().
|
inline |
Definition at line 57 of file housekeeper.h.
Referenced by PeriodicHouseKeeperTask::CalculateWindow().
|
inline |
Definition at line 58 of file housekeeper.h.
QDateTime HouseKeeperTask::QueryLastRun | ( | void | ) |
Definition at line 172 of file housekeeper.cpp.
QDateTime HouseKeeperTask::QueryLastSuccess | ( | void | ) |
Definition at line 178 of file housekeeper.cpp.
Definition at line 61 of file housekeeper.h.
Referenced by HouseKeepingThread::run(), and PeriodicHouseKeeperTask::UpdateLastRun().
Reimplemented in PeriodicHouseKeeperTask.
Definition at line 223 of file housekeeper.cpp.
Reimplemented in PeriodicHouseKeeperTask.
Definition at line 310 of file housekeeper.cpp.
Referenced by PeriodicHouseKeeperTask::SetLastRun().
|
inlinevirtual |
Reimplemented in PeriodicHouseKeeperTask, MythFillDatabaseTask, HardwareProfileTask, ArtworkTask, ThemeUpdateTask, and RadioStreamUpdateTask.
Definition at line 66 of file housekeeper.h.
Referenced by CheckImmediate(), CheckRun(), and CheckStartup().
|
inlinevirtual |
Reimplemented in MythFillDatabaseTask, JobQueueRecoverTask, HardwareProfileTask, ArtworkTask, ThemeUpdateTask, RadioStreamUpdateTask, and CleanupTask.
Definition at line 67 of file housekeeper.h.
Referenced by Run().
|
inlinevirtual |
Reimplemented in MythFillDatabaseTask, ArtworkTask, ThemeUpdateTask, and RadioStreamUpdateTask.
Definition at line 69 of file housekeeper.h.
|
private |
Definition at line 184 of file housekeeper.cpp.
Referenced by QueryLastRun(), and QueryLastSuccess().
|
private |
Definition at line 74 of file housekeeper.h.
Referenced by QueryLast(), Run(), and UpdateLastRun().
Definition at line 75 of file housekeeper.h.
Referenced by CheckRun(), CheckStartup(), and UpdateLastRun().
|
private |
Definition at line 76 of file housekeeper.h.
Referenced by QueryLast(), and UpdateLastRun().
|
private |
Definition at line 77 of file housekeeper.h.
Referenced by CheckImmediate(), and CheckStartup().
Definition at line 78 of file housekeeper.h.
Referenced by CheckRun(), and Run().
|
private |
Definition at line 80 of file housekeeper.h.
Referenced by QueryLast(), QueryLastRun(), QueryLastSuccess(), SetLastRun(), and UpdateLastRun().
|
private |
Definition at line 81 of file housekeeper.h.
Referenced by QueryLast(), SetLastRun(), and UpdateLastRun().
|
private |
Definition at line 82 of file housekeeper.h.
Referenced by QueryLast(), SetLastRun(), and UpdateLastRun().