diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index aa3d89eff65ae3b2a8a7be71822765ee34c2e893..3b8c6df15d30053c09c05895e58d1e7eeb731a6f 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -27,6 +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/ArchiveFileSummary.hpp" #include "common/dataStructures/ArchiveJob.hpp" #include "common/dataStructures/ArchiveRequest.hpp" @@ -190,12 +191,11 @@ public: * @param user The user for whom the file is to be archived. This will be * used by the Catalogue to determine the mount policy to be used when * archiving the file. - * @return A triplet of archive file ID, tape copy to tape pool map and mount - * group. + * @return The information required to queue the associated archive request. */ - virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap, - cta::common::dataStructures::MountPolicy> prepareForNewFile( - const std::string &storageClass, const std::string &user) = 0; + virtual cta::common::dataStructures::ArchiveFileQueueCriteria + prepareForNewFile(const std::string &storageClass, const std::string &user) + = 0; /** * Notifies the catalogue that a file has been written to tape. diff --git a/catalogue/DummyCatalogue.cpp b/catalogue/DummyCatalogue.cpp index 13bd50559ac59feddf2a55d823e26d781ce5c835..721f0af0b84baeb54d68f6fa0711109e68f0ddc8 100644 --- a/catalogue/DummyCatalogue.cpp +++ b/catalogue/DummyCatalogue.cpp @@ -441,14 +441,10 @@ void cta::catalogue::DummyCatalogue::fileWrittenToTape( //------------------------------------------------------------------------------ // prepareForNewFile //------------------------------------------------------------------------------ -std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap, - cta::common::dataStructures::MountPolicy> +cta::common::dataStructures::ArchiveFileQueueCriteria cta::catalogue::DummyCatalogue::prepareForNewFile( const std::string &storageClass, const std::string &user) { - const uint64_t fileId = 0; - const common::dataStructures::TapeCopyToPoolMap copyToPoolMap; - const common::dataStructures::MountPolicy mountPolicy; - return std::make_tuple(fileId, copyToPoolMap, mountPolicy); + return common::dataStructures::ArchiveFileQueueCriteria(); } //------------------------------------------------------------------------------ diff --git a/catalogue/DummyCatalogue.hpp b/catalogue/DummyCatalogue.hpp index cfee2b6ce11c6740343f096a147b9dc5b2183860..71ee43602ac1e26e692f129751721eb7ebb0235f 100644 --- a/catalogue/DummyCatalogue.hpp +++ b/catalogue/DummyCatalogue.hpp @@ -157,12 +157,10 @@ public: * @param user The user for whom the file is to be archived. This will be * used by the Catalogue to determine the mount policy to be used when * archiving the file. - * @return A triplet of archive file ID, tape copy to tape pool map and mount - * group. + * @return The information required to queue the associated archive request. */ - virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap, - cta::common::dataStructures::MountPolicy> prepareForNewFile( - const std::string &storageClass, const std::string &user); + virtual cta::common::dataStructures::ArchiveFileQueueCriteria + prepareForNewFile(const std::string &storageClass, const std::string &user); std::map<uint64_t,std::string> getCopyNbToTapePoolMap(const std::string &storageClass) const; diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp index 93a413ae2fd9c40e9330759e6887058d358a40c7..a6ec231f604f89585e3ab90c3fa1fa0bcd7314ae 100644 --- a/catalogue/SqliteCatalogue.cpp +++ b/catalogue/SqliteCatalogue.cpp @@ -2043,14 +2043,10 @@ void cta::catalogue::SqliteCatalogue::fileWrittenToTape( //------------------------------------------------------------------------------ // prepareForNewFile //------------------------------------------------------------------------------ -std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap, - cta::common::dataStructures::MountPolicy> +cta::common::dataStructures::ArchiveFileQueueCriteria cta::catalogue::SqliteCatalogue::prepareForNewFile( const std::string &storageClass, const std::string &user) { - const uint64_t fileId = 0; - const common::dataStructures::TapeCopyToPoolMap copyToPoolMap; - const common::dataStructures::MountPolicy mountPolicy; - return std::make_tuple(fileId, copyToPoolMap, mountPolicy); + return common::dataStructures::ArchiveFileQueueCriteria(); } //------------------------------------------------------------------------------ diff --git a/catalogue/SqliteCatalogue.hpp b/catalogue/SqliteCatalogue.hpp index c995d96444527ffa7380b22c844dd83a4ed2f447..5733f842e2ca649c746f56323f02e8e7047ed1d9 100644 --- a/catalogue/SqliteCatalogue.hpp +++ b/catalogue/SqliteCatalogue.hpp @@ -177,12 +177,10 @@ public: * @param user The user for whom the file is to be archived. This will be * used by the Catalogue to determine the mount policy to be used when * archiving the file. - * @return A triplet of archive file ID, tape copy to tape pool map and mount - * group. + * @return The information required to queue the associated archive request. */ - virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap, - cta::common::dataStructures::MountPolicy> prepareForNewFile( - const std::string &storageClass, const std::string &user); + virtual cta::common::dataStructures::ArchiveFileQueueCriteria + prepareForNewFile(const std::string &storageClass, const std::string &user); virtual std::map<uint64_t,std::string> getCopyNbToTapePoolMap(const std::string &storageClass) const; virtual cta::common::dataStructures::MountPolicy getArchiveMountPolicy(const cta::common::dataStructures::UserIdentity &requester) const; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 0d406186727e27f59f2a6077cb5c6d13f24b1388..79acf644bb4fef40909bb0e48d8058e6ec6344b8 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -25,6 +25,7 @@ set (COMMON_LIB_SRC_FILES dataStructures/AdminHost.cpp dataStructures/AdminUser.cpp dataStructures/ArchiveFile.cpp + dataStructures/ArchiveFileQueueCriteria.cpp dataStructures/ArchiveFileSummary.cpp dataStructures/ArchiveJob.cpp dataStructures/ArchiveRequest.cpp diff --git a/common/dataStructures/ArchiveFileQueueCriteria.cpp b/common/dataStructures/ArchiveFileQueueCriteria.cpp new file mode 100644 index 0000000000000000000000000000000000000000..366a6d7d27e11df230fd97997d67910a101861e8 --- /dev/null +++ b/common/dataStructures/ArchiveFileQueueCriteria.cpp @@ -0,0 +1,26 @@ +/* + * The CERN Tape Archive (CTA) project + * Copyright (C) 2015 CERN + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "common/dataStructures/ArchiveFileQueueCriteria.hpp" + +//------------------------------------------------------------------------------ +// constructor +//------------------------------------------------------------------------------ +cta::common::dataStructures::ArchiveFileQueueCriteria:: + ArchiveFileQueueCriteria(): fileId(0) { +} diff --git a/common/dataStructures/ArchiveFileQueueCriteria.hpp b/common/dataStructures/ArchiveFileQueueCriteria.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cd72de5335c98decbe03102a09401b9ed5f17fcf --- /dev/null +++ b/common/dataStructures/ArchiveFileQueueCriteria.hpp @@ -0,0 +1,62 @@ +/* + * The CERN Tape Archive (CTA) project + * Copyright (C) 2015 CERN + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "common/dataStructures/MountPolicy.hpp" +#include "common/dataStructures/TapeCopyToPoolMap.hpp" + +#include <stdint.h> + +namespace cta { +namespace common { +namespace dataStructures { + +/** + * The queueing criteria created after preparing for a new archive file within + * the Catalogue. This queueing criteria specify on which tape-pool queue(s) + * the corresponding data-transfer jobs are to be queued and which mount policy + * should be used. + */ +struct ArchiveFileQueueCriteria { + + /** + * Constructor. + */ + ArchiveFileQueueCriteria(); + + /** + * The unique archive-file identifier. + */ + uint64_t fileId; + + /** + * The map from tape copy number to tape pool name. + */ + TapeCopyToPoolMap copyToPoolMap; + + /** + * The mount policy. + */ + MountPolicy mountPolicy; + +}; // struct ArchiveFileQueueCriteria + +} // namespace dataStructures +} // namespace common +} // namespace cta