Skip to content
Snippets Groups Projects
Commit d12d772f authored by Michael Davis's avatar Michael Davis
Browse files

[lpa_stream] Cleans up comments

parent caf06b90
No related branches found
No related tags found
No related merge requests found
...@@ -24,10 +24,11 @@ ...@@ -24,10 +24,11 @@
namespace cta { namespace cta {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// QueueItor::getQueueJobs // QueueItor::getQueueJobs (generic)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<typename JobQueuesQueue, typename JobQueue> template<typename JobQueuesQueue, typename JobQueue>
void QueueItor<JobQueuesQueue, JobQueue>::getQueueJobs() void QueueItor<JobQueuesQueue, JobQueue>::
getQueueJobs()
{ {
// Behaviour is racy: it's possible that the queue can disappear before we read it. // Behaviour is racy: it's possible that the queue can disappear before we read it.
// In this case, we ignore the error and move on. // In this case, we ignore the error and move on.
...@@ -44,6 +45,41 @@ void QueueItor<JobQueuesQueue, JobQueue>::getQueueJobs() ...@@ -44,6 +45,41 @@ void QueueItor<JobQueuesQueue, JobQueue>::getQueueJobs()
} }
} }
//------------------------------------------------------------------------------
// QueueItor::QueueItor (Archive specialisation)
//------------------------------------------------------------------------------
template<>
QueueItor<objectstore::RootEntry::ArchiveQueueDump, objectstore::ArchiveQueue>::
QueueItor(objectstore::Backend &objectStore, const std::string &queue_id) :
m_objectStore(objectStore),
m_onlyThisQueueId(!queue_id.empty()),
m_jobQueueIt(m_jobQueue.begin())
{
objectstore::RootEntry re(m_objectStore);
objectstore::ScopedSharedLock rel(re);
re.fetch();
m_jobQueuesQueue = re.dumpArchiveQueues();
rel.release();
// Set queue iterator to the first queue in the list
m_jobQueuesQueueIt = m_jobQueuesQueue.begin();
// If we specified a tape pool, advance to the correct queue
if(m_onlyThisQueueId) {
for( ; m_jobQueuesQueueIt != m_jobQueuesQueue.end(); ++m_jobQueuesQueueIt) {
if(m_jobQueuesQueueIt->tapePool == queue_id) break;
}
if(m_jobQueuesQueueIt == m_jobQueuesQueue.end()) {
throw cta::exception::UserError("TapePool " + queue_id + " not found.");
}
}
// Find the first job in the queue
if(m_jobQueuesQueueIt != m_jobQueuesQueue.end()) {
getQueueJobs();
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// QueueItor::qid (Archive specialisation) // QueueItor::qid (Archive specialisation)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -100,10 +136,10 @@ getJob() const ...@@ -100,10 +136,10 @@ getJob() const
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// QueueItor::QueueItor (Archive specialisation) // QueueItor::QueueItor (Retrieve specialisation)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<> template<>
QueueItor<objectstore::RootEntry::ArchiveQueueDump, objectstore::ArchiveQueue>:: QueueItor<objectstore::RootEntry::RetrieveQueueDump, objectstore::RetrieveQueue>::
QueueItor(objectstore::Backend &objectStore, const std::string &queue_id) : QueueItor(objectstore::Backend &objectStore, const std::string &queue_id) :
m_objectStore(objectStore), m_objectStore(objectStore),
m_onlyThisQueueId(!queue_id.empty()), m_onlyThisQueueId(!queue_id.empty()),
...@@ -112,21 +148,22 @@ QueueItor(objectstore::Backend &objectStore, const std::string &queue_id) : ...@@ -112,21 +148,22 @@ QueueItor(objectstore::Backend &objectStore, const std::string &queue_id) :
objectstore::RootEntry re(m_objectStore); objectstore::RootEntry re(m_objectStore);
objectstore::ScopedSharedLock rel(re); objectstore::ScopedSharedLock rel(re);
re.fetch(); re.fetch();
m_jobQueuesQueue = re.dumpArchiveQueues(); m_jobQueuesQueue = re.dumpRetrieveQueues();
rel.release(); rel.release();
// Set queue iterator to the first queue in the list // Find the first queue
m_jobQueuesQueueIt = m_jobQueuesQueue.begin(); m_jobQueuesQueueIt = m_jobQueuesQueue.begin();
#if 0
// If we specified a tape pool, advance to the correct queue // If we specified a tape pool, advance to the correct queue
if(m_onlyThisQueueId) { if(m_onlyThisQueueId) {
for( ; m_jobQueuesQueueIt != m_jobQueuesQueue.end(); ++m_jobQueuesQueueIt) { for( ; m_jobQueuesQueueIt != m_jobQueuesQueue.end(); ++m_jobQueuesQueueIt) {
if(m_jobQueuesQueueIt->tapePool == queue_id) break; if(m_jobQueuesQueueIt->tapePool == queue_id) {
} break;
if(m_jobQueuesQueueIt == m_jobQueuesQueue.end()) { }
throw cta::exception::UserError("TapePool " + queue_id + " not found.");
} }
} }
#endif
// Find the first job in the queue // Find the first job in the queue
if(m_jobQueuesQueueIt != m_jobQueuesQueue.end()) { if(m_jobQueuesQueueIt != m_jobQueuesQueue.end()) {
...@@ -146,7 +183,7 @@ qid() const ...@@ -146,7 +183,7 @@ qid() const
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// QueueItor::QueueItor (Retrieve specialisation) // QueueItor::getJob (Retrieve specialisation)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<> template<>
std::pair<bool,objectstore::RetrieveQueue::job_t> std::pair<bool,objectstore::RetrieveQueue::job_t>
...@@ -173,41 +210,4 @@ getJob() const ...@@ -173,41 +210,4 @@ getJob() const
} }
} }
//------------------------------------------------------------------------------
// QueueItor::QueueItor (Retrieve specialisation)
//------------------------------------------------------------------------------
template<>
QueueItor<objectstore::RootEntry::RetrieveQueueDump, objectstore::RetrieveQueue>::
QueueItor(objectstore::Backend &objectStore, const std::string &queue_id) :
m_objectStore(objectStore),
m_onlyThisQueueId(!queue_id.empty()),
m_jobQueueIt(m_jobQueue.begin())
{
objectstore::RootEntry re(m_objectStore);
objectstore::ScopedSharedLock rel(re);
re.fetch();
m_jobQueuesQueue = re.dumpRetrieveQueues();
rel.release();
// Find the first queue
m_jobQueuesQueueIt = m_jobQueuesQueue.begin();
#if 0
// If we specified a tape pool, advance to the correct queue
if(m_onlyThisQueueId) {
for( ; m_jobQueuesQueueIt != m_jobQueuesQueue.end(); ++m_jobQueuesQueueIt) {
if(m_jobQueuesQueueIt->tapePool == queue_id) {
break;
}
}
}
#endif
// Find the first job in the queue
if(m_jobQueuesQueueIt != m_jobQueuesQueue.end()) {
getQueueJobs();
}
}
} // namespace cta } // namespace cta
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment