MythTV master
|
Used to expire recordings to make space for new recordings. More...
#include <mythbackend/autoexpire.h>
Public Member Functions | |
AutoExpire (QMap< int, EncoderLink * > *tvList) | |
Creates AutoExpire class, starting the thread. More... | |
AutoExpire ()=default | |
~AutoExpire () override | |
AutoExpire destructor stops auto delete thread if it is running. More... | |
void | CalcParams (void) |
Calculates how much space needs to be cleared, and how often. More... | |
void | PrintExpireList (const QString &expHost="ALL") |
Prints a summary of the files that can be deleted. More... | |
uint64_t | GetDesiredSpace (int fsID) const |
Used by the scheduler to select the next recording dir. More... | |
void | GetAllExpiring (QStringList &strList) |
Gets the full list of programs that can expire in expiration order. More... | |
void | GetAllExpiring (pginfolist_t &list) |
Gets the full list of programs that can expire in expiration order. More... | |
void | SetMainServer (MainServer *ms) |
Static Public Member Functions | |
static void | ClearExpireList (pginfolist_t &expireList, bool deleteProg=true) |
Clears expireList, freeing any ProgramInfo's if necessary. More... | |
static void | Update (int encoder, int fsID, bool immediately) |
This is used to update the global AutoExpire instance "expirer". More... | |
static void | Update (bool immediately) |
Public Attributes | |
QMap< int, EncoderLink * > * | m_encoderList {nullptr} |
Protected Member Functions | |
void | RunExpirer (void) |
This contains the main loop for the auto expire process. More... | |
Private Member Functions | |
void | ExpireLiveTV (int type) |
This expires LiveTV programs. More... | |
void | ExpireOldDeleted (void) |
This expires deleted programs older than DeletedMaxAge. More... | |
void | ExpireQuickDeleted (void) |
This expires deleted programs within a few minutes. More... | |
void | ExpireRecordings (void) |
This expires normal recordings. More... | |
void | ExpireEpisodesOverMax (void) |
This deletes programs exceeding the maximum number of episodes of that program desired. More... | |
void | FillExpireList (pginfolist_t &expireList) |
Uses the "AutoExpireMethod" setting in the database to fill the list of files that are deletable. More... | |
void | FillDBOrdered (pginfolist_t &expireList, int expMethod) |
Creates a list of programs to delete using the database to order list. More... | |
void | Sleep (std::chrono::milliseconds sleepTime) |
Sleeps for sleepTime milliseconds; unless the expire thread is told to quit. More... | |
void | UpdateDontExpireSet (void) |
bool | IsInDontExpireSet (uint chanid, const QDateTime &recstartts) const |
Static Private Member Functions | |
static void | SendDeleteMessages (pginfolist_t &deleteList) |
This sends delete message to main event thread. More... | |
static bool | IsInExpireList (const pginfolist_t &expireList, uint chanid, const QDateTime &recstartts) |
Private Attributes | |
QSet< QString > | m_dontExpireSet |
ExpireThread * | m_expireThread {nullptr} |
uint | m_desiredFreq {15} |
bool | m_expireThreadRun {false} |
QMap< int, int64_t > | m_desiredSpace |
QMap< int, int > | m_usedEncoders |
QMutex | m_instanceLock |
QWaitCondition | m_instanceCond |
MainServer * | m_mainServer {nullptr} |
QMutex | m_updateLock |
QQueue< UpdateEntry > | m_updateQueue |
Friends | |
class | ExpireThread |
Used to expire recordings to make space for new recordings.
Definition at line 59 of file autoexpire.h.
|
explicit |
Creates AutoExpire class, starting the thread.
tvList | EncoderLink list of all recorders |
Definition at line 74 of file autoexpire.cpp.
|
default |
|
override |
AutoExpire destructor stops auto delete thread if it is running.
Definition at line 86 of file autoexpire.cpp.
void AutoExpire::CalcParams | ( | void | ) |
Calculates how much space needs to be cleared, and how often.
Definition at line 124 of file autoexpire.cpp.
Referenced by RunExpirer(), and Update().
|
static |
Clears expireList, freeing any ProgramInfo's if necessary.
Definition at line 888 of file autoexpire.cpp.
Referenced by ExpireLiveTV(), ExpireOldDeleted(), ExpireQuickDeleted(), ExpireRecordings(), FillExpireList(), Scheduler::FillRecordingDir(), GetAllExpiring(), and PrintExpireList().
|
private |
This deletes programs exceeding the maximum number of episodes of that program desired.
Excludes recordings in the LiveTV Recording Group.
Definition at line 662 of file autoexpire.cpp.
Referenced by RunExpirer().
|
private |
This expires LiveTV programs.
Definition at line 364 of file autoexpire.cpp.
Referenced by RunExpirer().
|
private |
This expires deleted programs older than DeletedMaxAge.
Definition at line 377 of file autoexpire.cpp.
Referenced by RunExpirer().
|
private |
This expires deleted programs within a few minutes.
Definition at line 390 of file autoexpire.cpp.
Referenced by RunExpirer().
|
private |
This expires normal recordings.
Definition at line 404 of file autoexpire.cpp.
Referenced by RunExpirer().
|
private |
Creates a list of programs to delete using the database to order list.
Definition at line 907 of file autoexpire.cpp.
Referenced by ExpireLiveTV(), ExpireOldDeleted(), ExpireQuickDeleted(), FillExpireList(), and GetAllExpiring().
|
private |
Uses the "AutoExpireMethod" setting in the database to fill the list of files that are deletable.
Definition at line 781 of file autoexpire.cpp.
Referenced by ExpireRecordings(), and PrintExpireList().
void AutoExpire::GetAllExpiring | ( | pginfolist_t & | list | ) |
Gets the full list of programs that can expire in expiration order.
Definition at line 866 of file autoexpire.cpp.
void AutoExpire::GetAllExpiring | ( | QStringList & | strList | ) |
Gets the full list of programs that can expire in expiration order.
Definition at line 842 of file autoexpire.cpp.
Referenced by Scheduler::FillRecordingDir(), V2Dvr::GetExpiringList(), and MainServer::HandleGetExpiringRecordings().
uint64_t AutoExpire::GetDesiredSpace | ( | int | fsID | ) | const |
Used by the scheduler to select the next recording dir.
Definition at line 113 of file autoexpire.cpp.
Referenced by Scheduler::FillRecordingDir().
Definition at line 1116 of file autoexpire.cpp.
Referenced by ExpireEpisodesOverMax(), and FillDBOrdered().
|
staticprivate |
Definition at line 1125 of file autoexpire.cpp.
Referenced by FillDBOrdered().
void AutoExpire::PrintExpireList | ( | const QString & | expHost = "ALL" | ) |
Prints a summary of the files that can be deleted.
Definition at line 803 of file autoexpire.cpp.
Referenced by handle_command().
|
protected |
This contains the main loop for the auto expire process.
Responsible for cleanup of old LiveTV programs as well as deleting as many recordings that are expirable as necessary to maintain enough free space on all directories in MythTV Storage Groups. The thread deletes short LiveTV programs every 2 minutes and long LiveTV and regular programs as needed every "desired_freq" minutes.
Definition at line 271 of file autoexpire.cpp.
|
staticprivate |
This sends delete message to main event thread.
Definition at line 625 of file autoexpire.cpp.
Referenced by ExpireLiveTV(), ExpireOldDeleted(), ExpireQuickDeleted(), and ExpireRecordings().
|
inline |
Definition at line 81 of file autoexpire.h.
Referenced by MainServer::MainServer(), and MainServer::Stop().
|
private |
Sleeps for sleepTime milliseconds; unless the expire thread is told to quit.
Must be called with instance_lock held.
Definition at line 347 of file autoexpire.cpp.
Referenced by RunExpirer().
|
inlinestatic |
Definition at line 79 of file autoexpire.h.
Referenced by Update().
|
static |
This is used to update the global AutoExpire instance "expirer".
encoder | This recorder starts a recording now |
fsID | file system ID of the writing directory |
immediately | If true CalcParams() is called directly. If false, a thread is spawned to call CalcParams(), this is for use in the MainServer event thread where calling CalcParams() directly would deadlock the event thread. |
Definition at line 1046 of file autoexpire.cpp.
Referenced by MainServer::autoexpireUpdate(), Scheduler::GetNextLiveTVDir(), Scheduler::HandleRecording(), and MainServer::MainServer().
|
private |
Definition at line 1081 of file autoexpire.cpp.
Referenced by GetAllExpiring(), and RunExpirer().
|
friend |
Definition at line 63 of file autoexpire.h.
|
private |
Definition at line 112 of file autoexpire.h.
Referenced by CalcParams(), and RunExpirer().
|
private |
Definition at line 115 of file autoexpire.h.
Referenced by CalcParams(), ExpireRecordings(), and GetDesiredSpace().
|
private |
Definition at line 110 of file autoexpire.h.
Referenced by IsInDontExpireSet(), and UpdateDontExpireSet().
QMap<int, EncoderLink *>* AutoExpire::m_encoderList {nullptr} |
Definition at line 87 of file autoexpire.h.
Referenced by CalcParams(), and ExpireRecordings().
|
private |
Definition at line 111 of file autoexpire.h.
Referenced by AutoExpire(), and ~AutoExpire().
Definition at line 113 of file autoexpire.h.
Referenced by RunExpirer(), Sleep(), and ~AutoExpire().
|
private |
Definition at line 119 of file autoexpire.h.
Referenced by Sleep(), Update(), and ~AutoExpire().
|
mutableprivate |
Definition at line 118 of file autoexpire.h.
Referenced by CalcParams(), GetAllExpiring(), GetDesiredSpace(), RunExpirer(), SetMainServer(), Sleep(), Update(), and ~AutoExpire().
|
private |
Definition at line 121 of file autoexpire.h.
Referenced by CalcParams(), ExpireRecordings(), and SetMainServer().
|
private |
Definition at line 124 of file autoexpire.h.
Referenced by RunExpirer(), Update(), and ~AutoExpire().
|
private |
Definition at line 125 of file autoexpire.h.
Referenced by RunExpirer(), Update(), and ~AutoExpire().
|
private |
Definition at line 116 of file autoexpire.h.
Referenced by CalcParams(), RunExpirer(), and Update().