fio_RelFileTransLstMgr Class Reference
[Classes for large file i/o, relative file, and DataBase]

#include <fio_RelFileTransLstMgr.h>

Inheritance diagram for fio_RelFileTransLstMgr:

Inheritance graph
[legend]
Collaboration diagram for fio_RelFileTransLstMgr:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 46 of file fio_RelFileTransLstMgr.h.


Public Member Functions

 fio_RelFileTransLstMgr ()
virtual ~fio_RelFileTransLstMgr ()
void Insert (fio_RelFileTrans *a_rft_p)
 insert relative file transaction pointer at file ID - 1 index into vector Each file is possible to inser only once
fio_RelFileTransGetRelFileTrans (ivd_FileID_t a_fileID) const
 Return pointer to relative file object that match its file ID.
void SetDataBase (fio_DataBase *a_database_p)
 set DB to all files
void Synchronize (fio_Transaction *a_transaction_p)
 Sync all relative files.
void Commit ()
 Commit all relative files;.
void Flush ()
 Flush all relative files, write all changes from buffers to disk;.
void SetSizeOffsetVector (fio_SizeOff_v &a_sizeOff_v)
 return record size and offset of first record for each relative file
void SyncRelFileObj ()
 synchronize relative file objects.
void DumpHdr (ostream &os)

Public Attributes

 log_CLASSID_m

Private Attributes

fio_RelFileTrans ** m_firstRF_p

Friends

void Destroy (fio_RelFileTransLstMgr *a)
 call destructor

Constructor & Destructor Documentation

fio_RelFileTransLstMgr::fio_RelFileTransLstMgr (  ) 

Definition at line 44 of file fio_RelFileTransLstMgr.cpp.

00044                                                {
00045 }

fio_RelFileTransLstMgr::~fio_RelFileTransLstMgr (  )  [virtual]

Definition at line 49 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

00049                                                 {
00050     log_FUNC_m(~fio_RelFileTransLstMgr);
00051 
00052     iterator p;
00053     for (p = begin(); p != end(); p++) {
00054         if (*p != NULL) {
00055             delete (*p);
00056         }
00057     }
00058 }


Member Function Documentation

void fio_RelFileTransLstMgr::Insert ( fio_RelFileTrans a_rft_p  ) 

insert relative file transaction pointer at file ID - 1 index into vector Each file is possible to inser only once

Definition at line 69 of file fio_RelFileTransLstMgr.cpp.

References fio_File::GetFileID(), ie_DUPLICATE_REL_FILE_ID, ie_REL_FILE_INDEX_INV, ivd_Error, ivd_NULLCHK_m, log_FUNC_m, m_firstRF_p, NULL, push_back(), s_className, and size.

Referenced by fsc_Files::fsc_Files(), and hdb_Tables::hdb_Tables().

00069                                                              {
00070     log_FUNC_m(Insert);
00071 
00072     ivd_NULLCHK_m(a_rft_p, fio_RelFileTrans::s_className);
00073 
00074     // TODO resize dinamicaly
00075 
00076     unsigned int vectID = a_rft_p->GetFileID() - 1;
00077     if (size() < vectID) {
00078         throw ivd_InternalError(ie_REL_FILE_INDEX_INV, "Too big file ID.", true);
00079     }
00080     else if (  (size() != vectID)  //TODO check index on proper way
00081        && (operator[](vectID) != NULL) ) {
00082         throw ivd_Error(ie_DUPLICATE_REL_FILE_ID, "File with same ID in DB.", true);
00083     };
00084 
00085     push_back(a_rft_p);
00086     m_firstRF_p = &(*begin());
00087 }

Here is the call graph for this function:

Here is the caller graph for this function:

fio_RelFileTrans* fio_RelFileTransLstMgr::GetRelFileTrans ( ivd_FileID_t  a_fileID  )  const [inline]

Return pointer to relative file object that match its file ID.

Used for recovery and or to find proper relative files for FSC.

Definition at line 70 of file fio_RelFileTransLstMgr.h.

Referenced by main(), and fio_AlterJour::UpdateDB().

00070                                                                    {
00071         return *(m_firstRF_p + a_fileID - 1);
00072     };

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::SetDataBase ( fio_DataBase a_database_p  ) 

set DB to all files

Definition at line 91 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, m_firstRF_p, and fio_RelFileTrans::SetDataBase().

Referenced by fio_DataBase::fio_DataBase().

00091                                                                         {
00092     log_FUNC_m(SetDataBase);
00093 
00094     fio_RelFileTrans** pi = m_firstRF_p;
00095     fio_RelFileTrans** pe = &(*end());
00096     for (; pi < pe; pi++) {
00097        (*pi)->SetDataBase(a_database_p);
00098     }
00099     //fio_RelFileTrans_p_v_t::iterator p;
00100     //for (p = begin(); p != end(); p++) {
00101     //    if (*p != NULL) {
00102     //       (*p)->SetDataBase(a_database_p);
00103     //    }
00104     //}
00105 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::Synchronize ( fio_Transaction a_transaction_p  ) 

Sync all relative files.

Definition at line 144 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

Referenced by fio_DataBase::Synchronize().

00144                                                                          {
00145     log_FUNC_m(Synchronize);
00146 
00147     fio_RelFileTrans_p_v_t::iterator p;
00148     for (p = begin(); p != end(); p++) {
00149         if (*p != NULL) {
00150            (*p)->Synchronize(a_transaction_p);
00151         }
00152     }
00153 }

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::Commit (  ) 

Commit all relative files;.

Definition at line 109 of file fio_RelFileTransLstMgr.cpp.

References dbg_NORM, log_DBG_m, log_FUNC_m, and m_firstRF_p.

00109                                     {
00110     log_FUNC_m(Commit);
00111 
00112     fio_RelFileTrans** pi = m_firstRF_p;
00113     fio_RelFileTrans** pe = &(*end());
00114     for (; pi < pe; pi++) {
00115        log_DBG_m(dbg_NORM, "Commit " << (*pi)->GetFullPathRef());
00116        (*pi)->SyncF();
00117     }
00118 
00119     //fio_RelFileTrans_p_v_t::iterator p;
00120     //for (p = begin(); p != end(); p++) {
00121     //    if (*p != NULL) {
00122     //        log_DBG_m(dbg_NORM, "Commit " << (*p)->GetFullPathRef());
00123     //       (*p)->SyncF();
00124     //    }
00125     //}
00126     //log_DBG_m(dbg_NORM, "END Commiting");
00127 }

void fio_RelFileTransLstMgr::Flush (  ) 

Flush all relative files, write all changes from buffers to disk;.

Definition at line 131 of file fio_RelFileTransLstMgr.cpp.

References fio_RelFile::Flush(), and m_firstRF_p.

00131                                    {
00132 //    log_FUNC_m(Flush);
00133 
00134 //    fio_RelFileTrans_p_v_t::iterator p;
00135     fio_RelFileTrans** pi = m_firstRF_p;
00136     fio_RelFileTrans** pe = &(*end());
00137     for (; pi < pe; pi++) {
00138        (*pi)->Flush();
00139     }
00140 }

Here is the call graph for this function:

void fio_RelFileTransLstMgr::SetSizeOffsetVector ( fio_SizeOff_v a_sizeOff_v  ) 

return record size and offset of first record for each relative file

Definition at line 157 of file fio_RelFileTransLstMgr.cpp.

Referenced by main().

00157                                                                            {
00158     fio_SizeOffset sizeOff(0,0);
00159     a_sizeOff_v.clear();
00160     a_sizeOff_v.push_back(sizeOff);
00161     for (fio_RelFileTrans_p_v_ti iter = begin();
00162          iter != end();
00163          iter++) {
00164              fio_SizeOffset sizeOff((*iter)->GetRecordSize(),
00165                                     (*iter)->GetFirstRecordOffset());
00166              a_sizeOff_v.push_back(sizeOff);
00167          }
00168 }

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::SyncRelFileObj (  ) 

synchronize relative file objects.

Used after transation reply.

Definition at line 172 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

Referenced by fio_DataBase::fio_DataBase(), main(), RevertUpdate(), and Update().

00172                                             {
00173     log_FUNC_m(SyncRelFileObj);
00174 
00175     fio_RelFileTrans_p_v_t::iterator p;
00176     for (p = begin(); p != end(); p++) {
00177         if (*p != NULL) {
00178            (*p)->SyncRelFileObj();
00179         }
00180     }
00181 }

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::DumpHdr ( ostream &  os  ) 

Definition at line 196 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

Referenced by Interactive(), and main().

00196                                                 {
00197     log_FUNC_m(DumpHdr);
00198 
00199     fio_RelFileTrans_p_v_t::iterator p;
00200     for (p = begin(); p != end(); p++) {
00201         if (*p != NULL) {
00202            (*p)->DumpHdr(os);
00203         }
00204     }
00205 }

Here is the caller graph for this function:


Friends And Related Function Documentation

void Destroy ( fio_RelFileTransLstMgr a  )  [friend]

call destructor

Definition at line 62 of file fio_RelFileTransLstMgr.cpp.

00063 {
00064   delete a;
00065 }


Member Data Documentation

Definition at line 57 of file fio_RelFileTransLstMgr.h.

Referenced by Commit(), Flush(), Insert(), and SetDataBase().

Reimplemented in hdb_Tables, and fsc_Files.

Definition at line 60 of file fio_RelFileTransLstMgr.h.


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

Generated on Mon Feb 27 19:17:26 2012 for OPENARCHIVE by  doxygen 1.5.6