From a3f88c1c52e92ccf1aef709f4bf3c06a523f0c90 Mon Sep 17 00:00:00 2001 From: Michael Davis <michael.davis@cern.ch> Date: Tue, 8 May 2018 16:21:32 +0200 Subject: [PATCH] [lpa-stream] Moves getting list of archive queues into separate method --- scheduler/OStoreDB/OStoreDB.cpp | 30 +++++++++++++++++++----------- scheduler/OStoreDB/OStoreDB.hpp | 4 ++++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 6d6f01a3e8..a2d6c3cd0f 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -19,7 +19,6 @@ #include "OStoreDB.hpp" #include "MemQueues.hpp" #include "common/dataStructures/SecurityIdentity.hpp" -#include "objectstore/RootEntry.hpp" #include "objectstore/ArchiveQueue.hpp" #include "objectstore/RetrieveQueue.hpp" #include "objectstore/DriveRegister.hpp" @@ -506,16 +505,27 @@ OStoreDB::ArchiveToFileRequestCancelation::~ArchiveToFileRequestCancelation() { } } +//------------------------------------------------------------------------------ +// OStoreDB::getArchiveQueues() +//------------------------------------------------------------------------------ +std::list<objectstore::RootEntry::ArchiveQueueDump> OStoreDB::getArchiveQueues() const { + objectstore::RootEntry re(m_objectStore); + objectstore::ScopedSharedLock rel(re); + re.fetch(); + auto tpl = re.dumpArchiveQueues(); + rel.release(); + + return tpl; +} + //------------------------------------------------------------------------------ // OStoreDB::getArchiveJobs() //------------------------------------------------------------------------------ std::list<cta::common::dataStructures::ArchiveJob> OStoreDB::getArchiveJobs(const std::string& tapePoolName) const { - objectstore::RootEntry re(m_objectStore); - objectstore::ScopedSharedLock rel(re); - re.fetch(); - auto tpl = re.dumpArchiveQueues(); - rel.release(); + + auto tpl = getArchiveQueues(); + for (auto & tpp:tpl) { if (tpp.tapePool != tapePoolName) continue; std::list<cta::common::dataStructures::ArchiveJob> ret; @@ -566,11 +576,9 @@ std::list<cta::common::dataStructures::ArchiveJob> //------------------------------------------------------------------------------ std::map<std::string, std::list<common::dataStructures::ArchiveJob> > OStoreDB::getArchiveJobs() const { - objectstore::RootEntry re(m_objectStore); - objectstore::ScopedSharedLock rel(re); - re.fetch(); - auto tpl = re.dumpArchiveQueues(); - rel.release(); + + auto tpl = getArchiveQueues(); + std::map<std::string, std::list<common::dataStructures::ArchiveJob> > ret; for (auto & tpp:tpl) { objectstore::ArchiveQueue osaq(tpp.address, m_objectStore); diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp index 14b71be42b..965f8c84bf 100644 --- a/scheduler/OStoreDB/OStoreDB.hpp +++ b/scheduler/OStoreDB/OStoreDB.hpp @@ -26,6 +26,7 @@ #include "objectstore/ArchiveRequest.hpp" #include "objectstore/DriveRegister.hpp" #include "objectstore/RetrieveRequest.hpp" +#include "objectstore/RootEntry.hpp" #include "objectstore/SchedulerGlobalLock.hpp" #include "catalogue/Catalogue.hpp" #include "common/log/Logger.hpp" @@ -280,6 +281,9 @@ public: * information. */ private: + /** Returns the current list of archive queues */ + std::list<objectstore::RootEntry::ArchiveQueueDump> getArchiveQueues() const; + /** Collection of smaller scale parts of reportDriveStatus */ struct ReportDriveStatusInputs { common::dataStructures::DriveStatus status; -- GitLab