Commit 3fb87139 authored by Eric Cano's avatar Eric Cano
Browse files

Added reporting of size of file, and path of disk copy for recalls.

parent 6357c57e
......@@ -88,7 +88,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc) {
break;
}
} //end of while(1)
reporter.reportCompletedJob(*m_recallingFile,checksum);
reporter.reportCompletedJob(*m_recallingFile,checksum,m_stats.dataVolume);
m_stats.waitReportingTime+=localTime.secs(utils::Timer::resetCounter);
logWithStat(LOG_DEBUG, "File successfully transfered to disk",lc);
......
......@@ -38,7 +38,7 @@ namespace unitTests{
using namespace castor::tape::tapeserver::daemon;
using namespace castor::tape::tapeserver::client;
struct MockRecallReportPacker : public RecallReportPacker {
MOCK_METHOD2(reportCompletedJob,void(const FileStruct&,unsigned long));
MOCK_METHOD3(reportCompletedJob,void(const FileStruct&,u_int32_t,u_int64_t));
MOCK_METHOD3(reportFailedJob, void(const FileStruct& ,const std::string&,int));
MOCK_METHOD0(reportEndOfSession, void());
MOCK_METHOD2(reportEndOfSessionWithErrors, void(const std::string,int));
......
......@@ -38,7 +38,7 @@ namespace unitTests{
using namespace castor::tape::tapeserver::daemon;
using namespace castor::tape::tapeserver::client;
struct MockRecallReportPacker : public RecallReportPacker {
MOCK_METHOD2(reportCompletedJob,void(const FileStruct&,unsigned long));
MOCK_METHOD3(reportCompletedJob,void(const FileStruct&,u_int32_t,u_int64_t));
MOCK_METHOD3(reportFailedJob, void(const FileStruct& ,const std::string&,int));
MOCK_METHOD0(reportEndOfSession, void());
MOCK_METHOD2(reportEndOfSessionWithErrors, void(const std::string,int));
......@@ -57,7 +57,7 @@ namespace unitTests{
castor::log::LogContext lc(log);
MockRecallReportPacker report(client,lc);
EXPECT_CALL(report,reportCompletedJob(_,_)).Times(5);
EXPECT_CALL(report,reportCompletedJob(_,_,_)).Times(5);
//EXPECT_CALL(tskInjectorl,requestInjection(_,_,_)).Times(2);
EXPECT_CALL(report,reportEndOfSession()).Times(1);
......
......@@ -59,8 +59,9 @@ RecallReportPacker::~RecallReportPacker(){
//------------------------------------------------------------------------------
//reportCompletedJob
//------------------------------------------------------------------------------
void RecallReportPacker::reportCompletedJob(const FileStruct& recalledFile,unsigned long checksum){
std::auto_ptr<Report> rep(new ReportSuccessful(recalledFile,checksum));
void RecallReportPacker::reportCompletedJob(const FileStruct& recalledFile,
u_int32_t checksum, u_int64_t size){
std::auto_ptr<Report> rep(new ReportSuccessful(recalledFile,checksum,size));
castor::server::MutexLocker ml(&m_producterProtection);
m_fifo.push(rep.release());
}
......@@ -106,6 +107,8 @@ void RecallReportPacker::ReportSuccessful::execute(RecallReportPacker& parent){
successRecall->setId(m_recalledFile.id());
successRecall->setNshost(m_recalledFile.nshost());
successRecall->setFileid(m_recalledFile.fileid());
successRecall->setPath(m_recalledFile.path());
successRecall->setFileSize(m_size);
//WARNING : ad hoc name of checksum algorithm
successRecall->setChecksumName("adler32");
......
......@@ -54,7 +54,7 @@ public:
* @param checksum the checksum the DWT has computed for the file
*/
virtual void reportCompletedJob(const FileStruct& recalledFile,
unsigned long checksum);
u_int32_t checksum, u_int64_t size);
/**
* Create into the MigrationReportPacker a report for the failed migration
......@@ -101,10 +101,12 @@ private:
};
class ReportSuccessful : public Report {
const FileStruct m_recalledFile;
unsigned long m_checksum;
u_int32_t m_checksum;
u_int64_t m_size;
public:
ReportSuccessful(const FileStruct& file,unsigned long checksum):
Report(false),m_recalledFile(file),m_checksum(checksum){}
ReportSuccessful(const FileStruct& file,u_int32_t checksum,
u_int64_t size):
Report(false),m_recalledFile(file),m_checksum(checksum),m_size(size){}
virtual void execute(RecallReportPacker& _this);
};
class ReportError : public Report {
......
......@@ -39,8 +39,8 @@ TEST(castor_tape_tapeserver_daemon, RecallReportPackerNominal) {
rrp.startThreads();
tapegateway::FileToRecallStruct recalledFiled;
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportEndOfSession();
rrp.waitThread();
......@@ -61,9 +61,9 @@ TEST(castor_tape_tapeserver_daemon, RecallReportPackerCumulated) {
rrp.startThreads();
tapegateway::FileToRecallStruct recalledFiled;
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportEndOfSession();
rrp.waitThread();
......@@ -87,9 +87,9 @@ TEST(castor_tape_tapeserver_daemon, RecallReportPackerBadBadEnd) {
rrp.startThreads();
tapegateway::FileToRecallStruct recalledFiled;
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportFailedJob(recalledFiled,error_msg,error_code);
rrp.reportEndOfSessionWithErrors(error_msg,error_code);
rrp.waitThread();
......@@ -117,9 +117,9 @@ TEST(castor_tape_tapeserver_daemon, RecallReportPackerBadGoodEnd) {
tapegateway::FileToRecallStruct recalledFiled;
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportFailedJob(recalledFiled,error_msg,-1);
rrp.reportEndOfSession();
rrp.waitThread();
......@@ -146,8 +146,8 @@ TEST(castor_tape_tapeserver_daemon, RecallReportPackerGoodBadEnd) {
rrp.startThreads();
tapegateway::FileToRecallStruct recalledFiled;
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportEndOfSessionWithErrors(error_msg,error_code);
rrp.waitThread();
......@@ -174,8 +174,8 @@ TEST(castor_tape_tapeserver_daemon, RecallReportPackerFaillure) {
rrp.startThreads();
tapegateway::FileToRecallStruct recalledFiled;
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportCompletedJob(recalledFiled,0,0);
rrp.reportEndOfSessionWithErrors(error_msg,error_code);
rrp.waitThread();
......
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