From 76de9bad5c4153a4a12432b5595867d5e3d156fc Mon Sep 17 00:00:00 2001 From: Steven Murray <Steven.Murray@cern.ch> Date: Mon, 12 Feb 2018 18:53:37 +0100 Subject: [PATCH] Renamed dataStructures::ArchiveFileQueueCriteria to ArchiveFileQueueCriteriaAndFileId --- catalogue/Catalogue.hpp | 4 ++-- catalogue/CatalogueRetryWrapper.hpp | 2 +- catalogue/CatalogueTest.cpp | 6 +++--- catalogue/DummyCatalogue.hpp | 2 +- catalogue/RdbmsCatalogue.cpp | 5 +++-- catalogue/RdbmsCatalogue.hpp | 2 +- common/CMakeLists.txt | 2 +- ...Criteria.cpp => ArchiveFileQueueCriteriaAndFileId.cpp} | 8 ++++---- ...Criteria.hpp => ArchiveFileQueueCriteriaAndFileId.hpp} | 8 ++++---- scheduler/OStoreDB/OStoreDB.cpp | 2 +- scheduler/OStoreDB/OStoreDB.hpp | 2 +- scheduler/OStoreDB/OStoreDBFactory.hpp | 2 +- scheduler/OStoreDB/OStoreDBTest.cpp | 2 +- scheduler/SchedulerDatabase.hpp | 4 ++-- scheduler/SchedulerDatabaseTest.cpp | 4 ++-- 15 files changed, 28 insertions(+), 27 deletions(-) rename common/dataStructures/{ArchiveFileQueueCriteria.cpp => ArchiveFileQueueCriteriaAndFileId.cpp} (81%) rename common/dataStructures/{ArchiveFileQueueCriteria.hpp => ArchiveFileQueueCriteriaAndFileId.hpp} (91%) diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index 49502f9577..808bf0c8c7 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -27,7 +27,7 @@ #include "common/dataStructures/AdminHost.hpp" #include "common/dataStructures/AdminUser.hpp" #include "common/dataStructures/ArchiveFile.hpp" -#include "common/dataStructures/ArchiveFileQueueCriteria.hpp" +#include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp" #include "common/dataStructures/ArchiveFileSummary.hpp" #include "common/dataStructures/ArchiveJob.hpp" #include "common/dataStructures/ArchiveRoute.hpp" @@ -111,7 +111,7 @@ public: * archiving the file. * @return The information required to queue the associated archive request. */ - virtual common::dataStructures::ArchiveFileQueueCriteria prepareForNewFile( + virtual common::dataStructures::ArchiveFileQueueCriteriaAndFileId prepareForNewFile( const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) = 0; diff --git a/catalogue/CatalogueRetryWrapper.hpp b/catalogue/CatalogueRetryWrapper.hpp index f6502d8be8..b0b753c118 100644 --- a/catalogue/CatalogueRetryWrapper.hpp +++ b/catalogue/CatalogueRetryWrapper.hpp @@ -68,7 +68,7 @@ public: return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeLabelled(vid, drive, lbpIsOn);}, m_maxTriesToConnect); } - common::dataStructures::ArchiveFileQueueCriteria prepareForNewFile( const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override { + common::dataStructures::ArchiveFileQueueCriteriaAndFileId prepareForNewFile( const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override { return retryOnLostConnection(m_log, [&]{return m_catalogue->prepareForNewFile(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect); } diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp index 3a01724ce8..acdb401f8e 100644 --- a/catalogue/CatalogueTest.cpp +++ b/catalogue/CatalogueTest.cpp @@ -4667,7 +4667,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareForNewFile_requester_mount_rule) { userIdentity.group = "group"; uint64_t expectedArchiveFileId = 0; for(uint64_t i = 0; i<10; i++) { - const common::dataStructures::ArchiveFileQueueCriteria queueCriteria = + const common::dataStructures::ArchiveFileQueueCriteriaAndFileId queueCriteria = m_catalogue->prepareForNewFile(storageClass.diskInstance, storageClass.name, userIdentity); if(0 == i) { @@ -4766,7 +4766,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareForNewFile_requester_group_mount_rule userIdentity.group = requesterGroupName; uint64_t expectedArchiveFileId = 0; for(uint64_t i = 0; i<10; i++) { - const common::dataStructures::ArchiveFileQueueCriteria queueCriteria = + const common::dataStructures::ArchiveFileQueueCriteriaAndFileId queueCriteria = m_catalogue->prepareForNewFile(storageClass.diskInstance, storageClass.name, userIdentity); if(0 == i) { @@ -4884,7 +4884,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareForNewFile_requester_mount_rule_overi userIdentity.group = "group"; uint64_t expectedArchiveFileId = 0; for(uint64_t i = 0; i<10; i++) { - const common::dataStructures::ArchiveFileQueueCriteria queueCriteria = + const common::dataStructures::ArchiveFileQueueCriteriaAndFileId queueCriteria = m_catalogue->prepareForNewFile(storageClass.diskInstance, storageClass.name, userIdentity); if(0 == i) { diff --git a/catalogue/DummyCatalogue.hpp b/catalogue/DummyCatalogue.hpp index 008c80c328..aa1f55e686 100644 --- a/catalogue/DummyCatalogue.hpp +++ b/catalogue/DummyCatalogue.hpp @@ -99,7 +99,7 @@ public: void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& tapePoolName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void noSpaceLeftOnTape(const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void ping() override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } - common::dataStructures::ArchiveFileQueueCriteria prepareForNewFile(const std::string& diskInstanceName, const std::string& storageClassName, const common::dataStructures::UserIdentity& user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } + common::dataStructures::ArchiveFileQueueCriteriaAndFileId prepareForNewFile(const std::string& diskInstanceName, const std::string& storageClassName, const common::dataStructures::UserIdentity& user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& instanceName, const uint64_t archiveFileId, const common::dataStructures::UserIdentity& user, log::LogContext &lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFileByDiskFileId(const std::string &diskInstanceName, const std::string &diskFileId, const common::dataStructures::UserIdentity &user, log::LogContext &lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void reclaimTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 281ffd99d7..e5d8cc4ee3 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -3916,7 +3916,8 @@ void RdbmsCatalogue::tapeLabelled(const std::string &vid, const std::string &dri //------------------------------------------------------------------------------ // prepareForNewFile //------------------------------------------------------------------------------ -common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::prepareForNewFile(const std::string &diskInstanceName, +common::dataStructures::ArchiveFileQueueCriteriaAndFileId RdbmsCatalogue::prepareForNewFile( + const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) { try { auto conn = m_connPool.getConn(); @@ -3958,7 +3959,7 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::prepareForNewFi // consume an archive file identifier const uint64_t archiveFileId = getNextArchiveFileId(conn); - return common::dataStructures::ArchiveFileQueueCriteria(archiveFileId, copyToPoolMap, mountPolicy); + return common::dataStructures::ArchiveFileQueueCriteriaAndFileId(archiveFileId, copyToPoolMap, mountPolicy); } catch(exception::LostDatabaseConnection &le) { throw exception::LostDatabaseConnection(std::string(__FUNCTION__) + " failed: " + le.getMessage().str()); } catch(exception::UserError &) { diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp index 5500f12a18..99fb948b90 100644 --- a/catalogue/RdbmsCatalogue.hpp +++ b/catalogue/RdbmsCatalogue.hpp @@ -116,7 +116,7 @@ public: * archiving the file. * @return The information required to queue the associated archive request. */ - common::dataStructures::ArchiveFileQueueCriteria prepareForNewFile( + common::dataStructures::ArchiveFileQueueCriteriaAndFileId prepareForNewFile( const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::UserIdentity &user) override; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 3aa0c85c7c..8965badd86 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -31,7 +31,7 @@ set (COMMON_LIB_SRC_FILES dataStructures/AdminHost.cpp dataStructures/AdminUser.cpp dataStructures/ArchiveFile.cpp - dataStructures/ArchiveFileQueueCriteria.cpp + dataStructures/ArchiveFileQueueCriteriaAndFileId.cpp dataStructures/ArchiveFileSummary.cpp dataStructures/ArchiveJob.cpp dataStructures/ArchiveRequest.cpp diff --git a/common/dataStructures/ArchiveFileQueueCriteria.cpp b/common/dataStructures/ArchiveFileQueueCriteriaAndFileId.cpp similarity index 81% rename from common/dataStructures/ArchiveFileQueueCriteria.cpp rename to common/dataStructures/ArchiveFileQueueCriteriaAndFileId.cpp index 251124e524..c02082dae8 100644 --- a/common/dataStructures/ArchiveFileQueueCriteria.cpp +++ b/common/dataStructures/ArchiveFileQueueCriteriaAndFileId.cpp @@ -16,19 +16,19 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "common/dataStructures/ArchiveFileQueueCriteria.hpp" +#include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp" //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -cta::common::dataStructures::ArchiveFileQueueCriteria:: - ArchiveFileQueueCriteria(): fileId(0) { +cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId:: + ArchiveFileQueueCriteriaAndFileId(): fileId(0) { } //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -cta::common::dataStructures::ArchiveFileQueueCriteria::ArchiveFileQueueCriteria( +cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId::ArchiveFileQueueCriteriaAndFileId( const uint64_t fileId, const TapeCopyToPoolMap ©ToPoolMap, const MountPolicy &mountPolicy): diff --git a/common/dataStructures/ArchiveFileQueueCriteria.hpp b/common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp similarity index 91% rename from common/dataStructures/ArchiveFileQueueCriteria.hpp rename to common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp index f0657451c1..8146c041c8 100644 --- a/common/dataStructures/ArchiveFileQueueCriteria.hpp +++ b/common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp @@ -33,12 +33,12 @@ namespace dataStructures { * the corresponding data-transfer jobs are to be queued and which mount policy * should be used. */ -struct ArchiveFileQueueCriteria { +struct ArchiveFileQueueCriteriaAndFileId { /** * Constructor. */ - ArchiveFileQueueCriteria(); + ArchiveFileQueueCriteriaAndFileId(); /** * Constructor. @@ -47,7 +47,7 @@ struct ArchiveFileQueueCriteria { * @param copyToPoolMap The map from tape copy number to tape pool name. * @param mountPolicy The mount policy. */ - ArchiveFileQueueCriteria( + ArchiveFileQueueCriteriaAndFileId( const uint64_t fileId, const TapeCopyToPoolMap ©ToPoolMap, const MountPolicy &mountPolicy); @@ -68,7 +68,7 @@ struct ArchiveFileQueueCriteria { */ MountPolicy mountPolicy; -}; // struct ArchiveFileQueueCriteria +}; // struct ArchiveFileQueueCriteriaAndFileId } // namespace dataStructures } // namespace common diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index ae370346a3..958ca20796 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -358,7 +358,7 @@ OStoreDB::TapeMountDecisionInfoNoLock::~TapeMountDecisionInfoNoLock() {} // OStoreDB::queueArchive() //------------------------------------------------------------------------------ void OStoreDB::queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest &request, - const cta::common::dataStructures::ArchiveFileQueueCriteria &criteria, log::LogContext &logContext) { + const cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId &criteria, log::LogContext &logContext) { assertAgentAddressSet(); cta::utils::Timer timer; // Construct the archive request object in memory diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp index f9d7e8e3a4..58b6bd94bb 100644 --- a/scheduler/OStoreDB/OStoreDB.hpp +++ b/scheduler/OStoreDB/OStoreDB.hpp @@ -203,7 +203,7 @@ public: CTA_GENERATE_EXCEPTION_CLASS(NoSuchArchiveQueue); void queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest &request, - const cta::common::dataStructures::ArchiveFileQueueCriteria &criteria, log::LogContext &logContext) override; + const cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId &criteria, log::LogContext &logContext) override; CTA_GENERATE_EXCEPTION_CLASS(ArchiveRequestAlreadyDeleted); class ArchiveToFileRequestCancelation: diff --git a/scheduler/OStoreDB/OStoreDBFactory.hpp b/scheduler/OStoreDB/OStoreDBFactory.hpp index 6080c3be9e..8a9e1e51be 100644 --- a/scheduler/OStoreDB/OStoreDBFactory.hpp +++ b/scheduler/OStoreDB/OStoreDBFactory.hpp @@ -80,7 +80,7 @@ public: m_OStoreDB.ping(); } - void queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest& request, const cta::common::dataStructures::ArchiveFileQueueCriteria& criteria, log::LogContext &logContext) override { + void queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest& request, const cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId& criteria, log::LogContext &logContext) override { return m_OStoreDB.queueArchive(instanceName, request, criteria, logContext); } diff --git a/scheduler/OStoreDB/OStoreDBTest.cpp b/scheduler/OStoreDB/OStoreDBTest.cpp index d53a75082e..22cfb48e0f 100644 --- a/scheduler/OStoreDB/OStoreDBTest.cpp +++ b/scheduler/OStoreDB/OStoreDBTest.cpp @@ -120,7 +120,7 @@ TEST_P(OStoreDBTest, getBatchArchiveJob) { // Add jobs to an archive queue. for (size_t i=0; i<10; i++) { cta::common::dataStructures::ArchiveRequest ar; - cta::common::dataStructures::ArchiveFileQueueCriteria afqc; + cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId afqc; ar.fileSize=123*(i+1); afqc.copyToPoolMap[1] = "Tapepool1"; afqc.fileId = i; diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp index 7283b79e48..ce2ab93ead 100644 --- a/scheduler/SchedulerDatabase.hpp +++ b/scheduler/SchedulerDatabase.hpp @@ -27,7 +27,7 @@ #include "common/dataStructures/ArchiveJob.hpp" #include "common/dataStructures/ArchiveFile.hpp" #include "common/dataStructures/ArchiveRequest.hpp" -#include "common/dataStructures/ArchiveFileQueueCriteria.hpp" +#include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp" #include "common/dataStructures/DriveInfo.hpp" #include "common/dataStructures/MountType.hpp" #include "common/dataStructures/MountPolicy.hpp" @@ -104,7 +104,7 @@ public: * @param logContext context allowing logging db operation */ virtual void queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest &request, - const cta::common::dataStructures::ArchiveFileQueueCriteria &criteria, + const cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId &criteria, log::LogContext &logContext) = 0; /** diff --git a/scheduler/SchedulerDatabaseTest.cpp b/scheduler/SchedulerDatabaseTest.cpp index 57fc412ea0..b012fac73f 100644 --- a/scheduler/SchedulerDatabaseTest.cpp +++ b/scheduler/SchedulerDatabaseTest.cpp @@ -153,7 +153,7 @@ TEST_P(SchedulerDatabaseTest, createManyArchiveJobs) { [i,&db,&lc](){ cta::common::dataStructures::ArchiveRequest ar; cta::log::LogContext locallc=lc; - cta::common::dataStructures::ArchiveFileQueueCriteria afqc; + cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId afqc; afqc.copyToPoolMap.insert({1, "tapePool"}); afqc.fileId = 0; afqc.mountPolicy.name = "mountPolicy"; @@ -233,7 +233,7 @@ TEST_P(SchedulerDatabaseTest, createManyArchiveJobs) { [i,&db,&lc](){ cta::common::dataStructures::ArchiveRequest ar; cta::log::LogContext locallc=lc; - cta::common::dataStructures::ArchiveFileQueueCriteria afqc; + cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId afqc; afqc.copyToPoolMap.insert({1, "tapePool"}); afqc.fileId = 0; afqc.mountPolicy.name = "mountPolicy"; -- GitLab