AcsMountTapeReadOnly.hpp 2.92 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
/******************************************************************************
 *
 * 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.
 *
 *
 *
 * @author Castor Dev team, castor-dev@cern.ch
 *****************************************************************************/

#pragma once

26
#include "castor/acs/Acs.hpp"
27
28
29
30
31
32
33
34
#include "castor/acs/AcsLibraryInteraction.hpp"
#include "castor/acs/AcsDaemon.hpp"
#include "castor/log/Logger.hpp"

namespace castor     {
namespace acs        {

/**
35
 * Class responsible for mounting tapes for read only access through ACS API .
36
 */
37
class AcsMountTapeReadOnly: public AcsLibraryInteraction {
38
39
40
41
42
43

public:

  /**
   * Constructor.
   */
44
  AcsMountTapeReadOnly(
45
46
    const std::string &vid, const uint32_t acs,
    const uint32_t lsm, const uint32_t panel, const uint32_t drive,
47
    Acs &acsWrapper,log::Logger &log,
48
49
50
51
52
    const AcsDaemon::CastorConf &castorConf);

  /**
   * Destructor.
   */
53
  ~AcsMountTapeReadOnly() throw();
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

  /**
   * Execute mount request through ACS API.
   */
  void execute() const ;
  
protected:

  /**
   * mounts the tape with the specified VID into the drive with the specified
   * drive ID.
   *
   * This method does not return until the mount has either succeeded, failed or
   * the specified timeout has been reached.
   */
69
  void syncMountTapeReadOnly() const;
70
71
72
73
74
75
  
  /**
   * Sends the mount request to ACSLS.
   *
   * @param seqNumber The sequence number to be used in the request.
   */
76
  void sendMountTapeReadOnlyRequest(const SEQ_NO seqNumber) const;
77
78
79
80
81
82
83
 
  /**
   * Throws castor::exception::MountFailed if the mount was not
   * successful.
   *
   * @param buf The mount-response message.
   */
84
  void processMountTapeReadOnlyResponse(
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
    ALIGNED_BYTES (&buf)[MAX_MESSAGE_SIZE / sizeof(ALIGNED_BYTES)]) const;
  
  /**
   * ACS VOLID
   */  
  VOLID m_volId;
  
  /**
   * ACS DRIVEID
   */  
  DRIVEID m_driveId;  
  
  /**
   * Object providing c wrapper for ACS commands.
   */
100
  Acs &m_acsWrapper;
101
102
103
104
105
106
107
108
109
110
111
  
  /**
   * Logger.
   */
  log::Logger &m_log;
  
  /**
   * The configuration parameters for the CASTOR ACS daemon.
   */
  const AcsDaemon::CastorConf & m_castorConf;

112
}; // class AcsMountTapeReadOnly
113
114
115

} // namespace acs
} // namespace castor