#include <df.h>


Definition at line 1602 of file df.h.
Public Member Functions | |
| df_FRIDistiller (df_BlockProxy *a_reader_p, cmn_UUID_t a_medVolID, cmn_UUID_t a_poolID, cmn_UUID_t a_partID, df_Writer &a_output) | |
| virtual | ~df_FRIDistiller () |
| void | CompleteStream (bool a_eod) |
| void | WriteCurrentSplit () |
Private Member Functions | |
| void | WriteFRIStart () |
| void | WriteFRIEnd (UInt32_t a_status) |
| void | WriteSplitInfo (const df_RecCmn_t *a_fileEnd_p) |
| void | CopyRecord (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcBlock (const UInt8_t *a_dataBlock) |
| virtual void | ProcRawBlock (const UInt8_t *a_dataBlock) |
| virtual void | ProcRecFileHdr (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecFileEnd (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecBSStart (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecEmbData (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcRecRawData (const UInt8_t *a_block_p) |
| virtual void | ProcRecBSEnd (const df_RecCmn_t *a_recCmn_p) |
| virtual void | ProcEndOfInput () |
| method ProcEndOfInput() must be called at the end of input when block per block parsing is used (migration, FRI check before wirtten to media. | |
| virtual bool | HandleDFError (const ivd_DFError &ie) |
Private Attributes | |
| log_CLASSID_m | |
| Macro to add class name member s_className. | |
| df_Writer & | m_output |
| const cmn_UUID_t | m_medVolID |
| const cmn_UUID_t | m_poolID |
| const cmn_UUID_t | m_partID |
| UInt32_t | m_firstBlockID |
| df_SplitInfo | m_curSplit |
| Holds information about the split info that is being processed. | |
| UInt64_t | m_curStreamSize |
| Fast fix 2106. | |
| bool | m_splitStartRecorded |
| Was split offset recorded in m_curSplit? | |
| UInt64_t | m_curSplitSize |
| Size of the current split. | |
| UInt32_t | m_friRecNum |
| Counter for FRI records. | |
| df_FRIDistiller::df_FRIDistiller | ( | df_BlockProxy * | a_reader_p, | |
| cmn_UUID_t | a_medVolID, | |||
| cmn_UUID_t | a_poolID, | |||
| cmn_UUID_t | a_partID, | |||
| df_Writer & | a_output | |||
| ) |
Definition at line 39 of file df_fridistiller.cpp.
References df_SplitInfo::Clear(), log_FUNC_m, and m_curSplit.
00046 : 00047 df_RecReader(a_reader_p), 00048 m_output(a_output), 00049 m_medVolID(a_medVolID), 00050 m_poolID(a_poolID), 00051 m_partID(a_partID), 00052 m_firstBlockID(0), 00053 m_curStreamSize(0), 00054 m_splitStartRecorded(false), 00055 m_curSplitSize(0), 00056 m_friRecNum(0) { 00057 00058 log_FUNC_m(df_FRIDistiller); 00059 00060 m_curSplit.Clear(); 00061 }

| df_FRIDistiller::~df_FRIDistiller | ( | ) | [virtual] |
Definition at line 66 of file df_fridistiller.cpp.
References df_FRIS_COMPLETE, log_FUNC_m, and WriteFRIEnd().
00066 { 00067 log_FUNC_m(~df_FRIDistiller); 00068 00069 WriteFRIEnd(df_FRIS_COMPLETE); 00070 }

| void df_FRIDistiller::CompleteStream | ( | bool | a_eod | ) |
Definition at line 73 of file df_fridistiller.cpp.
References alloca(), CopyRecord(), dbg_LOW, df_ALIGN_m, df_FS_ERROR, df_ST_ALTDATA, df_ST_META, df_SplitInfo::Dump(), df_SplitInfo::fileID, df_RecReader::GetBlkSize(), log_DBG_m, log_FUNC_m, m_curSplit, m_curSplitSize, df_RecReader::m_curStreamName, m_curStreamSize, df_RecReader::m_curStreamType, m_splitStartRecorded, df_SplitInfo::migrationID, NULL, df_SplitInfo::splitOffset, df_SplitInfo::splitSize, df_Packer::WriteRecBSEndRaw(), df_Packer::WriteRecFileEndRaw(), and WriteSplitInfo().
Referenced by HandleDFError(), ProcBlock(), ProcEndOfInput(), and ProcRecRawData().
00073 { 00074 log_FUNC_m(CompleteStream); 00075 00076 if (m_splitStartRecorded) { 00077 m_curSplit.splitSize = m_curSplitSize; 00078 if (a_eod) { 00079 log_DBG_m(dbg_LOW, 00080 "Flushing split for: " << m_curSplit.fileID << 00081 " offset: " << m_curSplit.splitOffset << 00082 " size:" << m_curSplit.splitSize); 00083 } 00084 else { 00085 log_DBG_m(dbg_LOW, "Complete opened stream. " << m_curSplit.Dump()); 00086 } 00087 00088 if (!a_eod) { 00089 // This is not a split. Write BSE with error status. 00090 if ( ((m_curStreamType == df_ST_META) && (m_curStreamSize <= GetBlkSize())) 00091 || (m_curStreamType == df_ST_ALTDATA)) { 00092 00093 UInt32_t recSize = df_ALIGN_m(sizeof(df_RecCmn_t) 00094 + sizeof(df_RecByteStreamEnd_t) 00095 + m_curStreamName.length() 00096 + 1); 00097 00098 UInt8_t *buff = reinterpret_cast<UInt8_t*>(alloca(recSize)); 00099 00100 df_Packer::WriteRecBSEndRaw( 00101 m_curSplit.fileID, 00102 df_FS_ERROR, 00103 m_curStreamType, 00104 m_curStreamSize, 00105 m_curSplitSize, 00106 m_curStreamName, 00107 0, 00108 buff); 00109 00110 CopyRecord(reinterpret_cast<df_RecCmn_t*>(buff)); 00111 } 00112 } 00113 m_curStreamType = 0; 00114 00115 if (a_eod) { 00116 // file end is not written at EOD (== split). 00117 WriteSplitInfo(NULL); 00118 } 00119 else { 00120 // Detected aborted migration (not a split) 00121 // Append file-end with error status 00122 UInt32_t recSize = df_ALIGN_m(sizeof(df_RecCmn_t) 00123 + sizeof(df_RecFileEnd_t)); 00124 UInt8_t *buff = reinterpret_cast<UInt8_t*>(alloca(recSize)); 00125 00126 df_Packer::WriteRecFileEndRaw(m_curSplit.fileID, 00127 m_curSplit.migrationID, 00128 df_FS_ERROR, 00129 0, 00130 buff, 00131 0); 00132 00133 WriteSplitInfo(reinterpret_cast<df_RecCmn_t*>(buff)); 00134 } 00135 } 00136 else { 00137 log_DBG_m(dbg_LOW, "There is no split to write. Exit."); 00138 } 00139 }


| void df_FRIDistiller::WriteCurrentSplit | ( | ) |
| void df_FRIDistiller::WriteFRIStart | ( | ) | [private] |
Definition at line 142 of file df_fridistiller.cpp.
References df_BlockProxyWriter::Allocate(), df_RecReader::GetBlockID(), ie_DF_EOD, log_FUNC_m, log_MARKLINE_m, m_firstBlockID, m_friRecNum, m_medVolID, m_output, m_partID, m_poolID, df_BlockProxyWriter::Move(), NULL, and df_Packer::WriteRecFRIStart().
Referenced by ProcRecFileHdr(), and WriteFRIEnd().
00142 { 00143 log_FUNC_m(WriteFRIStart); 00144 00145 m_firstBlockID = GetBlockID(); 00146 00147 // Write FRIStart record 00148 UInt32_t recSize = sizeof(df_RecCmn_t) + sizeof(df_RecFRIStart_t); 00149 UInt8_t* recBuf = m_output.Allocate(recSize); 00150 if (recBuf == NULL) { 00151 log_MARKLINE_m; 00152 throw ivd_DFError(ie_DF_EOD, 0, "Unexpected EOD in FRI buffer.", true); 00153 } 00154 00155 df_Packer::WriteRecFRIStart( 00156 m_medVolID, 00157 m_poolID, 00158 m_partID, 00159 m_firstBlockID, 00160 ++m_friRecNum, 00161 recBuf, 00162 recSize); 00163 00164 m_output.Move(recSize); 00165 }


| void df_FRIDistiller::WriteFRIEnd | ( | UInt32_t | a_status | ) | [private] |
Definition at line 170 of file df_fridistiller.cpp.
References df_BlockProxyWriter::Allocate(), dbg_LOW, df_RecReader::GetBlockID(), log_DBG_m, log_FUNC_m, m_firstBlockID, m_friRecNum, m_medVolID, m_output, m_partID, m_poolID, df_BlockProxyWriter::Move(), NULL, WriteFRIStart(), and df_Packer::WriteRecFRIEnd().
Referenced by ~df_FRIDistiller().
00170 { 00171 log_FUNC_m(WriteFRIEnd); 00172 00173 if (m_friRecNum == 0) { 00174 // Handle FRI for empty volume, where there's just FRI start and FRI end. 00175 log_DBG_m(dbg_LOW, "Writing FRIS for empty volume."); 00176 WriteFRIStart(); 00177 } 00178 00179 // Write FRIEnd record 00180 UInt32_t recSize = sizeof(df_RecCmn_t) + sizeof(df_RecFRIEnd_t); 00181 UInt8_t* recBuf = m_output.Allocate(recSize); 00182 00183 if (recBuf == NULL) { 00184 return; 00185 } 00186 00187 df_Packer::WriteRecFRIEnd( 00188 m_medVolID, 00189 m_poolID, 00190 m_partID, 00191 m_firstBlockID, 00192 GetBlockID(), 00193 a_status, 00194 ++m_friRecNum, 00195 recBuf, 00196 recSize); 00197 00198 m_output.Move(recSize); 00199 }


| void df_FRIDistiller::WriteSplitInfo | ( | const df_RecCmn_t * | a_fileEnd_p | ) | [private] |
Definition at line 204 of file df_fridistiller.cpp.
References df_BlockProxyWriter::Allocate(), df_SplitInfo::blockOffset, df_SplitInfo::Clear(), CopyRecord(), df_SplitInfo::dataType, df_SplitInfo::fileID, log_FUNC_m, m_curSplit, m_curSplitSize, m_friRecNum, m_output, m_splitStartRecorded, df_BlockProxyWriter::Move(), NULL, df_SplitInfo::splitOffset, df_SplitInfo::splitSize, and df_Packer::WriteRecFRISplitInfo().
Referenced by CompleteStream(), and ProcRecFileEnd().
00204 { 00205 log_FUNC_m(WriteSplitInfo); 00206 00207 // Add split info record 00208 UInt32_t siRecSize = sizeof(df_RecCmn_t) + sizeof(df_RecFRISpInfo_t); 00209 UInt8_t* siRecBuf = m_output.Allocate(siRecSize); 00210 00211 if (siRecBuf == NULL) { 00212 return; 00213 } 00214 00215 df_Packer::WriteRecFRISplitInfo( 00216 m_curSplit.fileID, 00217 m_curSplit.splitOffset, 00218 m_curSplit.splitSize, 00219 m_curSplit.dataType, 00220 ++m_friRecNum, 00221 m_curSplit.blockOffset, 00222 siRecBuf, 00223 siRecSize); 00224 m_output.Move(siRecSize); 00225 00226 // Splits at the end of the medium don't have 00227 // File End record. That's how FSC detects non-last splits. 00228 if (a_fileEnd_p != NULL) { 00229 // Append file end record 00230 CopyRecord(a_fileEnd_p); 00231 } 00232 00233 m_curSplit.Clear(); 00234 00235 m_splitStartRecorded = false; 00236 m_curSplitSize = 0; 00237 }


| void df_FRIDistiller::CopyRecord | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private] |
Definition at line 242 of file df_fridistiller.cpp.
References df_BlockProxyWriter::Allocate(), hton(), m_friRecNum, m_output, df_BlockProxyWriter::Move(), ntoh(), NULL, df_RecCmn_t::seqNum, and df_RecCmn_t::size.
Referenced by CompleteStream(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), ProcRecFileHdr(), and WriteSplitInfo().
00242 { 00243 // Copy record to the Writer 00244 UInt32_t recSize = ntoh(a_recCmn_p->size); 00245 UInt8_t* target = m_output.Allocate(recSize); 00246 if (target == NULL) { 00247 return; 00248 } 00249 00250 memcpy(target, a_recCmn_p, recSize); 00251 00252 df_RecCmn_t *outRec_p = reinterpret_cast<df_RecCmn_t*>(target); 00253 outRec_p->seqNum = hton(++m_friRecNum); 00254 00255 m_output.Move(recSize); 00256 }


| void df_FRIDistiller::ProcBlock | ( | const UInt8_t * | a_dataBlock | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 261 of file df_fridistiller.cpp.
References CompleteStream(), dbg_LOW, df_RecReader::GetBlockNum(), log_DBG_m, log_FUNC_m, and m_splitStartRecorded.
00261 { 00262 00263 // On the beginning of the new migration on the tape 00264 // any non-terminated file from the previous migration must be flushed 00265 if (GetBlockNum() == 1) { 00266 log_FUNC_m(ProcBlock); 00267 if (m_splitStartRecorded) { 00268 log_DBG_m(dbg_LOW, "Beginning of new migration. Flush current file."); 00269 CompleteStream(false); 00270 } 00271 } 00272 }

| void df_FRIDistiller::ProcRawBlock | ( | const UInt8_t * | a_dataBlock | ) | [private, virtual] |
| void df_FRIDistiller::ProcRecFileHdr | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 283 of file df_fridistiller.cpp.
References df_SplitInfo::blockOffset, df_SplitInfo::chunkOffset, df_RecFile_t::chunkSize, df_SplitInfo::chunkSize, cmn_Num2Str(), CopyRecord(), df_SplitInfo::dataType, dbg_NORM, df_RF_CONTINUED, df_SplitInfo::fileID, df_SplitInfo::fileName, df_SplitInfo::fileSize, df_SplitInfo::fileType, df_RecCmn_t::flags, df_RecReader::GetBlockID(), df_RecCmn_t::GetVarDataNet(), df_RecFile_t::idFile, df_RecFile_t::idMig, df_RecFile_t::idParent, df_RecFile_t::idParentOld, ie_FATAL_ERROR, ivd_ATTR_d, df_SplitInfo::lastSplit, log_DBG_m, log_FUNC_m, log_MARKLINE_m, m_curSplit, m_friRecNum, m_splitStartRecorded, df_SplitInfo::mediaKey, df_SplitInfo::medVolNum, df_SplitInfo::migrationID, df_RecFile_t::name, df_RecFile_t::nameOld, df_SplitInfo::noCopies, ntoh(), df_RecFile_t::numCopies, df_StandardAttr_t::numLinks, df_SplitInfo::numLinks, df_SplitInfo::oldFileName, df_SplitInfo::oldOwnerID, df_SplitInfo::ownerID, df_StandardAttr_t::size, df_SplitInfo::splitOffset, df_SplitInfo::splitSize, df_RecFile_t::stdAttr, df_StandardAttr_t::type, and WriteFRIStart().
00283 { 00284 log_FUNC_m(ProcRecFileHdr); 00285 00286 UInt32_t blockID(GetBlockID()); 00287 00288 // Prevent invalid medium position to be stored to FSC and FRI 00289 if (blockID < 3) { 00290 log_MARKLINE_m; 00291 throw ivd_InternalError(ie_FATAL_ERROR, 00292 string("Invalid medium position: ") + cmn_Num2Str(blockID) ); 00293 } 00294 00295 if (m_friRecNum == 0) { 00296 // This is the first file header, write FRIStart first 00297 WriteFRIStart(); 00298 } 00299 00300 CopyRecord(a_recCmn_p); 00301 00302 const df_RecFile_t *fh_p = df_GetSpecificRec<df_RecFile_t>(a_recCmn_p); 00303 00304 m_curSplit.fileType = static_cast<ivd_FileType_e>( ntoh(fh_p->stdAttr.type) ); 00305 m_curSplit.dataType = ivd_ATTR_d; 00306 m_curSplit.numLinks = ntoh(fh_p->stdAttr.numLinks); 00307 m_curSplit.lastSplit = false; // we do not know yet 00308 00309 m_splitStartRecorded = true; 00310 00311 // 00312 // Not used when creating FRI 00313 // 00314 m_curSplit.medVolNum = 0; 00315 m_curSplit.mediaKey = 0; 00316 00317 m_curSplit.blockOffset = blockID; 00318 00319 m_curSplit.fileID = static_cast<ivd_FileID_t>(ntoh(fh_p->idFile)); 00320 m_curSplit.migrationID = ntoh(fh_p->idMig); 00321 m_curSplit.fileSize = ntoh(fh_p->stdAttr.size); 00322 00323 m_curSplit.chunkOffset = 0; 00324 m_curSplit.chunkSize = ntoh(fh_p->chunkSize); 00325 00326 m_curSplit.noCopies = ntoh(fh_p->numCopies); 00327 00328 m_curSplit.splitOffset = 0; 00329 m_curSplit.splitSize = 0; 00330 00331 m_curSplit.ownerID = static_cast<ivd_FileID_t>(ntoh(fh_p->idParent)); 00332 m_curSplit.oldOwnerID = static_cast<ivd_FileID_t>(ntoh(fh_p->idParentOld)); 00333 00334 m_curSplit.fileName = a_recCmn_p->GetVarDataNet(fh_p->name); 00335 m_curSplit.oldFileName = a_recCmn_p->GetVarDataNet(fh_p->nameOld); 00336 00337 log_DBG_m(dbg_NORM, 00338 "File Start: " << m_curSplit.fileID << 00339 " copies: " << m_curSplit.noCopies << 00340 " filename: " << m_curSplit.fileName << 00341 " 1st split:" << ( (ntoh(a_recCmn_p->flags) & df_RF_CONTINUED)? "NO" : "YES") ); 00342 }

| void df_FRIDistiller::ProcRecFileEnd | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 347 of file df_fridistiller.cpp.
References dbg_NORM, df_SplitInfo::fileID, df_RecFileEnd_t::idFile, ie_DATA_CORRUPTION, df_SplitInfo::lastSplit, log_DBG_m, log_FUNC_m, m_curSplit, ntoh(), df_RecFileEnd_t::status, and WriteSplitInfo().
00347 { 00348 log_FUNC_m(ProcRecFileEnd); 00349 00350 const df_RecFileEnd_t *fe_p = df_GetSpecificRec<df_RecFileEnd_t>(a_recCmn_p); 00351 00352 // TODO: Overchecking? To be put in the base class? 00353 if (m_curSplit.fileID != ntoh(fe_p->idFile)) { 00354 ostringstream sstr; 00355 sstr 00356 <<"Incorrect File ID on FileEnd. " 00357 << "Expected (" << m_curSplit.fileID << ") " 00358 << "Found (" << ntoh(fe_p->idFile) << ")."; 00359 00360 throw ivd_InternalError(ie_DATA_CORRUPTION, sstr.str()); 00361 }; 00362 00363 // If the file end is read, then this is the last split 00364 // for this generation of the file. 00365 m_curSplit.lastSplit = true; 00366 UInt32_t status = ntoh(fe_p->status); 00367 00368 log_DBG_m(dbg_NORM, 00369 "FileEnd: " << m_curSplit.fileID << " status: " << status); 00370 00371 WriteSplitInfo(a_recCmn_p); 00372 }

| void df_FRIDistiller::ProcRecBSStart | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 377 of file df_fridistiller.cpp.
References df_RecByteStreamStart_t::allStreamSize, df_RecByteStreamStart_t::chunkOffset, df_SplitInfo::chunkOffset, CopyRecord(), df_SplitInfo::dataType, dbg_NORM, df_RF_CONTINUED, df_ST_DATA, df_ST_META, df_RecCmn_t::flags, df_RecReader::GetBlkSize(), df_RecByteStreamStart_t::idFile, log_DBG_m, log_FUNC_m, log_WRN_m, m_curSplit, m_curSplitSize, df_RecReader::m_curStreamName, m_curStreamSize, df_RecReader::m_curStreamType, ntoh(), df_SplitInfo::splitOffset, and df_RecByteStreamStart_t::streamSize.
00377 { 00378 00379 log_FUNC_m(ProcRecBSStart); 00380 00381 const df_RecByteStreamStart_t *bss_p = df_GetSpecificRec<df_RecByteStreamStart_t>(a_recCmn_p); 00382 00383 m_curSplit.chunkOffset = ntoh(bss_p->chunkOffset); 00384 00385 if (ntoh(a_recCmn_p->flags) & df_RF_CONTINUED) { 00386 // Split in the FSC terms means split of all streams 00387 // in the generation. 00388 m_curSplit.splitOffset = ntoh(bss_p->allStreamSize); 00389 m_curSplitSize = 0; 00390 00391 log_DBG_m(dbg_NORM, 00392 "Continued split: offset: " << m_curSplit.splitOffset); 00393 }; 00394 00395 m_curSplit.dataType |= m_curStreamType; 00396 m_curStreamSize = ntoh(bss_p->streamSize); 00397 00398 log_DBG_m(dbg_NORM, 00399 "ByteStreamStart: " << std::hex << "0x" << m_curStreamType << std::dec << 00400 " name: " << m_curStreamName); 00401 00402 if ( m_curStreamType == df_ST_DATA) { 00403 return; 00404 } 00405 00406 if ( m_curStreamType == df_ST_META 00407 && m_curStreamSize > GetBlkSize() ) { 00408 UInt64_t fileID = ntoh(bss_p->idFile); 00409 log_WRN_m( 00410 "Large meta-data stream skipped from FRI and FSC. " << 00411 "File ID: " << fileID << ", stream: " << m_curStreamName); 00412 return; 00413 } 00414 00415 CopyRecord(a_recCmn_p); 00416 }

| void df_FRIDistiller::ProcRecEmbData | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 421 of file df_fridistiller.cpp.
References CopyRecord(), df_RecEmbeddedData_t::data, df_ST_META, df_RecReader::GetBlkSize(), m_curSplitSize, m_curStreamSize, df_RecReader::m_curStreamType, ntoh(), and ivd_VarData_t::size.
00421 { 00422 const df_RecEmbeddedData_t *emd_p = df_GetSpecificRec<df_RecEmbeddedData_t>(a_recCmn_p); 00423 00424 m_curSplitSize += ntoh(emd_p->data.size); 00425 00426 if ( m_curStreamType == df_ST_META 00427 && m_curStreamSize <= GetBlkSize() ) { 00428 CopyRecord(a_recCmn_p); 00429 } 00430 }

| void df_FRIDistiller::ProcRecRawData | ( | const UInt8_t * | a_block_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 435 of file df_fridistiller.cpp.
References df_BlockProxyWriter::AllocateRawBlock(), CompleteStream(), dbg_LOW, df_ST_META, df_RecReader::DoesBlockContainNewMigration(), df_RecReader::GetBlkSize(), df_RecReader::GetBlockID(), log_DBG_m, log_FUNC_m, m_curSplitSize, m_curStreamSize, df_RecReader::m_curStreamType, m_output, df_BlockProxyWriter::Move(), NULL, and df_RecReader::Reset().
00435 { 00436 00437 if (DoesBlockContainNewMigration()) { 00438 log_FUNC_m(ProcRecRawData); 00439 log_DBG_m(dbg_LOW, 00440 "** FOUND NEW MIGRATION AFTER ABORTED. Medium position: " << 00441 GetBlockID()); 00442 CompleteStream(false); 00443 Reset(true, true); 00444 return; 00445 } 00446 00447 UInt32_t blkSize(GetBlkSize()); 00448 00449 m_curSplitSize += blkSize; 00450 00451 if ( m_curStreamType == df_ST_META 00452 && m_curStreamSize <= GetBlkSize() ) { 00453 // Copy meta block to the Writer 00454 UInt8_t* target = m_output.AllocateRawBlock(); 00455 if (target == NULL) { 00456 return; 00457 } 00458 00459 memcpy(target, a_block_p, blkSize); 00460 m_output.Move(blkSize); 00461 } 00462 }

| void df_FRIDistiller::ProcRecBSEnd | ( | const df_RecCmn_t * | a_recCmn_p | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 467 of file df_fridistiller.cpp.
References df_RecByteStreamEnd_t::allStreamSize, CopyRecord(), df_SplitInfo::dataType, dbg_DETAIL, df_SS_COMPLETE, df_ST_DATA, df_ST_META, df_SplitInfo::fileID, df_RecReader::GetBlkSize(), df_RecByteStreamEnd_t::idFile, log_DBG_m, log_FUNC_m, log_WRN_m, m_curSplit, m_curSplitSize, m_curStreamSize, df_RecReader::m_curStreamType, ntoh(), df_SplitInfo::splitOffset, df_SplitInfo::splitSize, and df_RecByteStreamEnd_t::status.
00467 { 00468 const df_RecByteStreamEnd_t *bse_p = df_GetSpecificRec<df_RecByteStreamEnd_t>(a_recCmn_p); 00469 00470 if (m_curSplitSize != (ntoh(bse_p->allStreamSize) - m_curSplit.splitOffset)) { 00471 log_FUNC_m(ProcRecBSEnd); 00472 log_WRN_m( 00473 "File ID: " << ntoh(bse_p->idFile) << 00474 "Split size does not correspond with " << 00475 "all stream size and its offset: " << 00476 m_curSplitSize << " != " << 00477 (ntoh(bse_p->allStreamSize) - m_curSplit.splitOffset) ); 00478 } 00479 00480 m_curSplit.splitSize = m_curSplitSize; 00481 00482 if (m_curStreamType != df_ST_DATA) { 00483 if (( m_curStreamType != df_ST_META // not meta data 00484 || m_curStreamSize <= GetBlkSize()) ) {// or meta data less than block size 00485 CopyRecord(a_recCmn_p); 00486 } 00487 } 00488 // remove stream type if stream data is not complete. 00489 if (ntoh(bse_p->status) != df_SS_COMPLETE) { 00490 log_FUNC_m(ProcRecBSEnd); 00491 m_curSplit.dataType &= ~m_curStreamType; 00492 log_DBG_m(dbg_DETAIL, 00493 "Stream is not complete. FileID = " << m_curSplit.fileID << 00494 " remove byte stream type = " << m_curStreamType << 00495 " data Type = " << m_curSplit.dataType); 00496 } 00497 00498 m_curStreamSize = 0; 00499 m_curStreamType = 0; 00500 }

| void df_FRIDistiller::ProcEndOfInput | ( | ) | [private, virtual] |
method ProcEndOfInput() must be called at the end of input when block per block parsing is used (migration, FRI check before wirtten to media.
).
Reimplemented from df_RecReader.
Definition at line 540 of file df_fridistiller.cpp.
References CompleteStream(), and log_FUNC_m.
00540 { 00541 log_FUNC_m(ProcEndOfInput); 00542 CompleteStream(true); // complete stream at EOD 00543 }

| bool df_FRIDistiller::HandleDFError | ( | const ivd_DFError & | ie | ) | [private, virtual] |
Reimplemented from df_RecReader.
Definition at line 503 of file df_fridistiller.cpp.
References CompleteStream(), df_RecReader::GetBlockID(), df_RecReader::GetBlockNum(), log_FUNC_m, log_WRN_m, m_curSplitSize, m_curStreamSize, m_medVolID, m_splitStartRecorded, df_RecReader::Reset(), and df_RecReader::SetFindMode().
00503 { 00504 log_FUNC_m(HandleDFError); 00505 // An aborted migration is followed by new migration. 00506 // Data format is not valid in that case for aborted file. 00507 // 00508 // If exception has occured because of new migration on the medium then: 00509 // flush current split info 00510 // reset record reader (parse block from begining) 00511 // return true to continue parsing 00512 // else 00513 // return false 00514 00515 CompleteStream(false); 00516 00517 if (GetBlockNum() == 1) { 00518 // Beginning of new migration detected. 00519 // Parsing will continue from this block on 00520 Reset(false); // Reset only record reader. 00521 } 00522 else { 00523 // Go to find mode until next block with magic cookie and beginning of 00524 // file is found. 00525 log_WRN_m( 00526 "Recreate FRI (" << m_medVolID << "): " << 00527 "Data format error on position " << GetBlockID() << ". " 00528 "Locating next useful block." ); 00529 // Reset members 00530 m_curStreamSize = 0; 00531 m_splitStartRecorded = false; 00532 m_curSplitSize = 0; 00533 Reset(); 00534 SetFindMode(); 00535 } 00536 return true; 00537 }

df_FRIDistiller::log_CLASSID_m [private] |
df_Writer& df_FRIDistiller::m_output [private] |
Definition at line 1618 of file df.h.
Referenced by CopyRecord(), ProcRecRawData(), WriteFRIEnd(), WriteFRIStart(), and WriteSplitInfo().
const cmn_UUID_t df_FRIDistiller::m_medVolID [private] |
Definition at line 1620 of file df.h.
Referenced by HandleDFError(), WriteFRIEnd(), and WriteFRIStart().
const cmn_UUID_t df_FRIDistiller::m_poolID [private] |
const cmn_UUID_t df_FRIDistiller::m_partID [private] |
UInt32_t df_FRIDistiller::m_firstBlockID [private] |
df_SplitInfo df_FRIDistiller::m_curSplit [private] |
Holds information about the split info that is being processed.
Definition at line 1627 of file df.h.
Referenced by CompleteStream(), df_FRIDistiller(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecFileEnd(), ProcRecFileHdr(), and WriteSplitInfo().
UInt64_t df_FRIDistiller::m_curStreamSize [private] |
Fast fix 2106.
Exclude stream greater than block size
Definition at line 1630 of file df.h.
Referenced by CompleteStream(), HandleDFError(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), and ProcRecRawData().
bool df_FRIDistiller::m_splitStartRecorded [private] |
Was split offset recorded in m_curSplit?
Definition at line 1633 of file df.h.
Referenced by CompleteStream(), HandleDFError(), ProcBlock(), ProcRecFileHdr(), and WriteSplitInfo().
UInt64_t df_FRIDistiller::m_curSplitSize [private] |
Size of the current split.
It is used for splits that end at file mark.
Definition at line 1637 of file df.h.
Referenced by CompleteStream(), HandleDFError(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), ProcRecRawData(), and WriteSplitInfo().
UInt32_t df_FRIDistiller::m_friRecNum [private] |
Counter for FRI records.
Definition at line 1640 of file df.h.
Referenced by CopyRecord(), ProcRecFileHdr(), WriteFRIEnd(), WriteFRIStart(), and WriteSplitInfo().
1.5.6