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

Cleaned up FileTransfer and its subclasses

parent e0e71e5c
No related branches found
No related tags found
No related merge requests found
...@@ -568,7 +568,7 @@ WARN_LOGFILE = ...@@ -568,7 +568,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = libs/middletier INPUT = middletier
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
...@@ -15,22 +15,19 @@ cta::ArchivalFileTransfer::~ArchivalFileTransfer() throw() { ...@@ -15,22 +15,19 @@ cta::ArchivalFileTransfer::~ArchivalFileTransfer() throw() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
cta::ArchivalFileTransfer::ArchivalFileTransfer(const std::string &remoteFile, cta::ArchivalFileTransfer::ArchivalFileTransfer(
const std::string &vid): const std::string &tapePoolName,
m_remoteFile(remoteFile), const std::string &id,
m_vid(vid) { const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile):
FileTransfer(id, userRequestId, copyNb, remoteFile),
m_tapePoolName(tapePoolName) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// getRemoteFile // getTapePoolName
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
const std::string &cta::ArchivalFileTransfer::getRemoteFile() const throw() { const std::string &cta::ArchivalFileTransfer::getTapePoolName() const throw() {
return m_remoteFile; return m_tapePoolName;
}
//------------------------------------------------------------------------------
// getVid
//------------------------------------------------------------------------------
const std::string &cta::ArchivalFileTransfer::getVid() const throw() {
return m_vid;
} }
#pragma once #pragma once
#include "cta/FileTransfer.hpp"
#include <stdint.h>
#include <string> #include <string>
namespace cta { namespace cta {
...@@ -7,7 +10,7 @@ namespace cta { ...@@ -7,7 +10,7 @@ namespace cta {
/** /**
* Class representing the transfer of a single copy of a remote file to tape. * Class representing the transfer of a single copy of a remote file to tape.
*/ */
class ArchivalFileTransfer { class ArchivalFileTransfer: public FileTransfer {
public: public:
/** /**
...@@ -23,36 +26,32 @@ public: ...@@ -23,36 +26,32 @@ public:
/** /**
* Constructor. * Constructor.
* *
* @param tapePoolName The name of the destination tape pool.
* @param id The identifier of the file transfer.
* @param userRequestId The identifier of the associated user request.
* @param copyNb The copy number.
* @param remoteFile The URL of the remote source file. * @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(); ArchivalFileTransfer(
const std::string &tapePoolName,
const std::string &id,
const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile);
/** /**
* Returns the volume identifier of the destination tape. * Returns the name of the destination tape pool.
* *
* @return the volume identifier of the destination tape. * @return the name of the destination tape pool.
*/ */
const std::string &getVid() const throw(); const std::string &getTapePoolName() const throw();
private: private:
/** /**
* The URL of the remote source file. * The name of the destination tape pool.
*/
std::string m_remoteFile;
/**
* The volume identifier of the destination tape.
*/ */
std::string m_vid; std::string m_tapePoolName;
}; // class ArchivalFileTransfer }; // class ArchivalFileTransfer
......
...@@ -16,11 +16,15 @@ cta::FileTransfer::~FileTransfer() throw() { ...@@ -16,11 +16,15 @@ cta::FileTransfer::~FileTransfer() throw() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
cta::FileTransfer::FileTransfer(const std::string &id, cta::FileTransfer::FileTransfer(
const std::string &userRequestId, const uint32_t copyNb): const std::string &id,
const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile):
m_id(id), m_id(id),
m_userRequestId(userRequestId), m_userRequestId(userRequestId),
m_copyNb(copyNb) { m_copyNb(copyNb),
m_remoteFile(remoteFile) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -43,3 +47,10 @@ const std::string &cta::FileTransfer::getUserRequestId() const throw() { ...@@ -43,3 +47,10 @@ const std::string &cta::FileTransfer::getUserRequestId() const throw() {
uint32_t cta::FileTransfer::getCopyNb() const throw() { uint32_t cta::FileTransfer::getCopyNb() const throw() {
return m_copyNb; return m_copyNb;
} }
//------------------------------------------------------------------------------
// getRemoteFile
//------------------------------------------------------------------------------
const std::string &cta::FileTransfer::getRemoteFile() const throw() {
return m_remoteFile;
}
...@@ -26,10 +26,16 @@ public: ...@@ -26,10 +26,16 @@ public:
* *
* @param id The identifier of the file transfer. * @param id The identifier of the file transfer.
* @param userRequestId The identifier of the associated user request. * @param userRequestId The identifier of the associated user request.
* @prama copyNb The copy number * @param copyNb The copy number.
* @param remoteFile The URL of the remote file that depending on the
* direction of the data transfer may be either the source or the
* destination of the file transfer.
*/ */
FileTransfer(const std::string &id, const std::string &userRequestId, FileTransfer(
const uint32_t copyNb); const std::string &id,
const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile);
/** /**
* Returns the identifier of the file transfer. * Returns the identifier of the file transfer.
...@@ -52,6 +58,17 @@ public: ...@@ -52,6 +58,17 @@ public:
*/ */
uint32_t getCopyNb() const throw(); uint32_t getCopyNb() const throw();
/**
* Returns the URL of the remote file that depending on the direction of the
* data transfer may be either the source or the destination of the file
* transfer.
*
* @return The URL of the remote file that depending on the direction of the
* data transfer may be either the source or the destination of the file
* transfer.
*/
const std::string &getRemoteFile() const throw();
private: private:
/** /**
...@@ -69,6 +86,12 @@ private: ...@@ -69,6 +86,12 @@ private:
*/ */
uint32_t m_copyNb; uint32_t m_copyNb;
/**
* The URL of the remote file that depending on the direction of the data
* transfer may be either the source or the destination of the file transfer.
*/
std::string m_remoteFile;
}; // class FileTransfer }; // class FileTransfer
} // namespace cta } // namespace cta
...@@ -16,9 +16,13 @@ cta::RetrievalFileTransfer::~RetrievalFileTransfer() throw() { ...@@ -16,9 +16,13 @@ cta::RetrievalFileTransfer::~RetrievalFileTransfer() throw() {
// constructor // constructor
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
cta::RetrievalFileTransfer::RetrievalFileTransfer( cta::RetrievalFileTransfer::RetrievalFileTransfer(
const TapeFileLocation &tapeFile, const std::string &remoteFile): const TapeFileLocation &tapeFile,
m_tapeFile(tapeFile), const std::string &id,
m_remoteFile(remoteFile) { const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile):
FileTransfer(id, userRequestId, copyNb, remoteFile),
m_tapeFile(tapeFile) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -28,10 +32,3 @@ const cta::TapeFileLocation &cta::RetrievalFileTransfer::getTapeFile() const ...@@ -28,10 +32,3 @@ const cta::TapeFileLocation &cta::RetrievalFileTransfer::getTapeFile() const
throw() { throw() {
return m_tapeFile; return m_tapeFile;
} }
//------------------------------------------------------------------------------
// getRemoteFile
//------------------------------------------------------------------------------
const std::string &cta::RetrievalFileTransfer::getRemoteFile() const throw() {
return m_remoteFile;
}
#pragma once #pragma once
#include "cta/FileTransfer.hpp"
#include "cta/TapeFileLocation.hpp" #include "cta/TapeFileLocation.hpp"
#include <string> #include <string>
...@@ -10,7 +11,7 @@ namespace cta { ...@@ -10,7 +11,7 @@ namespace cta {
* Class representing the transfer of a single copy of a tape file to a remote * Class representing the transfer of a single copy of a tape file to a remote
* file. * file.
*/ */
class RetrievalFileTransfer { class RetrievalFileTransfer: public FileTransfer {
public: public:
/** /**
...@@ -27,9 +28,16 @@ public: ...@@ -27,9 +28,16 @@ public:
* Constructor. * Constructor.
* *
* @param tapeFileLocation The location of the source tape file. * @param tapeFileLocation The location of the source tape file.
* @param id The identifier of the file transfer.
* @param userRequestId The identifier of the associated user request.
* @param copyNb The copy number.
* @param remoteFile The URL of the destination source file. * @param remoteFile The URL of the destination source file.
*/ */
RetrievalFileTransfer(const TapeFileLocation &tapeFile, RetrievalFileTransfer(
const TapeFileLocation &tapeFile,
const std::string &id,
const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile); const std::string &remoteFile);
/** /**
...@@ -39,13 +47,6 @@ public: ...@@ -39,13 +47,6 @@ public:
*/ */
const TapeFileLocation &getTapeFile() const throw(); 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: private:
/** /**
...@@ -53,11 +54,6 @@ private: ...@@ -53,11 +54,6 @@ private:
*/ */
const TapeFileLocation m_tapeFile; const TapeFileLocation m_tapeFile;
/**
* The URL of the remote destination file.
*/
std::string m_remoteFile;
}; // class RetrievalFileTransfer }; // class RetrievalFileTransfer
} // namespace cta } // namespace cta
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment