diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index 49502f95771f9f161f039e93bc88dc43ed83d98f..808bf0c8c7b9e212bdaf8fb6b391beccef5a0190 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 f6502d8be885d6c3e3d46de230431e552ece9ca8..b0b753c118142b7efe598172c3d2cb7fc58d9a18 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 3a01724ce89f560b98d3d9c35e4de1e5d924717f..acdb401f8e813339bbbcdbde213226749f35e8b5 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 008c80c32863c8c744eed87370a5c7b72bb501ec..aa1f55e686e81914061aeddd01bedd85b448417f 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 281ffd99d7ce131d64fb81fb817d781ca232aa0a..e5d8cc4ee3cba9c6a00e928899bebf83d0f2c703 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 5500f12a18e7a1204b1e3a6793fd7061f76c2452..99fb948b90776c75d026e49a1d66c56c6d07c762 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 3aa0c85c7c16e0ea7eb2925c0d80f8287ebe8a72..8965badd86868864aa1f2b0686c96531ce950915 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 251124e5242904929466c483ab64de1e829e9638..c02082dae8f92e6b449553f17af619ebbee3cbfa 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 f0657451c1cff8577bf58bfa672e8cb7646bab47..8146c041c8b1d3d3a79e2f7b026744d842be9cc7 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 ae370346a3ab122ddb9133e9eb09b64a16ed9d0c..958ca207961080043e4a7bfd264b36c3c661dd72 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 f9d7e8e3a46b660dffb1671ae2122f1637621a03..58b6bd94bb9ed63ffb6599f8831d266349795a86 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 6080c3be9e93eb2e6a8ec158a147c29e7f447dd9..8a9e1e51bef40faf89a0a5e3c01d22400d64a14e 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 d53a75082e417a7720500f0f17907c293e067850..22cfb48e0f5b41c8456fb388ecbc14cf0ca38014 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 7283b79e4848526cc4d0879e96d40acf8770c5f0..ce2ab93eadf8b06c8fc9ed778e2fbb8daf5a57e5 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 57fc412ea052e3cf63fbdd9b97fd15c542531bcc..b012fac73f5b515691c2f6c0439c6640f49b7ebf 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";