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

Added first attempt to insert a real writting in a DiskWriteTask. CMakeList...

Added first attempt to insert a real writting in a DiskWriteTask. CMakeList changed to add the File library to the tapeserver one
parent 207cacca
...@@ -42,6 +42,8 @@ add_library(tapeserver ...@@ -42,6 +42,8 @@ add_library(tapeserver
MigrationReportPacker.cpp MigrationReportPacker.cpp
RecallReportPacker.cpp) RecallReportPacker.cpp)
target_link_libraries(tapeserver File)
add_library(tapeserverdTest add_library(tapeserverdTest
../client/ClientSimulator.cpp ../client/ClientSimulator.cpp
../../tpcp/TpcpCommand.cpp ../../tpcp/TpcpCommand.cpp
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "castor/tape/tapeserver/daemon/DataFifo.hpp" #include "castor/tape/tapeserver/daemon/DataFifo.hpp"
#include "castor/tape/tapeserver/daemon/MemManager.hpp" #include "castor/tape/tapeserver/daemon/MemManager.hpp"
#include "castor/tape/tapeserver/daemon/DataConsumer.hpp" #include "castor/tape/tapeserver/daemon/DataConsumer.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
namespace castor { namespace castor {
namespace tape { namespace tape {
namespace tapeserver { namespace tapeserver {
...@@ -47,15 +47,11 @@ public: ...@@ -47,15 +47,11 @@ public:
* @param blockCount: number of memory blocks that will be used * @param blockCount: number of memory blocks that will be used
* @param mm: memory manager of the session * @param mm: memory manager of the session
*/ */
DiskWriteTask(int fileId, int blockCount, MemoryManager& mm): m_fifo(blockCount), DiskWriteTask(int fileId, int blockCount, const std::string& filePath,MemoryManager& mm):
m_blockCount(blockCount), m_fileId(fileId), m_fifo(blockCount),m_blockCount(blockCount), m_fileId(fileId),
m_memManager(mm) { mm.addClient(&m_fifo); } m_memManager(mm),m_writer(filePath){
mm.addClient(&m_fifo);
/** }
* TODO: Do we need this here?
* @return always false
*/
virtual bool endOfWork() { return false; }
/** /**
* Return the numebr of files to write to disk * Return the numebr of files to write to disk
...@@ -78,6 +74,7 @@ public: ...@@ -78,6 +74,7 @@ public:
MemBlock *mb = m_fifo.popDataBlock(); MemBlock *mb = m_fifo.popDataBlock();
mb->m_fileid = m_fileId; mb->m_fileid = m_fileId;
mb->m_fileBlock = blockId++; mb->m_fileBlock = blockId++;
m_writer.write(mb->m_payload.get(),mb->m_payload.size());
} }
} }
...@@ -132,6 +129,8 @@ private: ...@@ -132,6 +129,8 @@ private:
* Mutex forcing serial access to the fifo * Mutex forcing serial access to the fifo
*/ */
castor::tape::threading::Mutex m_producerProtection; castor::tape::threading::Mutex m_producerProtection;
tape::diskFile::WriteFile m_writer;
}; };
}}}} }}}}
...@@ -55,11 +55,11 @@ void RecallTaskInjector::injectBulkRecalls(const std::vector<castor::tape::tapeg ...@@ -55,11 +55,11 @@ void RecallTaskInjector::injectBulkRecalls(const std::vector<castor::tape::tapeg
LogContext::ScopedParam(m_lc, Param("NSFILENSHOST", (*it)->nshost())), LogContext::ScopedParam(m_lc, Param("NSFILENSHOST", (*it)->nshost())),
LogContext::ScopedParam(m_lc, Param("NSFILEPATH", (*it)->path())) LogContext::ScopedParam(m_lc, Param("NSFILEPATH", (*it)->path()))
}; };
tape::utils::suppresUnusedVariable(sp[0]); tape::utils::suppresUnusedVariable(sp);
m_lc.log(LOG_INFO, "Logged file to recall"); m_lc.log(LOG_INFO, "Logged file to recall");
DiskWriteTask * dwt = new DiskWriteTask((*it)->id(), blockID(**it), m_memManager); DiskWriteTask * dwt = new DiskWriteTask((*it)->id(), blockID(**it),(*it)->path() ,m_memManager);
TapeReadFileTask * trt = new TapeReadFileTask(*dwt, (*it)->fseq(), blockID(**it)); TapeReadFileTask * trt = new TapeReadFileTask(*dwt, (*it)->fseq(), blockID(**it));
m_diskWriter.push(dwt); m_diskWriter.push(dwt);
......
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