Initial rewrite and migration of housekeeper to libraries

Multimedia / MythTV - Raymond Wagner [mythtv.org] - 30 May 2013 09:28 UTC

This rewrites the existing housekeeper found in mythbackend, and places it in libmythbase to make it available for use by other programs. The structure is modular, with tasks subclassing one of the base task classes, and then being registered against the housekeeper instance. The housekeeper itself is threadless, looping through its list of tasks on a one minute timer, and queuing up what tasks will need to be run.

The queue is handled by one or more threads independent of the housekeeper. There will always be one primary thread waiting to be woken up by the housekeeper, that will work through the queue of tasks available. If a task is taking longer than one minute, such that the housekeeper has made another pass and found items waiting in the queue, an additional thread will be started to begin working through the queue, while the first will be set to terminate after finishing its current task. This is so long running tasks such as guide data downloading does not disrupt any other tasks in the queue.

Currently, the existing housekeeping tasks in the backend housekeeper have been re-implemented using this mechanism. Additional immediately planned tasks include a monthly Smolt run to replace the existing startup check in mythfrontend, and a rescan of available addresses every few minutes to allow ServerPool to adjust to dynamic network interfaces, such as frontends on a wireless network, or distributions that have not finished initing networks prior to the backend starting.

This compiles, but it has not yet been tested in any form. Further, this is not yet ready for use, as it relies on a not-yet-written schema update to create a new table and adapt data from the settings table into it.

6122951 Initial rewrite and migration of housekeeper to libraries.
mythtv/libs/libmythbase/housekeeper.cpp | 629 ++++++++++++++++++++
mythtv/libs/libmythbase/housekeeper.h | 165 +++++
mythtv/libs/libmythbase/libmythbase.pro | 4 +-
mythtv/programs/mythbackend/backendhousekeeper.cpp | 565 ++++++++++++++++++
mythtv/programs/mythbackend/backendhousekeeper.h | 74 +++
mythtv/programs/mythbackend/main.cpp | 1 -
mythtv/programs/mythbackend/main_helpers.cpp | 21 +-
mythtv/programs/mythbackend/mythbackend.pro | 5 +-
8 files changed, 1453 insertions(+), 11 deletions(-)

Upstream: github.com


  • Share