Commit e2247b1c authored by David COME's avatar David COME
Browse files

Added into ReportPackerInterface a list of methods

Changed consequently the types to use the interface instead of the derived type : RecallReportPacker
parent 8babacb5
......@@ -91,7 +91,7 @@ public:
* Main routine: takes each memory block in the fifo and writes it to disk
* @return true if the file has been successfully written false otherwise.
*/
virtual bool execute(RecallReportPacker& reporter,log::LogContext& lc) {
virtual bool execute(ReportPackerInterface<detail::Recall>& reporter,log::LogContext& lc) {
using log::LogContext;
using log::Param;
try{
......
......@@ -26,7 +26,7 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/daemon/ReportPackerInterface.hpp"
namespace castor {
......@@ -36,7 +36,6 @@ namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class RecallReportPacker;
/**
* Abstract class describing the interface for a task that wants to write to disk.
* This is inherited exclusively by DiskWriteFileTask.
......@@ -57,12 +56,12 @@ public:
/**
* Main routine of the task
*/
virtual bool execute(RecallReportPacker& reporter,log::LogContext& lc) =0;
virtual bool execute(ReportPackerInterface<detail::Recall>& reporter,log::LogContext& lc) =0;
/**
* Wait for the end of the task
*/
virtual void waitCompletion() {};
virtual void waitCompletion()=0;
/**
* Destructor
......
......@@ -8,7 +8,7 @@ namespace daemon {
DiskWriteThreadPool::DiskWriteThreadPool(int nbThread, int maxFilesReq, int maxBlocksReq,
RecallReportPacker& report,castor::log::LogContext lc):
ReportPackerInterface<detail::Recall>& report,castor::log::LogContext lc):
m_jobInjector(NULL), m_blocksQueued(0),
m_maxFilesReq(maxFilesReq), m_maxBytesReq(maxBlocksReq),m_reporter(report),m_lc(lc)
{
......@@ -119,7 +119,7 @@ namespace daemon {
++failledWritting;
}
else {
log::LogContext::ScopedParam(_this.m_lc, log::Param("threadID", threadID));
log::LogContext::ScopedParam(lc, log::Param("threadID", threadID));
lc.log(LOG_INFO,"Disk write thread finishing");
break;
}
......
......@@ -45,7 +45,7 @@ namespace daemon {
class DiskWriteThreadPool : public DiskThreadPoolInterface<DiskWriteTaskInterface> {
public:
DiskWriteThreadPool(int nbThread, int maxFilesReq, int maxBlocksReq,
RecallReportPacker& report,castor::log::LogContext lc);
ReportPackerInterface<detail::Recall>& report,castor::log::LogContext lc);
~DiskWriteThreadPool();
void startThreads();
......@@ -92,7 +92,7 @@ private:
uint32_t m_maxFilesReq;
uint64_t m_maxBytesReq;
RecallReportPacker& m_reporter;
ReportPackerInterface<detail::Recall>& m_reporter;
//logging context that will copied by each thread
castor::log::LogContext m_lc;
......
......@@ -36,7 +36,7 @@ namespace tape {
namespace tapeserver {
namespace daemon {
class RecallReportPacker : private ReportPackerInterface<detail::Recall> {
class RecallReportPacker : public ReportPackerInterface<detail::Recall> {
public:
RecallReportPacker(client::ClientInterface & tg,unsigned int reportFilePeriod,log::LogContext lc);
......
......@@ -76,6 +76,35 @@ public:
m_client(tg),m_lc(lc),m_listReports(new FileReportList)
{}
virtual ~ReportPackerInterface(){}
/**
* Create into the MigrationReportPacker a report for the successful migration
* of migratedFile
* @param migratedFile the file successfully migrated
*/
virtual void reportCompletedJob(const FileStruct&) =0;
/**
* Create into the MigrationReportPacker a report for the failled migration
* of migratedFile
* @param migratedFile the file which failled
*/
virtual void reportFailedJob(const FileStruct& ,const std::string&,int)=0;
/**
* Create into the MigrationReportPacker a report for the nominal end of session
*/
virtual void reportEndOfSession() =0;
/**
* Create into the MigrationReportPacker a report for an erroneous end of session
* @param msg The error message
* @param error_code The error code given by the drive
*/
virtual void reportEndOfSessionWithErrors(const std::string,int) =0;
protected:
/**
* Log a set of files independently of the success/failure
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment