Skip to content
Snippets Groups Projects
Commit 22c53ded authored by Steven Murray's avatar Steven Murray
Browse files

Added the abstract FileTransfer class and its concrete sub-classes

parent 91a0438d
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ include_directories (${SQLITE3_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set (MIDDLE_TIER_LIB_SRC_FILES
cta/AdminHost.cpp
cta/AdminUser.cpp
cta/ArchivalFileTransfer.cpp
cta/ArchivalJob.cpp
cta/ArchivalJobQueues.cpp
cta/ArchivalJobState.cpp
......@@ -24,6 +25,7 @@ set (MIDDLE_TIER_LIB_SRC_FILES
cta/FileSystemNode.cpp
cta/FileSystemStorageClass.cpp
cta/FileSystemStorageClasses.cpp
cta/FileTransfer.cpp
cta/LogicalLibrary.cpp
cta/MiddleTierAdmin.cpp
cta/MiddleTierUser.cpp
......
#include "cta/ArchivalFileTransfer.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchivalFileTransfer::ArchivalFileTransfer() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::ArchivalFileTransfer::~ArchivalFileTransfer() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchivalFileTransfer::ArchivalFileTransfer(const std::string &remoteFile,
const std::string &vid):
m_remoteFile(remoteFile),
m_vid(vid) {
}
//------------------------------------------------------------------------------
// getRemoteFile
//------------------------------------------------------------------------------
const std::string &cta::ArchivalFileTransfer::getRemoteFile() const throw() {
return m_remoteFile;
}
//------------------------------------------------------------------------------
// getVid
//------------------------------------------------------------------------------
const std::string &cta::ArchivalFileTransfer::getVid() const throw() {
return m_vid;
}
#pragma once
#include <string>
namespace cta {
/**
* Class representing the transfer of a single copy of a remote file to tape.
*/
class ArchivalFileTransfer {
public:
/**
* Constructor.
*/
ArchivalFileTransfer();
/**
* Destructor.
*/
~ArchivalFileTransfer() throw();
/**
* Constructor.
*
* @param remoteFile The URL of the remote source file.
* @param vid The volume identifier of the destination tape.
*/
ArchivalFileTransfer(const std::string &remoteFile, const std::string &vid);
/**
* Returns the URL of the remote source file.
*
* @return the URL of the remote source file.
*/
const std::string &getRemoteFile() const throw();
/**
* Returns the volume identifier of the destination tape.
*
* @return the volume identifier of the destination tape.
*/
const std::string &getVid() const throw();
private:
/**
* The URL of the remote source file.
*/
std::string m_remoteFile;
/**
* The volume identifier of the destination tape.
*/
std::string m_vid;
}; // class ArchivalFileTransfer
} // namespace cta
......@@ -3,7 +3,8 @@
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchivalRequest::ArchivalRequest() {
cta::ArchivalRequest::ArchivalRequest():
m_priority(0) {
}
//------------------------------------------------------------------------------
......
#include "cta/FileTransfer.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::FileTransfer::FileTransfer():
m_copyNb(0) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::FileTransfer::~FileTransfer() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::FileTransfer::FileTransfer(const std::string &id,
const std::string &userRequestId, const uint32_t copyNb):
m_id(id),
m_userRequestId(userRequestId),
m_copyNb(copyNb) {
}
//------------------------------------------------------------------------------
// getId
//------------------------------------------------------------------------------
const std::string &cta::FileTransfer::getId() const throw() {
return m_id;
}
//------------------------------------------------------------------------------
// getUserRequestId
//------------------------------------------------------------------------------
const std::string &cta::FileTransfer::getUserRequestId() const throw() {
return m_userRequestId;
}
//------------------------------------------------------------------------------
// getCopyNb
//------------------------------------------------------------------------------
uint32_t cta::FileTransfer::getCopyNb() const throw() {
return m_copyNb;
}
#pragma once
#include <stdint.h>
#include <string>
namespace cta {
/**
* Abstract class representing the transfer of a single copy of file.
*/
class FileTransfer {
public:
/**
* Constructor.
*/
FileTransfer();
/**
* Destructor.
*/
virtual ~FileTransfer() throw() = 0;
/**
* Constructor.
*
* @param id The identifier of the file transfer.
* @param userRequestId The identifier of the associated user request.
* @prama copyNb The copy number
*/
FileTransfer(const std::string &id, const std::string &userRequestId,
const uint32_t copyNb);
/**
* Returns the identifier of the file transfer.
*
* @return The identifier of the file transfer.
*/
const std::string &getId() const throw();
/**
* Returns the identifier of the associated user request.
*
* @return The identifier of the associated user request.
*/
const std::string &getUserRequestId() const throw();
/**
* Returns the copy number.
*
* @return The copy number.
*/
uint32_t getCopyNb() const throw();
private:
/**
* The identifier of the file transfer.
*/
std::string m_id;
/**
* The identifier of the associated user request.
*/
std::string m_userRequestId;
/**
* The copy number.
*/
uint32_t m_copyNb;
}; // class FileTransfer
} // namespace cta
#pragma once
#include "cta/TapeFileLocation.hpp"
#include <string>
namespace cta {
/**
* Class representing the transfer of a single copy of a tape file to a remote
* file.
*/
class RetrievalFileTransfer {
public:
/**
* Constructor.
*/
RetrievalFileTransfer();
/**
* Destructor.
*/
~RetrievalFileTransfer() throw();
/**
* Constructor.
*
* @param tapeFileLocation The location of the source tape file.
* @param remoteFile The URL of the destination source file.
*/
RetrievalFileTransfer(const TapeFileLocation &tapeFile,
const std::string &remoteFile);
/**
* Returns the location of the source tape file.
*
* @return The location of the source tape file.
*/
const TapeFileLocation &getTapeFile() const throw();
/**
* Returns the URL of the remote source file.
*
* @return the URL of the remote source file.
*/
const std::string &getRemoteFile() const throw();
private:
/**
* The location of the source tape file.
*/
const TapeFileLocation m_tapeFile;
/**
* The URL of the remote destination file.
*/
std::string m_remoteFile;
}; // class RetrievalFileTransfer
} // namespace cta
......@@ -3,7 +3,8 @@
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrievalRequest::RetrievalRequest() {
cta::RetrievalRequest::RetrievalRequest():
m_priority(0) {
}
//------------------------------------------------------------------------------
......
#pragma once
#include <stdint.h>
#include <string>
namespace cta {
/**
* Class repsenting the location of a file on a tape.
*/
class TapeFileLocation {
public:
/**
* Constructor.
*/
TapeFileLocation();
/**
* Constructor.
*
* @param vid The volume identifier of the tape.
* @param fseq The sequence number of the file.
* @param blockId The block identifier of the file.
*/
TapeFileLocation(const std::string &vid, const uint64_t fseq,
const uint64_t blockId);
/**
* Returns the volume identifier of the tape.
*
* @return The volume identifier of the tape.
*/
const std::string &getVid() const throw();
/**
* Returns the sequence number of the file.
*
* @return The sequence number of the file.
*/
uint64_t &getFseq() const throw();
/**
* Returns the block identifier of the file.
*
* @return The block identifier of the file.
*/
uint64_t &getBlockId() const throw();
private:
/**
* The volume identifier of the tape.
*/
std::string m_vid;
/**
* The sequence number of the file.
*/
uint64_t m_fseq;
/**
* The block identifier of the file.
*/
uint64_t m_blockId;
}; // class TapeFileLocation
}; // namepsace cta
......@@ -3,7 +3,9 @@
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::UserRequest::UserRequest() {
cta::UserRequest::UserRequest():
m_id(0),
m_creationTime(time(NULL)) {
}
//------------------------------------------------------------------------------
......@@ -12,7 +14,8 @@ cta::UserRequest::UserRequest() {
cta::UserRequest::UserRequest(const std::string &id,
const SecurityIdentity &user):
m_id(id),
m_user(user) {
m_user(user),
m_creationTime(time(NULL)) {
}
//------------------------------------------------------------------------------
......@@ -34,3 +37,10 @@ const std::string &cta::UserRequest::getId() const throw() {
const cta::SecurityIdentity &cta::UserRequest::getUser() const throw() {
return m_user;
}
//------------------------------------------------------------------------------
// getCreationTime
//------------------------------------------------------------------------------
time_t cta::UserRequest::getCreationTime() const throw() {
return m_creationTime;
}
......@@ -3,6 +3,7 @@
#include "cta/SecurityIdentity.hpp"
#include <string>
#include <time.h>
namespace cta {
......@@ -44,6 +45,13 @@ public:
*/
const SecurityIdentity &getUser() const throw();
/**
* Returns the time at which the user request was created.
*
* @return The time at which the user request was created.
*/
time_t getCreationTime() const throw();
private:
/**
......@@ -56,6 +64,11 @@ private:
*/
SecurityIdentity m_user;
/**
* The time at which the user request was created.
*/
time_t m_creationTime;
}; // class UserRequest
} // namespace cta
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment