hdb_Tables Class Reference
[HSM Database]

#include <hdb_Tables.h>

Inheritance diagram for hdb_Tables:

Inheritance graph
[legend]
Collaboration diagram for hdb_Tables:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 33 of file hdb_Tables.h.


Public Member Functions

 hdb_Tables (cmn_Path a_path, bool a_readOnly, bool a_winStructFiles=false)
virtual ~hdb_Tables ()
void DumpActiveEntries (ostream &a_os)
void DumpReleaseCand (ostream &a_os, fio_CirFileTrans *a_cf_p)
void DumpMigratedFiles (ostream &a_os)

Public Attributes

 log_CLASSID_m

Friends

class ut_hdb_Tables

Constructor & Destructor Documentation

hdb_Tables::hdb_Tables ( cmn_Path  a_path,
bool  a_readOnly,
bool  a_winStructFiles = false 
)

Definition at line 65 of file hdb_Tables.cpp.

References c_hsm_ActiveVer, c_hsm_DirTreeVer, c_hsm_File2hdbIDVer, c_hsm_NameOwnerVer, c_hsm_RelCandVer, cmn_CreatePath(), dbg_DETAIL, g_winStructures, fio_RelFileTransLstMgr::Insert(), ivd_NULLCHK_m, log_DBG_m, log_FUNC_m, and s_className.

00066     :
00067     fio_RelFileTransLstMgr()
00068 {
00069     log_FUNC_m(hdb_Tables);
00070 
00071     g_winStructures = a_winStructFiles;
00072 
00073     UInt32_t sizeOfActive = sizeof(hdb_Active_t);
00074     UInt32_t sizeOfRelCand = sizeof(hdb_ReleaseCand_t);
00075 
00076     #if   TGT_OS_linux
00077         if (a_winStructFiles) {
00078             sizeOfActive  += 4;
00079             sizeOfRelCand += 8;
00080         }        
00081     //#elif TGT_OS_windows
00082     //#else
00083     //#   error "Unsupported platform!"
00084     #endif
00085 
00086     cmn_CreatePath(a_path);
00087     // Be careful of relative file          |    sequence number.
00088     // Do not change the seq num            v      after release.
00089     log_DBG_m(dbg_DETAIL, "Instantiate hsmDirEntName.lrf  record size=8");
00090     g_DirEntName_p   = new fio_VarLenRFT   (a_readOnly, 1, a_path, "hsmDirEntName.lrf");
00091     ivd_NULLCHK_m(g_DirEntName_p, fio_VarLenRFT::s_className);
00092 
00093     log_DBG_m(dbg_DETAIL, "Instantiate hsmDirTree.lrf  record size=" << sizeof(hdb_DirNode_t));
00094     g_DirTree_p      = new fio_RelFileTrans(a_readOnly, 2, a_path, "hsmDirTree.lrf",      
00095                                                sizeof(hdb_DirNode_t),       
00096                                                c_hsm_DirTreeVer,
00097                                                1); // number of different vectors
00098     ivd_NULLCHK_m(g_DirTree_p, fio_RelFileTrans::s_className);
00099 
00100     log_DBG_m(dbg_DETAIL, "Instantiate hsmNameOwner.lrf  record size=" << sizeof(hdb_NameOwner_t));
00101     g_NameOwner_p    = new fio_RelFileTrans(a_readOnly, 3, a_path, "hsmNameOwner.lrf", 
00102                                                sizeof(hdb_NameOwner_t),   
00103                                                c_hsm_NameOwnerVer,
00104                                                1); // number of different vectors
00105     ivd_NULLCHK_m(g_NameOwner_p, fio_RelFileTrans::s_className);
00106 
00107     log_DBG_m(dbg_DETAIL, "Instantiate hsmFile2hdbID.lrf  record size=" << sizeof(hdb_file2hdbID_t));
00108     g_File2hdbID_p   = new fio_RelFileTrans(a_readOnly, 4, a_path, "hsmFile2hdbID.lrf", 
00109                                                sizeof(hdb_file2hdbID_t),   
00110                                                c_hsm_File2hdbIDVer,
00111                                                1); // number of different vectors
00112     ivd_NULLCHK_m(g_File2hdbID_p, fio_RelFileTrans::s_className);
00113 
00114     g_Active_p       = new fio_CirFileTrans(a_readOnly, 5, a_path, "hsmActive.lrf", 
00115                                                sizeOfActive,   
00116                                                c_hsm_ActiveVer);
00117     ivd_NULLCHK_m(g_Active_p, fio_CirFileTrans::s_className);
00118 
00119     g_RelCandMigrt_p = new fio_CirFileTrans(a_readOnly, 6, a_path, "hsmRelCndMigrt.lrf",  
00120                                               sizeOfRelCand,
00121                                               c_hsm_RelCandVer);
00122     ivd_NULLCHK_m(g_RelCandMigrt_p, fio_CirFileTrans::s_className);
00123 
00124     g_RelCandRecal_p = new fio_CirFileTrans(a_readOnly, 7, a_path, "hsmRelCndRecal.lrf",  
00125                                               sizeOfRelCand,   
00126                                               c_hsm_RelCandVer);
00127     ivd_NULLCHK_m(g_RelCandRecal_p, fio_CirFileTrans::s_className);
00128 
00129     g_RelCandSmall_p = new fio_CirFileTrans(a_readOnly, 8, a_path, "hsmRelCndSmall.lrf",  
00130                                               sizeOfRelCand,
00131                                               c_hsm_RelCandVer);
00132     ivd_NULLCHK_m(g_RelCandSmall_p, fio_CirFileTrans::s_className);
00133 
00134 
00135     Insert(g_DirEntName_p);     // 1
00136     Insert(g_DirTree_p);        // 2
00137     Insert(g_NameOwner_p);      // 3
00138     Insert(g_File2hdbID_p);     // 4
00139     Insert(g_Active_p);         // 5
00140     Insert(g_RelCandMigrt_p);   // 6
00141     Insert(g_RelCandRecal_p);   // 7
00142     Insert(g_RelCandSmall_p);   // 8
00143 }
//============================================================================//

Here is the call graph for this function:

virtual hdb_Tables::~hdb_Tables (  )  [inline, virtual]

Definition at line 38 of file hdb_Tables.h.

00038 {};


Member Function Documentation

void hdb_Tables::DumpActiveEntries ( ostream &  a_os  ) 

Definition at line 147 of file hdb_Tables.cpp.

References hdb_Active_t::chgFlags, fio_CirFileTrans::DumpHdr(), hdb_Active_t::fileID, hdb_Active_t::generalInode, hdbReadNameOwnRec(), hsmdbGetPath(), IVD_PRINT_ID_FS, log_FUNC_m, hdb_Active_t::nameOwnIdx, hdb_Active_t::oldNameOwnIdx, path, fio_CirFileTrans::ReadNext(), and fio_CirFileTrans::ReadNextReset().

Referenced by main().

00147                                                 {
00148     log_FUNC_m(DumpActiveEntries);
00149 
00150     hdb_Active_t  actRec;
00151     ivd_RecordIDX_t idx;
00152     
00153     g_Active_p->DumpHdr(a_os);
00154     
00155     a_os << " Counter  DB Idx   Flags  FileID Inode              Path/oldPath\n"
00156          << "==================================================================\n";
00157     
00158     int counter = 0;
00159     // reset circular list for read
00160     g_Active_p->ReadNextReset();
00161     while ((idx = g_Active_p->ReadNext(&actRec)) > 0) {
00162         if (actRec.generalInode > 0) {
00163             counter++;
00164             // directory can be already in cache
00165 //            a_os << "Find active FH rec in HSMDB Idx = " << idx << '\n' << actRec;
00166 
00167             hdb_DirNode_t dir; // default const. it filled with zeroes
00168             ivd_RecordIDX_t dirTreeIdx = 0;
00169             hdb_String name;
00170             hdbReadNameOwnRec(actRec.nameOwnIdx, dirTreeIdx, name, dir);
00171             cmn_Path path = hsmdbGetPath(dir);
00172 
00173             a_os << setw(8)  << counter 
00174                  << setw(8)  << idx 
00175                  << hex << setw(8) << actRec.chgFlags << dec
00176                  << setw(8) << actRec.fileID
00177                  << " " << IVD_PRINT_ID_FS(actRec.generalInode) << " " << path + name;
00178             
00179             hdb_DirNode_t oldDir;
00180             ivd_RecordIDX_t oldDirTreeIdx = 0;
00181             hdb_String oldName;
00182 
00183             if (actRec.oldNameOwnIdx > 0) {
00184                 hdbReadNameOwnRec(actRec.oldNameOwnIdx, oldDirTreeIdx, oldName, oldDir);
00185                 cmn_Path oldPath = hsmdbGetPath(oldDir);
00186                 a_os << "  old: " << oldPath + oldName << '\n';
00187             }
00188             else {
00189                 a_os << '\n';
00190             }
00191         }
00192     }
00193 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hdb_Tables::DumpReleaseCand ( ostream &  a_os,
fio_CirFileTrans a_cf_p 
)

Definition at line 197 of file hdb_Tables.cpp.

References hdb_ReleaseCand_t::appendTime, hdb_ReleaseCand_t::fileID, g_winStructures, hdb_ReleaseCand_t::generalInode, cmn_File::GetFullPathRef(), hdbReadNameOwnRec(), hsmdbGetPath(), log_FUNC_m, hdb_ReleaseCand_t::nameOwnIdx, path, fio_CirFileTrans::ReadNext(), fio_CirFileTrans::ReadNextReset(), cmn_Time::Time2YMDhms(), and hdb_ReleaseCand_t::ToHostStructure().

Referenced by main().

00197                                                                         {
00198     log_FUNC_m(DumpMigReleaseCand);
00199 
00200 
00201     hdbWIN_ReleaseCand_t relCandRecWinStr;
00202     hdb_ReleaseCand_t   &relCandRec = *reinterpret_cast<hdb_ReleaseCand_t*>(&relCandRecWinStr);
00203     ivd_RecordIDX_t idx;
00204 
00205     a_os << "Dump release candidate from file " << a_cf_p->GetFullPathRef();
00206     a_os << "\n Counter    FileID  DB Idx Append time         Path\n"
00207          << "======================================================\n";
00208     
00209 //    int recSize = g_RelCandMigrt_p->GetRecordSize();
00210     
00211     int counter = 0;
00212     // reset circular list for read
00213     a_cf_p->ReadNextReset();
00214     while ((idx = a_cf_p->ReadNext(&relCandRecWinStr)) > 0) {
00215 #if TGT_OS_hpux
00216 #pragma warning "Cross platform DatabBase dump not implemented."
00217 #else
00218         relCandRec.ToHostStructure(g_winStructures);
00219 #endif
00220         if (relCandRec.generalInode > 0) {
00221             counter++;
00222             // directory can be already in cache
00223 //            a_os << "Find active FH rec in HSMDB Idx = " << idx << '\n' << actRec;
00224 
00225             hdb_DirNode_t dir; // default const. it filled with zeroes
00226             ivd_RecordIDX_t dirTreeIdx = 0;
00227             hdb_String name;
00228             hdbReadNameOwnRec(relCandRec.nameOwnIdx, dirTreeIdx, name, dir);
00229             cmn_Path path = hsmdbGetPath(dir);
00230 
00231             cmn_Time appendTime(relCandRec.appendTime);
00232             
00233             a_os << setw( 8) << counter 
00234                  << setw(10) << relCandRec.fileID 
00235                  << setw( 8) << idx 
00236                  << " " << appendTime.Time2YMDhms() << " " << path + name << '\n';
00237 //                 << relCandRec << endl
00238 //                 << cmn_HexDump(&relCandRec, recSize, recSize, false);
00239         }
00240     }
00241 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hdb_Tables::DumpMigratedFiles ( ostream &  a_os  ) 

Definition at line 245 of file hdb_Tables.cpp.

References hdb_file2hdbID_t::circList, fio_RelFile::FirstNewIDX(), hdbReadNameOwnRec(), hsmdbGetPath(), hdb_file2hdbID_t::nameOwnIdx, path, and fio_RelFile::ReadRec().

Referenced by main().

00245                                                 {
00246     a_os << "Dump migrated files. \n";
00247     a_os << "legend:  M- migrate, R- recall, S-small release candidate list";
00248     a_os << "\n    FileID NameOwnIdx List Path         (NameOwnIdx DirTreeIdx)/... of parrent directory\n"
00249          << "=================================================================\n";
00250     char list[5] = " MRS";
00251     ivd_RecordIDX_t fileID = 1;
00252     UInt32_t fileIDs = g_File2hdbID_p->FirstNewIDX();
00253     int showProgEvery = 1000;
00254     int count = showProgEvery;
00255     cerr << (fileIDs - 1) << " has to be scanned. Progres every " << showProgEvery << endl;
00256     while (fileID < g_File2hdbID_p->FirstNewIDX()) {
00257         hdb_file2hdbID_t file2hdbID;
00258         g_File2hdbID_p->ReadRec(fileID, &file2hdbID);
00259         if (file2hdbID.nameOwnIdx > 0) {
00260             hdb_DirNode_t dir; // default const. it filled with zeroes
00261             ivd_RecordIDX_t dirTreeIdx = 0;
00262             hdb_String name;
00263             hdbReadNameOwnRec(file2hdbID.nameOwnIdx, dirTreeIdx, name, dir);
00264             hdb_DirTreeVec_t dirNode_v;
00265             dirNode_v.push_back(hdb_DirTree_t(dirTreeIdx, dir));
00266             cmn_Path path = hsmdbGetPath(dir, dirNode_v) + name;
00267 
00268             a_os << setw(10) << fileID 
00269                  << setw(11) << file2hdbID.nameOwnIdx 
00270 //                 << setw(11) << dirTreeIdx 
00271                  << " " << list[file2hdbID.circList] 
00272                             << "    " << path << " ";
00273             if (path.size() < 40) {
00274                 a_os << string(40 - path.size(), ' ');
00275             }
00276             for (int i = dirNode_v.size() - 1; i >= 0; --i) {
00277                 a_os << "(" << setw(7) << dirNode_v[i].dirNode.nameOwnIdx
00278                      << " " << setw(7) << dirNode_v[i].dirTreeIdx << ")/";
00279             }
00280             a_os << endl;
00281         }
00282         if (--count == 0) {
00283             cerr << fileID << "\015";
00284             cerr.flush();
00285             count = showProgEvery;
00286         }
00287         fileID++;
00288     }
00289 }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class ut_hdb_Tables [friend]

Definition at line 34 of file hdb_Tables.h.


Member Data Documentation

Reimplemented from fio_RelFileTransLstMgr.

Definition at line 46 of file hdb_Tables.h.


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

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