Public Types | Public Member Functions | Private Member Functions | Private Attributes

df_Filter Class Reference

#include <df_filter.h>

Inheritance diagram for df_Filter:
Inheritance graph
[legend]
Collaboration diagram for df_Filter:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ConsistencyCheckMode {
  RIGOROUS, WARN,
  NONE
}
 

Consistency check mode is strict by default, however in the error recovery cleanup (e.g.

More...

Public Member Functions

 df_Filter (UInt32_t a_blkSize, const string &a_diskBufferFS, const string &a_dbName, ivd_FileLocVect_t &a_files, bool a_append, const ivd_FileSize_t a_dbFileSize=0)
virtual ~df_Filter ()
UInt8_tNextInputBlock ()
 This function is called by the user of the df_Filter (e.g.
void SetConsistencyMode (ConsistencyCheckMode a_mode)
ConsistencyCheckMode GetConsistencyMode () const
virtual void Reset ()
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.
void CheckLeftovers ()
 This function shall be used at the end of processing the input data stream to verify if everything has been processed by the filter.
bool ProcessingFile () const
 Is filter currently procesing (copying) a file from the input stream?
UInt32_t NextBlockToCopy () const
 Which is the next block number that the filter will use for copying data?

Private Member Functions

void Init ()
void LookupInTable (ivd_FileID_t a_fid, ivd_MigrationID_t a_migID)
 The function looks up the passed file and migration ID in the filter table.
void CopyRecord (const df_RecCmn_t *a_recCmn_p)
 Copy data format records from input stream to the output stream.
void CloseCopiedSplit ()
void CheckUnhandledFiles ()
virtual void ProcBlock (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)

Private Attributes

 log_CLASSID_m
 Macro to add class name member s_className.
ConsistencyCheckMode m_checkMode
auto_ptr< df_Writerm_output
UInt32_t m_outRecNum
ivd_FileLocVect_tm_files
ivd_FileLocIter_t m_blockBegin
ivd_FileLocIter_t m_blockEnd
ivd_FileLocationData_tm_curFile
vector< UInt8_tm_block
 Buffer, which is used for filtering records inside one block.
UInt8_tm_inputBlock_p
ivd_FileType_e m_fileType
ivd_FileID_t m_fileID
ivd_MigrationID_t m_migrationID
ivd_FileSize_t m_fileSize
UInt64_t m_streamSplitSize
UInt64_t m_splitProcessed
bool m_alteredBSS
UInt64_t m_streamSize
UInt64_t m_allStreamSize
bool m_bsEndMissing
bool m_fileEndMissing

Detailed Description

Definition at line 38 of file df_filter.h.


Member Enumeration Documentation

Consistency check mode is strict by default, however in the error recovery cleanup (e.g.

after a medium error) the consistency check level must be decreased.

Enumerator:
RIGOROUS 
WARN 
NONE 

Definition at line 45 of file df_filter.h.

{ RIGOROUS, WARN, NONE };


Constructor & Destructor Documentation

df_Filter::df_Filter ( UInt32_t  a_blkSize,
const string &  a_diskBufferFS,
const string &  a_dbName,
ivd_FileLocVect_t a_files,
bool  a_append,
const ivd_FileSize_t  a_dbFileSize = 0 
)

Definition at line 53 of file df_filter.cpp.

References Init(), log_FUNC_m, and m_output.

    : df_RecReader(new df_BlockProxy(blk_Data_c, bbt_DISK_BUF, a_blkSize)),
      m_checkMode(RIGOROUS),
      m_output(new df_Writer(blk_Data_c, bbt_DISK_BUF, a_blkSize)),
      m_outRecNum(0),
      m_files(a_files),
      m_blockBegin(m_files.begin()), // files with same block offset are in range
      m_blockEnd(m_files.begin()), // block range not defined yet
      m_block(GetBlkSize()) {

    log_FUNC_m(df_Filter);

    Init();

    m_output->NewDiskBuffer(a_diskbufferID, a_diskBufferFS, a_dbFileSize, a_append);
    m_output->Go();
}

Here is the call graph for this function:

df_Filter::~df_Filter (  )  [virtual]

Definition at line 79 of file df_filter.cpp.

References log_FUNC_m, and m_output.

                      {
    log_FUNC_m(~df_Filter);

    m_output->EndOfData();
}


Member Function Documentation

void df_Filter::CheckLeftovers (  ) 

This function shall be used at the end of processing the input data stream to verify if everything has been processed by the filter.

Uses m_checkMode, which can be set by SetConsistencyMode().

Definition at line 92 of file df_filter.cpp.

References CheckUnhandledFiles(), log_FUNC_m, m_blockEnd, and m_files.

Referenced by bea_RecallThread::Recall().

                               {
    log_FUNC_m(CheckLeftovers);

    // Make sure to verify if anything has been left in the table
    // by moving the iterator to the end().
    m_blockEnd = m_files.end();
    CheckUnhandledFiles();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Filter::CheckUnhandledFiles (  )  [private]

Definition at line 342 of file df_filter.cpp.

References dbg_DETAIL, df_RecReader::GetBlockID(), ie_DATA_CORRUPTION, log_DBG_m, log_ERR_m, log_FUNC_m, m_blockBegin, m_blockEnd, m_checkMode, NONE, and RIGOROUS.

Referenced by CheckLeftovers(), and ProcBlock().

                                    {
    log_FUNC_m(CheckUnhandledFiles);

    if (m_checkMode == NONE) {
        log_DBG_m(dbg_DETAIL, "Consistency check set to NONE.");
        return;
    }

    // Verify that all of the files from the previous block have been
    // processed.
    UInt32_t numUnhandled(0);

    for (ivd_FileLocIter_t i(m_blockBegin); i != m_blockEnd; ++i) {
        if (i->fileID != 0) {
            log_ERR_m(
                "FileID " << i->fileID <<
                ", migID " << i->migrationID <<
                ", splitSize " << i->splitSize <<
                " not found on position " << i->blockOffset);
            ++numUnhandled;
        }
    }

    if (numUnhandled > 0 && m_checkMode == RIGOROUS) {
        log_MARKLINE_m;
        throw ivd_DFError(ie_DATA_CORRUPTION, GetBlockID(),
            "State on medium doesn't match FSC. See error.log.");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Filter::CloseCopiedSplit (  )  [private]

Definition at line 264 of file df_filter.cpp.

References dbg_DETAIL, dbg_NORM, df_ALIGN_m, df_FS_COMPLETE, df_RF_SPLITTED, df_RecReader::GetBlockID(), ie_DF_INVSTATE, log_DBG_m, log_FUNC_m, log_WRN_m, m_allStreamSize, m_alteredBSS, m_bsEndMissing, m_checkMode, df_RecReader::m_curRecType, df_RecReader::m_curStreamLeft, df_RecReader::m_curStreamName, df_RecReader::m_curStreamType, m_fileEndMissing, m_fileID, m_migrationID, m_output, m_outRecNum, df_RecReader::m_prevRecType, m_streamSize, m_streamSplitSize, NONE, NULL, rec_BSEnd_c, rec_FileEnd_c, df_Packer::WriteRecBSEndRaw(), and df_Packer::WriteRecFileEndRaw().

Referenced by ProcEndOfInput().

                                 {
    log_FUNC_m(CloseCopiedSplit);

    if (m_checkMode == NONE) {
        log_DBG_m(dbg_DETAIL, "Consistency check mode set to NONE.");
    }

    log_DBG_m(dbg_NORM, "Trying to close copied split.");

    m_alteredBSS = false;

    if (m_bsEndMissing) {
        log_DBG_m(dbg_NORM, "BSE is missing. Write it.");

        // When BSS is altered, the size of the split at the end must match
        // with the size from the FSC.
        if (m_curStreamLeft > 0 && m_checkMode != NONE) {
            ostringstream sstr;
            sstr
                << "Closing copied split, but m_curStreamLeft == "
                << m_curStreamLeft << ".";

            throw ivd_DFError(ie_DF_INVSTATE, GetBlockID(),
                "Improperly copied split, FSC might contain wrong split size.",
                sstr.str(), true );
        }

        // -- Append ByteStreamEnd --

        m_bsEndMissing = false;

        UInt32_t recSize = df_ALIGN_m(
            sizeof(df_RecCmn_t) + sizeof(df_RecByteStreamEnd_t) +
            m_curStreamName.length()+1);

        UInt8_t *wp = m_output->Allocate(recSize);
        if (wp == NULL) {
            log_WRN_m("NULL block pointer from Allocate(). No reader available.");
            return;
        }

        df_Packer::WriteRecBSEndRaw(
            m_fileID,
            df_FS_COMPLETE, m_curStreamType,
            m_streamSize,
            // m_streamSplitSize contains the size of the
            // split if the split is at the end of medium or
            // in the middle.
            m_allStreamSize + m_streamSplitSize,
            m_curStreamName,
            ++m_outRecNum, wp);

        m_output->Move(recSize);
        // simulating proper record type read
        m_prevRecType = m_curRecType = rec_BSEnd_c;
    }

    if (m_fileEndMissing) {
        log_DBG_m(dbg_NORM, "FEnd is missing. Write it.");

        // -- Append FileEnd --
        UInt32_t recSize = df_ALIGN_m( sizeof(df_RecCmn_t) + sizeof(df_RecFileEnd_t) );

        UInt8_t* target = m_output->Allocate(recSize);
        df_Packer::WriteRecFileEndRaw(
            m_fileID, m_migrationID, df_FS_COMPLETE, ++m_outRecNum, target, df_RF_SPLITTED);

        m_output->Move(recSize);

        m_fileEndMissing  = false;
        // simulating proper record type read
        m_prevRecType = m_curRecType = rec_FileEnd_c;
    }

    m_allStreamSize = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Filter::CopyRecord ( const df_RecCmn_t a_recCmn_p  )  [private]

Copy data format records from input stream to the output stream.

Definition at line 225 of file df_filter.cpp.

References dbg_NORM, df_RecReader::GetBlkSize(), df_RecReader::GetCurBlockPos(), df_RecReader::GetCurBlockUsed(), hton(), ie_DF_BROKEN_PIPE, ivd_Error, log_DBG_m, log_FUNC_m, m_output, m_outRecNum, m_streamSplitSize, ntoh(), NULL, rec_BSStart_c, df_RecCmn_t::seqNum, df_RecCmn_t::size, and df_RecCmn_t::type.

Referenced by ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), ProcRecFileEnd(), and ProcRecFileHdr().

                                                        {
    // Copy record to the Writer
    UInt32_t recSize = ntoh(a_recCmn_p->size);

    UInt32_t allocSize = recSize;
    // Heuristic check if next record is embeded data
    // if true then BSS and EMB data has to be writen together.
    // Allocate space for all non-processed data in input block.
    if (a_recCmn_p->type == rec_BSStart_c &&
        m_streamSplitSize >= GetBlkSize()) {

        log_FUNC_m(CopyRecord);

        Int32_t blkSizeLeft = GetCurBlockUsed() - GetCurBlockPos();

        if (blkSizeLeft > 0) {
            // Allocate for BSE and the following EMB data.
            allocSize += blkSizeLeft;
        }

        log_DBG_m(dbg_NORM,
            "Allocating for BSSt and EMB: " << allocSize);
    }

    UInt8_t* target = m_output->Allocate(allocSize);
    if (target == NULL) {
        log_FUNC_m(CopyRecord);
        throw ivd_Error(ie_DF_BROKEN_PIPE, "Output thread down.");
    }

    memcpy(target, a_recCmn_p, recSize);

    df_RecCmn_t *outRec_p = reinterpret_cast<df_RecCmn_t*>(target);
    outRec_p->seqNum = hton(++m_outRecNum);

    m_output->Move(recSize);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ConsistencyCheckMode df_Filter::GetConsistencyMode (  )  const [inline]

Definition at line 63 of file df_filter.h.

                                                    {
        return m_checkMode;
    };

void df_Filter::Init (  )  [private]

Definition at line 112 of file df_filter.cpp.

References m_allStreamSize, m_alteredBSS, m_bsEndMissing, m_curFile, m_fileEndMissing, m_fileID, m_fileSize, m_fileType, m_inputBlock_p, m_migrationID, m_splitProcessed, m_streamSize, and m_streamSplitSize.

Referenced by df_Filter(), and Reset().

                     {

#if TGT_OS_linux
#warning "Put some of the members to base class and give them better names."
#endif
    m_curFile = NULL;
    m_fileType = ift_UNKNOWN;
    m_fileID = 0;
    m_migrationID = 0;
    m_fileSize = 0;
    m_allStreamSize = 0;
    m_streamSplitSize = 0;
    m_splitProcessed = 0;
    m_alteredBSS = false;
    m_bsEndMissing = false;
    m_fileEndMissing = false;
    m_streamSize = 0;
    m_inputBlock_p = NULL;
}

Here is the caller graph for this function:

void df_Filter::LookupInTable ( ivd_FileID_t  a_fid,
ivd_MigrationID_t  a_migID 
) [private]

The function looks up the passed file and migration ID in the filter table.

Warning:
fileID of the element in the table is immediatelly set to 0 to mark it as "found". Don't use the m_curFile->fileID, use m_fileID instead.

Definition at line 170 of file df_filter.cpp.

References ivd_FileLocationData_t::fileID, m_blockBegin, m_blockEnd, and m_curFile.

Referenced by ProcRecFileHdr().

                                                                           {

    for (ivd_FileLocIter_t i(m_blockBegin); i != m_blockEnd; ++i) {
        if (i->fileID == a_fid && i->migrationID == a_migID) {
            m_curFile = &(*i);

            // Mark the file immediatelly as found to prevent bogus
            // warnings emitted by CheckUnhandledFiles().
            m_curFile->fileID = 0;
            return;
        }
    }
    m_curFile = NULL;
}

Here is the caller graph for this function:

UInt32_t df_Filter::NextBlockToCopy (  )  const

Which is the next block number that the filter will use for copying data?

Return values:
0 No more blocks to be processed.

Definition at line 150 of file df_filter.cpp.

References m_blockEnd, and m_files.

Referenced by bea_RecallThread::Recall().

                                          {

    if (m_blockEnd == m_files.end()) {
        return 0;
    }

    return (m_blockEnd->blockOffset);
}

Here is the caller graph for this function:

UInt8_t * df_Filter::NextInputBlock (  ) 

This function is called by the user of the df_Filter (e.g.

ivd-bea). It fills input data (e.g. from tape) in the buffer returned by this function and then calls df_Writer::Unpack(buffer).

Return values:
NULL when finished parsing input stream, no block is allocated

Definition at line 193 of file df_filter.cpp.

References ie_DF_BROKEN_PIPE, df_RecReader::IsNextRecordRaw(), ivd_Error, m_alteredBSS, m_block, m_blockBegin, m_files, m_inputBlock_p, m_output, m_splitProcessed, m_streamSize, NULL, and ProcessingFile().

Referenced by bea_RecallThread::Recall().

                                   {

    // All the files in the file list have been processed
    if (!ProcessingFile() && m_blockBegin == m_files.end() ){
        return NULL;
    }

    // End-of-split detected
    if (m_alteredBSS && m_splitProcessed >= m_streamSize ) {
        return NULL;
    }

    if (ProcessingFile() && IsNextRecordRaw()) {

        UInt8_t* buffer_p = m_output->AllocateRawBlock();

        if (buffer_p == NULL) {
            throw ivd_Error(ie_DF_BROKEN_PIPE, "Output thread down.");
        }
        m_inputBlock_p = buffer_p;
    }
    else {
        m_inputBlock_p = &(m_block[0]);
    }

    return m_inputBlock_p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Filter::ProcBlock ( const UInt8_t a_dataBlock  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 373 of file df_filter.cpp.

References CheckUnhandledFiles(), dbg_DETAIL, dbg_LOW, evt_ERROR, df_RecReader::GetBlockID(), df_RecReader::GetBlockNum(), ie_DF_INVSTREAMFMT, ie_NOTFOUND, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_blockBegin, m_blockEnd, m_curFile, m_fileID, m_files, NULL, df_RecReader::PositionToRecord(), and rec_FileHdr_c.

                                                    {
    log_FUNC_m(ProcBlock);

    CheckUnhandledFiles();

    // Prepare pointers for LookupInTable() to work properly,
    // based on block ID (== block number)
    UInt32_t blockID(GetBlockID());
    log_DBG_m(dbg_DETAIL,"ProcBlock() ID: " << blockID);

    if (GetBlockNum() == 1) {
        if (m_curFile != NULL) {
            ostringstream sstr;
            sstr
                << "Detected file stream that spans over the migration boundary. "
                << "Recreate FRI for this medium and "
                << "run FSC vs media check with autocorrect.";

            log_WriteEvent(evt_ERROR, sstr.str(), "DF");

            throw ivd_DFError(ie_DF_INVSTREAMFMT,
                blockID, "Incomplete file.", sstr.str() );
        }
    }

    // TODO: What if blockID differs from the block ID in the recall list?

    m_blockBegin = m_blockEnd;

    while (m_blockEnd != m_files.end() && m_blockEnd->blockOffset <= blockID) {
        ++m_blockEnd;
    }

    // If no files have been processed yet then
    // position to first FILE record.

    if (m_fileID == 0) {
        const df_RecCmn_t* pos = PositionToRecord(rec_FileHdr_c);
        if (pos == NULL) {
            log_MARKLINE_m;
            ostringstream sstr;
            sstr
                << "Record "
                << string((const char*)(&rec_FileHdr_c), sizeof(rec_FileHdr_c))
                << " not found in block.";
            throw ivd_DFError(
                ie_NOTFOUND, GetBlockID(), sstr.str(), true);
        }
    }

    if (m_blockBegin != m_files.end() && m_blockBegin->blockOffset != blockID) {
        log_DBG_m(dbg_LOW,
            "Medium block offset is different from offset on the list. " <<
            "Medium: " << blockID << ", list: " << m_blockBegin->blockOffset);
    }
}

Here is the call graph for this function:

void df_Filter::ProcEndOfInput (  )  [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 621 of file df_filter.cpp.

References CloseCopiedSplit(), and log_FUNC_m.

Referenced by bea_RecallThread::Recall().

Here is the call graph for this function:

Here is the caller graph for this function:

bool df_Filter::ProcessingFile (  )  const

Is filter currently procesing (copying) a file from the input stream?

Definition at line 106 of file df_filter.cpp.

References m_curFile, and NULL.

Referenced by NextInputBlock(), and bea_RecallThread::Recall().

                                     {
    return (m_curFile != NULL);
}

Here is the caller graph for this function:

void df_Filter::ProcRecBSEnd ( const df_RecCmn_t a_recCmn_p  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 574 of file df_filter.cpp.

References df_RecByteStreamEnd_t::allStreamSize, CopyRecord(), hton(), df_RecByteStreamEnd_t::idFile, log_ERR_m, log_FUNC_m, log_WRN_m, m_allStreamSize, m_bsEndMissing, m_curFile, m_streamSize, m_streamSplitSize, ntoh(), and NULL.

                                                          {
    log_FUNC_m(ProcRecBSEnd);

    if (m_curFile != NULL) {
        const df_RecByteStreamEnd_t *bse_p =
            df_GetSpecificRec<df_RecByteStreamEnd_t>(a_recCmn_p);

        // Calculate relative position in the stream at the BSEn
        // regardless of the split.
        UInt64_t relStreamPos = m_streamSize;

        if (m_streamSplitSize > 0) {
            if (m_streamSplitSize < m_streamSize) {
                relStreamPos -= (m_streamSize - m_streamSplitSize);
            }
            else if (m_streamSplitSize > m_streamSize){
                log_ERR_m(
                    "File ID: " << ntoh(bse_p->idFile) <<
                    "Stream split size > stream size. " <<
                    m_streamSplitSize << " > " << m_streamSize);
            }
        }

        // Reorg/redundant copy of a split might have created wrong BSEn
        // record (invalid allStreamSize). It will be corrected.
        if ( (m_allStreamSize + relStreamPos) != ntoh(bse_p->allStreamSize)) {

            df_RecByteStreamEnd_t *bse_nc_p =
                const_cast<df_RecByteStreamEnd_t *>(bse_p);

            log_WRN_m(
                "File ID: " << ntoh(bse_p->idFile) <<
                "Corrected BSE.allStreamSize from " <<
                ntoh(bse_p->allStreamSize) << " to " <<
                m_allStreamSize + relStreamPos);

            bse_nc_p->allStreamSize = hton(m_allStreamSize + relStreamPos);
        }

        // TODO: Check if the stream was copied, but was aborted.
        CopyRecord(a_recCmn_p);
        m_streamSplitSize = 0;
        m_bsEndMissing = false;
    }
}

Here is the call graph for this function:

void df_Filter::ProcRecBSStart ( const df_RecCmn_t a_recCmn_p  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 501 of file df_filter.cpp.

References CopyRecord(), dbg_LOW, dbg_NORM, df_RF_SPLITTED, df_RecCmn_t::flags, hton(), log_DBG_m, log_FUNC_m, m_allStreamSize, m_alteredBSS, m_bsEndMissing, m_curFile, df_RecReader::m_curStreamLeft, df_RecReader::m_curStreamName, m_fileID, m_splitProcessed, m_streamSize, m_streamSplitSize, ntoh(), NULL, and ivd_FileLocationData_t::splitSize.

                                                            {

    log_FUNC_m(ProcRecBSStart);

    if (m_curFile != NULL) {

        const df_RecByteStreamStart_t* bssConst_p =
            df_GetSpecificRec<df_RecByteStreamStart_t>(a_recCmn_p);

        df_RecByteStreamStart_t* bss_p =
            const_cast<df_RecByteStreamStart_t*>(bssConst_p);

        df_RecCmn_t* recCmnNotConst_p = const_cast<df_RecCmn_t*>(a_recCmn_p);

        m_streamSplitSize = m_curStreamLeft;
        log_DBG_m(dbg_NORM,
            "BSS: size " << ntoh(bss_p->streamSize)
            << ", Current stream left: " << m_curStreamLeft
            << ", FSC.splitSize: " << m_curFile->splitSize
            << ", splitProcessed: " << m_splitProcessed);

        m_bsEndMissing  = true;
        m_allStreamSize = ntoh(bss_p->allStreamSize);
        m_streamSize = ntoh(bss_p->streamSize);

        // if stream split size > expected stream size
        if ( m_streamSplitSize > ((UInt64_t)m_curFile->splitSize - (UInt64_t)m_splitProcessed) ) {
            log_DBG_m(dbg_LOW,
                "Detected a stream that is split at the end of volume." <<
                " Correcting BSS.");

            // NOTE: Updating a member of a base class!
            m_curStreamLeft
            = m_streamSplitSize
            = m_curFile->splitSize - m_splitProcessed;

            bss_p->streamSplitSize = hton(m_curStreamLeft);
            recCmnNotConst_p->flags |= hton(UInt32_t(df_RF_SPLITTED));

            m_alteredBSS = true;

            log_DBG_m(dbg_NORM,
                "File ID: " << m_fileID <<
                ", stream \'" << m_curStreamName << "\' is split at: " <<
                m_streamSplitSize);
        }
        CopyRecord(a_recCmn_p);
    }
}

Here is the call graph for this function:

void df_Filter::ProcRecEmbData ( const df_RecCmn_t a_recCmn_p  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 552 of file df_filter.cpp.

References CopyRecord(), df_RecEmbeddedData_t::data, m_curFile, m_splitProcessed, ntoh(), NULL, and ivd_VarData_t::size.

                                                            {

    // TODO: Try to optimize target EMbD by joining them together.
    if (m_curFile != NULL) {
        CopyRecord(a_recCmn_p);

        const df_RecEmbeddedData_t *emd_p =
            df_GetSpecificRec<df_RecEmbeddedData_t>(a_recCmn_p);
        m_splitProcessed += ntoh(emd_p->data.size);
    }
}

Here is the call graph for this function:

void df_Filter::ProcRecFileEnd ( const df_RecCmn_t a_recCmn_p  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 463 of file df_filter.cpp.

References CopyRecord(), dbg_DETAIL, dbg_NORM, df_RecFileEnd_t::idFile, ie_DATA_CORRUPTION, log_DBG_m, log_FUNC_m, m_allStreamSize, m_curFile, m_fileEndMissing, m_fileID, m_splitProcessed, m_streamSplitSize, ntoh(), NULL, and df_RecFileEnd_t::status.

                                                            {
    log_FUNC_m(ProcRecFileEnd);

    const df_RecFileEnd_t* fe_p = df_GetSpecificRec<df_RecFileEnd_t>(a_recCmn_p);
    UInt32_t status = ntoh(fe_p->status);

    // TODO: Overchecking? To be put in the base class?
    if (m_fileID != ntoh(fe_p->idFile)) {
        ostringstream sstr;
        sstr
            << "Incorrect File ID on FileEnd. "
            << "Expected (" << m_fileID << ") "
            << "Found (" << ntoh(fe_p->idFile) << ").";

        throw ivd_InternalError(ie_DATA_CORRUPTION, sstr.str());
    };

    log_DBG_m(dbg_DETAIL,
        "FileEnd: " << m_fileID << " status: " << status);

    if (m_curFile != NULL) {
        // TODO: Check if the file was copied, but was aborted.

        m_fileEndMissing  = false;

        log_DBG_m(dbg_NORM, "End of copying the file: " << m_fileID);

        CopyRecord(a_recCmn_p);
        m_splitProcessed = 0;
        m_streamSplitSize = 0;
        m_allStreamSize = 0;

        // We're done with this file
        m_curFile = NULL;
    }
}

Here is the call graph for this function:

void df_Filter::ProcRecFileHdr ( const df_RecCmn_t a_recCmn_p  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 432 of file df_filter.cpp.

References CopyRecord(), dbg_DETAIL, dbg_NORM, df_RF_CONTINUED, df_StandardAttr_t::flags, df_RecCmn_t::GetVarDataNet(), df_RecFile_t::idFile, df_RecFile_t::idMig, log_DBG_m, log_FUNC_m, LookupInTable(), m_curFile, m_fileEndMissing, m_fileID, m_fileSize, m_fileType, m_migrationID, m_streamSplitSize, df_RecFile_t::name, ntoh(), NULL, df_StandardAttr_t::size, df_RecFile_t::stdAttr, and df_StandardAttr_t::type.

                                                            {
    log_FUNC_m(ProcRecFileHdr);

    const df_RecFile_t *fh_p = df_GetSpecificRec<df_RecFile_t>(a_recCmn_p);

    m_fileType     = static_cast<ivd_FileType_e>( ntoh(fh_p->stdAttr.type) );
    m_fileID       = static_cast<ivd_FileID_t>(ntoh(fh_p->idFile));
    m_migrationID  = ntoh(fh_p->idMig);
    m_fileSize     = ntoh(fh_p->stdAttr.size);

    string name(a_recCmn_p->GetVarDataNet(fh_p->name));

    UInt32_t ff = ntoh(fh_p->stdAttr.flags);

    log_DBG_m(dbg_DETAIL,
        "File ID (mig ID): " << m_fileID << "(" << m_migrationID << ")" <<
        " file name: " << name <<
        " 1st split:" << ( (ff & df_RF_CONTINUED)? "NO" : "YES") );

    LookupInTable(m_fileID, m_migrationID);

    if (m_curFile != NULL) {
        log_DBG_m(dbg_NORM, "Start of copying the file: " << m_fileID);
        m_streamSplitSize = 0;
        m_fileEndMissing  = true;
        CopyRecord(a_recCmn_p);
    }

}

Here is the call graph for this function:

void df_Filter::ProcRecRawData ( const UInt8_t a_block_p  )  [private, virtual]

Reimplemented from df_RecReader.

Definition at line 565 of file df_filter.cpp.

References df_RecReader::GetBlkSize(), m_curFile, m_output, m_splitProcessed, and NULL.

                                                       {
    if (m_curFile != NULL) {
        UInt32_t blkSize = GetBlkSize();
        m_output->Move(blkSize);
        m_splitProcessed += blkSize;
    }
}

Here is the call graph for this function:

void df_Filter::Reset (  )  [virtual]

Definition at line 134 of file df_filter.cpp.

References Init(), and log_FUNC_m.

Referenced by bea_RecallThread::Recall().

                      {
    log_FUNC_m(Reset);

    // Reset own members first
    Init();

    df_RecReader::Reset();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void df_Filter::SetConsistencyMode ( ConsistencyCheckMode  a_mode  )  [inline]

Definition at line 59 of file df_filter.h.

Referenced by bea_RecallThread::Recall().

                                                         {
        m_checkMode = a_mode;
    };

Here is the caller graph for this function:


Member Data Documentation

Macro to add class name member s_className.

Reimplemented from df_RecReader.

Definition at line 75 of file df_filter.h.

Definition at line 106 of file df_filter.h.

Referenced by CloseCopiedSplit(), Init(), ProcRecBSEnd(), ProcRecBSStart(), and ProcRecFileEnd().

bool df_Filter::m_alteredBSS [private]

Definition at line 103 of file df_filter.h.

Referenced by CloseCopiedSplit(), Init(), NextInputBlock(), and ProcRecBSStart().

Buffer, which is used for filtering records inside one block.

Definition at line 91 of file df_filter.h.

Referenced by NextInputBlock().

Definition at line 85 of file df_filter.h.

Referenced by CheckUnhandledFiles(), LookupInTable(), NextInputBlock(), and ProcBlock().

bool df_Filter::m_bsEndMissing [private]

Definition at line 109 of file df_filter.h.

Referenced by CloseCopiedSplit(), Init(), ProcRecBSEnd(), and ProcRecBSStart().

Definition at line 77 of file df_filter.h.

Referenced by CheckUnhandledFiles(), and CloseCopiedSplit().

Definition at line 110 of file df_filter.h.

Referenced by CloseCopiedSplit(), Init(), ProcRecFileEnd(), and ProcRecFileHdr().

Definition at line 84 of file df_filter.h.

Referenced by CheckLeftovers(), NextBlockToCopy(), NextInputBlock(), and ProcBlock().

Definition at line 98 of file df_filter.h.

Referenced by Init(), and ProcRecFileHdr().

Definition at line 95 of file df_filter.h.

Referenced by Init(), and ProcRecFileHdr().

Definition at line 92 of file df_filter.h.

Referenced by Init(), and NextInputBlock().

Definition at line 97 of file df_filter.h.

Referenced by CloseCopiedSplit(), Init(), and ProcRecFileHdr().

auto_ptr<df_Writer> df_Filter::m_output [private]

Definition at line 81 of file df_filter.h.

Referenced by CloseCopiedSplit(), and CopyRecord().

Definition at line 105 of file df_filter.h.

Referenced by CloseCopiedSplit(), Init(), NextInputBlock(), ProcRecBSEnd(), and ProcRecBSStart().


The documentation for this class was generated from the following files: