TapeForWriting.hpp 2.53 KB
Newer Older
1
/*
2
 * @project        The CERN Tape Archive (CTA)
3
 * @copyright      Copyright(C) 2015-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
 */

#pragma once

20
21
#include "common/optional.hpp"

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
#include <ostream>
#include <stdint.h>
#include <string>

namespace cta {
namespace catalogue {

/**
 * A tape that can be written to.
 */
struct TapeForWriting {

  /**
   * Constructor.
   *
   * Sets the value of all integer member-variables to zero.
   *
   * Sets the value of all boolean member-variables to false.
   */
  TapeForWriting();

  /**
   * Equality operator.
   *
   * Two tapes for writing are equal if and only if their volume identifiers
   * (VIDs) are equal.
   *
   * @param ths The right hand side of the operator.
   */
  bool operator==(const TapeForWriting &rhs) const;

  /**
   * The volume identifier of the tape.
   */
  std::string vid;
57
58
59
60
61
62
63
64
65
66

  /**
   * The media type of the tape.
   */
  std::string mediaType;

  /**
   * The vendor of the tape.
   */
  std::string vendor;
67
68
  
  /**
69
   * The name of the tape pool.
70
71
   */
  std::string tapePool;
72
73
74
75
76
  
  /**
   * The virtual organisation owning the tape.
   */
  std::string vo;
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

  /**
   * The file sequence number of the last file successfully written to the tape.
   */
  uint64_t lastFSeq;

  /**
   * The capacity of the tape in bytes.
   */
  uint64_t capacityInBytes;

  /**
   * The total amount of data written to the tape in bytes.
   */
  uint64_t dataOnTapeInBytes;

}; // struct TapeForWriting

/**
 * Output stream operator for an TapeForWriting object.
 *
 * This function writes a human readable form of the specified object to the
 * specified output stream.
 *
 * @param os The output stream.
 * @param obj The object.
 */
std::ostream &operator<<(std::ostream &os, const TapeForWriting &obj);

} // namespace catalogue
} // namespace cta