Commit 794f2433 authored by Eric Cano's avatar Eric Cano
Browse files

Removed deprecated structures from archiveNS and nameserver namespaces....

Removed deprecated structures from archiveNS and nameserver namespaces. Removed RetrieveToFileRequest.
parent c4aceb78
......@@ -114,7 +114,6 @@ ELSE(DEFINED PackageOnly)
add_subdirectory(cmdline)
add_subdirectory(common)
add_subdirectory(objectstore)
add_subdirectory(nameserver)
add_subdirectory(remotens)
add_subdirectory(scheduler)
add_subdirectory(tapeserver)
......
......@@ -42,7 +42,8 @@ bool ArchiveFileRow::operator==(const ArchiveFileRow &rhs) const {
diskFileGroup == rhs.diskFileGroup &&
diskFileRecoveryBlob == rhs.diskFileRecoveryBlob &&
size == rhs.size &&
checksum == rhs.checksum &&
checksumType == rhs.checksumType &&
checksumValue == rhs.checksumValue &&
storageClassName == rhs.storageClassName;
}
......@@ -60,7 +61,7 @@ std::ostream &operator<<(std::ostream &os, const ArchiveFileRow &obj) {
"diskFileGroup=" << obj.diskFileGroup <<
"diskFileRecoveryBlob=" << obj.diskFileRecoveryBlob <<
"size=" << obj.size <<
"checksum=" << obj.checksum <<
"checksumType=" << obj.checksumType << "checksumValue=" << obj.checksumValue <<
"storageClassName=" << obj.storageClassName <<
"}";
return os;
......
......@@ -89,11 +89,16 @@ struct ArchiveFileRow {
* The uncompressed size of the tape file in bytes.
*/
uint64_t size;
/**
* Checksum type of the tape file content
*/
std::string checksumType;
/**
* Checksum of the tape file contents.
* Checksum value of the file type content
*/
Checksum checksum;
std::string checksumValue;
/**
* The name of the file's storage class.
......
......@@ -1684,7 +1684,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) {
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file1Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file1Written.size, archiveFile.fileSize);
ASSERT_EQ(file1Written.storageClassName, archiveFile.storageClass);
......@@ -1726,7 +1726,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, prepareToRetrieveFile) {
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file2Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file2Written.size, archiveFile.fileSize);
ASSERT_EQ(file2Written.storageClassName, archiveFile.storageClass);
......@@ -1909,7 +1909,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_diffe
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file1Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file1Written.size, archiveFile.fileSize);
ASSERT_EQ(file1Written.storageClassName, archiveFile.storageClass);
......@@ -1959,7 +1959,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_diffe
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file2Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file2Written.size, archiveFile.fileSize);
ASSERT_EQ(file2Written.storageClassName, archiveFile.storageClass);
......@@ -2076,7 +2076,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_same_
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file1Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file1Written.size, archiveFile.fileSize);
ASSERT_EQ(file1Written.storageClassName, archiveFile.storageClass);
......@@ -2190,7 +2190,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, fileWrittenToTape_2_tape_files_corru
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file1Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file1Written.size, archiveFile.fileSize);
ASSERT_EQ(file1Written.storageClassName, archiveFile.storageClass);
......@@ -2339,7 +2339,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteArchiveFile) {
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file1Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file1Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file1Written.size, archiveFile.fileSize);
ASSERT_EQ(file1Written.storageClassName, archiveFile.storageClass);
......@@ -2389,7 +2389,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteArchiveFile) {
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->getArchiveFileById(archiveFileId);
ASSERT_EQ(file2Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file2Written.size, archiveFile.fileSize);
ASSERT_EQ(file2Written.storageClassName, archiveFile.storageClass);
......@@ -2424,7 +2424,7 @@ TEST_F(cta_catalogue_InMemoryCatalogueTest, deleteArchiveFile) {
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->deleteArchiveFile(archiveFileId);
ASSERT_EQ(file2Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.diskFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.dstURL);
ASSERT_EQ(file2Written.size, archiveFile.fileSize);
ASSERT_EQ(file2Written.storageClassName, archiveFile.storageClass);
......
......@@ -2345,7 +2345,7 @@ std::list<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveFiles(
archiveFile.archiveFileID = archiveFileId;
archiveFile.diskInstance = rset->columnText("DISK_INSTANCE");
archiveFile.diskFileID = rset->columnText("DISK_FILE_ID");
archiveFile.dstURL = rset->columnText("DISK_FILE_ID");
archiveFile.drData.drPath = rset->columnText("DISK_FILE_PATH");
archiveFile.drData.drOwner = rset->columnText("DISK_FILE_USER");
archiveFile.drData.drGroup = rset->columnText("DISK_FILE_GROUP");
......@@ -2651,9 +2651,9 @@ void RdbmsCatalogue::throwIfCommonEventDataMismatch(const common::dataStructures
const TapeFileWritten &actual) const {
// Throw an exception if the common disk information of this tape file
// written event does not match the previous
if(expected.diskFileID != actual.diskFileId) {
if(expected.dstURL != actual.diskFileId) {
exception::Exception ex;
ex.getMessage() << "Disk file ID mismatch: expected=" << expected.diskFileID << " actual=" <<
ex.getMessage() << "Disk file ID mismatch: expected=" << expected.dstURL << " actual=" <<
actual.diskFileId;
throw ex;
}
......@@ -2970,7 +2970,7 @@ std::unique_ptr<common::dataStructures::ArchiveFile> RdbmsCatalogue::getArchiveF
archiveFile->archiveFileID = rset->columnUint64("ARCHIVE_FILE_ID");
archiveFile->diskInstance = rset->columnText("DISK_INSTANCE");
archiveFile->diskFileID = rset->columnText("DISK_FILE_ID");
archiveFile->dstURL = rset->columnText("DISK_FILE_ID");
archiveFile->drData.drPath = rset->columnText("DISK_FILE_PATH");
archiveFile->drData.drOwner = rset->columnText("DISK_FILE_USER");
archiveFile->drData.drGroup = rset->columnText("DISK_FILE_GROUP");
......
......@@ -90,7 +90,7 @@ common::dataStructures::ArchiveFile SqliteCatalogue::deleteArchiveFile(const uin
archiveFile->archiveFileID = selectRset->columnUint64("ARCHIVE_FILE_ID");
archiveFile->diskInstance = selectRset->columnText("DISK_INSTANCE");
archiveFile->diskFileID = selectRset->columnText("DISK_FILE_ID");
archiveFile->dstURL = selectRset->columnText("DISK_FILE_ID");
archiveFile->drData.drPath = selectRset->columnText("DISK_FILE_PATH");
archiveFile->drData.drOwner = selectRset->columnText("DISK_FILE_USER");
archiveFile->drData.drGroup = selectRset->columnText("DISK_FILE_GROUP");
......
......@@ -46,7 +46,8 @@ bool TapeFileWritten::operator==(const TapeFileWritten &rhs) const {
diskFileGroup == rhs.diskFileGroup &&
diskFileRecoveryBlob == rhs.diskFileRecoveryBlob &&
size == rhs.size &&
checksum == rhs.checksum &&
checksumType == rhs.checksumType &&
checksumValue == rhs.checksumValue &&
storageClassName == rhs.storageClassName &&
vid == rhs.vid &&
fSeq == rhs.fSeq &&
......@@ -69,7 +70,7 @@ std::ostream &operator<<(std::ostream &os, const TapeFileWritten &obj) {
"diskFileGroup=" << obj.diskFileGroup <<
"diskFileRecoveryBlob=" << obj.diskFileRecoveryBlob <<
"size=" << obj.size <<
"checksum=" << obj.checksum <<
"checksumType=" << obj.checksumType << "checksumValue=" << obj.checksumValue <<
"storageClassName=" << obj.storageClassName <<
"vid=" << obj.vid <<
"fSeq=" << obj.fSeq <<
......
......@@ -91,10 +91,15 @@ struct TapeFileWritten {
uint64_t size;
/**
* Checksum of the tape file contents.
* Checksum type for the tape file contents.
*/
Checksum checksum;
std::string checksumType;
/**
* Checksum value for the tape file contents.
*/
std::string checksumValue;
/**
* The name of the file's storage class.
*/
......
......@@ -67,11 +67,11 @@ set (COMMON_LIB_SRC_FILES
admin/AdminHost.cpp
admin/AdminUser.cpp
archiveRoutes/ArchiveRoute.cpp
archiveNS/ArchiveFile.cpp
archiveNS/ArchiveFileStatus.cpp
archiveNS/StorageClass.cpp
archiveNS/Tape.cpp
archiveNS/TapeFileLocation.cpp
# archiveNS/ArchiveFile.cpp
# archiveNS/ArchiveFileStatus.cpp
# archiveNS/StorageClass.cpp
# archiveNS/Tape.cpp
# archiveNS/TapeFileLocation.cpp
checksum/Checksum.cpp
exception/Backtrace.cpp
exception/Errnum.cpp
......
/*
* 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/>.
*/
#include "ArchiveFile.hpp"
namespace cta { namespace common { namespace archiveNS {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
ArchiveFile::ArchiveFile():
fileId(0),
size(0),
checksum(0),
lastModificationTime(0) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
ArchiveFile::ArchiveFile(const std::string & nsHostName, uint64_t fileId,
uint64_t size, const uint32_t checksum, const time_t lastModificationTime):
nsHostName(nsHostName),
fileId(fileId),
size(size),
checksum(checksum),
lastModificationTime(lastModificationTime) {}
}}} //namespace cta::common::archiveNS
/*
* 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/>.
*/
#pragma once
#include <string>
#include "common/checksum/Checksum.hpp"
namespace cta { namespace common { namespace archiveNS {
/**
* A class containing the location and properties of an archive file.
*/
class ArchiveFile {
public:
/**
* Constructor.
*/
ArchiveFile();
/**
* Constructor.
*
* @param path The location of the file at NS lookup time
* @param nsHostName The NS host name
* @param fileId The file ID (to be used in the tape copy header)
* @param size The file size
* @param checksum The file checksum
* @param lastModificationTime The last modification time of the file
*/
ArchiveFile(const std::string & nsHostName, uint64_t fileId,
uint64_t size, const uint32_t checksum, const time_t lastModificationTime);
/**
* The NS host name
*/
std::string nsHostName;
/**
* The file ID
*/
uint64_t fileId;
/**
* The file size
*/
uint64_t size;
/**
* The file checksum
*/
uint32_t checksum;
/**
* The last modification time of the file
*/
time_t lastModificationTime;
};
}}} // namespace cta::common::archiveNS
/*
* 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/>.
*/
#include "common/archiveNS/ArchiveFileStatus.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::common::archiveNS::ArchiveFileStatus::ArchiveFileStatus():
fileId(0),
mode(0),
size(0) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::common::archiveNS::ArchiveFileStatus::ArchiveFileStatus(
const UserIdentity &owner,
const uint64_t fileId,
const mode_t mode,
const uint64_t size,
const Checksum &checksum,
const std::string &storageClassName):
owner(owner),
fileId(fileId),
mode(mode),
size(size),
checksum(checksum),
storageClassName(storageClassName) {
}
/*
* 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/>.
*/
#pragma once
#include "common/checksum/Checksum.hpp"
#include "common/UserIdentity.hpp"
#include <stdint.h>
#include <string>
namespace cta { namespace common { namespace archiveNS {
/**
* The status of a file or a directory entry in the archive namespace.
*/
struct ArchiveFileStatus {
/**
* Constructor.
*
* Initialises all integer member-variables to 0.
*/
ArchiveFileStatus();
/**
* Constructor.
*
* @param owner The identity of the owner.
* @param mode The mode bits of the file or directory.
* @param size The size of the file in bytes.
* @param checksum The checksum of the file.
* @param storageClassName The name of the file or directory's storage class.
* An empty string indicates no storage class.
*/
ArchiveFileStatus(
const UserIdentity &owner,
const uint64_t fileId,
const mode_t mode,
const uint64_t size,
const Checksum &checksum,
const std::string &storageClassName);
/**
* The identity of the owner.
*/
UserIdentity owner;
/**
* The nameserver file ID
*/
uint64_t fileId;
/**
* The mode bits of the directory entry.
*/
mode_t mode;
/**
* Returns the size of the file in bytes.
*/
uint64_t size;
/**
* The checksum of the file.
*/
Checksum checksum;
/**
* The name of the directory's storage class or an empty string if the
* directory does not have a storage class.
*/
std::string storageClassName;
}; // class ArchiveFileStatus
}}} // namespace cta::common::archiveNS
/*
* 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/>.
*/
#include "common/archiveNS/StorageClass.hpp"
#include "common/CreationLog.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::StorageClass::StorageClass():
nbCopies(0) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::StorageClass::~StorageClass() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::StorageClass::StorageClass(
const std::string &name,
const uint16_t nbCopies,
const CreationLog &creationLog):
name(name),
nbCopies(nbCopies),
creationLog(creationLog) {
}
//------------------------------------------------------------------------------
// operator<
//------------------------------------------------------------------------------
bool cta::StorageClass::operator<(const StorageClass& rhs) const {
return name < rhs.name;
}
/*
* 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/>.
*/
#pragma once
#include "common/CreationLog.hpp"
#include <stdint.h>
#include <string>
namespace cta {
class CreationLog;
/**
* Class representing an archive storage-class.
*/
struct StorageClass {
/**
* Constructor.
*/
StorageClass();
/**
* Destructor.
*/
~StorageClass() throw();
/**
* Constructor.
*
* @param name The name of the storage class.
* @param nbCopies The number of copies a file associated with this storage
* class should have on tape.
* @param creationLog The who, where, when an why of this modification.
* time is used.
*/
StorageClass(
const std::string &name,
const uint16_t nbCopies,
const CreationLog &creationLog);
/**
* Returns true if the specified right-hand side is greater than this object.
*
* @param rhs The object on the right-hand side of the < operator.
* @return True if the specified right-hand side is greater than this object.
*/
bool operator<(const StorageClass &rhs) const;
/**
* The name of the storage class.
*/
std::string name;
/**
* The number of copies a file associated with this storage
* class should have on tape.
*/
uint16_t nbCopies;