Commit 1905f2c6 authored by Steven Murray's avatar Steven Murray
Browse files

WIP

parent 47d625c8
......@@ -2099,7 +2099,7 @@ TEST_P(cta_catalogue_CatalogueTest, prepareToRetrieveFile) {
const common::dataStructures::RetrieveFileQueueCriteria queueCriteria =
m_catalogue->prepareToRetrieveFile(archiveFileId, userIdentity);
ASSERT_EQ(2, queueCriteria.tapeFiles.size());
ASSERT_EQ(2, queueCriteria.archiveFile.tapeFiles.size());
ASSERT_EQ(archivePriority, queueCriteria.mountPolicy.archivePriority);
ASSERT_EQ(minArchiveRequestAge, queueCriteria.mountPolicy.archiveMinRequestAge);
ASSERT_EQ(maxDrivesAllowed, queueCriteria.mountPolicy.maxDrivesAllowed);
......
......@@ -2805,7 +2805,12 @@ void RdbmsCatalogue::throwIfCommonEventDataMismatch(const common::dataStructures
common::dataStructures::RetrieveFileQueueCriteria RdbmsCatalogue::prepareToRetrieveFile(const uint64_t archiveFileId,
const common::dataStructures::UserIdentity &user) {
try {
const std::map<uint64_t, common::dataStructures::TapeFile> tapeFiles = getTapeFiles(archiveFileId);
std::unique_ptr<common::dataStructures::ArchiveFile> archiveFile = getArchiveFile(archiveFileId);
if(NULL == archiveFile.get()) {
exception::Exception ex;
ex.getMessage() << "Archive file with ID " << archiveFileId << " does not exist";
throw ex;
}
const RequesterAndGroupMountPolicies mountPolicies = getMountPolicies(user.name, user.group);
// Requester mount policies overrule requester group mount policies
......@@ -2820,7 +2825,11 @@ common::dataStructures::RetrieveFileQueueCriteria RdbmsCatalogue::prepareToRetri
"for " + user.name + ":" + user.group;
throw ue;
}
return common::dataStructures::RetrieveFileQueueCriteria(tapeFiles, mountPolicy);
common::dataStructures::RetrieveFileQueueCriteria criteria;
criteria.archiveFile = *archiveFile;
criteria.mountPolicy = mountPolicy;
return criteria;
} catch(UserError &) {
throw;
} catch(exception::Exception &ex) {
......
......@@ -48,7 +48,6 @@ set (COMMON_LIB_SRC_FILES
dataStructures/RepackType.cpp
dataStructures/RequesterGroupMountRule.cpp
dataStructures/RequesterMountRule.cpp
dataStructures/RetrieveFileQueueCriteria.cpp
dataStructures/RetrieveJob.cpp
dataStructures/RetrieveRequest.cpp
dataStructures/SecurityIdentity.cpp
......
/*
* 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/RetrieveFileQueueCriteria.hpp"
namespace cta {
namespace common {
namespace dataStructures {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
RetrieveFileQueueCriteria::RetrieveFileQueueCriteria() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
RetrieveFileQueueCriteria::RetrieveFileQueueCriteria(
const std::map<uint64_t, TapeFile> &tapeFiles,
const MountPolicy &mountPolicy):
tapeFiles(tapeFiles),
mountPolicy(mountPolicy) {
}
} // namespace dataStructures
} // namespace common
} // namespace cta
......@@ -18,8 +18,8 @@
#pragma once
#include "common/dataStructures/ArchiveFile.hpp"
#include "common/dataStructures/MountPolicy.hpp"
#include "common/dataStructures/TapeFile.hpp"
#include <map>
#include <stdint.h>
......@@ -34,26 +34,9 @@ namespace dataStructures {
struct RetrieveFileQueueCriteria {
/**
* Constructor.
* The archived file.
*/
RetrieveFileQueueCriteria();
/**
* Constructor.
*
* @param tapeFiles The location(s) of the file on tape as a map from tape
* copy number to location.
* @param mountPolicy The mount policy.
*/
RetrieveFileQueueCriteria(
const std::map<uint64_t, TapeFile> &tapeFiles,
const MountPolicy &mountPolicy);
/**
* The location(s) of the file on tape as a map from tape copy number to
* location.
*/
std::map<uint64_t, TapeFile> tapeFiles;
ArchiveFile archiveFile;
/**
* The mount policy.
......
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