fsc_RawMediumContentCollector Class Reference
[G_new_group]

#include <fsc_RawMediumContentCollector.h>

Inheritance diagram for fsc_RawMediumContentCollector:

Inheritance graph
[legend]
Collaboration diagram for fsc_RawMediumContentCollector:

Collaboration graph
[legend]

List of all members.


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 45 of file fsc_RawMediumContentCollector.h.


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

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 47 of file fsc_RawMediumContentCollector.cpp.

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

00054     : m_csvFile(a_csvFilePath),
00055       m_mediumKey(a_mediumKey),
00056       m_separator(a_separator),
00057       m_detailed(a_detailed),
00058       m_migID(0),
00059       m_dataSize(0),
00060       m_splitOffset(0),
00061       m_splitSize(0),
00062       m_medVolNum(0),
00063       m_medVolNumSelected(a_medVolNum),
00064       m_blockOffset(0),
00065       m_dataType(0),
00066       m_status(0) {
00067 
00068     log_FUNC_m(fsc_RawMediumContentCollector);
00069     
00070     m_csvFile.OpenF(fom_WRITE | fom_CREATE_NEW);
00071 
00072     if (m_detailed) {
00073         cout
00074             << "File ID,"
00075             << "Migration ID,"
00076             << "Migration time,"
00077             << "Size of all streams,"
00078             << "Split offset,"
00079             << "Split size,"
00080             << "Medium position,"
00081             << "Medium Volume,"
00082             << "Data type flags,";
00083     }
00084     cout
00085         << "Status flags,"
00086         << "\"Full path from mountpoint\"" << endl;
00087 }

Here is the call graph for this function:

fsc_RawMediumContentCollector::~fsc_RawMediumContentCollector (  )  [virtual]

Definition at line 91 of file fsc_RawMediumContentCollector.cpp.

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

00091                                                               {
00092     log_FUNC_m(~fsc_RawMediumContentCollector);
00093     m_csvFile.CloseF();
00094 }

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 97 of file fsc_RawMediumContentCollector.cpp.

References m_blockOffset, m_dataSize, m_dataType, m_medVolNum, m_migID, m_path, m_splitOffset, m_splitSize, m_status, and fsc_RawCollector::ProcFileID().

00097                                                                       {
00098     fsc_RawCollector::ProcFileID(a_fileID);
00099     m_migID = 0;
00100     m_dataSize = 0;
00101     m_splitOffset =0;
00102     m_splitSize = 0;
00103     m_medVolNum = 0;
00104     m_blockOffset = 0;
00105     m_dataType = 0;
00106     m_status = 0;
00107     m_path.clear();
00108 
00109     return true;
00110 }

Here is the call graph for this function:

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 113 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.

00114                                                 {
00115 
00116     m_migID         = a_gen.migrationID;
00117     m_dataSize      = a_gen.size;
00118     m_splitOffset   = 0;
00119     m_splitSize     = a_gen.size;
00120     m_dataType      = a_gen.nextEntity.dataType;
00121     m_status        = a_status;
00122     return true;
00123 }

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 126 of file fsc_RawMediumContentCollector.cpp.

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

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

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 136 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.

00136                                                                      {
00137     m_splitOffset = a_split.dataOffset;
00138     m_splitSize   = a_split.dataSize;
00139     m_dataType    = a_split.nextEntity.dataType;
00140     return true;
00141 }

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 144 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().

00144                                                                                  {
00145 
00146     m_blockOffset = a_medPos.blockOffset;
00147     m_medVolNum = a_medPos.medVolNum;
00148 
00149     if (m_mediumKey == a_medPos.mediaKey) {
00150         // print all volumes || print filtered by volume if volume is provided at cli
00151         if (m_medVolNumSelected == 0 || m_medVolNumSelected == m_medVolNum) {
00152             bool isDirectory(false);
00153             if (m_path.empty()) {
00154                 // Get full path from NSC.
00155                 fsc_nsElement* nsElement_p(fsc_nsCreateElementObj(m_curFileID));
00156 
00157                 if (nsElement_p == NULL) {
00158                     m_path.assign("unknown file path (not in NSC)");
00159                 }
00160                 else {
00161                     nsElement_p->GetFullPath(m_path, m_separator);
00162                     isDirectory = nsElement_p->IsDirectory();
00163 
00164                     // Can we use this information?
00165                     //ivd_MigrationID_t nscMigID = nsElement_p->GetMigID();
00166 
00167                     fsc_nsRemoveElementObj(nsElement_p);
00168                 }
00169             }
00170 
00171             ostringstream sstr;
00172             if (m_detailed) {
00173                 cmn_Time migTime(time_t(m_migID >> 8));
00174 
00175                 sstr
00176                     << m_curFileID<< ","
00177                     << m_migID << ","
00178                     << migTime.Time2YMDhms() << ","
00179                     << m_dataSize<< ","
00180                     << m_splitOffset<< ","
00181                     << m_splitSize<< ","
00182                     << m_blockOffset<< ","
00183                     << m_medVolNum << ","
00184                     << cmn_GetMigFlags(m_dataType) << ",";
00185             }
00186 
00187             if (isDirectory) {
00188                 sstr << "dir;";
00189             }
00190             if (m_status & mvds_NONSC) {
00191                 sstr << "no-NSC;";
00192             }
00193             if (m_status & mvds_DELETED) {
00194                 sstr << "deleted;";
00195             }
00196             if (m_status & mvds_LASTGENERATION) {
00197                 sstr << "last;";
00198             }
00199             sstr << ",";
00200 
00201             sstr  << "\"" << m_path<< "\"" << endl;
00202 
00203             string line = sstr.str();
00204             m_csvFile.WriteF(line.c_str(), line.length());
00205         }
00206     }
00207     return true;
00208 }

Here is the call graph for this function:


Member Data Documentation

Reimplemented from fsc_RawCollector.

Definition at line 81 of file fsc_RawMediumContentCollector.h.

Output file where records will be written in CSV form.

Definition at line 85 of file fsc_RawMediumContentCollector.h.

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

Medium to limit output for.

Definition at line 88 of file fsc_RawMediumContentCollector.h.

Referenced by ProcRecMedPosMgr().

Definition at line 90 of file fsc_RawMediumContentCollector.h.

Referenced by ProcRecMedPosMgr().

Definition at line 93 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), ProcRecGeneration(), and ProcRecMedPosMgr().

Definition at line 94 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), ProcRecGeneration(), and ProcRecMedPosMgr().

Definition at line 97 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), and ProcRecMedPosMgr().

Definition at line 98 of file fsc_RawMediumContentCollector.h.

Referenced by ProcRecMedPosMgr().

Definition at line 99 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), and ProcRecMedPosMgr().

Definition at line 103 of file fsc_RawMediumContentCollector.h.

Referenced by ProcFileID(), and ProcRecMedPosMgr().


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

Generated on Mon Feb 27 19:24:02 2012 for OPENARCHIVE by  doxygen 1.5.6