RAOAlgorithm.hpp 2.02 KB
Newer Older
1
/*
2
 * @project        The CERN Tape Archive (CTA)
3
 * @copyright      Copyright(C) 2003-2021 CERN
4
5
6
7
 * @license        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.
8
 *
9
10
11
12
 *                 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.
13
 *
14
15
 *                 You should have received a copy of the GNU General Public License
 *                 along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17
18
19
20
21
22
 */

#pragma once

#include <vector>
#include <memory>
#include "scheduler/RetrieveJob.hpp"
23
#include "common/log/TimingList.hpp"
24
25
26
27
28
29
30

namespace castor { namespace tape { namespace tapeserver { namespace rao {
  
/**
 * Abstract class that represents an RAO algorithm
 */
class RAOAlgorithm {
31
32
33
protected:
  //Timing list to store the timings of the different steps of the RAO algorithm
  cta::log::TimingList m_raoTimings;
34
35
36
37
38
39
40
41
42
43
public:
  virtual ~RAOAlgorithm();
  
  /**
   * Returns the vector of indexes of the jobs passed in parameter
   * sorted according to an algorithm
   * @param jobs the jobs to perform RAO on
   * @return the vector of indexes sorted by an algorithm applied on the jobs passed in parameter
   */
  virtual std::vector<uint64_t> performRAO(const std::vector<std::unique_ptr<cta::RetrieveJob>> & jobs) = 0;
44
45
46
47
48
49
50
51
52
53
54
55
  
  /**
   * Returns the timings the RAO Algorithm took to perform each step
   * @return the timings the RAO Algorithm took to perform each step
   */
  cta::log::TimingList getRAOTimings();
  
  /**
   * Returns the name of the RAO algorithm
   * @return the name of the RAO algorithm
   */
  virtual std::string getName() const = 0;
56
57
58
};

}}}}