ArchiveFileRow.hpp 2.89 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
#include "common/checksum/ChecksumBlob.hpp"
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
61
62
63
64
65

#include <stdint.h>
#include <string>

namespace cta {
namespace catalogue {

/**
 * A row in the ArchiveFile table.
 */
struct ArchiveFileRow {

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

  /**
   * Equality operator.
   *
   * @param ths The right hand side of the operator.
   */
  bool operator==(const ArchiveFileRow &rhs) const;

  /**
   * The unique identifier of the file being archived.
   */
  uint64_t archiveFileId;

  /**
   * The instance name of the source disk system.
   */
  std::string diskInstance;

  /**
   * The identifier of the source disk file which is unique within it's host
   * disk system.  Two files from different disk systems may have the same
   * identifier.  The combination of diskInstance and diskFileId must be
   * globally unique, in other words unique within the CTA catalogue.
   */
  std::string diskFileId;

  /**
66
   * The user ID of the owner of the source disk file within its host disk system.
67
   */
68
  uint32_t diskFileOwnerUid;
69
70

  /**
71
   * The group ID of the source disk file within its host disk system.
72
   */
73
  uint32_t diskFileGid;
74
75
76
77
78

  /**
   * The uncompressed size of the tape file in bytes.
   */
  uint64_t size;
79
80
  
  /**
81
   * Set of checksum types and values
82
   */
83
  checksum::ChecksumBlob checksumBlob;
84
  
85
86
87
88
89
  /**
   * The name of the file's storage class.
   */
  std::string storageClassName;

90
91
92
93
94
95
96
97
98
99
  /**
   * Creation time in seconds since the Unix epoch.
   */
  time_t creationTime;

  /**
   * Reconciliation time in seconds since the Unix epoch.
   */
  time_t reconciliationTime;

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
}; // struct ArchiveFileRow

/**
 * Output stream operator for an ArchiveFileRow 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 ArchiveFileRow &obj);

} // namespace catalogue
} // namespace cta