Commit 1946ef83 authored by David COME's avatar David COME
Browse files

Added function to read/write data from WriteFile/ReadFile

parent 023d9d95
......@@ -95,7 +95,7 @@ public:
using log::LogContext;
using log::Param;
try{
tape::diskFile::WriteFile writer(m_recallingFile->path());
tape::diskFile::WriteFile ourFile(m_recallingFile->path());
int blockId = 0;
while(!m_fifo.finished()) {
......@@ -114,9 +114,9 @@ public:
lc.log(LOG_ERR,"received a bad block for writing");
throw castor::tape::Exception("received a bad block for writing");
}
writer.write(mb->m_payload.get(),mb->m_payload.size());
mb->m_payload.write(ourFile);
}
writer.close();
ourFile.close();
reporter.reportCompletedJob(*m_recallingFile);
return true;
}
......
......@@ -25,6 +25,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include <memory>
namespace castor {
......@@ -57,12 +58,27 @@ public:
char* get(){
return m_payload;
}
char const* get() const {
return m_payload;
}
void read(tape::diskFile::ReadFile& from){
m_size = from.read(m_payload,m_capacity);
}
void write(tape::diskFile::WriteFile& to){
to.write(m_payload,m_size);
}
private:
char* m_payload;
size_t m_capacity;
size_t m_size;
};
class MemBlock {
public:
static const int uninitialised_value = -1;
......
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