fsc_nsElement Class Reference
[G_new_group]

#include <fsc_nsElement.h>

Inheritance diagram for fsc_nsElement:

Inheritance graph
[legend]
Collaboration diagram for fsc_nsElement:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 49 of file fsc_nsElement.h.


Public Member Functions

 fsc_nsElement (ivd_RecordIDX_t a_fileID)
 used if you know dir entry type (file or directory) Usualy when add split info.
 fsc_nsElement (ivd_RecordIDX_t a_fileID, fsc_nsElement_t &a_elRec, nse_Opentype_e a_openType=nse_STANDARD)
 used in FSC dump, when record is read first and then checked if file or directory is read.
virtual ~fsc_nsElement (void)
virtual void Write2DB (fio_Transaction &a_trans)
 Write element changes to DB and.
virtual void InsertSplit (df_SplitInfo &a_splitInfo, fsc_GenInsertAct_e a_genInsAct)
 Take care about element ownerID (fileID of owner) and element deletion.
void Remove ()
 remove entry
void CheckLastGen (string &a_status, i_FSCfileState_t &a_FSCFileState, const i_IvdfsFileInfo_t &a_ivdFSfileInfo, ivd_MigrationID_t &a_migID)
void CheckLastGen (string &a_status, df_SplitInfo &a_splitInfo, bool a_autoCorrect, UInt32_t a_fieldStatus)
ivd_RecordIDX_t GetOwnerFileID ()
ivd_RecordIDX_t GetFileID ()
ivd_MigrationID_t GetMigID ()
ivd_FileSize_t GetFileSize ()
virtual bool IsDirectory ()
fsc_nsElement_tGetElementRecRef ()
 write changes to DB before it's removed from cache
df_StandardAttr_tGetStandAttrPtr ()
virtual void Dump (ostream &os)
void Pack (df_Packer &a_packer, char a_pathSeparator)
 fill packer, but packer could have any writer.
int GetFullPath (string &a_path, char a_pathSeparator= '/')
 fill a_path string with file and its path path separator is a_pathSeparator return 1 if found not initialized owner in that case also path is modified differently instead unknown owner the "IVD-lost+found" directory is used and file name is extended by its fileID in following format -IVD-<fileID> Example: file1.txt with fileid(12345) has owner with fileID > 0, but owner's name is not known.

Public Attributes

 log_CLASSID_m

Protected Attributes

ivd_RecordIDX_t m_fileID
fsc_nsOwnerMgrm_ownerMgrProperty_p
fsc_nsAttrMgrm_attribMgrProperty_p
fsc_nsNameMgrm_nameMgrProperty_p
fsc_nsElement_t m_elementRec
int m_refCounter

Private Member Functions

void SetMemOfOwner (ivd_RecordIDX_t a_memFileID)
void ChgOwner (ivd_RecordIDX_t a_newOwnFileID)
void ChgAttrib (df_SplitInfo &a_splitInfo, fsc_GenInsertAct_e a_genInsAct)
void ChgName (const string &a_name)

Friends

class ut_fsc_nsElement
ostream & operator<< (ostream &a_os, fsc_nsElement &a_nsElem)

Constructor & Destructor Documentation

fsc_nsElement::fsc_nsElement ( ivd_RecordIDX_t  a_fileID  ) 

used if you know dir entry type (file or directory) Usualy when add split info.

Definition at line 67 of file fsc_nsElement.cpp.

References log_FUNC_m.

00068   : fio_Vector(*g_nsElementRF_p, 1, a_fileID, false),    
00069     m_fileID(a_fileID),    
00070     m_ownerMgrProperty_p(NULL),
00071     m_attribMgrProperty_p(NULL),
00072     m_nameMgrProperty_p(NULL),    
00073     m_elementRec(a_fileID)
00074 {    
00075     log_FUNC_m(fsc_nsElement);
00076 }

fsc_nsElement::fsc_nsElement ( ivd_RecordIDX_t  a_fileID,
fsc_nsElement_t a_elRec,
nse_Opentype_e  a_openType = nse_STANDARD 
)

used in FSC dump, when record is read first and then checked if file or directory is read.

Definition at line 79 of file fsc_nsElement.cpp.

References fsc_nsCreateOwnerMgrObj(), GetOwnerFileID(), log_FUNC_m, m_ownerMgrProperty_p, and nse_CREATE_PARENT.

00082   : fio_Vector(*g_nsElementRF_p, 1, a_fileID, false),
00083     m_fileID(a_fileID),    
00084     m_ownerMgrProperty_p(NULL),
00085     m_attribMgrProperty_p(NULL),
00086     m_nameMgrProperty_p(NULL),    
00087     m_elementRec(a_elRec)
00088 {
00089     log_FUNC_m(fsc_nsElement);
00090     if (a_openType == nse_CREATE_PARENT) {
00091         m_ownerMgrProperty_p = fsc_nsCreateOwnerMgrObj(GetOwnerFileID());
00092     }
00093 }

Here is the call graph for this function:

fsc_nsElement::~fsc_nsElement ( void   )  [virtual]

Definition at line 96 of file fsc_nsElement.cpp.

References dbg_DETAIL, log_DBG_m, log_FUNC_m, m_attribMgrProperty_p, m_nameMgrProperty_p, m_ownerMgrProperty_p, and NULL.

00096                                   {    
00097     log_FUNC_m(~fsc_nsElement);
00098     
00099     log_DBG_m(dbg_DETAIL, " remove EL p= " << this);
00100 #if TGT_OS_linux
00101     #warning "Check this."
00102 #elif TGT_OS_windows
00103     #pragma message ("Check this.")
00104 #endif
00105 // CR
00106 // CR Use auto_ptr?
00107 // CR
00108     if (m_ownerMgrProperty_p != NULL) {
00109         delete m_ownerMgrProperty_p;
00110     };
00111     if (m_attribMgrProperty_p != NULL) {
00112         delete m_attribMgrProperty_p;
00113     };
00114     if (m_nameMgrProperty_p != NULL) {
00115         delete m_nameMgrProperty_p;
00116     }
00117 }


Member Function Documentation

void fsc_nsElement::Write2DB ( fio_Transaction a_trans  )  [virtual]

Write element changes to DB and.

Reimplemented in fsc_nsDirectory.

Definition at line 120 of file fsc_nsElement.cpp.

References fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, dbg_DETAIL, log_DBG_m, log_FUNC_m, m_attribMgrProperty_p, fio_Vector::m_changed, m_elementRec, m_fileID, m_nameMgrProperty_p, fsc_nsElement_t::nameIdx, fsc_nsElement_t::nameType, nit_DELETED, NULL, fsc_nsElement_t::numOfAttrib, fsc_nsElement_t::numOfName, fio_Vector::Write2DB(), fsc_nsNameMgr::Write2DB(), and fsc_nsAttrMgr::Write2DB().

Referenced by fsc_nsDirectory::Write2DB(), and fsc_DataL::Write2DB().

00120                                                      {    
00121     log_FUNC_m(Write2DB);    
00122     // fields regarding member/owner is handled by inheritted class    
00123     // owner is updatted when all its members are released.    
00124     //if (m_ownerMgrProperty_p != NULL) {    
00125     //   m_ownerMgrProperty_p->Write2DB(a_trans);    
00126     //}    m_elementRec.ownerType = oit_OWNER;    
00127     
00128     if (m_attribMgrProperty_p != NULL) {
00129         UInt8_t flags = m_elementRec.attribType;  
00130 //        log_DBG_m(dbg_DETAIL, " Update attributes ");
00131         if ( m_attribMgrProperty_p->Write2DB(flags,
00132                                           m_elementRec.numOfAttrib,
00133                                           m_elementRec.attribIdx,
00134                                           a_trans)) {            
00135             m_elementRec.attribType = flags;
00136             m_changed = true;        
00137         }
00138     }
00139     if (m_nameMgrProperty_p != NULL) {
00140         UInt8_t flags = m_elementRec.nameType;
00141         if (m_nameMgrProperty_p->Write2DB(flags,
00142                                        m_elementRec.numOfName,
00143                                        m_elementRec.nameIdx,
00144                                        a_trans)) {            
00145             m_changed = true;
00146         }
00147         if (m_elementRec.nameType != nit_DELETED ) {            
00148             m_elementRec.nameType = flags;        
00149         }    
00150     }    
00151     if (m_changed) {        
00152         fio_Vector::Write2DB(&m_elementRec, a_trans);    
00153     }
00154 
00155     log_DBG_m(dbg_DETAIL, "fsc_nsElement::Write2DB fileID = " << m_fileID << " " << endl
00156                             << *this);
00157 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::InsertSplit ( df_SplitInfo a_splitInfo,
fsc_GenInsertAct_e  a_genInsAct 
) [virtual]

Take care about element ownerID (fileID of owner) and element deletion.

All other fields are maintained by propriate managers: name, owner, and attribute.

Definition at line 160 of file fsc_nsElement.cpp.

References ChgAttrib(), ChgName(), ChgOwner(), dbg_DETAIL, df_SplitInfo::Dump(), df_SplitInfo::fileID, df_SplitInfo::fileName, fsc_nsCreateNameObj(), fsc_nsNameMgr::GetNameRef(), GetOwnerFileID(), giaINSERT_ONE_BEFORE_LAST_GEN, giaLAST_GEN_UPDATED, giaNEWEST_GEN, log_DBG_m, log_FUNC_m, log_WRN_m, fio_Vector::m_changed, m_elementRec, m_fileID, m_nameMgrProperty_p, fsc_nsElement_t::migID, df_SplitInfo::migrationID, fsc_nsElement_t::nameIdx, fsc_nsElement_t::nameType, nit_DELETED, nit_NAME, nit_NSCMISSING, NULL, fsc_nsElement_t::numOfName, df_SplitInfo::oldFileName, df_SplitInfo::oldOwnerID, df_SplitInfo::ownerID, fsc_nsElement_t::ownerIdx, and SetMemOfOwner().

Referenced by CheckLastGen(), fsc_DataL::fsc_DataL(), and fsc_DataL::Insert().

00160                                                                                          {    
00161     log_FUNC_m(InsertSplit);
00162 
00163     log_DBG_m(dbg_DETAIL, "NSC insert fileID = " 
00164                             << a_splitInfo.fileID
00165                             << " gen act " << (int)a_genInsAct
00166                             << "  owner " << a_splitInfo.ownerID
00167                             << "  name '" << a_splitInfo.fileName << "'"
00168                             << "  old owner " << a_splitInfo.oldOwnerID
00169                             << "  old name '" << a_splitInfo.oldFileName << "'" << endl
00170                             << *this);
00171     // NSC is not yet updatted  -----------------------
00172     // update NSC only if last or one before last generation are come
00173     if (m_elementRec.nameType == nit_NSCMISSING
00174         && a_genInsAct <= giaINSERT_ONE_BEFORE_LAST_GEN) {
00175 
00176         m_changed = true;        
00177 
00178         log_DBG_m(dbg_DETAIL, "first time.");
00179         if (a_splitInfo.fileName.empty()) {  // file is deleted
00180             // deleted generation doesn't change migID
00181             ChgName(a_splitInfo.oldFileName);            
00182             // change attributes is nonsense when file is deletted
00183             // attributes will be set when one before last generation is inserted
00184             m_elementRec.nameType = nit_DELETED;            
00185             m_elementRec.ownerIdx = a_splitInfo.oldOwnerID;        
00186             m_elementRec.migID    = a_splitInfo.migrationID;
00187         }
00188         else {
00189             m_elementRec.migID = a_splitInfo.migrationID;
00190             ChgName(a_splitInfo.fileName);
00191             ChgAttrib(a_splitInfo, giaNEWEST_GEN);
00192             m_elementRec.nameType = nit_NAME;
00193             m_elementRec.ownerIdx = a_splitInfo.ownerID;        
00194         }
00195         SetMemOfOwner(a_splitInfo.fileID);
00196         goto exit;
00197     }
00198 
00199     fsc_GenInsertAct_e genInsAct;
00200     if (a_splitInfo.migrationID > m_elementRec.migID) {
00201         genInsAct = giaNEWEST_GEN;
00202         m_changed = true;        
00203         m_elementRec.migID = a_splitInfo.migrationID;
00204     }
00205     else if (a_splitInfo.migrationID == m_elementRec.migID) {
00206         genInsAct = giaLAST_GEN_UPDATED;
00207     }
00208     else {
00209         return;
00210     }
00211     // change Name  -----------------------
00212     // will pass at every copy of deted file generation
00213     if (    genInsAct == giaNEWEST_GEN) {
00214         if (m_nameMgrProperty_p == NULL) {
00215             m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);        
00216         }
00217         if (a_splitInfo.fileName != m_nameMgrProperty_p->GetNameRef()) { 
00218             // name is changed or element is deletted
00219             if (    a_splitInfo.fileName.empty() ) {
00220                 if (m_elementRec.nameType == nit_DELETED) {
00221                     goto exit; // already updated
00222                 }
00223                 log_DBG_m(dbg_DETAIL, "File is DELETED.");
00224                 // just in case
00225                 ChgName(a_splitInfo.oldFileName);
00226                 if (a_splitInfo.oldOwnerID != GetOwnerFileID()) {
00227                     ChgOwner(a_splitInfo.oldOwnerID);
00228                 }
00229                 m_elementRec.nameType = nit_DELETED;
00230                 m_changed = true;
00231                 goto exit;
00232     //            return; // all other fields stay same
00233             }
00234             else {
00235                 if (m_elementRec.nameType == nit_DELETED) {
00236                     string spltiInfoDump = a_splitInfo.Dump();
00237                     log_WRN_m("Element was DELETED, but new generation is inserting." << endl
00238                             << "splitInfo = " << spltiInfoDump << endl
00239                             << "fsc_nsElement::InsertSplit fileID = " << m_fileID << " " << endl
00240                                 << *this);
00241                     m_elementRec.nameType = nit_NAME;
00242                 }
00243                 log_DBG_m(dbg_DETAIL, "Old name '" << a_splitInfo.oldFileName << "'");
00244                 log_DBG_m(dbg_DETAIL, "Change name to '" << a_splitInfo.fileName << "'");
00245                 ChgName(a_splitInfo.fileName);
00246             }
00247         }
00248     }
00249 
00250     // update Attributes  -----------------------
00251     // change attribute when new gen, or not comletted yet (many splits)
00252     // or use one before last gen in case that file is deletted
00253 
00254     ChgAttrib(a_splitInfo, genInsAct);
00255 
00256     // update Owner  -----------------------
00257     if (   genInsAct == giaNEWEST_GEN
00258         && a_splitInfo.ownerID != GetOwnerFileID()) {
00259         log_DBG_m(dbg_DETAIL, "Change own. old " << GetOwnerFileID() 
00260                              << "  new " << a_splitInfo.ownerID);
00261         // owner is changed
00262         ChgOwner(a_splitInfo.ownerID);
00263     }
00264 exit:
00265     log_DBG_m(dbg_DETAIL, "after NSC insert fileID = " << m_fileID << " " << endl
00266                             << *this );
00267 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::Remove (  ) 

remove entry

Definition at line 270 of file fsc_nsElement.cpp.

References fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, ChgName(), fsc_nsCreateAttribMgrObj(), ie_FSC_NONSCELEMENTOBJ, log_FUNC_m, m_attribMgrProperty_p, m_elementRec, m_fileID, m_ownerMgrProperty_p, fsc_nsElement_t::nameType, nit_NSCMISSING, NULL, fsc_nsElement_t::numOfAttrib, fsc_nsAttrMgr::RemoveAttributes(), and fsc_nsOwnerMgr::RemoveMember().

Referenced by fsc_DataL::Write2DB().

00270                            {
00271     log_FUNC_m(Remove);
00272     if (m_elementRec.nameType == nit_NSCMISSING) {
00273         return;
00274     }
00275     
00276     if (m_ownerMgrProperty_p == NULL) {
00277         ostringstream sstr;
00278         sstr << "Parent object of FileID:" << m_fileID << " must be generated before Remove() method is called."
00279             << " Cannot remove NSC of this file.";
00280         throw ivd_InternalError(ie_FSC_NONSCELEMENTOBJ, sstr.str(), true);
00281     }
00282     m_ownerMgrProperty_p->RemoveMember(m_fileID);
00283     
00284     ChgName("");
00285 
00286     if (m_attribMgrProperty_p == NULL) {
00287         m_attribMgrProperty_p = fsc_nsCreateAttribMgrObj(m_elementRec.attribType,
00288                                                          m_elementRec.numOfAttrib,
00289                                                          m_elementRec.attribIdx);
00290     }
00291     m_attribMgrProperty_p->RemoveAttributes();
00292 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::CheckLastGen ( string &  a_status,
i_FSCfileState_t a_FSCFileState,
const i_IvdfsFileInfo_t a_ivdFSfileInfo,
ivd_MigrationID_t a_migID 
)

Definition at line 295 of file fsc_nsElement.cpp.

References ait_NOTALLATTR, fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, cmn_HexDump(), dbg_DETAIL, i_IvdfsFileInfo_t::fileName, i_IvdfsFileInfo_t::fileSize, fmm_FILENAME, fmm_FILESIZE, fmm_MIGID, fmm_OK, fmm_OWNERID, fsc_MissmatchTxt_d, fsc_nsCreateAttribMgrObj(), fsc_nsCreateNameObj(), fsc_nsNameMgr::GetNameRef(), fsc_nsAttrMgr::GetStandAttrRef(), log_DBG_m, log_FUNC_m, m_attribMgrProperty_p, m_elementRec, m_nameMgrProperty_p, fsc_nsElement_t::memberIdx, fsc_nsElement_t::migID, fsc_nsElement_t::nameIdx, fsc_nsElement_t::nameType, nit_NSCMISSING, ntoh(), NULL, fsc_nsElement_t::numOfAttrib, fsc_nsElement_t::numOfName, i_IvdfsFileInfo_t::ownerID, fsc_nsElement_t::ownerIdx, i_FSCfileState_t::ownerMismatch, and df_StandardAttr_t::size.

Referenced by fsc_VolumeCheck::Check(), CheckLastGen(), and fsc_DataL::CheckLastGen().

00298                                                                   {
00299     log_FUNC_m(CheckLastGen);
00300     i_FileSize_t fileSize = 0;
00301 
00302     if (m_elementRec.nameType == nit_NSCMISSING) {
00303         a_status += "    No NSC.\n";
00304         return;
00305     }
00306     UInt32_t fieldStatus = fmm_OK;
00307 
00308     if (m_elementRec.migID > a_migID) {
00309         fieldStatus |= fmm_MIGID;
00310     }
00311     if (m_elementRec.ownerIdx != a_ivdFSfileInfo.ownerID) {
00312         log_DBG_m(dbg_DETAIL, "Owner mismatch");
00313         a_FSCFileState.ownerMismatch = true;
00314         fieldStatus |= fmm_OWNERID;
00315     } 
00316 
00317     if (m_nameMgrProperty_p == NULL) {
00318         m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);
00319     }
00320 
00321     string fsName(a_ivdFSfileInfo.fileName);
00322     
00323     if (fsName != m_nameMgrProperty_p->GetNameRef()) {
00324         string &fscStr = m_nameMgrProperty_p->GetNameRef();
00325         log_DBG_m(dbg_DETAIL, "FS.name = '" << fsName 
00326                         << "' Size " << fsName.size() 
00327                         << " DUMP: " << cmn_HexDump(fsName.data(), fsName.size()) << endl 
00328                         << " FSC name = '" << fscStr
00329                         << "' Size " << fscStr.size() 
00330                         << " DUMP: " << cmn_HexDump(fscStr.data(), fscStr.size()));
00331         fieldStatus |= fmm_FILENAME;
00332     }
00333 
00334     if (m_elementRec.attribType == ait_NOTALLATTR) {
00335         a_status += string("    Some or all file's meta data missing in NSC.\n");
00336         goto end;
00337     }
00338 
00339     if (   m_elementRec.memberIdx == 0 ) { // is a file, so check file size
00340 
00341         if (m_attribMgrProperty_p == NULL) {
00342             m_attribMgrProperty_p = fsc_nsCreateAttribMgrObj(m_elementRec.attribType,
00343                                                             m_elementRec.numOfAttrib,
00344                                                             m_elementRec.attribIdx);
00345         }
00346         df_StandardAttr_t &standAttr = m_attribMgrProperty_p->GetStandAttrRef();
00347         fileSize = ntoh(standAttr.size);
00348         if ( fileSize != a_ivdFSfileInfo.fileSize) {
00349             fieldStatus |= fmm_FILESIZE;
00350         }
00351     }
00352 end:
00353     if (fieldStatus) {
00354         ostringstream sstr;
00355         sstr << "    DUMP:                 FSC           HSMFS Notes" << endl;
00356 
00357         sstr << "    MigID    " << setw(16) << m_elementRec.migID
00358              << setw(16) << a_migID
00359              << fsc_MissmatchTxt_d(fieldStatus & fmm_MIGID);
00360 
00361         if (m_elementRec.attribType != ait_NOTALLATTR) {
00362             sstr << "    FileSize " << setw(16) << fileSize
00363                 << setw(16) << a_ivdFSfileInfo.fileSize
00364                 << fsc_MissmatchTxt_d(fieldStatus & fmm_FILESIZE);
00365         }
00366 
00367         sstr << "    FileName " << m_nameMgrProperty_p->GetNameRef() 
00368              << fsc_MissmatchTxt_d(fieldStatus & fmm_FILENAME);
00369 
00370         sstr << "    OwnerID  " << setw(16) << m_elementRec.ownerIdx
00371              << setw(16) << a_ivdFSfileInfo.ownerID
00372              << fsc_MissmatchTxt_d(fieldStatus & fmm_OWNERID);
00373 
00374         a_status += sstr.str();
00375     }
00376 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::CheckLastGen ( string &  a_status,
df_SplitInfo a_splitInfo,
bool  a_autoCorrect,
UInt32_t  a_fieldStatus 
)

Definition at line 379 of file fsc_nsElement.cpp.

References ait_NOTALLATTR, fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, CheckLastGen(), cmn_HexDump(), dbg_DETAIL, df_SplitInfo::fileName, df_SplitInfo::fileSize, fmm_FILENAME, fmm_FILESIZE, fmm_OWNERID, fsc_nsCreateAttribMgrObj(), fsc_nsCreateNameObj(), fsc_nsNameMgr::GetNameRef(), fsc_nsAttrMgr::GetStandAttrRef(), giaNEWEST_GEN, InsertSplit(), log_DBG_m, log_FUNC_m, m_attribMgrProperty_p, m_elementRec, m_nameMgrProperty_p, fsc_nsElement_t::memberIdx, fsc_nsElement_t::migID, df_SplitInfo::migrationID, fsc_nsElement_t::nameIdx, fsc_nsElement_t::nameType, nit_NSCMISSING, ntoh(), NULL, fsc_nsElement_t::numOfAttrib, fsc_nsElement_t::numOfName, df_SplitInfo::ownerID, fsc_nsElement_t::ownerIdx, and df_StandardAttr_t::size.

00382                                                                      {
00383 
00384     log_FUNC_m(CheckLastGen(df_SplitInfo));
00385     if (m_elementRec.nameType == nit_NSCMISSING) {
00386         a_status += "    Not in NSC. Internal error this must be handled before. \n";
00387         return;
00388     }
00389     if (m_elementRec.migID > a_splitInfo.migrationID) {
00390         // OK, probably new generation was inserted in meantime
00391         return;
00392     }
00393     if (m_elementRec.migID < a_splitInfo.migrationID) {
00394         if (a_autoCorrect) {
00395             InsertSplit(a_splitInfo, giaNEWEST_GEN);
00396             a_status += "    No last gen. in NSC. NSC probably disabled for some time. [CORRECTED]\n";
00397         }
00398         else {
00399             a_status += "    No last gen. in NSC. NSC probably disabled for some time. \n";
00400         }
00401         return;
00402     }
00403     // to do check attributes.
00404 
00405     if (m_elementRec.ownerIdx != a_splitInfo.ownerID) {
00406         a_fieldStatus |= fmm_OWNERID;
00407     }
00408 
00409     if (m_nameMgrProperty_p == NULL) {
00410         m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);
00411     }
00412 
00413     // not need to convert both are already in UTF8 format.
00414     if (string(a_splitInfo.fileName) != m_nameMgrProperty_p->GetNameRef()) {
00415         string &fscStr = m_nameMgrProperty_p->GetNameRef();
00416         log_DBG_m(dbg_DETAIL, "SplitInfo.name = '" << a_splitInfo.fileName 
00417                         << "' Size " << a_splitInfo.fileName.size() 
00418                         << " DUMP: " << cmn_HexDump(a_splitInfo.fileName.data(), a_splitInfo.fileName.size()) << endl 
00419                         << " FSC name = '" << fscStr
00420                         << "' Size " << fscStr.size() 
00421                         << " DUMP: " << cmn_HexDump(fscStr.data(), fscStr.size()));
00422     
00423         a_fieldStatus |= fmm_FILENAME;
00424     }
00425 
00426     if (m_elementRec.attribType == ait_NOTALLATTR) {
00427         a_status += string("    Some or all file's meta data missing in NSC.\n");
00428         return;
00429     }
00430 
00431     if (   m_elementRec.memberIdx == 0 ) { // is a file, so check file size
00432 
00433         if (m_attribMgrProperty_p == NULL) {
00434             m_attribMgrProperty_p = fsc_nsCreateAttribMgrObj(m_elementRec.attribType,
00435                                                             m_elementRec.numOfAttrib,
00436                                                             m_elementRec.attribIdx);
00437         }
00438         df_StandardAttr_t &standAttr = m_attribMgrProperty_p->GetStandAttrRef();
00439         if ( (ivd_FileSize_t)ntoh(standAttr.size) != a_splitInfo.fileSize) {
00440             a_fieldStatus |= fmm_FILESIZE;
00441         }
00442     }
00443 }

Here is the call graph for this function:

ivd_RecordIDX_t fsc_nsElement::GetOwnerFileID (  )  [inline]

Definition at line 90 of file fsc_nsElement.h.

Referenced by ChgOwner(), fsc_nsElement(), GetFullPath(), InsertSplit(), and SetMemOfOwner().

00090 {return m_elementRec.ownerIdx;};

Here is the caller graph for this function:

ivd_RecordIDX_t fsc_nsElement::GetFileID ( void   )  [inline]

Definition at line 92 of file fsc_nsElement.h.

Referenced by fsc_nsDirectory::AddEntry(), fsc_nsRemoveElementObj(), fsc_nsDirectory::RemoveEntry(), and fsc_nsDirectory::Write2DB().

00092 { return m_fileID; };

Here is the caller graph for this function:

ivd_MigrationID_t fsc_nsElement::GetMigID (  )  [inline]

Definition at line 93 of file fsc_nsElement.h.

Referenced by fsc_DataL::GetFullPath().

00093 { return m_elementRec.migID; };

Here is the caller graph for this function:

ivd_FileSize_t fsc_nsElement::GetFileSize ( void   ) 

Definition at line 446 of file fsc_nsElement.cpp.

References GetStandAttrPtr(), log_FUNC_m, ntoh(), NULL, and df_StandardAttr_t::size.

Referenced by fsc_DataL::GetCopiesPos().

00446                                            {
00447     log_FUNC_m(GetFileSize);
00448     df_StandardAttr_t *attr = GetStandAttrPtr();
00449     if (attr == NULL) {
00450         return 0;
00451     }
00452     return ntoh(attr->size);
00453 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool fsc_nsElement::IsDirectory (  )  [inline, virtual]

Reimplemented in fsc_nsDirectory.

Definition at line 97 of file fsc_nsElement.h.

Referenced by fsc_nsRemoveElementObj(), fsc_DataL::GetCopiesPos(), and fsc_RawMediumContentCollector::ProcRecMedPosMgr().

00097 { return false; };

Here is the caller graph for this function:

fsc_nsElement_t& fsc_nsElement::GetElementRecRef (  )  [inline]

write changes to DB before it's removed from cache

Definition at line 103 of file fsc_nsElement.h.

00103 { return m_elementRec; };

df_StandardAttr_t * fsc_nsElement::GetStandAttrPtr (  ) 

void fsc_nsElement::Dump ( ostream &  os  )  [virtual]

Reimplemented from fio_Vector.

Reimplemented in fsc_nsDirectory.

Definition at line 515 of file fsc_nsElement.cpp.

References fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, fsc_nsAttrMgr::Dump(), fsc_nsNameMgr::Dump(), fsc_nsCreateAttribMgrObj(), fsc_nsCreateNameObj(), log_FUNC_m, m_attribMgrProperty_p, m_elementRec, m_nameMgrProperty_p, fsc_nsElement_t::memberIdx, fsc_nsElement_t::migID, fsc_nsElement_t::nameIdx, fsc_nsElement_t::nameType, nit_DELETED, NULL, fsc_nsElement_t::numOfAttrib, fsc_nsElement_t::numOfMember, fsc_nsElement_t::numOfName, fsc_nsElement_t::ownerIdx, and fsc_nsElement_t::ownerType.

Referenced by fsc_RawScan::DirTreeWalk(), fsc_nsDirectory::Dump(), and fsc_DataL::Dump().

00515                                     {    
00516     log_FUNC_m(Dump);
00517     if (m_elementRec.nameType == nit_DELETED) {
00518     os << "   DELETED\n";
00519     }
00520     os << "   Owner fileID    = " << m_elementRec.ownerIdx;
00521     os << "   MigID = " << m_elementRec.migID;
00522     os << "\n   Attrib vec type = " << (int)m_elementRec.attribType 
00523                       << " size = " << (int)m_elementRec.numOfAttrib 
00524                        << " idx = " << m_elementRec.attribIdx;
00525     os << "\n   Name   vec type = " << (int)m_elementRec.nameType   
00526                       << " size = " << (int)m_elementRec.numOfName   
00527                        << " idx = " << m_elementRec.nameIdx;
00528     os << "\n   Member vec type = " << (int)m_elementRec.ownerType  
00529                       << " size = " << (int)m_elementRec.numOfMember 
00530                        << " idx = " << m_elementRec.memberIdx << endl;
00531 
00532 //    log_DBG_m(dbg_DETAIL, " Attrib vec size =" << (short)m_elementRec.numOfAttrib << " Idx   = " << m_elementRec.attribIdx);
00533 
00534     if (m_nameMgrProperty_p == NULL) {
00535         m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);        
00536     }
00537     m_nameMgrProperty_p->Dump(os);
00538 
00539     if (m_attribMgrProperty_p == NULL) {
00540         m_attribMgrProperty_p = fsc_nsCreateAttribMgrObj(m_elementRec.attribType,
00541                                                          m_elementRec.numOfAttrib,
00542                                                          m_elementRec.attribIdx);
00543     }
00544     m_attribMgrProperty_p->Dump(os);
00545 
00546 /*    UInt8_t             ownerType  : 1; // 
00547     UInt8_t             memberType : 2;
00548     UInt8_t             attribType : 2;
00549     UInt8_t             nameType   : 3;
00550     UInt8_t             numOfMember;
00551     UInt8_t             numOfAttrib;
00552     UInt8_t             numOfName;
00553     ivd_RecordIDX_t     ownerIdx;
00554     ivd_RecordIDX_t     memberIdx; // used in directory only
00555     ivd_RecordIDX_t     attribIdx;
00556     ivd_RecordIDX_t     nameIdx;
00557 */
00558 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::Pack ( df_Packer a_packer,
char  a_pathSeparator 
)

fill packer, but packer could have any writer.

check user to see what kind of writer is used. For now a fsc_nsFSrecovery is used to recover IVDFS

Definition at line 561 of file fsc_nsElement.cpp.

References fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, c_lostAndFoundStr(), cmn_Num2Str(), dbg_LOW, dbg_NORM, df_SS_COMPLETE, fsc_nsCreateAttribMgrObj(), GetFullPath(), fsc_nsAttrMgr::GetStandAttrRef(), log_DBG_m, log_FUNC_m, m_attribMgrProperty_p, m_elementRec, m_fileID, NULL, fsc_nsElement_t::numOfAttrib, fsc_nsElement_t::ownerIdx, fsc_nsAttrMgr::Pack(), df_Packer::WriteRecFile(), and df_Packer::WriteRecFileEnd().

Referenced by nsc_ScanForIVDFSRecovery().

00561                                                                   {
00562     log_FUNC_m(Pack);
00563     // write file header first
00564     // possible streams from attributes
00565     // finish with file end
00566     UInt32_t status = df_SS_COMPLETE;
00567     string fileName;
00568     if (GetFullPath(fileName, a_pathSeparator) == 1) { // lost+found file, append fileID to its name
00569         fileName = c_lostAndFoundStr + a_pathSeparator + fileName + "_" + cmn_Num2Str(m_fileID);
00570         log_DBG_m(dbg_LOW, "Lost+Found entry Pack FieID = " << m_fileID 
00571                            << " fileName = " << fileName);  
00572     } else {
00573         log_DBG_m(dbg_NORM, "Pack FileID = " << m_fileID 
00574                            << " fileName = " << fileName);
00575     };
00576 
00577     if (m_attribMgrProperty_p == NULL) {
00578         m_attribMgrProperty_p = fsc_nsCreateAttribMgrObj(m_elementRec.attribType,
00579                                                          m_elementRec.numOfAttrib,
00580                                                          m_elementRec.attribIdx);
00581     }
00582     a_packer.WriteRecFile(m_fileID, 
00583                           m_elementRec.ownerIdx, 
00584                           fileName, 
00585                           m_attribMgrProperty_p->GetStandAttrRef());
00586 
00587     m_attribMgrProperty_p->Pack(a_packer);
00588 
00589     a_packer.WriteRecFileEnd(status);
00590 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::SetMemOfOwner ( ivd_RecordIDX_t  a_memFileID  )  [private]

Definition at line 469 of file fsc_nsElement.cpp.

References fsc_nsCreateOwnerMgrObj(), GetOwnerFileID(), log_FUNC_m, m_ownerMgrProperty_p, NULL, and fsc_nsOwnerMgr::SetMember().

Referenced by InsertSplit().

00469                                                             {
00470     log_FUNC_m(SetMemOfOwner);
00471 
00472     if (m_ownerMgrProperty_p == NULL) {
00473         m_ownerMgrProperty_p = fsc_nsCreateOwnerMgrObj(GetOwnerFileID());
00474     }
00475     m_ownerMgrProperty_p->SetMember(a_memFileID);
00476 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::ChgOwner ( ivd_RecordIDX_t  a_newOwnFileID  )  [private]

Definition at line 479 of file fsc_nsElement.cpp.

References fsc_nsOwnerMgr::ChgOwner(), fsc_nsCreateOwnerMgrObj(), GetOwnerFileID(), log_FUNC_m, fio_Vector::m_changed, m_elementRec, m_fileID, m_ownerMgrProperty_p, NULL, and fsc_nsElement_t::ownerIdx.

Referenced by InsertSplit().

00479                                                           {
00480     log_FUNC_m(ChgOwner);
00481     if (m_ownerMgrProperty_p == NULL) {
00482         m_ownerMgrProperty_p = fsc_nsCreateOwnerMgrObj(GetOwnerFileID());
00483     }
00484     m_ownerMgrProperty_p->ChgOwner(m_fileID, a_newOwnFileID);
00485     m_elementRec.ownerIdx = a_newOwnFileID;
00486     m_changed = true;
00487 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::ChgAttrib ( df_SplitInfo a_splitInfo,
fsc_GenInsertAct_e  a_genInsAct 
) [private]

Definition at line 490 of file fsc_nsElement.cpp.

References fsc_nsElement_t::attribIdx, fsc_nsElement_t::attribType, fsc_nsAttrMgr::ChgAttributes(), dbg_DETAIL, fsc_nsCreateAttribMgrObj(), log_DBG_m, log_FUNC_m, m_attribMgrProperty_p, m_elementRec, NULL, and fsc_nsElement_t::numOfAttrib.

Referenced by InsertSplit().

00491                                                               {
00492     log_FUNC_m(ChgAttrib);
00493     log_DBG_m(dbg_DETAIL, "generation action = " << (int)a_genInsAct);
00494     if (m_attribMgrProperty_p == NULL) {
00495         m_attribMgrProperty_p = fsc_nsCreateAttribMgrObj(m_elementRec.attribType,
00496                                                          m_elementRec.numOfAttrib,
00497                                                          m_elementRec.attribIdx);
00498     }
00499     m_attribMgrProperty_p->ChgAttributes(a_splitInfo, a_genInsAct);
00500 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsElement::ChgName ( const string &  a_name  )  [private]

Definition at line 503 of file fsc_nsElement.cpp.

References fsc_nsNameMgr::ChgName(), dbg_DETAIL, fsc_nsCreateNameObj(), log_DBG_m, log_FUNC_m, m_elementRec, m_nameMgrProperty_p, fsc_nsElement_t::nameIdx, NULL, and fsc_nsElement_t::numOfName.

Referenced by InsertSplit(), and Remove().

00503                                                 {
00504     log_FUNC_m(ChgName);
00505 
00506     if (m_nameMgrProperty_p == NULL) {
00507         m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);
00508     }
00509     log_DBG_m(dbg_DETAIL, " nsElement name = " << a_name
00510                         << " m_nameMgrProperty_p = " << m_nameMgrProperty_p );
00511     m_nameMgrProperty_p->ChgName(a_name);
00512 }

Here is the call graph for this function:

Here is the caller graph for this function:

int fsc_nsElement::GetFullPath ( string &  a_path,
char  a_pathSeparator = '/' 
)

fill a_path string with file and its path path separator is a_pathSeparator return 1 if found not initialized owner in that case also path is modified differently instead unknown owner the "IVD-lost+found" directory is used and file name is extended by its fileID in following format -IVD-<fileID> Example: file1.txt with fileid(12345) has owner with fileID > 0, but owner's name is not known.

IVD-lost+found/file1.txt

NOTE a_path must be clean berfore use.

Definition at line 593 of file fsc_nsElement.cpp.

References c_lostAndFoundStr(), cmn_IsSpecialFile(), cmn_Num2Str(), dbg_DETAIL, dbg_NORM, fsc_nsCreateNameObj(), fsc_nsCreateOwnerMgrObj(), g_cmn, fsc_nsOwnerMgr::GetfullPath(), fsc_nsNameMgr::GetNameRef(), GetOwnerFileID(), ift_UNKNOWN, log_DBG_m, log_FUNC_A_m, m_elementRec, m_fileID, m_nameMgrProperty_p, ivd_Product::m_nameShort, m_ownerMgrProperty_p, fsc_nsElement_t::nameIdx, fsc_nsElement_t::nameType, nit_NSCMISSING, NULL, fsc_nsElement_t::numOfName, and cmn_Global::prod.

Referenced by fsc_nsOwnerMgr::GetfullPath(), fsc_DataL::GetFullPath(), Pack(), fsc_RawMedVolPathCollector::ProcRecMedPosMgr(), fsc_RawMediumContentCollector::ProcRecMedPosMgr(), and fsc_DataL::Write2DB().

00593                                                                    {
00594     log_FUNC_A_m(GetFullPath, " a_path = " << a_path);
00595     int ret = 0;
00596     string nameBuffer; 
00597     if (m_elementRec.nameType == nit_NSCMISSING) {
00598         nameBuffer = c_lostAndFoundStr +  "_" +  cmn_Num2Str(m_fileID);
00599         log_DBG_m(dbg_NORM, "Item not in NSC, put to " << c_lostAndFoundStr 
00600                        << " FileID = " << m_fileID );
00601         ret = 1;
00602     } else {
00603         if (m_nameMgrProperty_p == NULL) {
00604             m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);        
00605         }
00606     
00607         nameBuffer = m_nameMgrProperty_p->GetNameRef();
00608         log_DBG_m(dbg_DETAIL, " FileID = " << m_fileID 
00609                        << " fileName = " << nameBuffer );
00610         if (cmn_IsSpecialFile(nameBuffer, ift_UNKNOWN)) {
00611             // added for bug 7721 
00612             nameBuffer = c_lostAndFoundStr + "_" + nameBuffer 
00613                                            + "_" + cmn_Num2Str(m_fileID);
00614             log_DBG_m(dbg_NORM, "Special file item found, put to " 
00615                                   << g_cmn.prod.m_nameShort << "lost+found FileID = "
00616                                   << m_fileID 
00617                                   << " fileName = " << nameBuffer );
00618             ret = 1;
00619         }
00620     }
00621     if (m_nameMgrProperty_p == NULL) {
00622         m_nameMgrProperty_p = fsc_nsCreateNameObj(m_elementRec.numOfName, m_elementRec.nameIdx);
00623     }
00624     log_DBG_m(dbg_DETAIL, " FileID = " << m_fileID
00625                        << " fileName = " << m_nameMgrProperty_p->GetNameRef());
00626     if(m_ownerMgrProperty_p == NULL) {
00627         log_DBG_m(dbg_DETAIL, "m_ownerMgrProperty_p is null. Created new.");
00628         m_ownerMgrProperty_p = fsc_nsCreateOwnerMgrObj(GetOwnerFileID());
00629     }
00630     if (GetOwnerFileID() == 0 ) {
00631        // we are at the root of the HSMFS so stop recursion
00632         a_path = nameBuffer;
00633         return ret;
00634     }
00635 
00636     // use / as internal DF path separator
00637     // recurse into until root is found
00638     ret = m_ownerMgrProperty_p->GetfullPath(a_path, a_pathSeparator);
00639     a_path += a_pathSeparator + nameBuffer;
00640     return ret;
00641 }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class ut_fsc_nsElement [friend]

Definition at line 50 of file fsc_nsElement.h.

ostream& operator<< ( ostream &  a_os,
fsc_nsElement a_nsElem 
) [friend]

Definition at line 108 of file fsc_nsElement.h.

00108                                                                         {
00109         ostringstream str;
00110         a_nsElem.Dump(str);
00111         a_os << str.str();
00112         return a_os ;
00113     }


Member Data Documentation

Reimplemented from fio_Vector.

Reimplemented in fsc_nsDirectory.

Definition at line 121 of file fsc_nsElement.h.

Definition at line 148 of file fsc_nsElement.h.

Referenced by ChgOwner(), GetFullPath(), InsertSplit(), Pack(), Remove(), and Write2DB().

int fsc_nsElement::m_refCounter [protected]

Definition at line 155 of file fsc_nsElement.h.


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

Generated on Mon Feb 27 19:23:22 2012 for OPENARCHIVE by  doxygen 1.5.6