Commit 5fc38552 authored by Steven Murray's avatar Steven Murray
Browse files

Added libcastortapeserverfileunittests.so

parent adc63355
......@@ -19,11 +19,19 @@
#include "ArchiveFileInfo.hpp"
namespace cta {
ArchiveFileInfo::ArchiveFileInfo():
fileId(0),
size(0),
lastModificationTime(0) {
}
ArchiveFileInfo::ArchiveFileInfo(
const std::string& lastKnownPath, uint64_t fileId, uint64_t size,
const Checksum & checksum, const time_t lastModificationTime):
lastKnownPath(lastKnownPath),
fileId(fileId),
size(size),
checksum(checksum), lastModificationTime(lastModificationTime) {}
}
\ No newline at end of file
checksum(checksum),
lastModificationTime(lastModificationTime) {}
}
......@@ -27,12 +27,20 @@ namespace cta {
*/
class ArchiveFileInfo {
public:
/**
* Constructor.
*/
ArchiveFileInfo();
/**
* Constructor.
*/
ArchiveFileInfo(const std::string & lastKnownPath, uint64_t fileId,
uint64_t size, const Checksum & checksum, const time_t lastModificationTime);
const std::string lastKnownPath; /**< The location of the file at NS lookup time */
const uint64_t fileId; /**< The file ID (to be used in the tape copy header, among other */
const uint64_t size; /**< The file's size */
const Checksum checksum;
const time_t lastModificationTime;
std::string lastKnownPath; /**< The location of the file at NS lookup time */
uint64_t fileId; /**< The file ID (to be used in the tape copy header, among other */
uint64_t size; /**< The file's size */
Checksum checksum;
time_t lastModificationTime;
};
}
\ No newline at end of file
}
......@@ -22,7 +22,7 @@
// constructor
//------------------------------------------------------------------------------
cta::TapeCopyInfo::TapeCopyInfo():
fseq(0),
fSeq(0),
blockId(0) {
}
......@@ -30,9 +30,9 @@ cta::TapeCopyInfo::TapeCopyInfo():
// constructor
//------------------------------------------------------------------------------
cta::TapeCopyInfo::TapeCopyInfo(const std::string &vid,
const uint64_t fseq, const uint64_t blockId, uint16_t copyNumber):
const uint64_t fSeq, const uint64_t blockId, uint16_t copyNumber):
vid(vid),
fseq(fseq),
fSeq(fSeq),
blockId(blockId),
copyNumber(copyNumber) {
}
......@@ -37,11 +37,11 @@ struct TapeCopyInfo {
* Constructor.
*
* @param vid The volume identifier of the tape.
* @param fseq The sequence number of the file.
* @param fSeq The sequence number of the file.
* @param blockId The block identifier of the file.
* @param copyNumber The copy number for this tape copy.
*/
TapeCopyInfo(const std::string &vid, const uint64_t fseq,
TapeCopyInfo(const std::string &vid, const uint64_t fSeq,
const uint64_t blockId, uint16_t copyNumber);
/**
......@@ -62,7 +62,7 @@ struct TapeCopyInfo {
/**
* The sequence number of the file.
*/
uint64_t fseq;
uint64_t fSeq;
/**
* The block identifier of the file.
......
......@@ -24,6 +24,12 @@
cta::ArchiveJob::~ArchiveJob() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchiveJob::ArchiveJob() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
......@@ -31,12 +37,12 @@ cta::ArchiveJob::ArchiveJob(
const std::string &tapePoolName,
const ArchiveFileInfo & archiveFile,
const RemotePathAndStatus &remoteFile,
const TapeCopyLocationAndStatus &copyLocation,
const TapeCopyLocationAndStatus &tapeCopy,
const uint16_t copyNb):
tapePoolName(tapePoolName),
archiveFile(archiveFile),
remoteFile(remoteFile),
copyLocation(copyLocation),
tapeCopy(tapeCopy),
copyNumber(copyNb) {}
//------------------------------------------------------------------------------
......
......@@ -44,10 +44,16 @@ class ArchiveJob {
friend class ArchiveMount;
CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
private:
protected:
/**
* Constructor. It is private as the ArchiveJob is generated by the
* Constructor. It is not protected as the ArchiveJob is generated by the
* ArchiveMount.
*/
ArchiveJob();
/**
* Constructor. It is not protected as the ArchiveJob is generated by the
* ArchiveMount.
*
* @param tapePoolName the name of the tape pool the tape copy should be
......@@ -61,7 +67,7 @@ private:
const std::string &tapePoolName,
const ArchiveFileInfo & archiveFile,
const RemotePathAndStatus &remoteFile,
const TapeCopyLocationAndStatus &copyLocation,
const TapeCopyLocationAndStatus &tapeCopy,
const uint16_t copyNb);
public:
......@@ -78,13 +84,6 @@ public:
*/
const std::string &getTapePoolName() const throw();
/**
* Returns the size of the file to be archived in bytes.
*
* @return The size of the file to be archived in bytes.
*/
uint64_t getFileSize() const throw();
/**
* Returns the The URL of the remote source file.
*
......@@ -92,13 +91,6 @@ public:
*/
std::string getRemoteFile() const throw();
/**
* Stores the location of the archives tape copy prior to calling complete()
* @param tapeCopyLocation all the information about the tape copy after
* writing
*/
void setCopyLocationAndStatus (const TapeCopyLocationAndStatus & tapeCopyLocation);
/**
* Indicates that the job was successful and updates the backend store
*
......@@ -130,16 +122,16 @@ public:
virtual void retry();
public:
const std::string tapePoolName;
std::string tapePoolName;
/**< The name of the destination tape pool. */
const ArchiveFileInfo archiveFile;
ArchiveFileInfo archiveFile;
/**< All information related to the archive file for which we
* are recording this tape copy. */
const RemotePathAndStatus remoteFile;
RemotePathAndStatus remoteFile;
/**< The size of the file to be archived in bytes. */
TapeCopyLocationAndStatus copyLocation;
const uint16_t copyNumber;
TapeCopyLocationAndStatus tapeCopy;
uint16_t copyNumber;
/**< The copy number for this tape copy */
CTA_GENERATE_EXCEPTION_CLASS(LocationNotSet);
/**< Accessor to the tape location status */
......
......@@ -24,19 +24,25 @@
cta::RetrieveJob::~RetrieveJob() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrieveJob::RetrieveJob() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrieveJob::RetrieveJob(
// TO BE DECIDED
//RetrieveMount &mount,
const TapeCopyInfo &tapeCopyLocation,
const TapeCopyInfo &tapeCopy,
const std::string &id,
const std::string &userRequestId,
const uint32_t copyNb,
const std::string &remoteFile,
const uint64_t castorNsFileId):
tapeCopyInfo(tapeCopyLocation), m_id(id) {
tapeCopy(tapeCopy), m_id(id) {
}
//------------------------------------------------------------------------------
......
......@@ -37,15 +37,21 @@ class RetrieveJob {
*/
friend class RetrieveMount;
private:
protected:
/**
* Constructor. It is not public as the ArchiveJob is generated by the
* RetrieveMount.
*/
RetrieveJob();
/**
* Constructor. It is private as the ArchiveJob is generated by the
* Constructor. It is not public as the ArchiveJob is generated by the
* RetrieveMount.
*
// TO BE DECIDED
* @param mount The mount to which the job belongs.
* @param tapeFile The location of the source tape file.
* @param tapeCopy The location of the source tape file.
* @param id The identifier of the tape job.
* @param userRequestId The identifier of the associated user request.
* @param copyNb The copy number.
......@@ -57,7 +63,7 @@ private:
RetrieveJob(
// TO BE DECIDED
// RetrieveMount &mount,
const TapeCopyInfo &tapeFile,
const TapeCopyInfo &tapeCopy,
const std::string &id,
const std::string &userRequestId,
const uint32_t copyNb,
......@@ -112,7 +118,7 @@ public:
/** Translation of positioningMethod */
std::string toString (PositioningMethod);
TapeCopyInfo tapeCopyInfo; /**<The location of the source tape file. */
TapeCopyInfo tapeCopy; /**<The location of the source tape file. */
PositioningMethod positioningMethod; /**< The desired positioning method. */
RemotePath remoteFilePath; /** <The location of the destination file. */
std::string m_id;
......
......@@ -477,7 +477,7 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
tcl.back().blockId = 666;
tcl.back().fileId = 777;
tcl.back().archiveFilePath = "cta:://cta/myfile";
tcl.back().fseq = 10;
tcl.back().fSeq = 10;
tcl.back().nsHostName = "NSHost";
tcl.back().vid = "Tape2";
tcl.back().copyNumber = 1;
......@@ -485,7 +485,7 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
tcl.back().blockId = 111;
tcl.back().fileId = 777;
tcl.back().archiveFilePath = "cta:://cta/myfile";
tcl.back().fseq = 5;
tcl.back().fSeq = 5;
tcl.back().nsHostName = "NSHost";
tcl.back().vid = "Tape3";
tcl.back().copyNumber = 2;
......@@ -526,7 +526,7 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
tcl2.back().blockId = 999;
tcl2.back().fileId = 888;
tcl2.back().archiveFilePath = "cta:://cta/myfile2";
tcl2.back().fseq = 11;
tcl2.back().fSeq = 11;
tcl2.back().nsHostName = "NSHost";
tcl2.back().vid = "Tape3";
tcl2.back().copyNumber = 1;
......@@ -534,7 +534,7 @@ TEST_P(SchedulerDatabaseTest, getMountInfo) {
tcl2.back().blockId = 333;
tcl2.back().fileId = 888;
tcl2.back().archiveFilePath = "cta:://cta/myfile2";
tcl2.back().fseq = 3;
tcl2.back().fSeq = 3;
tcl2.back().nsHostName = "NSHost";
tcl2.back().vid = "Tape2";
tcl2.back().copyNumber = 2;
......
......@@ -90,7 +90,7 @@ void DiskReadTask::execute(log::LogContext& lc, diskFile::DiskFileFactory & file
m_stats.waitFreeMemoryTime+=localTime.secs(castor::utils::Timer::resetCounter);
//set metadata and read the data
mb->m_fileid = m_archiveJob->copyLocation.fileId;
mb->m_fileid = m_archiveJob->tapeCopy.fileId;
mb->m_fileBlock = blockId++;
currentErrorToCount = "Error_diskRead";
......@@ -180,7 +180,7 @@ void DiskReadTask::circulateAllBlocks(size_t fromBlockId, MemBlock * mb){
mb = m_nextTask.getFreeBlock();
++blockId;
}
mb->m_fileid = m_archiveJob->copyLocation.fileId;
mb->m_fileid = m_archiveJob->tapeCopy.fileId;
mb->markAsCancelled();
m_nextTask.pushDataBlock(mb);
mb=NULL;
......@@ -208,7 +208,7 @@ void DiskReadTask::logWithStat(int level,const std::string& msg,log::LogContext&
m_stats.transferTime?1.0*m_stats.dataVolume/1000/1000/m_stats.transferTime:0)
.add("openRWCloseToTransferTimeRatio",
m_stats.transferTime?(m_stats.openingTime+m_stats.readWriteTime+m_stats.closingTime)/m_stats.transferTime:0.0)
.add("FILEID",m_archiveJob->copyLocation.fileId)
.add("FILEID",m_archiveJob->tapeCopy.fileId)
.add("path",m_archiveJob->archiveFile.lastKnownPath);
lc.log(level,msg);
}
......
......@@ -52,10 +52,10 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
castor::utils::Timer totalTime(localTime);
castor::utils::Timer transferTime(localTime);
log::ScopedParamContainer URLcontext(lc);
URLcontext.add("NSFILEID",m_retrieveJob->tapeCopyInfo.fileId)
.add("path", m_retrieveJob->tapeCopyInfo.archiveFilePath)
URLcontext.add("NSFILEID",m_retrieveJob->tapeCopy.fileId)
.add("path", m_retrieveJob->tapeCopy.archiveFilePath)
.add("fileTransactionId",m_retrieveJob->m_id)
.add("fSeq",m_retrieveJob->tapeCopyInfo.fseq);
.add("fSeq",m_retrieveJob->tapeCopy.fSeq);
// This out-of-try-catch variables allows us to record the stage of the
// process we're in, and to count the error if it occurs.
// We will not record errors for an empty string. This will allow us to
......@@ -90,7 +90,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
// Synchronise the counter with the open time counter.
currentErrorToCount = "Error_diskOpenForWrite";
transferTime = localTime;
writeFile.reset(fileFactory.createWriteFile(m_retrieveJob->tapeCopyInfo.archiveFilePath));
writeFile.reset(fileFactory.createWriteFile(m_retrieveJob->tapeCopy.archiveFilePath));
URLcontext.add("actualURL", writeFile->URL());
lc.log(LOG_INFO, "Opened disk file for writing");
m_stats.openingTime+=localTime.secs(castor::utils::Timer::resetCounter);
......@@ -200,7 +200,7 @@ void DiskWriteTask::releaseAllBlock(){
//------------------------------------------------------------------------------
void DiskWriteTask::checkErrors(MemBlock* mb,int blockId,castor::log::LogContext& lc){
using namespace castor::log;
if(m_retrieveJob->tapeCopyInfo.fileId != static_cast<unsigned int>(mb->m_fileid)
if(m_retrieveJob->tapeCopy.fileId != static_cast<unsigned int>(mb->m_fileid)
|| blockId != mb->m_fileBlock || mb->isFailed() ){
LogContext::ScopedParam sp[]={
LogContext::ScopedParam(lc, Param("received_NSFILEID", mb->m_fileid)),
......@@ -253,8 +253,8 @@ void DiskWriteTask::logWithStat(int level,const std::string& msg,log::LogContext
m_stats.transferTime?1.0*m_stats.dataVolume/1000/1000/m_stats.transferTime:0)
.add("openRWCloseToTransferTimeRatio",
m_stats.transferTime?(m_stats.openingTime+m_stats.readWriteTime+m_stats.closingTime)/m_stats.transferTime:0.0)
.add("FILEID",m_retrieveJob->tapeCopyInfo.fileId)
.add("path",m_retrieveJob->tapeCopyInfo.archiveFilePath);
.add("FILEID",m_retrieveJob->tapeCopy.fileId)
.add("path",m_retrieveJob->tapeCopy.archiveFilePath);
lc.log(level,msg);
}
}}}}
......
......@@ -56,9 +56,9 @@ namespace daemon {
for(auto it= jobs.begin();it!=jobs.end();++it){
const u_signed64 fileSize = (*it)->archiveFile.size;
LogContext::ScopedParam sp[]={
LogContext::ScopedParam(m_lc, Param("NSHOSTNAME", (*it)->copyLocation.nsHostName)),
LogContext::ScopedParam(m_lc, Param("NSFILEID", (*it)->copyLocation.fileId)),
LogContext::ScopedParam(m_lc, Param("fSeq", (*it)->copyLocation.fSeq)),
LogContext::ScopedParam(m_lc, Param("NSHOSTNAME", (*it)->tapeCopy.nsHostName)),
LogContext::ScopedParam(m_lc, Param("NSFILEID", (*it)->tapeCopy.fileId)),
LogContext::ScopedParam(m_lc, Param("fSeq", (*it)->tapeCopy.fSeq)),
LogContext::ScopedParam(m_lc, Param("path", (*it)->archiveFile.lastKnownPath))
};
tape::utils::suppresUnusedVariable(sp);
......@@ -129,7 +129,7 @@ namespace daemon {
m_lc.log(LOG_ERR, "No files to migrate: empty mount");
return false;
} else {
m_firstFseqToWrite = jobs.front()->copyLocation.fSeq;
m_firstFseqToWrite = jobs.front()->tapeCopy.fSeq;
injectBulkMigrations(jobs);
return true;
}
......
......@@ -91,11 +91,11 @@ void RecallTaskInjector::injectBulkRecalls(const std::vector<cta::RetrieveJob *>
(*it)->positioningMethod=cta::RetrieveJob::PositioningMethod::ByBlock;
LogContext::ScopedParam sp[]={
LogContext::ScopedParam(m_lc, Param("NSHOSTNAME", (*it)->tapeCopyInfo.nsHostName)),
LogContext::ScopedParam(m_lc, Param("NSFILEID", (*it)->tapeCopyInfo.fileId)),
LogContext::ScopedParam(m_lc, Param("fSeq", (*it)->tapeCopyInfo.fseq)),
LogContext::ScopedParam(m_lc, Param("blockID", (*it)->tapeCopyInfo.blockId)),
LogContext::ScopedParam(m_lc, Param("path", (*it)->tapeCopyInfo.archiveFilePath))
LogContext::ScopedParam(m_lc, Param("NSHOSTNAME", (*it)->tapeCopy.nsHostName)),
LogContext::ScopedParam(m_lc, Param("NSFILEID", (*it)->tapeCopy.fileId)),
LogContext::ScopedParam(m_lc, Param("fSeq", (*it)->tapeCopy.fSeq)),
LogContext::ScopedParam(m_lc, Param("blockID", (*it)->tapeCopy.blockId)),
LogContext::ScopedParam(m_lc, Param("path", (*it)->tapeCopy.archiveFilePath))
};
tape::utils::suppresUnusedVariable(sp);
......
......@@ -69,12 +69,12 @@ public:
// Set the common context for all the coming logs (file info)
log::ScopedParamContainer params(lc);
params.add("NSHOSTNAME", m_retrieveJob->tapeCopyInfo.nsHostName)
.add("NSFILEID", m_retrieveJob->tapeCopyInfo.fileId)
.add("BlockId", m_retrieveJob->tapeCopyInfo.blockId)
.add("fSeq", m_retrieveJob->tapeCopyInfo.fseq)
params.add("NSHOSTNAME", m_retrieveJob->tapeCopy.nsHostName)
.add("NSFILEID", m_retrieveJob->tapeCopy.fileId)
.add("BlockId", m_retrieveJob->tapeCopy.blockId)
.add("fSeq", m_retrieveJob->tapeCopy.fSeq)
.add("fileTransactionId", m_retrieveJob->m_id)
.add("path", m_retrieveJob->tapeCopyInfo.archiveFilePath);
.add("path", m_retrieveJob->tapeCopy.archiveFilePath);
// We will clock the stats for the file itself, and eventually add those
// stats to the session's.
......@@ -110,9 +110,9 @@ public:
mb=m_mm.getFreeBlock();
localStats.waitFreeMemoryTime += timer.secs(castor::utils::Timer::resetCounter);
mb->m_fSeq = m_retrieveJob->tapeCopyInfo.fseq;
mb->m_fSeq = m_retrieveJob->tapeCopy.fSeq;
mb->m_fileBlock = fileBlock++;
mb->m_fileid = m_retrieveJob->tapeCopyInfo.fileId;
mb->m_fileid = m_retrieveJob->tapeCopy.fileId;
mb->m_tapeFileBlock = tapeBlock;
mb->m_tapeBlockSize = rf->getBlockSize();
try {
......@@ -191,8 +191,8 @@ public:
*/
void reportCancellationToDiskTask(){
MemBlock* mb =m_mm.getFreeBlock();
mb->m_fSeq = m_retrieveJob->tapeCopyInfo.fseq;
mb->m_fileid = m_retrieveJob->tapeCopyInfo.fileId;
mb->m_fSeq = m_retrieveJob->tapeCopy.fSeq;
mb->m_fileid = m_retrieveJob->tapeCopy.fileId;
//mark the block cancelled and push it (plus signal the end)
mb->markAsCancelled();
m_fifo.pushDataBlock(mb);
......@@ -208,8 +208,8 @@ private:
// fill it up
if (!mb) {
mb=m_mm.getFreeBlock();
mb->m_fSeq = m_retrieveJob->tapeCopyInfo.fseq;
mb->m_fileid = m_retrieveJob->tapeCopyInfo.fileId;
mb->m_fSeq = m_retrieveJob->tapeCopy.fSeq;
mb->m_fileid = m_retrieveJob->tapeCopy.fileId;
}
//mark the block failed and push it (plus signal the end)
mb->markAsFailed(msg,code);
......
......@@ -69,11 +69,11 @@ namespace daemon {
using castor::log::ScopedParamContainer;
// Add to our logs the informations on the file
ScopedParamContainer params(lc);
params.add("NSHOSTNAME", m_archiveJob->copyLocation.nsHostName)
.add("NSFILEID",m_archiveJob->copyLocation.fileId)
params.add("NSHOSTNAME", m_archiveJob->tapeCopy.nsHostName)
.add("NSFILEID",m_archiveJob->tapeCopy.fileId)
.add("lastKnownFilename",m_archiveJob->archiveFile.lastKnownPath)
.add("fileSize",m_archiveJob->archiveFile.size)
.add("fSeq",m_archiveJob->copyLocation.fSeq)
.add("fSeq",m_archiveJob->tapeCopy.fSeq)
.add("path",m_archiveJob->remoteFile.path.getRaw());
// We will clock the stats for the file itself, and eventually add those
......@@ -90,7 +90,7 @@ namespace daemon {
// We will not record errors for an empty string. This will allow us to
// prevent counting where error happened upstream.
std::string currentErrorToCount = "Error_tapeFSeqOutOfSequenceForWrite";
session.validateNextFSeq(m_archiveJob->copyLocation.fSeq);
session.validateNextFSeq(m_archiveJob->tapeCopy.fSeq);
try {
//try to open the session
currentErrorToCount = "Error_tapeWriteHeader";
......@@ -129,7 +129,7 @@ namespace daemon {
m_taskStats.headerVolume += TapeSessionStats::trailerVolumePerFile;
m_taskStats.filesCount ++;
// Record the fSeq in the tape session
session.reportWrittenFSeq(m_archiveJob->copyLocation.fSeq);
session.reportWrittenFSeq(m_archiveJob->tapeCopy.fSeq);
reportPacker.reportCompletedJob(std::move(m_archiveJob),ckSum,output->getBlockId());
m_taskStats.waitReportingTime += timer.secs(castor::utils::Timer::resetCounter);
m_taskStats.totalTime = localTime.secs();
......@@ -314,9 +314,9 @@ namespace daemon {
.add("payloadTransferSpeedMBps",m_taskStats.totalTime?
1.0*m_taskStats.dataVolume/1000/1000/m_taskStats.totalTime:0.0)
.add("fileSize",m_archiveJob->archiveFile.size)
.add("NSHOST",m_archiveJob->copyLocation.nsHostName)
.add("NSFILEID",m_archiveJob->copyLocation.fileId)
.add("fSeq",m_archiveJob->copyLocation.fSeq)
.add("NSHOST",m_archiveJob->tapeCopy.nsHostName)
.add("NSFILEID",m_archiveJob->tapeCopy.fileId)
.add("fSeq",m_archiveJob->tapeCopy.fSeq)
.add("lastKnownFilename",m_archiveJob->archiveFile.lastKnownPath)
.add("lastModificationTime",m_archiveJob->archiveFile.lastModificationTime);
......
......@@ -32,3 +32,9 @@ add_library(File
../exception/XrootCl.cpp)
target_link_libraries (File castorrfio XrdCl cryptopp)
add_library(castortapeserverfileunittests SHARED
StructuresTest.cpp
FileTest.cpp)
target_link_libraries(castortapeserverfileunittests
File)
......@@ -108,13 +108,13 @@ namespace castor {
const cta::RetrieveJob &filetoRecall,
const tape::tapeserver::daemon::VolumeInfo &volInfo) {
const std::string &volId = volInfo.vid;
if(!checkHeaderNumericalField(hdr1.getFileId(), filetoRecall.tapeCopyInfo.fileId, hexadecimal)) {
if(!checkHeaderNumericalField(hdr1.getFileId(), filetoRecall.tapeCopy.fileId, hexadecimal)) {
// the nsfileid stored in HDR1 as an hexadecimal string . The one in
// filetoRecall is numeric
std::stringstream ex_str;
ex_str << "[HeaderChecker::checkHDR1] - Invalid fileid detected: (0x)\""
<< hdr1.getFileId() << "\". Wanted: 0x" << std::hex
<< filetoRecall.tapeCopyInfo.fileId << std::endl;
<< filetoRecall.tapeCopy.fileId << std::endl;
throw TapeFormatError(ex_str.str());
}
......@@ -129,19 +129,19 @@ namespace castor {
void HeaderChecker::checkUHL1(const UHL1 &uhl1,
const cta::RetrieveJob &fileToRecall) {
if(!checkHeaderNumericalField(uhl1.getfSeq(), fileToRecall.tapeCopyInfo.fseq, decimal)) {
if(!checkHeaderNumericalField(uhl1.getfSeq(), fileToRecall.tapeCopy.fSeq, decimal)) {
std::stringstream ex_str;
ex_str << "[HeaderChecker::checkUHL1] - Invalid fseq detected in uhl1: \""
<< uhl1.getfSeq() << "\". Wanted: " << fileToRecall.tapeCopyInfo.fseq;
<< uhl1.getfSeq() << "\". Wanted: " << fileToRecall.tapeCopy.fSeq;
throw TapeFormatError(ex_str.str());
}
}
void HeaderChecker::checkUTL1(const UTL1 &utl1, const uint32_t fseq) {
if(!checkHeaderNumericalField(utl1.getfSeq(), (uint64_t)fseq, decimal)) {
void HeaderChecker::checkUTL1(const UTL1 &utl1, const uint32_t fSeq) {
if(!checkHeaderNumericalField(utl1.getfSeq(), (uint64_t)fSeq, decimal)) {
std::stringstream ex_str;
ex_str << "[HeaderChecker::checkUTL1] - Invalid fseq detected in utl1: \""
<< utl1.getfSeq() << "\". Wanted: " << fseq;
<< utl1.getfSeq() << "\". Wanted: " << fSeq;
throw TapeFormatError(ex_str.str());
}
}
......@@ -174,15 +174,15 @@ namespace castor {
m_session->release();
}
void ReadFile::positionByFseq(const cta::RetrieveJob &fileToRecall) {
if(fileToRecall.tapeCopyInfo.fseq<1) {
if(fileToRecall.tapeCopy.fSeq<1) {
std::stringstream err;
err << "Unexpected fileId in ReadFile::position with fSeq expected >=1, got: "
<< fileToRecall.tapeCopyInfo.fseq << ")";
<< fileToRecall.tapeCopy.fSeq << ")";
throw castor::exception::InvalidArgument(err.str());
}
int64_t fseq_delta = fileToRecall.tapeCopyInfo.fseq - m_session->getCurrentFseq();
if(fileToRecall.tapeCopyInfo.fseq == 1) {
int64_t fSeq_delta = fileToRecall.tapeCopy.fSeq - m_session->getCurrentFseq();
if(fileToRecall.tapeCopy.fSeq == 1) {
// special case: we can rewind the tape to be faster
//(TODO: in the future we could also think of a threshold above
//which we rewind the tape anyway and then space forward)
......@@ -195,31 +195,31 @@ namespace castor {
throw TapeFormatError(e.what());
}
}
else if(fseq_delta == 0) {
else if(fSeq_delta == 0) {