Public Member Functions | Public Attributes | Private Attributes | Friends

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.

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

Detailed Description

Definition at line 60 of file fio_RelFileTransLstMgr.h.


Constructor & Destructor Documentation

fio_RelFileTransLstMgr::fio_RelFileTransLstMgr (  ) 

Definition at line 58 of file fio_RelFileTransLstMgr.cpp.

                                               {
}

fio_RelFileTransLstMgr::~fio_RelFileTransLstMgr (  )  [virtual]

Definition at line 63 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

                                                {
    log_FUNC_m(~fio_RelFileTransLstMgr);

    iterator p;
    for (p = begin(); p != end(); p++) {
        if (*p != NULL) {
            delete (*p);
        }
    }
}


Member Function Documentation

void fio_RelFileTransLstMgr::Commit (  ) 

Commit all relative files;.

Definition at line 123 of file fio_RelFileTransLstMgr.cpp.

References dbg_NORM, log_DBG_m, log_FUNC_m, and m_firstRF_p.

                                    {
    log_FUNC_m(Commit);

    fio_RelFileTrans** pi = m_firstRF_p;
    fio_RelFileTrans** pe = &(*end());
    for (; pi < pe; pi++) {
       log_DBG_m(dbg_NORM, "Commit " << (*pi)->GetFullPathRef());
       (*pi)->SyncF();
    }

    //fio_RelFileTrans_p_v_t::iterator p;
    //for (p = begin(); p != end(); p++) {
    //    if (*p != NULL) {
    //        log_DBG_m(dbg_NORM, "Commit " << (*p)->GetFullPathRef());
    //       (*p)->SyncF();
    //    }
    //}
    //log_DBG_m(dbg_NORM, "END Commiting");
}

void fio_RelFileTransLstMgr::DumpHdr ( ostream &  os  ) 

Definition at line 210 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

Referenced by Interactive(), and main().

                                                {
    log_FUNC_m(DumpHdr);

    fio_RelFileTrans_p_v_t::iterator p;
    for (p = begin(); p != end(); p++) {
        if (*p != NULL) {
           (*p)->DumpHdr(os);
        }
    }
}

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::Flush (  ) 

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

Definition at line 145 of file fio_RelFileTransLstMgr.cpp.

References fio_RelFile::Flush(), and m_firstRF_p.

                                   {
//    log_FUNC_m(Flush);

//    fio_RelFileTrans_p_v_t::iterator p;
    fio_RelFileTrans** pi = m_firstRF_p;
    fio_RelFileTrans** pe = &(*end());
    for (; pi < pe; pi++) {
       (*pi)->Flush();
    }
}

Here is the call 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 84 of file fio_RelFileTransLstMgr.h.

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

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

Here is the caller graph for this function:

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

                                                             {
    log_FUNC_m(Insert);

    ivd_NULLCHK_m(a_rft_p, fio_RelFileTrans::s_className);

    // TODO resize dinamicaly

    unsigned int vectID = a_rft_p->GetFileID() - 1;
    if (size() < vectID) {
        throw ivd_InternalError(ie_REL_FILE_INDEX_INV, "Too big file ID.", true);
    }
    else if (  (size() != vectID)  //TODO check index on proper way
       && (operator[](vectID) != NULL) ) {
        throw ivd_Error(ie_DUPLICATE_REL_FILE_ID, "File with same ID in DB.", true);
    };

    push_back(a_rft_p);
    m_firstRF_p = &(*begin());
}

Here is the call graph for this function:

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 105 of file fio_RelFileTransLstMgr.cpp.

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

Referenced by fio_DataBase::fio_DataBase().

                                                                        {
    log_FUNC_m(SetDataBase);

    fio_RelFileTrans** pi = m_firstRF_p;
    fio_RelFileTrans** pe = &(*end());
    for (; pi < pe; pi++) {
       (*pi)->SetDataBase(a_database_p);
    }
    //fio_RelFileTrans_p_v_t::iterator p;
    //for (p = begin(); p != end(); p++) {
    //    if (*p != NULL) {
    //       (*p)->SetDataBase(a_database_p);
    //    }
    //}
}

Here is the call graph for this function:

Here is the caller 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 171 of file fio_RelFileTransLstMgr.cpp.

Referenced by main().

                                                                           {
    fio_SizeOffset sizeOff(0,0);
    a_sizeOff_v.clear();
    a_sizeOff_v.push_back(sizeOff);
    for (fio_RelFileTrans_p_v_ti iter = begin();
         iter != end();
         iter++) {
             fio_SizeOffset sizeOff((*iter)->GetRecordSize(),
                                    (*iter)->GetFirstRecordOffset());
             a_sizeOff_v.push_back(sizeOff);
         }
}

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::Synchronize ( fio_Transaction a_transaction_p  ) 

Sync all relative files.

Definition at line 158 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

Referenced by fio_DataBase::Synchronize().

                                                                         {
    log_FUNC_m(Synchronize);

    fio_RelFileTrans_p_v_t::iterator p;
    for (p = begin(); p != end(); p++) {
        if (*p != NULL) {
           (*p)->Synchronize(a_transaction_p);
        }
    }
}

Here is the caller graph for this function:

void fio_RelFileTransLstMgr::SyncRelFileObj (  ) 

synchronize relative file objects.

Used after transation reply.

Definition at line 186 of file fio_RelFileTransLstMgr.cpp.

References log_FUNC_m, and NULL.

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

                                            {
    log_FUNC_m(SyncRelFileObj);

    fio_RelFileTrans_p_v_t::iterator p;
    for (p = begin(); p != end(); p++) {
        if (*p != NULL) {
           (*p)->SyncRelFileObj();
        }
    }
}

Here is the caller graph for this function:


Friends And Related Function Documentation

void Destroy ( fio_RelFileTransLstMgr a  )  [friend]

call destructor

Definition at line 76 of file fio_RelFileTransLstMgr.cpp.

{
  delete a;
}


Member Data Documentation

Reimplemented in hdb_Tables, and fsc_Files.

Definition at line 74 of file fio_RelFileTransLstMgr.h.

Definition at line 71 of file fio_RelFileTransLstMgr.h.

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


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