The controller for Queue objects. More...
#include <QueuesController.h>
Public Member Functions | |
treqs::Queue * | create (string s, int p) |
Create a new Queue. | |
bool | exists (string t) |
Test if there is a queue for this tape name. | |
Queue * | exists (string t, QueueStatus qs) |
Find the unique queue in a given state for a given tape. | |
bool | remove (string) |
Remove a queue from the list of queues. | |
Queue * | addFilePositionOnTape (FilePositionOnTape *f, int r, int pvr) |
Add a file in the correct queue. | |
pair< multimap< string, Queue > ::iterator, multimap< string, Queue >::iterator > | getMapIterators () |
Provide a way to iterate through the queues. | |
pair< multimap< string, Queue > ::iterator, multimap< string, Queue >::iterator > | getQueuesOnTape (std::string t) |
Get all queues on a given tape. | |
int | cleanDoneQueues () |
Do house cleaning on done queues. | |
void | updateSuspendTime (int t) |
Update the SuspendTime of all the queues. Sets the localSuspendTime. | |
Static Public Member Functions | |
static QueuesController * | getInstance () |
Provide access to the singleton. | |
Protected Member Functions | |
QueuesController () | |
Constructor. | |
~QueuesController () | |
Destructor. | |
Private Attributes | |
multimap< string, Queue > | QueuesMap |
The list of queues. | |
int | SuspendTime |
Time laps a queue is suspended when it has to. | |
Static Private Attributes | |
static QueuesController * | _instance = 0 |
Pointer to the singleton instance. | |
static LoggerPtr | logger |
The LOG4CXX logger. |
The controller for Queue objects.
The Queues Controller provides an interface to create new queues, get the queues from a name, remove queues from a name, test existance
The Queues are organized in a multimap, the key being the name of the queue (typically the tape name).
treqs::QueuesController::QueuesController | ( | ) | [protected] |
Constructor.
treqs::QueuesController::~QueuesController | ( | ) | [protected] |
Destructor.
treqs::Queue * treqs::QueuesController::addFilePositionOnTape | ( | treqs::FilePositionOnTape * | f, | |
int | r, | |||
int | pvr | |||
) |
Add a file in the correct queue.
Based on the tape referenced by the file, the correct queue is found. Based on the file's position, insert the file in the activated queue or in the created queue We also ask the FilePositionOnTapesController to register the returned instance.
f | the file to insert | |
r | the retry number | |
pvr | the PVR Id for the queue |
int treqs::QueuesController::cleanDoneQueues | ( | ) |
Do house cleaning on done queues.
Iterate on the queues map and clean the done queues
treqs::Queue * treqs::QueuesController::create | ( | string | s, | |
int | p | |||
) |
Create a new Queue.
Create a new Queue and insert the instance in the multimap
s | the name of the queue (aka the name of the tape) | |
p | the pvrid |
treqs::Queue * treqs::QueuesController::exists | ( | string | t, | |
treqs::QueueStatus | qs | |||
) |
Find the unique queue in a given state for a given tape.
t | the tape name | |
qs | the queue status |
bool treqs::QueuesController::exists | ( | string | t | ) |
Test if there is a queue for this tape name.
t | the tape name |
treqs::QueuesController * treqs::QueuesController::getInstance | ( | ) | [static] |
Provide access to the singleton.
pair< multimap< string, treqs::Queue >::iterator, multimap< string, treqs::Queue >::iterator > treqs::QueuesController::getMapIterators | ( | ) |
Provide a way to iterate through the queues.
pair< multimap< string, treqs::Queue >::iterator, multimap< string, treqs::Queue >::iterator > treqs::QueuesController::getQueuesOnTape | ( | std::string | t | ) |
Get all queues on a given tape.
t | the tape to search for |
bool treqs::QueuesController::remove | ( | string | s | ) |
Remove a queue from the list of queues.
call the Queue's destructor TODO : Not implemented yet.
s | the name of the queue |
void treqs::QueuesController::updateSuspendTime | ( | int | t | ) |
Update the SuspendTime of all the queues. Sets the localSuspendTime.
t | the time in second for queue suspension |
treqs::QueuesController * treqs::QueuesController::_instance = 0 [static, private] |
Pointer to the singleton instance.
LoggerPtr treqs::QueuesController::logger [static, private] |
The LOG4CXX logger.
multimap<string, Queue> treqs::QueuesController::QueuesMap [private] |
The list of queues.
Non-Unique key of the multimap is the Queue's name.
int treqs::QueuesController::SuspendTime [private] |
Time laps a queue is suspended when it has to.