Commit 56104d85 authored by David COME's avatar David COME
Browse files

Namespaces are now right for all the files in castor/tape/tapeserver/drive/

parent 89e7a7d4
......@@ -46,8 +46,8 @@ int castor::tape::tapeserver::daemon::CleanerSession::clean(const std::string &v
castor::tape::SCSI::DeviceInfo driveInfo = dv.findBySymlink(m_driveConfig.devFilename);
// Instantiate the drive object
std::auto_ptr<castor::tape::drives::DriveInterface> drive(
castor::tape::drives::DriveFactory(driveInfo, m_sysWrapper));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive(
castor::tape::tapeserver::drives::DriveFactory(driveInfo, m_sysWrapper));
if(NULL == drive.get()) {
castor::exception::Exception ex;
......
......@@ -171,7 +171,7 @@ int castor::tape::tapeserver::daemon::DataTransferSession::executeRead(log::LogC
// file to recall.
// findDrive does not throw exceptions (it catches them to log errors)
// A NULL pointer is returned on failure
std::auto_ptr<castor::tape::drives::DriveInterface> drive(findDrive(m_driveConfig,lc));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive(findDrive(m_driveConfig,lc));
if(!drive.get()) return 0;
// We can now start instantiating all the components of the data path
......@@ -261,7 +261,7 @@ int castor::tape::tapeserver::daemon::DataTransferSession::executeWrite(log::Log
// in order to get the task injector ready to check if we actually have a
// file to migrate.
// 1) Get hold of the drive error logs are done inside the findDrive function
std::auto_ptr<castor::tape::drives::DriveInterface> drive(findDrive(m_driveConfig,lc));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive(findDrive(m_driveConfig,lc));
if (!drive.get()) return 0;
// Once we got hold of the drive, we can run the session
{
......@@ -376,7 +376,7 @@ void castor::tape::tapeserver::daemon::DataTransferSession::executeDump(log::Log
* @param lc For logging purpose
* @return the drive if found, NULL otherwise
*/
castor::tape::drives::DriveInterface *
castor::tape::tapeserver::drives::DriveInterface *
castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const utils::DriveConfig
&driveConfig, log::LogContext& lc) {
// Find the drive in the system's SCSI devices
......@@ -438,8 +438,8 @@ castor::tape::tapeserver::daemon::DataTransferSession::findDrive(const utils::Dr
return NULL;
}
try {
std::auto_ptr<castor::tape::drives::DriveInterface> drive;
drive.reset(castor::tape::drives::DriveFactory(driveInfo, m_sysWrapper));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive;
drive.reset(castor::tape::tapeserver::drives::DriveFactory(driveInfo, m_sysWrapper));
if (drive.get()) drive->librarySlot = driveConfig.librarySlot;
return drive.release();
} catch (castor::exception::Exception & e) {
......
......@@ -137,7 +137,7 @@ namespace daemon {
/** utility to find the drive on the system. This function logs
* all errors and hence does not throw exceptions. It returns NULL
* in case of failure. */
castor::tape::drives::DriveInterface * findDrive(
castor::tape::tapeserver::drives::DriveInterface * findDrive(
const utils::DriveConfig &driveConfig,log::LogContext & lc);
/** sub-part of execute for the read sessions */
......
......@@ -108,7 +108,7 @@ TEST(tapeServer, DataTransferSessionGooddayRecall) {
//delete is unnecessary
//pointer with ownership will be passed to the application,
//which will do the delete
mockSys.fake.m_pathToDrive["/dev/nst0"] = new castor::tape::drives::FakeDrive;
mockSys.fake.m_pathToDrive["/dev/nst0"] = new castor::tape::tapeserver::drives::FakeDrive;
// We can prepare files for reading on the drive
{
......@@ -211,7 +211,7 @@ TEST(tapeServer, DataTransferSessionWrongRecall) {
//delete is unnecessary
//pointer with ownership will be passed to the application,
//which will do the delete
mockSys.fake.m_pathToDrive["/dev/nst0"] = new castor::tape::drives::FakeDrive;
mockSys.fake.m_pathToDrive["/dev/nst0"] = new castor::tape::tapeserver::drives::FakeDrive;
// We can prepare files for reading on the drive
{
......@@ -428,7 +428,7 @@ TEST(tapeServer, DataTransferSessionGooddayMigration) {
//delete is unnecessary
//pointer with ownership will be passed to the application,
//which will do the delete
mockSys.fake.m_pathToDrive["/dev/nst0"] = new castor::tape::drives::FakeDrive;
mockSys.fake.m_pathToDrive["/dev/nst0"] = new castor::tape::tapeserver::drives::FakeDrive;
// Just label the tape
castor::tape::tapeFile::LabelSession ls(*mockSys.fake.m_pathToDrive["/dev/nst0"],
......
......@@ -93,15 +93,15 @@ void castor::tape::tapeserver::daemon::LabelSession::checkIfVidStillHasSegments(
//------------------------------------------------------------------------------
// getDriveObject
//------------------------------------------------------------------------------
std::auto_ptr<castor::tape::drives::DriveInterface>
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface>
castor::tape::tapeserver::daemon::LabelSession::getDriveObject() {
castor::tape::SCSI::DeviceVector dv(m_sysWrapper);
castor::tape::SCSI::DeviceInfo driveInfo =
dv.findBySymlink(m_driveConfig.devFilename);
// Instantiate the drive object
std::auto_ptr<castor::tape::drives::DriveInterface> drive(
castor::tape::drives::DriveFactory(driveInfo, m_sysWrapper));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive(
castor::tape::tapeserver::drives::DriveFactory(driveInfo, m_sysWrapper));
if(NULL == drive.get()) {
castor::exception::Exception ex;
......@@ -124,7 +124,7 @@ std::auto_ptr<castor::tape::drives::DriveInterface>
//------------------------------------------------------------------------------
// waitUntilDriveReady
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::LabelSession::waitUntilDriveReady(castor::tape::drives::DriveInterface *drive) {
void castor::tape::tapeserver::daemon::LabelSession::waitUntilDriveReady(castor::tape::tapeserver::drives::DriveInterface *drive) {
std::list<log::Param> params;
params.push_back(log::Param("uid", m_request.uid));
params.push_back(log::Param("gid", m_request.gid));
......@@ -143,7 +143,7 @@ void castor::tape::tapeserver::daemon::LabelSession::waitUntilDriveReady(castor:
//------------------------------------------------------------------------------
// labelTheTape
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::LabelSession::labelTheTape(castor::tape::drives::DriveInterface *drive) {
void castor::tape::tapeserver::daemon::LabelSession::labelTheTape(castor::tape::tapeserver::drives::DriveInterface *drive) {
// We can now start labelling
castor::tape::tapeFile::LabelSession ls(*drive, m_request.vid, m_force);
......@@ -157,7 +157,7 @@ void castor::tape::tapeserver::daemon::LabelSession::executeLabel() {
task << "label tape " << m_request.vid << " for gid=" << m_request.gid <<
" uid=" << m_request.uid << " in drive " << m_request.drive;
std::auto_ptr<castor::tape::drives::DriveInterface> drive;
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive;
log::Param params[] = {
log::Param("uid", m_request.uid),
......
......@@ -106,7 +106,7 @@ namespace daemon {
*
* @return The drive object.
*/
std::auto_ptr<castor::tape::drives::DriveInterface> getDriveObject();
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> getDriveObject();
/**
* Check the tape drive write-ability and waits for it to become ready
......@@ -114,14 +114,14 @@ namespace daemon {
* @param drive The drive object pointer
* @return
*/
void waitUntilDriveReady(castor::tape::drives::DriveInterface *drive);
void waitUntilDriveReady(castor::tape::tapeserver::drives::DriveInterface *drive);
/**
* The function carrying out the actual labeling
* @param drive The drive object pointer
* @return
*/
void labelTheTape(castor::tape::drives::DriveInterface *drive);
void labelTheTape(castor::tape::tapeserver::drives::DriveInterface *drive);
/**
* The object representing the rmcd daemon.
......
......@@ -59,7 +59,7 @@ class FakeSingleTapeReadThread : public TapeSingleThreadInterface<TapeReadTask>
public:
using TapeSingleThreadInterface<TapeReadTask>::m_tasks;
FakeSingleTapeReadThread(castor::tape::drives::DriveInterface& drive,
FakeSingleTapeReadThread(castor::tape::tapeserver::drives::DriveInterface& drive,
castor::legacymsg::RmcProxy & rmc,
castor::tape::tapeserver::daemon::TapeServerReporter & tsr,
const castor::tape::tapeserver::client::ClientInterface::VolumeInfo& volInfo,
......@@ -87,7 +87,7 @@ TEST(castor_tape_tapeserver_daemon, RecallTaskInjectorNominal) {
castor::log::StringLogger log("castor_tape_tapeserver_daemon_RecallTaskInjectorTest");
castor::log::LogContext lc(log);
RecallMemoryManager mm(50U,50U,lc);
castor::tape::drives::FakeDrive drive;
castor::tape::tapeserver::drives::FakeDrive drive;
FakeClient client(nbCalls);
FakeDiskWriteThreadPool diskWrite(lc);
castor::legacymsg::RmcProxyDummy rmc;
......@@ -144,7 +144,7 @@ TEST(castor_tape_tapeserver_daemon, RecallTaskInjectorNoFiles) {
castor::log::StringLogger log("castor_tape_tapeserver_daemon_RecallTaskInjectorTest");
castor::log::LogContext lc(log);
RecallMemoryManager mm(50U,50U,lc);
castor::tape::drives::FakeDrive drive;
castor::tape::tapeserver::drives::FakeDrive drive;
FakeClient client(0);
FakeDiskWriteThreadPool diskWrite(lc);
castor::legacymsg::RmcProxyDummy rmc;
......
......@@ -56,7 +56,7 @@ public:
/**
*
*/
TapeReadSingleThread(castor::tape::drives::DriveInterface & drive,
TapeReadSingleThread(castor::tape::tapeserver::drives::DriveInterface & drive,
castor::legacymsg::RmcProxy & rmc,
TapeServerReporter & initialProcess,
const client::ClientInterface::VolumeInfo& volInfo,
......
......@@ -66,7 +66,7 @@ protected:
* An interface to manipulate the drive to manipulate the tape
* with the requested vid
*/
castor::tape::drives::DriveInterface & m_drive;
castor::tape::tapeserver::drives::DriveInterface & m_drive;
/** Reference to the mount interface */
castor::legacymsg::RmcProxy & m_rmc;
......@@ -199,7 +199,7 @@ public:
* @param capUtils
* @param lc lc The log context, later on copied
*/
TapeSingleThreadInterface(castor::tape::drives::DriveInterface & drive,
TapeSingleThreadInterface(castor::tape::tapeserver::drives::DriveInterface & drive,
castor::legacymsg::RmcProxy & rmc,
TapeServerReporter & tsr,
const client::ClientInterface::VolumeInfo& volInfo,
......
......@@ -26,7 +26,7 @@
#include "castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp"
castor::tape::tapeserver::daemon::TapeWriteSingleThread::TapeWriteSingleThread(
castor::tape::drives::DriveInterface & drive,
castor::tape::tapeserver::drives::DriveInterface & drive,
castor::legacymsg::RmcProxy & rmc,
TapeServerReporter & tsr,
const client::ClientInterface::VolumeInfo& volInfo,
......
......@@ -60,7 +60,7 @@ public:
* @param lastFseq the last fSeq
*/
TapeWriteSingleThread(
castor::tape::drives::DriveInterface & drive,
castor::tape::tapeserver::drives::DriveInterface & drive,
castor::legacymsg::RmcProxy & rmc,
TapeServerReporter & tsr,
const client::ClientInterface::VolumeInfo& volInfo,
......@@ -152,7 +152,7 @@ private:
const uint64_t m_bytesBeforeFlush;
///an interface for manipulating all type of drives
castor::tape::drives::DriveInterface& m_drive;
castor::tape::tapeserver::drives::DriveInterface& m_drive;
///the object that will send reports to the client
MigrationReportPacker & m_reportPacker;
......
......@@ -25,7 +25,9 @@
#include "castor/tape/tapeserver/drive/FakeDrive.hpp"
#include "castor/tape/tapeserver/drive/DriveGeneric.hpp"
using namespace castor::tape;
namespace castor {
namespace tape {
namespace tapeserver {
drives::DriveInterface * drives::DriveFactory(SCSI::DeviceInfo di,
System::virtualWrapper& sw) {
......@@ -822,3 +824,5 @@ drives::compressionStats drives::DriveIBM3592::getCompression() {
return driveCompressionStats;
}
}}}
\ No newline at end of file
......@@ -26,6 +26,7 @@
namespace castor {
namespace tape {
namespace tapeserver {
namespace drives {
/**
* Class abstracting the tape drives. This class is templated to allow the use
......@@ -349,4 +350,4 @@ namespace drives {
virtual compressionStats getCompression() ;
};
}}}
\ No newline at end of file
}}}}
\ No newline at end of file
......@@ -37,6 +37,7 @@
*/
namespace castor {
namespace tape {
namespace tapeserver {
namespace drives {
/**
......@@ -184,5 +185,6 @@ namespace drives {
System::virtualWrapper & sw);
} // namespace drives
} // namespace tapeserver
} // namespace tape
} // namespace castor
......@@ -69,9 +69,9 @@ TEST(castor_tape_drives_Drive, OpensCorrectly) {
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
std::string expected_classid (typeid(castor::tape::drives::DriveT10000).name());
std::auto_ptr<castor::tape::drives::DriveInterface>drive(
castor::tape::drives::DriveFactory(*i, sysWrapper));
std::string expected_classid (typeid(castor::tape::tapeserver::drives::DriveT10000).name());
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface>drive(
castor::tape::tapeserver::drives::DriveFactory(*i, sysWrapper));
std::string found_classid (typeid(*drive).name());
ASSERT_EQ(expected_classid, found_classid);
}
......@@ -102,9 +102,9 @@ TEST(castor_tape_drives_Drive, getPositionInfoAndPositionToLogicalObject) {
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
std::auto_ptr<castor::tape::drives::DriveInterface> drive (
castor::tape::drives::DriveFactory(*i, sysWrapper));
castor::tape::drives::positionInfo posInfo;
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive (
castor::tape::tapeserver::drives::DriveFactory(*i, sysWrapper));
castor::tape::tapeserver::drives::positionInfo posInfo;
EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(1);
posInfo = drive->getPositionInfo();
......@@ -151,8 +151,8 @@ TEST(castor_tape_drives_Drive, setDensityAndCompression) {
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
std::auto_ptr<castor::tape::drives::DriveInterface> drive (
castor::tape::drives::DriveFactory(*i, sysWrapper));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive (
castor::tape::tapeserver::drives::DriveFactory(*i, sysWrapper));
EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(2);
drive->setDensityAndCompression();
......@@ -195,8 +195,8 @@ TEST(castor_tape_drives_Drive, setStDriverOptions) {
castor::tape::SCSI::DeviceVector dl(sysWrapper);
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin(); i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
std::auto_ptr<castor::tape::drives::DriveInterface> drive (
castor::tape::drives::DriveFactory(*i, sysWrapper));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive (
castor::tape::tapeserver::drives::DriveFactory(*i, sysWrapper));
EXPECT_CALL(sysWrapper, ioctl(_,_,An<struct mtop *>())).Times(1);
drive->setSTBufferWrite(true);
......@@ -231,9 +231,9 @@ TEST(castor_tape_drives_Drive, getDeviceInfo) {
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
std::auto_ptr<castor::tape::drives::DriveInterface> drive (
castor::tape::drives::DriveFactory(*i, sysWrapper));
castor::tape::drives::deviceInfo devInfo;
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive (
castor::tape::tapeserver::drives::DriveFactory(*i, sysWrapper));
castor::tape::tapeserver::drives::deviceInfo devInfo;
EXPECT_CALL(sysWrapper, ioctl(_,_,An<sg_io_hdr_t*>())).Times(2);
devInfo = drive->getDeviceInfo();
......@@ -270,11 +270,11 @@ TEST(castor_tape_drives_Drive, getCompressionAndClearCompressionStats) {
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
castor::tape::drives::DriveGeneric *drive;
castor::tape::drives::compressionStats comp;
castor::tape::tapeserver::drives::DriveGeneric *drive;
castor::tape::tapeserver::drives::compressionStats comp;
{
drive = new castor::tape::drives::DriveT10000(*i, sysWrapper);
drive = new castor::tape::tapeserver::drives::DriveT10000(*i, sysWrapper);
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
comp = drive->getCompression();
......@@ -296,7 +296,7 @@ TEST(castor_tape_drives_Drive, getCompressionAndClearCompressionStats) {
delete drive;
}
{
drive = new castor::tape::drives::DriveIBM3592(*i, sysWrapper);
drive = new castor::tape::tapeserver::drives::DriveIBM3592(*i, sysWrapper);
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
comp = drive->getCompression();
......@@ -318,7 +318,7 @@ TEST(castor_tape_drives_Drive, getCompressionAndClearCompressionStats) {
delete drive;
}
{
drive = new castor::tape::drives::DriveLTO(*i, sysWrapper);
drive = new castor::tape::tapeserver::drives::DriveLTO(*i, sysWrapper);
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
comp = drive->getCompression();
......@@ -369,8 +369,8 @@ TEST(castor_tape_drives_Drive, getTapeAlerts) {
for (std::vector<castor::tape::SCSI::DeviceInfo>::iterator i = dl.begin();
i != dl.end(); i++) {
if (castor::tape::SCSI::Types::tape == i->type) {
std::auto_ptr<castor::tape::drives::DriveInterface> drive (
castor::tape::drives::DriveFactory(*i, sysWrapper));
std::auto_ptr<castor::tape::tapeserver::drives::DriveInterface> drive (
castor::tape::tapeserver::drives::DriveFactory(*i, sysWrapper));
EXPECT_CALL(sysWrapper, ioctl(_, _, An<sg_io_hdr_t*>())).Times(1);
std::vector<std::string> alerts = drive->getTapeAlerts();
ASSERT_EQ(3U, alerts.size());
......
......@@ -27,16 +27,17 @@ namespace {
const long unsigned int max_fake_drive_record_length = 1000;
const char filemark[] = "";
}
castor::tape::drives::FakeDrive::FakeDrive() throw() : m_current_position(0) {
castor::tape::tapeserver::drives::FakeDrive::FakeDrive() throw() : m_current_position(0) {
m_tape.reserve(max_fake_drive_record_length);
}
castor::tape::drives::compressionStats castor::tape::drives::FakeDrive::getCompression() {
castor::tape::tapeserver::drives::compressionStats castor::tape::tapeserver::drives::FakeDrive::getCompression() {
throw Exception("FakeDrive::getCompression Not implemented");
}
void castor::tape::drives::FakeDrive::clearCompressionStats() {
void castor::tape::tapeserver::drives::FakeDrive::clearCompressionStats() {
throw Exception("FakeDrive::clearCompressionStats Not implemented");
}
castor::tape::drives::deviceInfo castor::tape::drives::FakeDrive::getDeviceInfo() {
castor::tape::tapeserver::drives::deviceInfo castor::tape::tapeserver::drives::FakeDrive::getDeviceInfo() {
deviceInfo devInfo;
devInfo.product = "Fake Drv";
devInfo.productRevisionLevel = "0.1";
......@@ -44,13 +45,13 @@ castor::tape::drives::deviceInfo castor::tape::drives::FakeDrive::getDeviceInfo(
devInfo.serialNumber = "123456";
return devInfo;
}
std::string castor::tape::drives::FakeDrive::getSerialNumber() {
std::string castor::tape::tapeserver::drives::FakeDrive::getSerialNumber() {
throw Exception("FakeDrive::getSerialNumber Not implemented");
}
void castor::tape::drives::FakeDrive::positionToLogicalObject(uint32_t blockId) {
void castor::tape::tapeserver::drives::FakeDrive::positionToLogicalObject(uint32_t blockId) {
m_current_position = blockId;
}
castor::tape::drives::positionInfo castor::tape::drives::FakeDrive::getPositionInfo() {
castor::tape::tapeserver::drives::positionInfo castor::tape::tapeserver::drives::FakeDrive::getPositionInfo() {
positionInfo pos;
pos.currentPosition = m_current_position;
pos.dirtyBytesCount = 0;
......@@ -58,31 +59,31 @@ castor::tape::drives::positionInfo castor::tape::drives::FakeDrive::getPositionI
pos.oldestDirtyObject = 0;
return pos;
}
std::vector<std::string> castor::tape::drives::FakeDrive::getTapeAlerts() {
std::vector<std::string> castor::tape::tapeserver::drives::FakeDrive::getTapeAlerts() {
throw Exception("FakeDrive::getTapeAlerts Not implemented");
}
void castor::tape::drives::FakeDrive::setDensityAndCompression(bool compression, unsigned char densityCode) {
void castor::tape::tapeserver::drives::FakeDrive::setDensityAndCompression(bool compression, unsigned char densityCode) {
throw Exception("FakeDrive::setDensityAndCompression Not implemented");
}
castor::tape::drives::driveStatus castor::tape::drives::FakeDrive::getDriveStatus() {
castor::tape::tapeserver::drives::driveStatus castor::tape::tapeserver::drives::FakeDrive::getDriveStatus() {
throw Exception("FakeDrive::getDriveStatus Not implemented");
}
castor::tape::drives::tapeError castor::tape::drives::FakeDrive::getTapeError() {
castor::tape::tapeserver::drives::tapeError castor::tape::tapeserver::drives::FakeDrive::getTapeError() {
throw Exception("FakeDrive::getTapeError Not implemented");
}
void castor::tape::drives::FakeDrive::setSTBufferWrite(bool bufWrite) {
void castor::tape::tapeserver::drives::FakeDrive::setSTBufferWrite(bool bufWrite) {
throw Exception("FakeDrive::setSTBufferWrite Not implemented");
}
void castor::tape::drives::FakeDrive::fastSpaceToEOM(void) {
void castor::tape::tapeserver::drives::FakeDrive::fastSpaceToEOM(void) {
m_current_position = m_tape.size()-1;
}
void castor::tape::drives::FakeDrive::rewind(void) {
void castor::tape::tapeserver::drives::FakeDrive::rewind(void) {
m_current_position = 0;
}
void castor::tape::drives::FakeDrive::spaceToEOM(void) {
void castor::tape::tapeserver::drives::FakeDrive::spaceToEOM(void) {
m_current_position = m_tape.size()-1;
}
void castor::tape::drives::FakeDrive::spaceFileMarksBackwards(size_t count) {
void castor::tape::tapeserver::drives::FakeDrive::spaceFileMarksBackwards(size_t count) {
if(!count) return;
size_t countdown = count;
std::vector<std::string>::size_type i=0;
......@@ -94,7 +95,7 @@ void castor::tape::drives::FakeDrive::spaceFileMarksBackwards(size_t count) {
}
m_current_position = i-1; //BOT side of the filemark
}
void castor::tape::drives::FakeDrive::spaceFileMarksForward(size_t count) {
void castor::tape::tapeserver::drives::FakeDrive::spaceFileMarksForward(size_t count) {
if(!count) return;
size_t countdown = count;
std::vector<std::string>::size_type i=0;
......@@ -106,12 +107,12 @@ void castor::tape::drives::FakeDrive::spaceFileMarksForward(size_t count) {
}
m_current_position = i; //EOT side of the filemark
}
void castor::tape::drives::FakeDrive::unloadTape(void) {
void castor::tape::tapeserver::drives::FakeDrive::unloadTape(void) {
}
void castor::tape::drives::FakeDrive::flush(void) {
void castor::tape::tapeserver::drives::FakeDrive::flush(void) {
//already flushing
}
void castor::tape::drives::FakeDrive::writeSyncFileMarks(size_t count) {
void castor::tape::tapeserver::drives::FakeDrive::writeSyncFileMarks(size_t count) {
if(count==0) return;
m_tape.resize(m_current_position+count);
for(size_t i=0; i<count; ++i) {
......@@ -124,15 +125,15 @@ void castor::tape::drives::FakeDrive::writeSyncFileMarks(size_t count) {
m_current_position++;
}
}
void castor::tape::drives::FakeDrive::writeImmediateFileMarks(size_t count) {
void castor::tape::tapeserver::drives::FakeDrive::writeImmediateFileMarks(size_t count) {
writeSyncFileMarks(count);
}
void castor::tape::drives::FakeDrive::writeBlock(const void * data, size_t count) {
void castor::tape::tapeserver::drives::FakeDrive::writeBlock(const void * data, size_t count) {
m_tape.resize(m_current_position+1);
m_tape[m_current_position].assign((const char *)data, count);
m_current_position++;
}
ssize_t castor::tape::drives::FakeDrive::readBlock(void *data, size_t count) {
ssize_t castor::tape::tapeserver::drives::FakeDrive::readBlock(void *data, size_t count) {
if(count < m_tape[m_current_position].size()) {
throw Exception("Block size too small in FakeDrive::readBlock");
}
......@@ -140,7 +141,7 @@ ssize_t castor::tape::drives::FakeDrive::readBlock(void *data, size_t count) {
m_current_position++;
return bytes_copied;
}
std::string castor::tape::drives::FakeDrive::contentToString() throw() {
std::string castor::tape::tapeserver::drives::FakeDrive::contentToString() throw() {
std::stringstream exc;
exc << std::endl;
exc << "Tape position: " << m_current_position << std::endl;
......@@ -152,7 +153,7 @@ std::string castor::tape::drives::FakeDrive::contentToString() throw() {
exc << std::endl;
return exc.str();
}
void castor::tape::drives::FakeDrive::readExactBlock(void *data, size_t count, std::string context) {
void castor::tape::tapeserver::drives::FakeDrive::readExactBlock(void *data, size_t count, std::string context) {
if(count != m_tape[m_current_position].size()) {
std::stringstream exc;
exc << "Wrong block size in FakeDrive::readExactBlock. Expected: " << count << " Found: " << m_tape[m_current_position].size() << " Position: " << m_current_position << " String: " << m_tape[m_current_position] << std::endl;
......@@ -164,29 +165,29 @@ void castor::tape::drives::FakeDrive::readExactBlock(void *data, size_t count, s
}
m_current_position++;
}
void castor::tape::drives::FakeDrive::readFileMark(std::string context) {
void castor::tape::tapeserver::drives::FakeDrive::readFileMark(std::string context) {
if(m_tape[m_current_position].compare(filemark)) {
throw Exception("Failed FakeDrive::readFileMark");
}
m_current_position++;
}
bool castor::tape::drives::FakeDrive::waitUntilReady(int timeoutSecond) {
bool castor::tape::tapeserver::drives::FakeDrive::waitUntilReady(int timeoutSecond) {
return true;
}
bool castor::tape::drives::FakeDrive::isWriteProtected() {
bool castor::tape::tapeserver::drives::FakeDrive::isWriteProtected() {
return false;
}
bool castor::tape::drives::FakeDrive::isAtBOT() {
bool castor::tape::tapeserver::drives::FakeDrive::isAtBOT() {
return m_current_position==0;
}
bool castor::tape::drives::FakeDrive::isAtEOD() {
bool castor::tape::tapeserver::drives::FakeDrive::isAtEOD() {
return m_current_position==m_tape.size()-1;
}
bool castor::tape::drives::FakeDrive::isTapeBlank() {
bool castor::tape::tapeserver::drives::FakeDrive::isTapeBlank() {
return m_tape.empty();
}
bool castor::tape::drives::FakeDrive::hasTapeInPlace() {
bool castor::tape::tapeserver::drives::FakeDrive::hasTapeInPlace() {
return true;
}