TapeserverProxy.hpp 4.96 KB
Newer Older
Daniele Kruse's avatar
Daniele Kruse committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/******************************************************************************
 *
 * This file is part of the Castor project.
 * See http://castor.web.cern.ch/castor
 *
 * Copyright (C) 2003  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 2
 * 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
19
 * @author Castor Dev team, castor-dev@cern.ch
Daniele Kruse's avatar
Daniele Kruse committed
20
21
22
23
 *****************************************************************************/

#pragma once

24
#include "castor/exception/Exception.hpp"
25
26
27

#include <stdint.h>
#include <string>
Daniele Kruse's avatar
Daniele Kruse committed
28

29
namespace castor {
30
namespace messages {
Daniele Kruse's avatar
Daniele Kruse committed
31
32

/**
33
34
 * Abstract class defining the interface to a proxy object representing the
 * internal network interface of the tapeserverd daemon.
Daniele Kruse's avatar
Daniele Kruse committed
35
36
37
 */
class TapeserverProxy {
public:
38

Daniele Kruse's avatar
Daniele Kruse committed
39
40
41
  /**
   * Destructor.
   */
42
  virtual ~TapeserverProxy()  = 0;
Daniele Kruse's avatar
Daniele Kruse committed
43
44

  /**
45
   * Notifies the tapeserverd daemon that the mount-session child-process got
46
   * a recall job from the tapegatewayd daemon.
47
   *
48
   * @param vid The tape to be mounted for recall.
49
   * @param unitName The unit name of the tape drive.
50
   */
51
  virtual void gotRecallJobFromTapeGateway(const std::string &vid,
52
    const std::string &unitName) = 0;
53
54

  /**
55
   * Notifies the tapeserverd daemon that the mount-session child-process got
56
   * a recall job from the readtp command-line tool.
57
   *
58
59
60
61
62
63
64
65
66
67
68
   * @param vid The tape to be mounted for recall.
   * @param unitName The unit name of the tape drive.
   */
  virtual void gotRecallJobFromReadTp(const std::string &vid,
    const std::string &unitName) = 0;

  /**
   * Notifies the tapeserverd daemon that the mount-session child-process got
   * a migration job from the tapegatewayd daemon.
   *
   * @param vid The tape to be mounted for recall.
69
70
71
   * @param unitName The unit name of the tape drive.
   * @return The number of files currently stored on the tape as given by the
   * vmgrd daemon.
72
   */
73
  virtual uint32_t gotMigrationJobFromTapeGateway(const std::string &vid,
74
    const std::string &unitName) = 0;
75
76

  /**
77
   * Notifies the tapeserverd daemon that the mount-session child-process got
78
   * a migration job from the writetp command-line tool.
Daniele Kruse's avatar
Daniele Kruse committed
79
   *
80
   * @param vid The tape to be mounted for recall.
81
   * @param unitName The unit name of the tape drive.
82
83
   * @return The number of files currently stored on the tape as given by the
   * vmgrd daemon.
Daniele Kruse's avatar
Daniele Kruse committed
84
   */
85
  virtual uint32_t gotMigrationJobFromWriteTp(const std::string &vid,
86
    const std::string &unitName) = 0;
Daniele Kruse's avatar
Daniele Kruse committed
87

88
89
90
  /**
   * Notifies the tapeserverd daemon that the specified tape has been mounted.
   *
91
   * @param vid The tape to be mounted for recall.
92
   * @param unitName The unit name of the tape drive.
93
   */
94
  virtual void tapeMountedForRecall(const std::string &vid,
95
    const std::string &unitName) = 0;
96
97
98
99

  /**
   * Notifies the tapeserverd daemon that the specified tape has been mounted.
   *
100
   * @param vid The tape to be mounted for recall.
101
   * @param unitName The unit name of the tape drive.
102
   */
103
  virtual void tapeMountedForMigration(const std::string &vid,
104
    const std::string &unitName) = 0;
105

106
107
108
  /**
   * Notifies the tapeserverd daemon that the specified tape is unmounting.
   *
109
   * @param vid The tape to be mounted for recall.
110
   * @param unitName The unit name of the tape drive.
111
   */
112
  virtual void tapeUnmountStarted(const std::string &vid,
113
    const std::string &unitName) = 0;
114
115
116
117

  /**
   * Notifies the tapeserverd daemon that the specified tape has been unmounted.
   *
118
   * @param vid The tape to be mounted for recall.
119
   * @param unitName The unit name of the tape drive.
120
   */
121
  virtual void tapeUnmounted(const std::string &vid,
122
    const std::string &unitName) = 0;
123

David COME's avatar
David COME committed
124
  /**
125
126
127
   * Notifies the tapeserverd daemon that the data-transfer session is still
   * alive and gives an indication of how much data has been moved.
   *
128
129
   * @param unitName The unit name of the tape drive.
   * @param nbBytesMoved Delta value giving the number of bytes moved
130
   * since the last heartbeat message.
David COME's avatar
David COME committed
131
   */
132
133
  virtual void notifyHeartbeat(const std::string &unitName,
    const uint64_t nbBytesMoved) = 0;
134

135
136
137
138
139
140
141
142
143
144
  /**
   * Notifies the tapeserverd daemon that a label session has encountered the
   * specified error.
   *
   * @param unitName The unit name of the tape drive.
   * @param labelEx The error encountered by the label session.
   */
  virtual void labelError(const std::string &unitName,
    const castor::exception::Exception &labelEx) = 0;

Daniele Kruse's avatar
Daniele Kruse committed
145
146
}; // class TapeserverProxy

147
} // namespace messages
Daniele Kruse's avatar
Daniele Kruse committed
148
149
} // namespace castor