Commit 1787eea4 authored by Eric Cano's avatar Eric Cano
Browse files

Moved classes DataConsumer, DataFifo, MemException,

MemBlock, MemManager, MemManagerClient, MigrationJob,
TapeReadFileTask, TapeReadTask, TapeSingleThreadInterface,
TapeReadSingleThread, TapeWriteTask, TaskInjector
into castor::tape::tapeserver::daemon
parent 86e2ec44
......@@ -31,6 +31,12 @@
* has two methods: "pushDataBlock" used to put in the consumer's fifo a new full memory block
* to consume, and "getFreeBlock" used by client code two reclaim the consumed memory block.
*/
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class DataConsumer {
public:
......@@ -51,3 +57,8 @@ public:
*/
virtual ~DataConsumer() {}
};
}
}
}
}
......@@ -30,6 +30,11 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/exception/Exception.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
/* A fixed payload FIFO: at creation time, we know how many blocks will go through the FIFO.
The provide block method return true as long as it still needs more block. False when last
block is provided (and throws an exception after that).
......@@ -101,3 +106,8 @@ private:
castor::tape::threading::BlockingQueue<MemBlock *> m_freeBlocks;
castor::tape::threading::BlockingQueue<MemBlock *> m_dataBlocks;
};
}
}
}
}
......@@ -30,6 +30,11 @@
#include <string.h>
#include <stdio.h>
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class MemException: public std::exception {
public:
MemException(const std::string & what): m_what(what) {}
......@@ -42,3 +47,9 @@ private:
};
void errnoExeptLauncher(int ret, void * obj);
}
}
}
}
......@@ -27,6 +27,11 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include <memory>
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class Payload
{
public:
......@@ -81,3 +86,8 @@ public:
int m_tapeFileBlock;
};
}
}
}
}
......@@ -31,6 +31,10 @@
#include "castor/exception/Exception.hpp"
#include <iostream>
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
/**
* The memory manager is responsible for allocating memory blocks and distributing
* the free ones around to any class in need.
......@@ -163,3 +167,9 @@ private:
}
};
}
}
}
}
......@@ -28,6 +28,11 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/exception/Exception.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class MemoryManagerClient {
public:
virtual bool endOfWork() throw() = 0;
......@@ -36,3 +41,8 @@ public:
};
virtual ~MemoryManagerClient() throw() {}
};
}
}
}
}
......@@ -24,6 +24,11 @@
#pragma once
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class MigrationJob{
public:
MigrationJob(int fId, int fs, int bCnt): fileId(fId), fSeq(fs), blockCount(bCnt) {}
......@@ -31,3 +36,8 @@ public:
int fSeq;
int blockCount;
};
}
}
}
}
......@@ -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 {
class TapeReadFileTask: public TapeReadTask {
public:
TapeReadFileTask(DataConsumer & destination, int fSeq, int blockCount): m_fSeq(fSeq),
......@@ -52,3 +57,7 @@ private:
int m_blockCount;
DataConsumer & m_fifo;
};
}
}
}
}
......@@ -32,6 +32,10 @@
#include <iostream>
#include <stdio.h>
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class TapeReadSingleThread : public TapeSingleThreadInterface<TapeReadTask>{
public:
TapeReadSingleThread(castor::tape::drives::DriveInterface & drive):
......@@ -51,3 +55,8 @@ private:
}
}
};
}
}
}
}
......@@ -27,6 +27,10 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/drive/Drive.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class TapeReadTask {
public:
virtual bool endOfWork() = 0;
......@@ -35,3 +39,7 @@ public:
};
virtual ~TapeReadTask() {}
};
}
}
}
}
......@@ -9,8 +9,13 @@
#define TAPESINGLETHREADINTERFACE_HPP
#include "castor/tape/tapeserver/threading/Threading.hpp"
#include "castor/tape/tapeserver/threading/BlockingQueue.hpp"
#include "castor/tape/tapeserver/drive/Drive.hpp"
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
template <class Task> class TapeSingleThreadInterface : private castor::tape::threading::Thread
{
protected:
......@@ -31,4 +36,9 @@ public:
{}
};
}
}
}
}
#endif /* TAPESINGLETHREADINTERFACE_HPP */
......@@ -27,6 +27,11 @@
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/drive/Drive.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.
......@@ -66,3 +71,7 @@ public:
*/
virtual ~TapeWriteTask() {};
};
}
}
}
}
......@@ -24,8 +24,19 @@
#pragma once
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class TaskInjector{
public:
virtual void requestInjection(int maxFiles, int maxBlocks, bool lastCall) = 0;
virtual ~TaskInjector() {}
};
}
}
}
}
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