Commit e626555e authored by Steven Murray's avatar Steven Murray
Browse files

Improved the signature of Catalogue::prepareForNewFile().

parent 350fcac5
......@@ -49,9 +49,9 @@
#include "common/dataStructures/RetrieveRequest.hpp"
#include "common/dataStructures/SecurityIdentity.hpp"
#include "common/dataStructures/StorageClass.hpp"
#include "common/dataStructures/TapeCopyRoutes.hpp"
#include "common/dataStructures/TapeFileLocation.hpp"
#include "common/dataStructures/Tape.hpp"
#include "common/dataStructures/TapeCopyToPoolMap.hpp"
#include "common/dataStructures/TapeFileLocation.hpp"
#include "common/dataStructures/TapePool.hpp"
#include "common/dataStructures/UpdateFileInfoRequest.hpp"
#include "common/dataStructures/MountGroup.hpp"
......@@ -188,11 +188,13 @@ public:
* will be used by the Catalogue to determine the destinate tape pool for
* each tape copy.
* @param user The user for whom the file is to be archived. This will be
* used by the Catalogue to determine the mount group of the archive request.
* @return A triplet of archive file ID, tape copy routes and mount group.
* 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.
*/
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup> prepareForNewFile(
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap,
cta::common::dataStructures::MountPolicy> prepareForNewFile(
const std::string &storageClass, const std::string &user) = 0;
/**
......
......@@ -441,14 +441,14 @@ void cta::catalogue::DummyCatalogue::fileWrittenToTape(
//------------------------------------------------------------------------------
// prepareForNewFile
//------------------------------------------------------------------------------
std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup>
std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap,
cta::common::dataStructures::MountPolicy>
cta::catalogue::DummyCatalogue::prepareForNewFile(
const std::string &storageClass, const std::string &user) {
const uint64_t fileId = 0;
const common::dataStructures::TapeCopyRoutes routes;
const common::dataStructures::MountGroup mountGroup;
return std::make_tuple(fileId, routes, mountGroup);
const common::dataStructures::TapeCopyToPoolMap copyToPoolMap;
const common::dataStructures::MountPolicy mountPolicy;
return std::make_tuple(fileId, copyToPoolMap, mountPolicy);
}
//------------------------------------------------------------------------------
......
......@@ -147,10 +147,23 @@ public:
const cta::common::dataStructures::ArchiveRequest &archiveRequest,
const cta::common::dataStructures::TapeFileLocation &tapeFileLocation);
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup> prepareForNewFile(
/**
* Prepares the catalogue for a new archive file and returns the information
* required to queue the associated archive request.
*
* @param storageClass The storage class of the file to be archived. This
* will be used by the Catalogue to determine the destinate tape pool for
* each tape copy.
* @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.
*/
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap,
cta::common::dataStructures::MountPolicy> prepareForNewFile(
const std::string &storageClass, const std::string &user);
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;
......
......@@ -2043,13 +2043,14 @@ void cta::catalogue::SqliteCatalogue::fileWrittenToTape(
//------------------------------------------------------------------------------
// prepareForNewFile
//------------------------------------------------------------------------------
std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup> cta::catalogue::SqliteCatalogue::prepareForNewFile(
const std::string &storageClass, const std::string &user) {
std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap,
cta::common::dataStructures::MountPolicy>
cta::catalogue::SqliteCatalogue::prepareForNewFile(
const std::string &storageClass, const std::string &user) {
const uint64_t fileId = 0;
const common::dataStructures::TapeCopyRoutes routes;
const common::dataStructures::MountGroup mountGroup;
return std::make_tuple(fileId, routes, mountGroup);
const common::dataStructures::TapeCopyToPoolMap copyToPoolMap;
const common::dataStructures::MountPolicy mountPolicy;
return std::make_tuple(fileId, copyToPoolMap, mountPolicy);
}
//------------------------------------------------------------------------------
......
......@@ -167,8 +167,21 @@ public:
const cta::common::dataStructures::ArchiveRequest &archiveRequest,
const cta::common::dataStructures::TapeFileLocation &tapeFileLocation);
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup> prepareForNewFile(
/**
* Prepares the catalogue for a new archive file and returns the information
* required to queue the associated archive request.
*
* @param storageClass The storage class of the file to be archived. This
* will be used by the Catalogue to determine the destinate tape pool for
* each tape copy.
* @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.
*/
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyToPoolMap,
cta::common::dataStructures::MountPolicy> prepareForNewFile(
const std::string &storageClass, const std::string &user);
virtual std::map<uint64_t,std::string> getCopyNbToTapePoolMap(const std::string &storageClass) const;
......
......@@ -30,6 +30,13 @@ namespace dataStructures {
struct MountPolicy {
MountPolicy():
maxDrives(0),
minBytesQueued(0),
minFilesQueued(0),
minRequestAge(0),
priority(0) {
}
bool operator==(const MountPolicy &rhs) const;
......
......@@ -19,6 +19,7 @@
#pragma once
#include <map>
#include <stdint.h>
#include <string>
namespace cta {
......@@ -26,9 +27,9 @@ namespace common {
namespace dataStructures {
/**
* Map from tape copy number to destination tape pool.
* Map from tape copy number to destination tape pool name.
*/
typedef std::map<uint64_t, std::string> TapeCopyRoutes;
typedef std::map<uint64_t, std::string> TapeCopyToPoolMap;
} // namespace dataStructures
} // namespace common
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment