ArchiveMount.cpp 4.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * 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/>.
 */

19
#include "scheduler/ArchiveMount.hpp"
20

21
22
23
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
24
cta::ArchiveMount::ArchiveMount(NameServer & ns): m_ns(ns) {
25
26
}

27
28
29
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
30
31
cta::ArchiveMount::ArchiveMount(NameServer & ns,
  std::unique_ptr<SchedulerDatabase::ArchiveMount> dbMount): m_ns(ns) {
32
33
34
35
36
  m_dbMount.reset(
    dynamic_cast<SchedulerDatabase::ArchiveMount*>(dbMount.release()));
  if(!m_dbMount.get()) {
    throw WrongMountType(std::string(__FUNCTION__) +
      ": could not cast mount to SchedulerDatabase::ArchiveMount");
37
38
39
  }
}

40
41
42
43
44
//------------------------------------------------------------------------------
// getMountType
//------------------------------------------------------------------------------
cta::MountType::Enum cta::ArchiveMount::getMountType() const throw() {
  return MountType::ARCHIVE;
45
}
46

Steven Murray's avatar
Steven Murray committed
47
48
49
50
51
52
53
//------------------------------------------------------------------------------
// getVid
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getVid() const throw() {
  return "UNKNOWN_VID_FOR_ARCHIVE_MOUNT";
}

54
55
56
57
58
59
//------------------------------------------------------------------------------
// getDensity
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getDensity() const throw() {
  return "UNKNOWN_DENSITY_FOR_ARCHIVE_MOUNT";
}
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
//------------------------------------------------------------------------------
// getPoolName
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getPoolName() const throw() {
  return "UNKNOWN_POOL_FOR_ARCHIVE_MOUNT";
}

//------------------------------------------------------------------------------
// getCopyNumber
//------------------------------------------------------------------------------
int cta::ArchiveMount::getCopyNumber() const throw() {
  return 1;
}

75
76
77
78
79
80
//------------------------------------------------------------------------------
// getMountTransactionId
//------------------------------------------------------------------------------
std::string cta::ArchiveMount::getMountTransactionId() const throw(){
  return "UNKNOWN_MOUNTTRANSACTIONID_FOR_ARCHIVE_MOUNT";
}
81

82
83
84
85
//------------------------------------------------------------------------------
// getNextJob
//------------------------------------------------------------------------------
std::unique_ptr<cta::ArchiveJob> cta::ArchiveMount::getNextJob() {
86
87
88
89
90
91
92
93
94
  // try and get a new job from the DB side
  std::unique_ptr<cta::SchedulerDatabase::ArchiveJob> dbJob(m_dbMount->getNextJob().release());
  if (!dbJob.get())
    return std::unique_ptr<cta::ArchiveJob>(NULL);
  // We have something to migrate: prepare the response
  std::unique_ptr<cta::ArchiveJob> ret(new ArchiveJob(*this, m_ns,
      dbJob->archiveFile, dbJob->remoteFile, dbJob->nameServerTapeFile));
  ret->m_dbJob.reset(dbJob.release());
  return ret;
95
}
96
    
97
//------------------------------------------------------------------------------
98
// complete
99
//------------------------------------------------------------------------------
100
void cta::ArchiveMount::complete() {
101
  throw NotImplemented(std::string(__FUNCTION__) + ": Not implemented");
102
}
103

104
105
106
107
108
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::ArchiveMount::~ArchiveMount() throw() {
}