Commit 350fcac5 authored by Steven Murray's avatar Steven Murray
Browse files

Added catalogue::prepareForNewFile()

parent d098b53f
......@@ -22,6 +22,7 @@
#include <stdint.h>
#include <string>
#include <map>
#include <tuple>
#include "common/dataStructures/AdminHost.hpp"
#include "common/dataStructures/AdminUser.hpp"
......@@ -48,6 +49,7 @@
#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/TapePool.hpp"
......@@ -178,6 +180,21 @@ public:
*/
virtual uint64_t getNextArchiveFileId() = 0;
/**
* 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 group of the archive request.
* @return A triplet of archive file ID, tape copy routes and mount group.
*/
virtual std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup> prepareForNewFile(
const std::string &storageClass, const std::string &user) = 0;
/**
* Notifies the catalogue that a file has been written to tape.
*
......
......@@ -438,6 +438,19 @@ void cta::catalogue::DummyCatalogue::fileWrittenToTape(
const cta::common::dataStructures::TapeFileLocation &tapeFileLocation) {
}
//------------------------------------------------------------------------------
// prepareForNewFile
//------------------------------------------------------------------------------
std::tuple<uint64_t, cta::common::dataStructures::TapeCopyRoutes,
cta::common::dataStructures::MountGroup>
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);
}
//------------------------------------------------------------------------------
// getCopyNbToTapePoolMap
//------------------------------------------------------------------------------
......
......@@ -146,6 +146,10 @@ public:
virtual void fileWrittenToTape(
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(
const std::string &storageClass, const std::string &user);
std::map<uint64_t,std::string> getCopyNbToTapePoolMap(const std::string &storageClass) const;
......
......@@ -2040,6 +2040,18 @@ void cta::catalogue::SqliteCatalogue::fileWrittenToTape(
const cta::common::dataStructures::TapeFileLocation &tapeFileLocation) {
}
//------------------------------------------------------------------------------
// 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) {
const uint64_t fileId = 0;
const common::dataStructures::TapeCopyRoutes routes;
const common::dataStructures::MountGroup mountGroup;
return std::make_tuple(fileId, routes, mountGroup);
}
//------------------------------------------------------------------------------
// getCopyNbToTapePoolMap
//------------------------------------------------------------------------------
......
......@@ -166,6 +166,10 @@ public:
virtual void fileWrittenToTape(
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(
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;
......
......@@ -31,6 +31,17 @@ namespace dataStructures {
struct MountGroup {
MountGroup():
archive_minBytesQueued(0),
archive_minFilesQueued(0),
archive_minRequestAge(0),
archive_priority(0),
maxDrivesAllowed(0),
retrieve_minBytesQueued(0),
retrieve_minFilesQueued(0),
retrieve_minRequestAge(0),
retrieve_priority(0) {
}
bool operator==(const MountGroup &rhs) const;
......
/*
* 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 <map>
#include <string>
namespace cta {
namespace common {
namespace dataStructures {
/**
* Map from tape copy number to destination tape pool.
*/
typedef std::map<uint64_t, std::string> TapeCopyRoutes;
} // namespace dataStructures
} // namespace common
} // namespace cta
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