Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
89e7a7d4
Commit
89e7a7d4
authored
Jul 22, 2014
by
David COME
Browse files
Drive.[hc]pp is now split in several files
parent
5341d8a2
Changes
20
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/CMakeLists.txt
View file @
89e7a7d4
...
...
@@ -14,7 +14,6 @@ add_library(castorTapeServerDaemon
DriveCatalogueLabelSession.cpp
DriveCatalogueTransferSession.cpp
DriveCatalogueCleanerSession.cpp
../drive/Drive.cpp
TapeServerReporter.cpp
LabelCmdAcceptHandler.cpp
LabelCmdConnectionHandler.cpp
...
...
@@ -58,6 +57,7 @@ target_link_libraries(tapeserverd
System
Utils
File
TapeDrive
castorcommon
castorclient
castorlegacymsg
...
...
castor/tape/tapeserver/daemon/CleanerSession.hpp
View file @
89e7a7d4
...
...
@@ -26,7 +26,7 @@
#include
"castor/legacymsg/RmcProxy.hpp"
#include
"castor/log/LogContext.hpp"
#include
"castor/log/Logger.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
"castor/tape/tapeserver/file/Structures.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/utils/DriveConfig.hpp"
...
...
castor/tape/tapeserver/daemon/DataTransferSession.cpp
View file @
89e7a7d4
...
...
@@ -33,7 +33,7 @@
#include
"castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp"
#include
"castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp"
#include
"castor/tape/tapeserver/daemon/TapeServerReporter.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
"castor/tape/tapeserver/exception/Exception.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/utils/utils.hpp"
...
...
castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
View file @
89e7a7d4
...
...
@@ -45,6 +45,7 @@
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
#include
"castor/tape/tapeserver/threading/Threading.hpp"
#include
"castor/tape/tapeserver/file/File.hpp"
#include
"castor/tape/tapeserver/drive/FakeDrive.hpp"
#include
"h/Ctape.h"
#include
"h/smc_struct.h"
...
...
castor/tape/tapeserver/daemon/LabelSession.cpp
View file @
89e7a7d4
...
...
@@ -29,7 +29,7 @@
#include
"castor/tape/tapeserver/exception/Exception.hpp"
#include
"castor/tape/utils/utils.hpp"
#include
"castor/System.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
"castor/tape/tapeserver/file/File.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"h/Cns.h"
...
...
castor/tape/tapeserver/daemon/LabelSession.hpp
View file @
89e7a7d4
...
...
@@ -33,7 +33,7 @@
#include
"castor/tape/tapeserver/client/ClientProxy.hpp"
#include
"castor/legacymsg/NsProxy.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
<memory>
...
...
castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp
View file @
89e7a7d4
...
...
@@ -33,7 +33,7 @@
#include
"castor/tape/tapeserver/daemon/RecallTaskInjector.hpp"
#include
"castor/tape/tapeserver/daemon/TapeServerReporter.hpp"
#include
"castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/
Fake
Drive.hpp"
#include
"castor/tape/utils/TpconfigLine.hpp"
#include
"castor/utils/utils.hpp"
...
...
castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp
View file @
89e7a7d4
...
...
@@ -27,7 +27,7 @@
#include
"castor/tape/tapeserver/threading/BlockingQueue.hpp"
#include
"castor/tape/tapeserver/daemon/TapeReadTask.hpp"
#include
"castor/tape/tapeserver/threading/Threading.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
"castor/tape/tapeserver/file/File.hpp"
#include
"castor/tape/tapeserver/daemon/RecallTaskInjector.hpp"
#include
"castor/tape/tapeserver/daemon/TapeServerReporter.hpp"
...
...
castor/tape/tapeserver/daemon/TapeSingleThreadInterface.hpp
View file @
89e7a7d4
...
...
@@ -33,7 +33,7 @@
#include
"castor/server/ProcessCap.hpp"
#include
"castor/tape/tapeserver/threading/Threading.hpp"
#include
"castor/tape/tapeserver/threading/BlockingQueue.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
"castor/tape/tapeserver/client/ClientInterface.hpp"
#include
"castor/tape/utils/Timer.hpp"
#include
"castor/tape/tapeserver/daemon/SessionStats.hpp"
...
...
castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp
View file @
89e7a7d4
...
...
@@ -30,7 +30,7 @@
#include
"castor/tape/tapeserver/daemon/TapeSingleThreadInterface.hpp"
#include
"castor/tape/tapeserver/daemon/TapeWriteTask.hpp"
#include
"castor/tape/tapeserver/daemon/TaskWatchDog.hpp"
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/Drive
Interface
.hpp"
#include
"castor/tape/tapeserver/threading/BlockingQueue.hpp"
#include
"castor/tape/tapeserver/threading/Threading.hpp"
#include
"castor/tape/utils/Timer.hpp"
...
...
castor/tape/tapeserver/drive/CMakeLists.txt
View file @
89e7a7d4
add_library
(
TapeDrive Drive.cpp
)
set_property
(
SOURCE Drive.cpp PROPERTY COMPILE_FLAGS -fno-strict-aliasing
)
add_library
(
TapeDrive DriveGeneric.cpp FakeDrive.cpp
)
set_property
(
SOURCE DriveGeneric.cpp PROPERTY COMPILE_FLAGS -fno-strict-aliasing
)
target_link_libraries
(
TapeDrive SCSI
)
add_executable
(
TapeDriveReadWriteTest TapeDriveReadWriteTest.cpp
)
target_link_libraries
(
TapeDriveReadWriteTest TapeDrive Exception SCSI System Utils castorcommon castorclient
${
GTEST_LIBRARY
}
gmock pthread
)
castor/tape/tapeserver/drive/Drive.cpp
→
castor/tape/tapeserver/drive/Drive
Generic
.cpp
View file @
89e7a7d4
...
...
@@ -21,7 +21,9 @@
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include
"castor/tape/tapeserver/drive/Drive.hpp"
#include
"castor/tape/tapeserver/drive/DriveInterface.hpp"
#include
"castor/tape/tapeserver/drive/FakeDrive.hpp"
#include
"castor/tape/tapeserver/drive/DriveGeneric.hpp"
using
namespace
castor
::
tape
;
...
...
@@ -820,174 +822,3 @@ drives::compressionStats drives::DriveIBM3592::getCompression() {
return
driveCompressionStats
;
}
/**
* FAKE Drive methods
*/
const
long
unsigned
int
max_fake_drive_record_length
=
1000
;
const
char
filemark
[]
=
""
;
drives
::
FakeDrive
::
FakeDrive
()
throw
()
:
m_current_position
(
0
)
{
m_tape
.
reserve
(
max_fake_drive_record_length
);
}
drives
::
compressionStats
drives
::
FakeDrive
::
getCompression
()
{
throw
Exception
(
"FakeDrive::getCompression Not implemented"
);
}
void
drives
::
FakeDrive
::
clearCompressionStats
()
{
throw
Exception
(
"FakeDrive::clearCompressionStats Not implemented"
);
}
drives
::
deviceInfo
drives
::
FakeDrive
::
getDeviceInfo
()
{
deviceInfo
devInfo
;
devInfo
.
product
=
"Fake Drv"
;
devInfo
.
productRevisionLevel
=
"0.1"
;
devInfo
.
vendor
=
"ACME Ind"
;
devInfo
.
serialNumber
=
"123456"
;
return
devInfo
;
}
std
::
string
drives
::
FakeDrive
::
getSerialNumber
()
{
throw
Exception
(
"FakeDrive::getSerialNumber Not implemented"
);
}
void
drives
::
FakeDrive
::
positionToLogicalObject
(
uint32_t
blockId
)
{
m_current_position
=
blockId
;
}
drives
::
positionInfo
drives
::
FakeDrive
::
getPositionInfo
()
{
positionInfo
pos
;
pos
.
currentPosition
=
m_current_position
;
pos
.
dirtyBytesCount
=
0
;
pos
.
dirtyObjectsCount
=
0
;
pos
.
oldestDirtyObject
=
0
;
return
pos
;
}
std
::
vector
<
std
::
string
>
drives
::
FakeDrive
::
getTapeAlerts
()
{
throw
Exception
(
"FakeDrive::getTapeAlerts Not implemented"
);
}
void
drives
::
FakeDrive
::
setDensityAndCompression
(
bool
compression
,
unsigned
char
densityCode
)
{
throw
Exception
(
"FakeDrive::setDensityAndCompression Not implemented"
);
}
drives
::
driveStatus
drives
::
FakeDrive
::
getDriveStatus
()
{
throw
Exception
(
"FakeDrive::getDriveStatus Not implemented"
);
}
drives
::
tapeError
drives
::
FakeDrive
::
getTapeError
()
{
throw
Exception
(
"FakeDrive::getTapeError Not implemented"
);
}
void
drives
::
FakeDrive
::
setSTBufferWrite
(
bool
bufWrite
)
{
throw
Exception
(
"FakeDrive::setSTBufferWrite Not implemented"
);
}
void
drives
::
FakeDrive
::
fastSpaceToEOM
(
void
)
{
m_current_position
=
m_tape
.
size
()
-
1
;
}
void
drives
::
FakeDrive
::
rewind
(
void
)
{
m_current_position
=
0
;
}
void
drives
::
FakeDrive
::
spaceToEOM
(
void
)
{
m_current_position
=
m_tape
.
size
()
-
1
;
}
void
drives
::
FakeDrive
::
spaceFileMarksBackwards
(
size_t
count
)
{
if
(
!
count
)
return
;
size_t
countdown
=
count
;
std
::
vector
<
std
::
string
>::
size_type
i
=
0
;
for
(
i
=
m_current_position
;
i
!=
(
std
::
vector
<
std
::
string
>::
size_type
)
-
1
and
countdown
!=
0
;
i
--
)
{
if
(
!
m_tape
[
i
].
compare
(
filemark
))
countdown
--
;
}
if
(
countdown
)
{
throw
Exception
(
"FakeDrive::spaceFileMarksBackwards"
);
}
m_current_position
=
i
-
1
;
//BOT side of the filemark
}
void
drives
::
FakeDrive
::
spaceFileMarksForward
(
size_t
count
)
{
if
(
!
count
)
return
;
size_t
countdown
=
count
;
std
::
vector
<
std
::
string
>::
size_type
i
=
0
;
for
(
i
=
m_current_position
;
i
!=
m_tape
.
size
()
and
countdown
!=
0
;
i
++
)
{
if
(
!
m_tape
[
i
].
compare
(
filemark
))
countdown
--
;
}
if
(
countdown
)
{
throw
castor
::
exception
::
Errnum
(
EIO
,
"Failed FakeDrive::spaceFileMarksForward"
);
}
m_current_position
=
i
;
//EOT side of the filemark
}
void
drives
::
FakeDrive
::
unloadTape
(
void
)
{
}
void
drives
::
FakeDrive
::
flush
(
void
)
{
//already flushing
}
void
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
)
{
if
(
m_current_position
<
m_tape
.
size
())
{
m_tape
[
m_current_position
]
=
filemark
;
}
else
{
m_tape
.
push_back
(
filemark
);
}
m_current_position
++
;
}
}
void
drives
::
FakeDrive
::
writeImmediateFileMarks
(
size_t
count
)
{
writeSyncFileMarks
(
count
);
}
void
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
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"
);
}
size_t
bytes_copied
=
m_tape
[
m_current_position
].
copy
((
char
*
)
data
,
m_tape
[
m_current_position
].
size
());
m_current_position
++
;
return
bytes_copied
;
}
std
::
string
drives
::
FakeDrive
::
contentToString
()
throw
()
{
std
::
stringstream
exc
;
exc
<<
std
::
endl
;
exc
<<
"Tape position: "
<<
m_current_position
<<
std
::
endl
;
exc
<<
std
::
endl
;
exc
<<
"Tape contents:"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
m_tape
.
size
();
i
++
)
{
exc
<<
i
<<
": "
<<
m_tape
[
i
]
<<
std
::
endl
;
}
exc
<<
std
::
endl
;
return
exc
.
str
();
}
void
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
;
exc
<<
contentToString
();
throw
Exception
(
exc
.
str
());
}
if
(
count
!=
m_tape
[
m_current_position
].
copy
((
char
*
)
data
,
count
))
{
throw
Exception
(
"Failed FakeDrive::readExactBlock"
);
}
m_current_position
++
;
}
void
drives
::
FakeDrive
::
readFileMark
(
std
::
string
context
)
{
if
(
m_tape
[
m_current_position
].
compare
(
filemark
))
{
throw
Exception
(
"Failed FakeDrive::readFileMark"
);
}
m_current_position
++
;
}
bool
drives
::
FakeDrive
::
waitUntilReady
(
int
timeoutSecond
)
{
return
true
;
}
bool
drives
::
FakeDrive
::
isWriteProtected
()
{
return
false
;
}
bool
drives
::
FakeDrive
::
isAtBOT
()
{
return
m_current_position
==
0
;
}
bool
drives
::
FakeDrive
::
isAtEOD
()
{
return
m_current_position
==
m_tape
.
size
()
-
1
;
}
bool
drives
::
FakeDrive
::
isTapeBlank
()
{
return
m_tape
.
empty
();
}
bool
drives
::
FakeDrive
::
hasTapeInPlace
()
{
return
true
;
}
castor/tape/tapeserver/drive/Drive.hpp
→
castor/tape/tapeserver/drive/Drive
Generic
.hpp
View file @
89e7a7d4
...
...
@@ -20,214 +20,14 @@
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#
pragma once
#
include
"castor/tape/tapeserver/drive/DriveInterface.hpp"
#include
"castor/exception/Errnum.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/tapeserver/SCSI/Structures.hpp"
#include
"castor/tape/tapeserver/SCSI/Exception.hpp"
#include
"castor/tape/tapeserver/drive/mtio_add.hpp"
#include
"castor/tape/tapeserver/exception/Exception.hpp"
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
/**
* Class wrapping the tape server. Has to be templated (and hence fully in .hh)
* to allow unit testing against system wrapper.
*/
namespace
castor
{
namespace
tape
{
namespace
drives
{
/**
* Compressions statistics container, returned by Drive::getCompression()
*/
class
compressionStats
{
public:
compressionStats
()
:
fromHost
(
0
),
fromTape
(
0
),
toHost
(
0
),
toTape
(
0
)
{
}
uint64_t
fromHost
;
uint64_t
fromTape
;
uint64_t
toHost
;
uint64_t
toTape
;
};
/**
* Device information, returned by getDeviceInfo()
*/
class
deviceInfo
{
public:
std
::
string
vendor
;
std
::
string
product
;
std
::
string
productRevisionLevel
;
std
::
string
serialNumber
;
};
/**
* Position info, returning both the logical position and the
* buffer writing status.
* Returned by getPositionInfo()
*/
class
positionInfo
{
public:
uint32_t
currentPosition
;
uint32_t
oldestDirtyObject
;
uint32_t
dirtyObjectsCount
;
uint32_t
dirtyBytesCount
;
};
/**
*
*/
struct
driveStatus
{
bool
ready
;
bool
writeProtection
;
/* TODO: Error condition */
bool
eod
;
bool
bot
;
bool
hasTapeInPlace
;
};
class
tapeError
{
std
::
string
error
;
/* TODO: error code. See gettperror and get_sk_msg in CAStor */
};
/**
* Exception reported by drive functions when trying to read beyond
* end of data
*/
class
EndOfData
:
public
Exception
{
public:
EndOfData
(
const
std
::
string
w
=
""
)
:
Exception
(
w
)
{}
};
/**
* Exception reported by drive functions when trying to write beyond
* end of medium
*/
class
EndOfMedium
:
public
Exception
{
public:
EndOfMedium
(
const
std
::
string
w
=
""
)
:
Exception
(
w
)
{}
};
/**
* Exception reported by ReadExactBlock when the size is not right
*/
class
UnexpectedSize
:
public
Exception
{
public:
UnexpectedSize
(
const
std
::
string
w
=
""
)
:
Exception
(
w
)
{}
};
/**
* Exception reported by ReadFileMark when finding a data block
*/
class
NotAFileMark
:
public
Exception
{
public:
NotAFileMark
(
const
std
::
string
w
=
""
)
:
Exception
(
w
)
{}
};
/**
* Abstract class used by DriveGeneric(real stuff) and the FakeDrive(used for unit testing)
*/
class
DriveInterface
{
public:
virtual
~
DriveInterface
(){};
virtual
compressionStats
getCompression
()
=
0
;
virtual
void
clearCompressionStats
()
=
0
;
virtual
deviceInfo
getDeviceInfo
()
=
0
;
virtual
std
::
string
getSerialNumber
()
=
0
;
virtual
void
positionToLogicalObject
(
uint32_t
blockId
)
=
0
;
virtual
positionInfo
getPositionInfo
()
=
0
;
virtual
std
::
vector
<
std
::
string
>
getTapeAlerts
()
=
0
;
virtual
void
setDensityAndCompression
(
bool
compression
=
true
,
unsigned
char
densityCode
=
0
)
=
0
;
virtual
driveStatus
getDriveStatus
()
=
0
;
virtual
tapeError
getTapeError
()
=
0
;
virtual
void
setSTBufferWrite
(
bool
bufWrite
)
=
0
;
virtual
void
fastSpaceToEOM
(
void
)
=
0
;
virtual
void
rewind
(
void
)
=
0
;
virtual
void
spaceToEOM
(
void
)
=
0
;
virtual
void
spaceFileMarksBackwards
(
size_t
count
)
=
0
;
virtual
void
spaceFileMarksForward
(
size_t
count
)
=
0
;
virtual
void
unloadTape
(
void
)
=
0
;
virtual
void
flush
(
void
)
=
0
;
virtual
void
writeSyncFileMarks
(
size_t
count
)
=
0
;
virtual
void
writeImmediateFileMarks
(
size_t
count
)
=
0
;
virtual
void
writeBlock
(
const
void
*
data
,
size_t
count
)
=
0
;
virtual
ssize_t
readBlock
(
void
*
data
,
size_t
count
)
=
0
;
virtual
void
readExactBlock
(
void
*
data
,
size_t
count
,
std
::
string
context
)
=
0
;
virtual
void
readFileMark
(
std
::
string
context
)
=
0
;
virtual
bool
waitUntilReady
(
int
timeoutSecond
)
=
0
;
virtual
bool
isWriteProtected
()
=
0
;
virtual
bool
isAtBOT
()
=
0
;
virtual
bool
isAtEOD
()
=
0
;
virtual
bool
isTapeBlank
()
=
0
;
virtual
bool
hasTapeInPlace
()
=
0
;
/**
* Member string allowing the convenient storage of the string describing
* drive location for the mount system (we get the information from TPCONFIG
*/
std
::
string
librarySlot
;
};
/**
* Factory function that allocated the proper drive type, based on device info
* @param di deviceInfo, as found in a DeviceVector.
* @param sw reference to the system wrapper.
* @return pointer to the newly allocated drive object
*/
DriveInterface
*
DriveFactory
(
SCSI
::
DeviceInfo
di
,
System
::
virtualWrapper
&
sw
);
/**
* Fake drive class used for unit testing
*/
class
FakeDrive
:
public
DriveInterface
{
private:
std
::
vector
<
std
::
string
>
m_tape
;
uint32_t
m_current_position
;
public:
std
::
string
contentToString
()
throw
();
FakeDrive
()
throw
();
virtual
~
FakeDrive
()
throw
(){}
virtual
compressionStats
getCompression
()
;
virtual
void
clearCompressionStats
()
;
virtual
deviceInfo
getDeviceInfo
()
;
virtual
std
::
string
getSerialNumber
()
;
virtual
void
positionToLogicalObject
(
uint32_t
blockId
)
;
virtual
positionInfo
getPositionInfo
()
;
virtual
std
::
vector
<
std
::
string
>
getTapeAlerts
()
;
virtual
void
setDensityAndCompression
(
bool
compression
=
true
,
unsigned
char
densityCode
=
0
)
;
virtual
driveStatus
getDriveStatus
()
;
virtual
tapeError
getTapeError
()
;
virtual
void
setSTBufferWrite
(
bool
bufWrite
)
;
virtual
void
fastSpaceToEOM
(
void
)
;
virtual
void
rewind
(
void
)
;
virtual
void
spaceToEOM
(
void
)
;
virtual
void
spaceFileMarksBackwards
(
size_t
count
)
;
virtual
void
spaceFileMarksForward
(
size_t
count
)
;
virtual
void
unloadTape
(
void
)
;
virtual
void
flush
(
void
)
;
virtual
void
writeSyncFileMarks
(
size_t
count
)
;
virtual
void
writeImmediateFileMarks
(
size_t
count
)
;
virtual
void
writeBlock
(
const
void
*
data
,
size_t
count
)
;
virtual
ssize_t
readBlock
(
void
*
data
,
size_t
count
)
;
virtual
void
readExactBlock
(
void
*
data
,
size_t
count
,
std
::
string
context
)
;
virtual
void
readFileMark
(
std
::
string
context
)
;
virtual
bool
waitUntilReady
(
int
timeoutSecond
)
;
virtual
bool
isWriteProtected
()
;
virtual
bool
isAtBOT
()
;
virtual
bool
isAtEOD
()
;
virtual
bool
isTapeBlank
();
virtual
bool
hasTapeInPlace
();
};
/**
/**
* Class abstracting the tape drives. This class is templated to allow the use
* of unrelated test harness and real system. The test harness is made up of
* a classes with virtual tables, but the real system wrapper has the real
...
...
@@ -548,7 +348,5 @@ namespace drives {
virtual
compressionStats
getCompression
()
;
};
}
// namespace drives
}
// namespace tape
}
// namespace castor
}}}
\ No newline at end of file
castor/tape/tapeserver/drive/DriveInterface.hpp
0 → 100644
View file @
89e7a7d4
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include
"castor/exception/Errnum.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/tapeserver/SCSI/Structures.hpp"
#include
"castor/tape/tapeserver/SCSI/Exception.hpp"
#include
"castor/tape/tapeserver/drive/mtio_add.hpp"
#include
"castor/tape/tapeserver/exception/Exception.hpp"
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
/**
* Class wrapping the tape server. Has to be templated (and hence fully in .hh)
* to allow unit testing against system wrapper.
*/
namespace
castor
{
namespace
tape
{
namespace
drives
{
/**
* Compressions statistics container, returned by Drive::getCompression()
*/
class
compressionStats
{
public:
compressionStats
()
:
fromHost
(
0
),
fromTape
(
0
),
toHost
(
0
),
toTape
(
0
)
{
}
uint64_t
fromHost
;
uint64_t
fromTape
;
uint64_t
toHost
;
uint64_t
toTape
;
};
/**
* Device information, returned by getDeviceInfo()
*/
class
deviceInfo
{
public:
std
::
string
vendor
;
std
::
string
product
;
std
::
string
productRevisionLevel
;
std
::
string
serialNumber
;
};