Public Member Functions | Public Attributes | Private Attributes

fsc_RawMediumContentCollector Class Reference
[G_new_group]

This class is intended for dumping the contents of the specified medium (and medium volumes) to a specified file. More...

#include <fsc_RawMediumContentCollector.h>

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

List of all members.

Public Member Functions

 fsc_RawMediumContentCollector (const cmn_Path &a_csvFilePath, ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum, char a_separator, bool a_detailed)
virtual ~fsc_RawMediumContentCollector ()
virtual bool ProcFileID (ivd_RecordIDX_t a_fileID)
 this method is called by fsc_DataL object to collect FileID
virtual bool ProcRecGeneration (fsc_Generation_t &a_gen, UInt32_t a_status)
 this method is called by fsc_Generation object to collect GenID and Size
virtual bool ProcRecCopy (fsc_Copy_t &a_copy)
 ProcRecCopy is added just to check consistency between generation and its copies.
virtual bool ProcRecSplit (fsc_Split_t &a_split)
 this method is called by fsc_Split to collect split offset and size
virtual bool ProcRecMedPosMgr (fsc_MediaPosition_t &a_medPos)
 this method is called by fsc_MedPosMgs to collect media's block offset

Public Attributes

 log_CLASSID_m

Private Attributes

cmn_File m_csvFile
 Output file where records will be written in CSV form.
ivd_MediaKey_t m_mediumKey
 Medium to limit output for.
char m_separator
bool m_detailed
ivd_MigrationID_t m_migID
fsc_UInt48 m_dataSize
UInt64_t m_splitOffset
UInt64_t m_splitSize
ivd_MedVolNum_t m_medVolNum
ivd_MedVolNum_t m_medVolNumSelected
ivd_BlockOffset_t m_blockOffset
UInt16_t m_dataType
UInt32_t m_status
string m_path

Detailed Description

This class is intended for dumping the contents of the specified medium (and medium volumes) to a specified file.

It uses the FSC raw scanning infrastructure to achieve that. fsc_RawScan class is performing a tree walk through the FSC and calls functions in this class for each of the elements. This class is collecting the information and displays it if the split is on the required medium/volume. In that case it also uses the name space catalog to get the full path of the file.

Definition at line 59 of file fsc_RawMediumContentCollector.h.


Constructor & Destructor Documentation

fsc_RawMediumContentCollector::fsc_RawMediumContentCollector ( const cmn_Path a_csvFilePath,
ivd_MediaKey_t  a_mediumKey,
ivd_MedVolNum_t  a_medVolNum,
char  a_separator,
bool  a_detailed 
)

Definition at line 61 of file fsc_RawMediumContentCollector.cpp.

References fom_CREATE_NEW, fom_WRITE, log_FUNC_m, m_csvFile, m_detailed, and cmn_File::OpenF().

    : m_csvFile(a_csvFilePath),
      m_mediumKey(a_mediumKey),
      m_separator(a_separator),
      m_detailed(a_detailed),
      m_migID(0),
      m_dataSize(0),
      m_splitOffset(0),
      m_splitSize(0),
      m_medVolNum(0),
      m_medVolNumSelected(a_medVolNum),
      m_blockOffset(0),
      m_dataType(0),
      m_status(0) {

    log_FUNC_m(fsc_RawMediumContentCollector);
    
    m_csvFile.OpenF(fom_WRITE | fom_CREATE_NEW);

    if (m_detailed) {
        cout
            << "File ID,"
            << "Migration ID,"
            << "Migration time,"
            << "Size of all streams,"
            << "Split offset,"
            << "Split size,"
            << "Medium position,"
            << "Medium Volume,"
            << "Data type flags,";
    }
    cout
        << "Status flags,"
        << "\"Full path from mountpoint\"" << endl;
}

Here is the call graph for this function:

fsc_RawMediumContentCollector::~fsc_RawMediumContentCollector (  )  [virtual]

Definition at line 105 of file fsc_RawMediumContentCollector.cpp.

References cmn_File::CloseF(), log_FUNC_m, and m_csvFile.

Here is the call graph for this function:


Member Function Documentation

bool fsc_RawMediumContentCollector::ProcFileID ( ivd_RecordIDX_t  a_fileID  )  [virtual]

this method is called by fsc_DataL object to collect FileID

Reimplemented from fsc_RawCollector.

Definition at line 111 of file fsc_RawMediumContentCollector.cpp.

References m_blockOffset, m_dataSize, m_dataType, m_medVolNum, m_migID, m_path, m_splitOffset, m_splitSize, and m_status.

                                                                      {
    fsc_RawCollector::ProcFileID(a_fileID);
    m_migID = 0;
    m_dataSize = 0;
    m_splitOffset =0;
    m_splitSize = 0;
    m_medVolNum = 0;
    m_blockOffset = 0;
    m_dataType = 0;
    m_status = 0;
    m_path.clear();

    return true;
}

bool fsc_RawMediumContentCollector::ProcRecCopy ( fsc_Copy_t a_copy  )  [virtual]

ProcRecCopy is added just to check consistency between generation and its copies.

Reimplemented from fsc_RawCollector.

Definition at line 140 of file fsc_RawMediumContentCollector.cpp.

References fsc_NextEntity_t::dataType, m_dataType, and fsc_Copy_t::nextEntity.

                                                                  {
    // Generation may have H and D, but copy not.
    // If some migration is aborted this is known at BSE status.
    // Unfortunately if file is splitted, this first split does not know that
    // file is not consistent, so update generation as Data is in it.
    m_dataType = a_copy.nextEntity.dataType;
    return true;
}

bool fsc_RawMediumContentCollector::ProcRecGeneration ( fsc_Generation_t a_gen,
UInt32_t  a_status 
) [virtual]

this method is called by fsc_Generation object to collect GenID and Size

Reimplemented from fsc_RawCollector.

Definition at line 127 of file fsc_RawMediumContentCollector.cpp.

References fsc_NextEntity_t::dataType, m_dataSize, m_dataType, m_migID, m_splitOffset, m_splitSize, m_status, fsc_Generation_t::migrationID, fsc_Generation_t::nextEntity, and fsc_Generation_t::size.

                                                {

    m_migID         = a_gen.migrationID;
    m_dataSize      = a_gen.size;
    m_splitOffset   = 0;
    m_splitSize     = a_gen.size;
    m_dataType      = a_gen.nextEntity.dataType;
    m_status        = a_status;
    return true;
}

bool fsc_RawMediumContentCollector::ProcRecMedPosMgr ( fsc_MediaPosition_t a_medPos  )  [virtual]

this method is called by fsc_MedPosMgs to collect media's block offset

Reimplemented from fsc_RawCollector.

Definition at line 158 of file fsc_RawMediumContentCollector.cpp.

References fsc_MediaPosition_t::blockOffset, cmn_GetMigFlags(), fsc_nsCreateElementObj(), fsc_nsRemoveElementObj(), fsc_nsElement::GetFullPath(), fsc_nsElement::IsDirectory(), m_blockOffset, m_csvFile, fsc_RawCollector::m_curFileID, m_dataSize, m_dataType, m_detailed, m_mediumKey, m_medVolNum, m_medVolNumSelected, m_migID, m_path, m_separator, m_splitOffset, m_splitSize, m_status, fsc_MediaPosition_t::mediaKey, fsc_MediaPosition_t::medVolNum, mvds_DELETED, mvds_LASTGENERATION, mvds_NONSC, NULL, cmn_Time::Time2YMDhms(), and cmn_File::WriteF().

                                                                                 {

    m_blockOffset = a_medPos.blockOffset;
    m_medVolNum = a_medPos.medVolNum;

    if (m_mediumKey == a_medPos.mediaKey) {
        // print all volumes || print filtered by volume if volume is provided at cli
        if (m_medVolNumSelected == 0 || m_medVolNumSelected == m_medVolNum) {
            bool isDirectory(false);
            if (m_path.empty()) {
                // Get full path from NSC.
                fsc_nsElement* nsElement_p(fsc_nsCreateElementObj(m_curFileID));

                if (nsElement_p == NULL) {
                    m_path.assign("unknown file path (not in NSC)");
                }
                else {
                    nsElement_p->GetFullPath(m_path, m_separator);
                    isDirectory = nsElement_p->IsDirectory();

                    // Can we use this information?
                    //ivd_MigrationID_t nscMigID = nsElement_p->GetMigID();

                    fsc_nsRemoveElementObj(nsElement_p);
                }
            }

            ostringstream sstr;
            if (m_detailed) {
                cmn_Time migTime(time_t(m_migID >> 8));

                sstr
                    << m_curFileID<< ","
                    << m_migID << ","
                    << migTime.Time2YMDhms() << ","
                    << m_dataSize<< ","
                    << m_splitOffset<< ","
                    << m_splitSize<< ","
                    << m_blockOffset<< ","
                    << m_medVolNum << ","
                    << cmn_GetMigFlags(m_dataType) << ",";
            }

            if (isDirectory) {
                sstr << "dir;";
            }
            if (m_status & mvds_NONSC) {
                sstr << "no-NSC;";
            }
            if (m_status & mvds_DELETED) {
                sstr << "deleted;";
            }
            if (m_status & mvds_LASTGENERATION) {
                sstr << "last;";
            }
            sstr << ",";

            sstr  << "\"" << m_path<< "\"" << endl;

            string line = sstr.str();
            m_csvFile.WriteF(line.c_str(), line.length());
        }
    }
    return true;
}

Here is the call graph for this function:

bool fsc_RawMediumContentCollector::ProcRecSplit ( fsc_Split_t a_split  )  [virtual]

this method is called by fsc_Split to collect split offset and size

Reimplemented from fsc_RawCollector.

Definition at line 150 of file fsc_RawMediumContentCollector.cpp.

References fsc_Split_t::dataOffset, fsc_Split_t::dataSize, fsc_NextEntity_t::dataType, m_dataType, m_splitOffset, m_splitSize, and fsc_Split_t::nextEntity.

                                                                     {
    m_splitOffset = a_split.dataOffset;
    m_splitSize   = a_split.dataSize;
    m_dataType    = a_split.nextEntity.dataType;
    return true;
}


Member Data Documentation

Reimplemented from fsc_RawCollector.

Definition at line 95 of file fsc_RawMediumContentCollector.h.

Definition at line 113 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), and ProcRecMedPosMgr().

Output file where records will be written in CSV form.

Definition at line 99 of file fsc_RawMediumContentCollector.h.

Referenced by fsc_RawMediumContentCollector(), ProcRecMedPosMgr(), and ~fsc_RawMediumContentCollector().

Medium to limit output for.

Definition at line 102 of file fsc_RawMediumContentCollector.h.

Referenced by ProcRecMedPosMgr().

Definition at line 111 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), and ProcRecMedPosMgr().

Definition at line 112 of file fsc_RawMediumContentCollector.h.

Referenced by ProcRecMedPosMgr().

Definition at line 117 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), and ProcRecMedPosMgr().

Definition at line 104 of file fsc_RawMediumContentCollector.h.

Referenced by ProcRecMedPosMgr().


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