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

Added namespaces for the classes

parent 03887530
......@@ -28,7 +28,12 @@
#include "castor/tape/tapeserver/daemon/DataFifo.hpp"
#include "castor/tape/tapeserver/daemon/DataConsumer.hpp"
class DiskReadFileTask: public DiskReadTask {
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class DiskReadFileTask :public DiskReadTask {
public:
DiskReadFileTask(DataConsumer & destination, int fileId, int nbBlocks): m_fileId(fileId),
m_nbBlocks(nbBlocks), m_fifo(destination) {}
......@@ -47,3 +52,6 @@ private:
int m_nbBlocks;
DataConsumer & m_fifo;
};
}}}}
......@@ -26,6 +26,11 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class DiskReadTask {
public:
virtual bool endOfWork() = 0;
......@@ -34,3 +39,5 @@ public:
};
virtual ~DiskReadTask() {}
};
}}}}
......@@ -27,10 +27,15 @@
#include "castor/tape/tapeserver/daemon/DiskReadTask.hpp"
#include "castor/tape/tapeserver/threading/BlockingQueue.hpp"
#include "castor/tape/tapeserver/threading/Threading.hpp"
#include "DiskThreadPoolInterface.hpp"
#include "castor/tape/tapeserver/daemon/DiskThreadPoolInterface.hpp"
#include <vector>
class DiskReadThreadPool : public castor::tape::tapeserver::daemon::DiskThreadPoolInterface<DiskReadTask> {
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class DiskReadThreadPool : public DiskThreadPoolInterface<DiskReadTask> {
public:
DiskReadThreadPool(int nbThread) {
for(int i=0; i<nbThread; i++) {
......@@ -84,3 +89,5 @@ private:
};
std::vector<DiskReadWorkerThread *> m_threads;
};
}}}}
......@@ -29,6 +29,11 @@
#include "castor/tape/tapeserver/daemon/MemManager.hpp"
#include "castor/tape/tapeserver/daemon/DataConsumer.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
/**
* The DiskWriteFileTask is responsible to write a single file onto disk as part of a recall
* session. Being a consumer of memory blocks, it inherits from the DataConsumer class. It also
......@@ -128,3 +133,5 @@ private:
*/
castor::tape::threading::Mutex m_producerProtection;
};
}}}}
......@@ -26,6 +26,11 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
/**
* Abstract class describing the interface for a task that wants to write to disk.
* This is inherited exclusively by DiskWriteFileTask.
......@@ -65,3 +70,5 @@ public:
*/
virtual ~DiskWriteTask() {};
};
}}}}
......@@ -31,7 +31,12 @@
#include "DiskThreadPoolInterface.hpp"
#include <vector>
class DiskWriteThreadPool : public castor::tape::tapeserver::daemon::DiskThreadPoolInterface<DiskWriteTask> {
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class DiskWriteThreadPool : public DiskThreadPoolInterface<DiskWriteTask> {
public:
DiskWriteThreadPool(int nbThread, int maxFilesReq, int maxBlocksReq):
m_jobInjector(NULL), m_filesQueued(0), m_blocksQueued(0),
......@@ -142,3 +147,5 @@ private:
int m_maxBlocksReq;
};
}}}}
......@@ -7,11 +7,12 @@
namespace
{
using namespace castor::tape::tapeserver::daemon;
using namespace castor::tape;
const unsigned int nbFile=5;
const int blockSize=4096;
class FakeClient : public tapeserver::daemon::ClientInterface
class FakeClient : public ClientInterface
{
public:
......@@ -50,7 +51,7 @@ private:
int m_current;
};
class FakeDiskWriteThreadPool : public tapeserver::daemon::DiskThreadPoolInterface<DiskWriteTask>
class FakeDiskWriteThreadPool : public DiskThreadPoolInterface<DiskWriteTask>
{
public:
using tapeserver::daemon::DiskThreadPoolInterface<DiskWriteTask>::m_tasks;
......
......@@ -28,12 +28,17 @@
#include "castor/tape/tapeserver/daemon/DataFifo.hpp"
#include "castor/tape/tapeserver/daemon/MemManager.hpp"
#include "castor/tape/tapeserver/daemon/DataConsumer.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
/**
* The TapeWriteFileTask is responsible to write a single file onto tape as part of a migration
* session. Being a consumer of memory blocks, it inherits from the DataConsumer class. It also
* inherits several methods from the TapeWriteTask (TODO: do we really need this base class?).
*/
class TapeWriteFileTask: public TapeWriteTask, public DataConsumer {
public:
/**
......@@ -130,3 +135,6 @@ private:
*/
int m_blockCount;
};
}}}}
......@@ -50,7 +50,7 @@ int idToSize(int id) {
}
int main(void) {
using namespace castor::tape;
//try {
// while (1) new char[100000];
//} catch (std::exception e) {
......@@ -65,13 +65,13 @@ int main(void) {
MigrationReportPacker mrp(tg);
mrp.startThreads();
TapeWriteSingleThread tapeThread(drive, mrp, maxFilesBeforeFlush, maxBlocksBeforeFlush);
DiskReadThreadPool diskThreadPool(diskThreads);
tapeserver::daemon::DiskReadThreadPool diskThreadPool(diskThreads);
tapeThread.startThreads();
diskThreadPool.startThreads();
for (int i = 0; i < filesNumber; i++) {
int size = idToSize(i);
TapeWriteFileTask * twt = new TapeWriteFileTask(i, size, mm);
DiskReadFileTask * dwt = new DiskReadFileTask(*twt, i + 1000, size);
tapeserver::daemon::TapeWriteFileTask * twt = new tapeserver::daemon::TapeWriteFileTask(i, size, mm);
tapeserver::daemon::DiskReadFileTask * dwt = new tapeserver::daemon::DiskReadFileTask(*twt, i + 1000, size);
tapeThread.push(twt);
diskThreadPool.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