Commit c13af0b6 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[lto_rao] Added RAOFile to store each job with its index and its position

parent 713d845f
...@@ -24,6 +24,7 @@ set(CTARAO_LIBRARY_SRCS ...@@ -24,6 +24,7 @@ set(CTARAO_LIBRARY_SRCS
InterpolationFilePositionEstimator.cpp InterpolationFilePositionEstimator.cpp
RAOHelpers.cpp RAOHelpers.cpp
CTACostHeuristic.cpp CTACostHeuristic.cpp
RAOFile.cpp
) )
add_library (ctarao SHARED add_library (ctarao SHARED
......
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2019 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 "RAOFile.hpp"
namespace castor { namespace tape { namespace tapeserver { namespace rao {
RAOFile::RAOFile(const uint64_t index, const FilePositionInfos & filePositionInfos):m_index(index),m_filePositionInfos(filePositionInfos) {
}
RAOFile::RAOFile(const RAOFile & other) {
if(this != &other){
m_index = other.m_index;
m_filePositionInfos = other.m_filePositionInfos;
}
}
RAOFile & RAOFile::operator=(const RAOFile & other){
if(this != &other){
m_index = other.m_index;
m_filePositionInfos = other.m_filePositionInfos;
}
return *this;
}
uint64_t RAOFile::getIndex() const{
return m_index;
}
FilePositionInfos RAOFile::getFilePositionInfos() const{
return m_filePositionInfos;
}
RAOFile::~RAOFile() {
}
}}}}
\ No newline at end of file
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2019 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 "FilePositionInfos.hpp"
namespace castor { namespace tape { namespace tapeserver { namespace rao {
class RAOFile {
public:
RAOFile(const uint64_t index, const FilePositionInfos & filePositionInfos);
RAOFile(const RAOFile & other);
RAOFile &operator=(const RAOFile & other);
uint64_t getIndex() const;
FilePositionInfos getFilePositionInfos() const;
virtual ~RAOFile();
private:
uint64_t m_index;
FilePositionInfos m_filePositionInfos;
};
}}}}
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "InterpolationFilePositionEstimator.hpp" #include "InterpolationFilePositionEstimator.hpp"
#include "RAOHelpers.hpp" #include "RAOHelpers.hpp"
#include "CTACostHeuristic.hpp" #include "CTACostHeuristic.hpp"
#include "RAOFile.hpp"
namespace castor { namespace tape { namespace tapeserver { namespace rao { namespace castor { namespace tape { namespace tapeserver { namespace rao {
...@@ -27,6 +28,12 @@ SLTFRAOAlgorithm::SLTFRAOAlgorithm() {} ...@@ -27,6 +28,12 @@ SLTFRAOAlgorithm::SLTFRAOAlgorithm() {}
std::vector<uint64_t> SLTFRAOAlgorithm::performRAO(const std::vector<std::unique_ptr<cta::RetrieveJob> >& jobs) { std::vector<uint64_t> SLTFRAOAlgorithm::performRAO(const std::vector<std::unique_ptr<cta::RetrieveJob> >& jobs) {
std::vector<uint64_t> ret; std::vector<uint64_t> ret;
//Determine all the files position
std::vector<RAOFile> files;
for(uint64_t i = 0; i < jobs.size(); ++i){
files.push_back(RAOFile(i,m_filePositionEstimator->getFilePosition(*(jobs.at(i)))));
}
//Determine the matrix of the costs between each file
return ret; return ret;
} }
......
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