diff --git a/middletier/cta/ArchivalJobQueues.hpp b/middletier/cta/ArchivalJobQueues.hpp index 48224029294bb785802831eea4b136b8e1f846c6..84fd5e2e79056f6fcd0c3197a0ed9d048135bd26 100644 --- a/middletier/cta/ArchivalJobQueues.hpp +++ b/middletier/cta/ArchivalJobQueues.hpp @@ -93,11 +93,10 @@ public: * that it is the responsibility of the caller to deallocate any returned * ArchivalMount object. */ - virtual ArchivalMount *getNextMount(const std::string &tapePoolName) - = 0; + virtual ArchivalMount *getNextMount(const std::string &tapePoolName) = 0; /** - * Returns the next batch of archival jobs for the specified on going tape + * Returns the next batch of archival jobs for the specified on-going tape * mount. * * @param mountId The identifier of the mount. diff --git a/middletier/cta/RetrievalJobQueues.cpp b/middletier/cta/RetrievalJobQueues.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2a129d255735b87db469c4f70b106855f234d498 --- /dev/null +++ b/middletier/cta/RetrievalJobQueues.cpp @@ -0,0 +1,7 @@ +#include "cta/RetrievalJobQueues.hpp" + +//------------------------------------------------------------------------------ +// destructor +//------------------------------------------------------------------------------ +cta::RetrievalJobQueues::~RetrievalJobQueues() throw() { +} diff --git a/middletier/cta/RetrievalJobQueues.hpp b/middletier/cta/RetrievalJobQueues.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2b4a6ff3b205df07e73e7b537d5505c1b384ce6b --- /dev/null +++ b/middletier/cta/RetrievalJobQueues.hpp @@ -0,0 +1,93 @@ +#pragma once + +#include "cta/RetrievalJob.hpp" +#include "cta/RetrievalMount.hpp" +#include "cta/Exception.hpp" + +#include <list> +#include <stdint.h> +#include <string> + +namespace cta { + +/** + * Abstract class representing the retrieval job queues. + */ +class RetrievalJobQueues { +public: + + /** + * Destructor. + */ + virtual ~RetrievalJobQueues() throw() = 0; + + /** + * Queues the specified retrieval job with the specified priority. + * + * @param priority The priority of the job to be queued. + * @param job The job to be queued. + */ + virtual void queueJob(const uint32_t priority, const RetrievalJob &job) = 0; + + /** + * Deletes the retrieval job associated with the specified destination disk + * file. + * + * @param dstUrl The URL of the destination disk file. + */ + virtual void deleteJob(const std::string &dstUrl) = 0; + + /** + * Returns the current list of retrieval jobs for the specified tape. + * + * @param vid The volume-indentifier name of the tape. + */ + virtual std::list<RetrievalJob> getJobs(const std::string &vid) = 0; + + /** + * Notifies this object that the specified file transfer has succeeded. + * + * @param copyNb The copy number of the source tape file. + * @param dstUrl The URL of the destination disk file. + */ + virtual void fileTransferSucceeded(const uint32_t copyNb, + const std::string &dstUrl) = 0; + + /** + * Notifies this object that the specified file transfer has failed. + * + * @param copyNb The copy number of the source tape file. + * @param dstUrl The URL of the destination disk file. + * @param reason The reason the file transfer failed. + */ + virtual void fileTransferFailed(const uint32_t copyNb, + const std::string &dstUrl, const Exception &reason) = 0; + + /** + * Returns the next retrieval mount for the specified tape or NULL if there + * currenly isn't one. + * + * @param vid The volume-indentifier name of the tape. + * @return The next retrieval mount or NULL if there isn't one. Please note + * that it is the responsibility of the caller to deallocate any returned + * RetrievalMount object. + */ + virtual RetrievalMount *getNextMount(const std::string &vid) = 0; + + /** + * Returns the next batch of retrieval jobs for the specified on-going tape + * mount. + * + * @param mountId The identifier of the mount. + */ + virtual std::list<RetrievalJob> getNextJobsForMount(const std::string &mountId) + = 0; + + /** + * Requests this object to execute any time dependent and asynchronous logic. + */ + virtual void tick() = 0; + +}; // class RetrievalJobQueues + +} // namespace cta