EnterpriseRAOAlgorithm.hpp 2.14 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * 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 "RAOAlgorithm.hpp"
#include "castor/tape/tapeserver/drive/DriveInterface.hpp"
#include "EnterpriseRAOAlgorithmFactory.hpp"

namespace castor { namespace tape { namespace tapeserver { namespace rao {

class EnterpriseRAOAlgorithmFactory;
  
/**
 * This class represents an EnterpriseRAOAlgorithm. 
 */
class EnterpriseRAOAlgorithm : public RAOAlgorithm{
public:
  friend EnterpriseRAOAlgorithmFactory;
  
  virtual ~EnterpriseRAOAlgorithm();

  /**
   * Asks the Enteprise drive to perform a RAO query in order to get the RAO of the 
   * files represented by the jobs passed in parameter
   * @param jobs the jobs representing the files we want to perform the RAO on
   * @return the vector of the indexes of the jobs passed in parameters rearranged by the RAO query
   */
  std::vector<uint64_t> performRAO(const std::vector<std::unique_ptr<cta::RetrieveJob>> & jobs) override;
  
private:
  /**
   * Constructs an EnterpriseRAOAlgorithm
   * @param drive the drive in order to call its RAO via its DriveInterface
   * @param maxFilesSupported the maximum number of files supported by the drive to perform the RAO
   */
  EnterpriseRAOAlgorithm(castor::tape::tapeserver::drive::DriveInterface * drive, const uint64_t maxFilesSupported);
  
  //Interface to the drive
  castor::tape::tapeserver::drive::DriveInterface * m_drive;
  //Maximum number of files supported by the drive to perform the RAO
  uint64_t m_maxFilesSupported;
};

}}}}