AutoExpire Class Reference

#include <autoexpire.h>

List of all members.


Detailed Description

Used to expire recordings to make space for new recordings.

Definition at line 35 of file autoexpire.h.


Public Member Functions

 AutoExpire (QMap< int, EncoderLink * > *encoderList)
 Creates AutoExpire class, starting the thread.
 AutoExpire (void)
 Creates AutoExpire class.
 ~AutoExpire ()
 AutoExpire destructor stops auto delete thread if it is running.
void CalcParams (void)
 Calcualtes how much space needs to be cleared, and how often.
void PrintExpireList (QString expHost="ALL")
 Prints a summary of the files that can be deleted.
size_t GetDesiredSpace (int fsID) const
void GetAllExpiring (QStringList &strList)
 Gets the full list of programs that can expire in expiration order.
void GetAllExpiring (pginfolist_t &list)
 Gets the full list of programs that can expire in expiration order.

Static Public Member Functions

static void Update (int encoder, int fsID, bool immediately)
 This is used to update the global AutoExpire instance "expirer".
static void Update (bool immediately)

Public Attributes

QMap< int, EncoderLink * > * encoderList

Protected Member Functions

void RunExpirer (void)
 This contains the main loop for the auto expire process.

Static Protected Member Functions

static void * ExpirerThread (void *param)
 This calls RunExpirer() from within a new pthread.

Private Member Functions

void Init (void)
 Inits member vars.
void ExpireLiveTV (int type)
 This expires LiveTV programs.
void ExpireOldDeleted (void)
 This expires deleted programs older than DeletedMaxAge.
void ExpireRecordings (void)
 This expires normal recordings.
void ExpireEpisodesOverMax (void)
 This deletes programs exceeding the maximum number of episodes of that program desired.
void FillExpireList (pginfolist_t &expireList)
 Uses the "AutoExpireMethod" setting in the database to fill the list of files that are deletable.
void FillDBOrdered (pginfolist_t &expireList, int expMethod)
 Creates a list of programs to delete using the database to order list.
void SendDeleteMessages (pginfolist_t &deleteList)
 This sends delete message to main event thread.
void ClearExpireList (pginfolist_t &expireList, bool deleteProg=true)
 Clears expireList, freeing any ProgramInfo's if necessary.
void Sleep (int sleepTime)
 Sleeps for sleepTime minutes; unless the expire thread is told to quit, then stops sleeping within 5 seconds.
void UpdateDontExpireSet (void)
bool IsInDontExpireSet (QString chanid, QDateTime starttime)
bool IsInExpireList (pginfolist_t &expireList, QString chanid, QDateTime starttime)

Private Attributes

set< QString > dont_expire_set
pthread_t expire_thread
uint desired_freq
bool expire_thread_running
QMap< int, uint64_tdesired_space
QMap< int, int > used_encoders
QMutex instance_lock
QWaitCondition instance_cond
bool update_pending
pthread_t update_thread

Friends

void * SpawnUpdateThread (void *param)

Constructor & Destructor Documentation

AutoExpire::AutoExpire ( QMap< int, EncoderLink * > *  tvList  ) 

Creates AutoExpire class, starting the thread.

Parameters:
tvList EncoderLink list of all recorders

Definition at line 58 of file autoexpire.cpp.

AutoExpire::AutoExpire ( void   ) 

Creates AutoExpire class.

Definition at line 72 of file autoexpire.cpp.

AutoExpire::~AutoExpire (  ) 

AutoExpire destructor stops auto delete thread if it is running.

Definition at line 91 of file autoexpire.cpp.


Member Function Documentation

void AutoExpire::CalcParams ( void   ) 

Calcualtes how much space needs to be cleared, and how often.

Definition at line 124 of file autoexpire.cpp.

Referenced by RunExpirer(), SpawnUpdateThread(), and Update().

void AutoExpire::PrintExpireList ( QString  expHost = "ALL"  ) 

Prints a summary of the files that can be deleted.

Definition at line 760 of file autoexpire.cpp.

Referenced by main().

size_t AutoExpire::GetDesiredSpace ( int  fsID  )  const

Definition at line 114 of file autoexpire.cpp.

Referenced by Scheduler::FillRecordingDir().

void AutoExpire::GetAllExpiring ( QStringList &  strList  ) 

Gets the full list of programs that can expire in expiration order.

Definition at line 799 of file autoexpire.cpp.

Referenced by MythXML::GetExpiring(), and MainServer::HandleGetExpiringRecordings().

void AutoExpire::GetAllExpiring ( pginfolist_t list  ) 

Gets the full list of programs that can expire in expiration order.

Definition at line 824 of file autoexpire.cpp.

void AutoExpire::Update ( int  encoder,
int  fsID,
bool  immediately 
) [static]

This is used to update the global AutoExpire instance "expirer".

Parameters:
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 1043 of file autoexpire.cpp.

Referenced by MainServer::autoexpireUpdate(), Scheduler::GetNextLiveTVDir(), MainServer::MainServer(), Scheduler::RunScheduler(), and Update().

static void AutoExpire::Update ( bool  immediately  )  [inline, static]

Definition at line 51 of file autoexpire.h.

void AutoExpire::RunExpirer ( void   )  [protected]

This contains the main loop for the auto expire process.

Responsible for cleanup of old LiveTV programs as well as deleting as many expireable recordings 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 262 of file autoexpire.cpp.

Referenced by ExpirerThread().

void * AutoExpire::ExpirerThread ( void *  param  )  [static, protected]

This calls RunExpirer() from within a new pthread.

Definition at line 605 of file autoexpire.cpp.

Referenced by AutoExpire().

void AutoExpire::Init ( void   )  [private]

Inits member vars.

Definition at line 82 of file autoexpire.cpp.

Referenced by AutoExpire().

void AutoExpire::ExpireLiveTV ( int  type  )  [private]

This expires LiveTV programs.

Definition at line 331 of file autoexpire.cpp.

Referenced by RunExpirer().

void AutoExpire::ExpireOldDeleted ( void   )  [private]

This expires deleted programs older than DeletedMaxAge.

Definition at line 344 of file autoexpire.cpp.

Referenced by RunExpirer().

void AutoExpire::ExpireRecordings ( void   )  [private]

This expires normal recordings.

Definition at line 358 of file autoexpire.cpp.

Referenced by RunExpirer().

void AutoExpire::ExpireEpisodesOverMax ( void   )  [private]

This deletes programs exceeding the maximum number of episodes of that program desired.

Excludes recordings in the LiveTV Recording Group.

Definition at line 618 of file autoexpire.cpp.

Referenced by RunExpirer().

void AutoExpire::FillExpireList ( pginfolist_t expireList  )  [private]

Uses the "AutoExpireMethod" setting in the database to fill the list of files that are deletable.

Definition at line 738 of file autoexpire.cpp.

Referenced by ExpireRecordings(), and PrintExpireList().

void AutoExpire::FillDBOrdered ( pginfolist_t expireList,
int  expMethod 
) [private]

Creates a list of programs to delete using the database to order list.

Definition at line 866 of file autoexpire.cpp.

Referenced by ExpireLiveTV(), ExpireOldDeleted(), FillExpireList(), and GetAllExpiring().

void AutoExpire::SendDeleteMessages ( pginfolist_t deleteList  )  [private]

This sends delete message to main event thread.

Definition at line 563 of file autoexpire.cpp.

Referenced by ExpireLiveTV(), ExpireOldDeleted(), and ExpireRecordings().

void AutoExpire::ClearExpireList ( pginfolist_t expireList,
bool  deleteProg = true 
) [private]

Clears expireList, freeing any ProgramInfo's if necessary.

Definition at line 847 of file autoexpire.cpp.

Referenced by ExpireLiveTV(), ExpireOldDeleted(), ExpireRecordings(), FillExpireList(), GetAllExpiring(), and PrintExpireList().

void AutoExpire::Sleep ( int  sleepTime  )  [private]

Sleeps for sleepTime minutes; unless the expire thread is told to quit, then stops sleeping within 5 seconds.

Definition at line 317 of file autoexpire.cpp.

Referenced by RunExpirer().

void AutoExpire::UpdateDontExpireSet ( void   )  [private]

Definition at line 1089 of file autoexpire.cpp.

Referenced by GetAllExpiring(), and RunExpirer().

bool AutoExpire::IsInDontExpireSet ( QString  chanid,
QDateTime  starttime 
) [private]

Definition at line 1123 of file autoexpire.cpp.

Referenced by ExpireEpisodesOverMax(), and FillDBOrdered().

bool AutoExpire::IsInExpireList ( pginfolist_t expireList,
QString  chanid,
QDateTime  starttime 
) [private]

Definition at line 1130 of file autoexpire.cpp.

Referenced by FillDBOrdered().


Friends And Related Function Documentation

void* SpawnUpdateThread ( void *  param  )  [friend]

Definition at line 1020 of file autoexpire.cpp.

Referenced by Update().


Member Data Documentation

Definition at line 53 of file autoexpire.h.

Referenced by AutoExpire(), CalcParams(), and ExpireRecordings().

set<QString> AutoExpire::dont_expire_set [private]

Definition at line 79 of file autoexpire.h.

Referenced by IsInDontExpireSet(), and UpdateDontExpireSet().

Definition at line 80 of file autoexpire.h.

Referenced by AutoExpire(), and ~AutoExpire().

Definition at line 81 of file autoexpire.h.

Referenced by CalcParams(), Init(), and RunExpirer().

Definition at line 82 of file autoexpire.h.

Referenced by AutoExpire(), RunExpirer(), Sleep(), and ~AutoExpire().

QMap<int, uint64_t> AutoExpire::desired_space [private]

Definition at line 84 of file autoexpire.h.

Referenced by CalcParams(), ExpireRecordings(), and GetDesiredSpace().

QMap<int, int> AutoExpire::used_encoders [private]

Definition at line 85 of file autoexpire.h.

Referenced by CalcParams(), and Update().

QMutex AutoExpire::instance_lock [private]

QWaitCondition AutoExpire::instance_cond [private]

Definition at line 88 of file autoexpire.h.

Referenced by SpawnUpdateThread(), Update(), and ~AutoExpire().

Definition at line 91 of file autoexpire.h.

Referenced by Init(), SpawnUpdateThread(), Update(), and ~AutoExpire().

Definition at line 92 of file autoexpire.h.

Referenced by Update().


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

Generated on Sat Dec 18 05:15:59 2010 for MythTV by  doxygen 1.5.5