diff --git a/scheduler/ArchiveJob.cpp b/scheduler/ArchiveJob.cpp index 5d7cb455cf0d37d73a606da25086ad7bcc361a9c..ec686428342956d9d788ec5731097a74fbae16f5 100644 --- a/scheduler/ArchiveJob.cpp +++ b/scheduler/ArchiveJob.cpp @@ -18,12 +18,6 @@ #include "scheduler/ArchiveJob.hpp" -//------------------------------------------------------------------------------ -// constructor -//------------------------------------------------------------------------------ -cta::ArchiveJob::ArchiveJob() { -} - //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ @@ -34,13 +28,35 @@ cta::ArchiveJob::~ArchiveJob() throw() { // constructor //------------------------------------------------------------------------------ cta::ArchiveJob::ArchiveJob( +// NOT YET DECIDED +//ArchiveMount &mount, const std::string &tapePoolName, + const uint64_t fileSize, const std::string &id, const std::string &userRequestId, const uint32_t copyNb, - const std::string &remoteFile): - TapeJob(id, userRequestId, copyNb, remoteFile), - m_tapePoolName(tapePoolName) { + const std::string &remoteFile, + const uint64_t castorNsFileId): + TapeJob(id, userRequestId, copyNb, remoteFile, castorNsFileId), +// NOT YET DECIDED +// m_mount(mount), + m_tapePoolName(tapePoolName), + m_fileSize(fileSize) { +} + +//------------------------------------------------------------------------------ +// getMount +//------------------------------------------------------------------------------ +// NOT YET DECIDED +//cta::ArchiveMount &cta::ArchiveJob::getMount() { +// return m_mount; +//} + +//------------------------------------------------------------------------------ +// getMount +//------------------------------------------------------------------------------ +cta::ArchiveMount &cta::ArchiveJob::getMount() const { + return m_mount; } //------------------------------------------------------------------------------ @@ -50,16 +66,24 @@ const std::string &cta::ArchiveJob::getTapePoolName() const throw() { return m_tapePoolName; } +//------------------------------------------------------------------------------ +// getFileSize +//------------------------------------------------------------------------------ +uint64_t cta::ArchiveJob::getFileSize() const throw() { + return m_fileSize; +} + //------------------------------------------------------------------------------ // complete //------------------------------------------------------------------------------ -void cta::ArchiveJob::complete() { +void cta::ArchiveJob::complete(const uint32_t checksumOfTransfer, + const uint64_t fileSizeOfTransfer) { } //------------------------------------------------------------------------------ // failed //------------------------------------------------------------------------------ -void cta::ArchiveJob::failed() { +void cta::ArchiveJob::failed(const std::exception &ex) { } //------------------------------------------------------------------------------ diff --git a/scheduler/ArchiveJob.hpp b/scheduler/ArchiveJob.hpp index d485ff94a500f113242cf92444aa390ed3b16a91..14d9f4c485dcd57f9bca070d14fbdbe7618cb0f4 100644 --- a/scheduler/ArchiveJob.hpp +++ b/scheduler/ArchiveJob.hpp @@ -26,41 +26,71 @@ namespace cta { // Forward declaration // class ArchivePath; + class ArchiveMount; class RemotePathAndStatus; /** * Class representing the transfer of a single copy of a remote file to tape. */ class ArchiveJob: public TapeJob { - friend class ArchiveMount; -private: - /** - * Constructor. It is private as the ArchiveJob is generated by the - * ArchiveMount. - */ - ArchiveJob(); -public: /** - * Destructor. + * The ArchiveMount class is a friend so that it can call the private + * constructor of ArchiveJob. */ - ~ArchiveJob() throw(); + friend class ArchiveMount; + +private: /** - * Constructor. + * Constructor. It is private as the ArchiveJob is generated by the + * ArchiveMount. * +// NOT YET DECIDED + * @param archiveMount The mount to which the job belongs. * @param tapePoolName The name of the destination tape pool. + * @param fileSize The size of the file to be archived in bytes. * @param id The identifier of the tape job. * @param userRequestId The identifier of the associated user request. * @param copyNb The copy number. * @param remoteFile The URL of the remote source file. + * @param castorNsFileId The CASTOR name server identifier of the file in the + * archive namespace that depending on the direction of the data transfer may + * be either the source or the destination of the tape job. */ ArchiveJob( +// NOT YET DECIDED +// ArchiveMount &archiveMount, const std::string &tapePoolName, + const uint64_t fileSize, const std::string &id, const std::string &userRequestId, const uint32_t copyNb, - const std::string &remoteFile); + const std::string &remoteFile, + const uint64_t castorNsFileId); + +public: + + /** + * Destructor. + */ + ~ArchiveJob() throw(); + + /** + * Returns the mount to which this job belongs. + * + * @return the mount to which this job belongs. + */ +// TO BE DECIDED +//ArchiveMount &getMount() const; + + /** + * Returns the mount to which this job belongs. + * + * @return the mount to which this job belongs. + */ + // NO YET DECIDED + //ArchiveMount &getMount(); /** * Returns the name of the destination tape pool. @@ -68,30 +98,63 @@ public: * @return the name of the destination tape pool. */ const std::string &getTapePoolName() const throw(); - + + /** + * Returns the size of the file to be archived in bytes. + * + * @return The size of the file to be archived in bytes. + */ + uint64_t getFileSize() const throw(); + + /** + * Returns the The URL of the remote source file. + * + * @return The The URL of the remote source file. + */ + std::string getRemoteFile() const throw(); + /** * Indicates that the job was successful + * + * @param checksumOfTransfer The adler-32 checksum of the file as calculated + * during the execution of the job. + * @param fileSizeOfTransfer The size of the file as calculated during the + * execution of the job. */ - void complete(); - + virtual void complete(const uint32_t checksumOfTransfer, + const uint64_t fileSizeOfTransfer); + /** * Indicates that the job failed + * + * @param ex The reason for the failure. */ - void failed(); - + virtual void failed(const std::exception &ex); + /** * Indicates that the job should be tried again (typically reaching the end * of the tape). */ - void retry(); + virtual void retry(); private: + /** + * The mount to which the job belongs. + */ +// NOT YET DECIDED +//ArchiveMount &m_mount; + /** * The name of the destination tape pool. */ std::string m_tapePoolName; + /** + * The size of the file to be archived in bytes. + */ + uint64_t m_fileSize; + }; // class ArchiveJob } // namespace cta diff --git a/scheduler/ArchiveMount.cpp b/scheduler/ArchiveMount.cpp index 57a86cdb0edbe83e9d9306f31805e4c7992b710a..30df27f7c086fc6de5519675fda1250c955cd34f 100644 --- a/scheduler/ArchiveMount.cpp +++ b/scheduler/ArchiveMount.cpp @@ -38,6 +38,13 @@ cta::MountType::Enum cta::ArchiveMount::getMountType() const throw() { return MountType::ARCHIVE; } +//------------------------------------------------------------------------------ +// getVid +//------------------------------------------------------------------------------ +std::string cta::ArchiveMount::getVid() const throw() { + return "UNKNOWN_VID_FOR_ARCHIVE_MOUNT"; +} + //------------------------------------------------------------------------------ // finish //------------------------------------------------------------------------------ diff --git a/scheduler/ArchiveMount.hpp b/scheduler/ArchiveMount.hpp index b57e99fe043aff54a71aa86f2fffc4740204aec3..5691b2236687f06bc0efaf72572c6e30d4a44682 100644 --- a/scheduler/ArchiveMount.hpp +++ b/scheduler/ArchiveMount.hpp @@ -28,7 +28,6 @@ namespace cta { - class ArchiveMount; /** * The class driving a retrieve mount. * The class only has private constructors as it is instanciated by @@ -55,7 +54,14 @@ namespace cta { * * @return The type of this tape mount. */ - MountType::Enum getMountType() const throw(); + virtual MountType::Enum getMountType() const throw(); + + /** + * Returns the volume identifier of the tape to be mounted. + * + * @return The volume identifier of the tape to be mounted. + */ + virtual std::string getVid() const throw(); /** * Notifies the scheduler that the session is finished diff --git a/scheduler/RetrieveJob.cpp b/scheduler/RetrieveJob.cpp index b18abb21c3fbbfde07ec3c7f1c43fbb67ade0cb5..b2935feedc5f5ef662b36c1d74d1cf78404961bc 100644 --- a/scheduler/RetrieveJob.cpp +++ b/scheduler/RetrieveJob.cpp @@ -18,12 +18,6 @@ #include "scheduler/RetrieveJob.hpp" -//------------------------------------------------------------------------------ -// constructor -//------------------------------------------------------------------------------ -cta::RetrieveJob::RetrieveJob() { -} - //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ @@ -34,25 +28,30 @@ cta::RetrieveJob::~RetrieveJob() throw() { // constructor //------------------------------------------------------------------------------ cta::RetrieveJob::RetrieveJob( +// TO BE DECIDED +//RetrieveMount &mount, const TapeCopyLocation &tapeFile, const std::string &id, const std::string &userRequestId, const uint32_t copyNb, - const std::string &remoteFile): - TapeJob(id, userRequestId, copyNb, remoteFile), + const std::string &remoteFile, + const uint64_t castorNsFileId): + TapeJob(id, userRequestId, copyNb, remoteFile, castorNsFileId), + m_mount(mount), tapeFile(tapeFile) { } //------------------------------------------------------------------------------ // complete //------------------------------------------------------------------------------ -void cta::RetrieveJob::complete() { +void cta::RetrieveJob::complete(const uint32_t checksumOfTransfer, + const uint64_t fileSizeOfTransfer) { } //------------------------------------------------------------------------------ // failed //------------------------------------------------------------------------------ -void cta::RetrieveJob::failed() { +void cta::RetrieveJob::failed(const std::exception &ex) { } //------------------------------------------------------------------------------ diff --git a/scheduler/RetrieveJob.hpp b/scheduler/RetrieveJob.hpp index 7937e0dddf6cee235206a0be7edecf9863816bfa..b7326f6a86b633ebc96636b7070173cb0733840c 100644 --- a/scheduler/RetrieveJob.hpp +++ b/scheduler/RetrieveJob.hpp @@ -1,5 +1,5 @@ /* - * The CERN Tape Archive (CTA) project + * The CERN Tape Retrieve (CTA) project * Copyright (C) 2015 CERN * * This program is free software: you can redistribute it and/or modify @@ -25,47 +25,86 @@ namespace cta { +class RetrieveMount; + /** * The transfer of a single copy of a tape file to a remote file. */ -struct RetrieveJob: public TapeJob { -public: - +class RetrieveJob: public TapeJob { /** - * Constructor. + * The RetrieveMount class is a friend so that it can call the private + * constructor of RetrieveJob. */ - RetrieveJob(); + friend class RetrieveMount; - /** - * Destructor. - */ - ~RetrieveJob() throw(); +private: /** - * Constructor. + * Constructor. It is private as the ArchiveJob is generated by the + * RetrieveMount. * +// TO BE DECIDED + * @param mount The mount to which the job belongs. * @param tapeFile The location of the source tape file. * @param id The identifier of the tape job. * @param userRequestId The identifier of the associated user request. * @param copyNb The copy number. * @param remoteFile The URL of the destination source file. + * @param castorNsFileId The CASTOR name server identifier of the file in the + * archive namespace that depending on the direction of the data transfer may + * be either the source or the destination of the tape job. */ RetrieveJob( +// TO BE DECIDED +// RetrieveMount &mount, const TapeCopyLocation &tapeFile, const std::string &id, const std::string &userRequestId, const uint32_t copyNb, - const std::string &remoteFile); + const std::string &remoteFile, + const uint64_t castorNsFileId); + +public: + + /** + * Destructor. + */ + ~RetrieveJob() throw(); + + + /** + * Returns the mount to which this job belongs. + * + * @return the mount to which this job belongs. + */ +// TO BE DECIDED +//RetrieveMount &getMount() const; + + /** + * Returns the mount to which this job belongs. + * + * @return the mount to which this job belongs. + */ +// TO BE DECIDED +//RetrieveMount &getMount(); /** * Indicates that the job was successful + * + * @param checksumOfTransfer The adler-32 checksum of the file as calculated + * during the execution of the job. + * @param fileSizeOfTransfer The size of the file as calculated during the + * execution of the job. */ - void complete(); + virtual void complete(const uint32_t checksumOfTransfer, + const uint64_t fileSizeOfTransfer); /** * Indicates that the job failed + * + * @param ex The reason for the failure. */ - void failed(); + virtual void failed(const std::exception &ex); /** * Indicates that the job should be tried again (typically reaching the end @@ -73,6 +112,16 @@ public: */ void retry(); +private: + + /** + * The mount to which the job belongs. + */ +// TO BE DECIDED +//RetrieveMount &m_mount; + +public: + /** * The location of the source tape file. */ diff --git a/scheduler/RetrieveMount.cpp b/scheduler/RetrieveMount.cpp index 04c22305916c1eb8b6a8c03b34988e8ddace2c8e..42f89fd374df6017afceffbd8d1a366b620c9aba 100644 --- a/scheduler/RetrieveMount.cpp +++ b/scheduler/RetrieveMount.cpp @@ -38,6 +38,13 @@ cta::MountType::Enum cta::RetrieveMount::getMountType() const throw() { return MountType::ARCHIVE; } +//------------------------------------------------------------------------------ +// getVid +//------------------------------------------------------------------------------ +std::string cta::RetrieveMount::getVid() const throw() { + return "UNKNOWN_VID_FOR_RETRIEVE_MOUNT"; +} + //------------------------------------------------------------------------------ // finish //------------------------------------------------------------------------------ diff --git a/scheduler/RetrieveMount.hpp b/scheduler/RetrieveMount.hpp index b4d541fdd97e77792bb1029d6c5c9db8db609950..2174df0c45599b39c5f4aedef4882581751375eb 100644 --- a/scheduler/RetrieveMount.hpp +++ b/scheduler/RetrieveMount.hpp @@ -28,7 +28,6 @@ namespace cta { - class RetrieveMount; /** * The class driving a retrieve mount. * The class only has private constructors as it is instanciated by @@ -55,7 +54,14 @@ namespace cta { * * @return The type of this tape mount. */ - MountType::Enum getMountType() const throw(); + virtual MountType::Enum getMountType() const throw(); + + /** + * Returns the volume identifier of the tape to be mounted. + * + * @return The volume identifier of the tape to be mounted. + */ + virtual std::string getVid() const throw(); /** * Notifies the scheduler that the session is finished diff --git a/scheduler/TapeJob.cpp b/scheduler/TapeJob.cpp index 2157b48bd8b5544aa67d1684fa83b2f0803c3e65..606260a365c230291fe18e6ac96ccb01d4c46a8d 100644 --- a/scheduler/TapeJob.cpp +++ b/scheduler/TapeJob.cpp @@ -38,11 +38,13 @@ cta::TapeJob::TapeJob( const std::string &id, const std::string &userRequestId, const uint32_t copyNb, - const std::string &remoteFile): + const std::string &remoteFile, + const uint64_t castorNsFileId): m_id(id), m_userRequestId(userRequestId), m_copyNb(copyNb), - m_remoteFile(remoteFile) { + m_remoteFile(remoteFile), + m_castorNsFileId(castorNsFileId) { } //------------------------------------------------------------------------------ @@ -72,3 +74,10 @@ uint32_t cta::TapeJob::getCopyNb() const throw() { const std::string &cta::TapeJob::getRemoteFile() const throw() { return m_remoteFile; } + +//------------------------------------------------------------------------------ +// getCastorNsFileId +//------------------------------------------------------------------------------ +uint64_t cta::TapeJob::getCastorNsFileId() const throw() { + return m_castorNsFileId; +} diff --git a/scheduler/TapeJob.hpp b/scheduler/TapeJob.hpp index bf2f7a771398fc04cd70e30910a2c8e32aa08b9d..30c4c17f6e539b12f908a7f6b4a7e35f4807fb6b 100644 --- a/scheduler/TapeJob.hpp +++ b/scheduler/TapeJob.hpp @@ -48,12 +48,16 @@ public: * @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 tape job. + * @param castorNsFileId The CASTOR name server identifier of the file in the + * archive namespace that depending on the direction of the data transfer may + * be either the source or the destination of the tape job. */ TapeJob( const std::string &id, const std::string &userRequestId, const uint32_t copyNb, - const std::string &remoteFile); + const std::string &remoteFile, + const uint64_t castorNsFileId); /** * Returns the identifier of the tape job. @@ -87,16 +91,35 @@ public: */ const std::string &getRemoteFile() const throw(); + /** + * Returns The CASTOR name server identifier of the file in the archive + * namespace that depending on the direction of the data transfer may be + * either the source or the destination of the tape job. + * + * @return The CASTOR name server identifier of the file in the archive + * namespace that depending on the direction of the data transfer may be + * either the source or the destination of the tape job. + */ + uint64_t getCastorNsFileId() const throw(); + /** * Indicates that the job was successful + * + * @param checksumOfTransfer The adler-32 checksum of the file as calculated + * during the execution of the job. + * @param fileSizeOfTransfer The size of the file as calculated during the + * execution of the job. */ - virtual void complete() = 0; - + virtual void complete(const uint32_t checksumOfTransfer, + const uint64_t fileSizeOfTransfer) = 0; + /** * Indicates that the job failed + * + * @param ex The reason for the failure. */ - virtual void failed() = 0; - + virtual void failed(const std::exception &ex) = 0; + /** * Indicates that the job should be tried again (typically reaching the end * of the tape). @@ -126,6 +149,13 @@ private: */ std::string m_remoteFile; + /** + * The CASTOR name server identifier of the file in the archive + * namespace that depending on the direction of the data transfer may be + * either the source or the destination of the tape job. + */ + uint64_t m_castorNsFileId; + }; // class TapeJob } // namespace cta diff --git a/scheduler/TapeMount.hpp b/scheduler/TapeMount.hpp index c905883bcb82a9d6ab23efc1312a6a4500a00f65..5a520484e576997016c083b2a8189d51c39f777e 100644 --- a/scheduler/TapeMount.hpp +++ b/scheduler/TapeMount.hpp @@ -20,6 +20,8 @@ #include "scheduler/MountType.hpp" +#include <string> + namespace cta { /** * A placeholder class from which will derive ArchiveSession and RetriveSession. @@ -35,6 +37,13 @@ namespace cta { */ virtual MountType::Enum getMountType() const throw() = 0; + /** + * Returns the volume identifier of the tape to be mounted. + * + * @return The volume identifier of the tape to be mounted. + */ + virtual std::string getVid() const throw() = 0; + /** * Notifies the scheduler that the session is finished */