Public Member Functions | Static Public Member Functions | Public Attributes | Friends

fio_StartTransaction_t Struct Reference
[Classes for large file i/o, relative file, and DataBase]

#include <fio_Transaction.h>

List of all members.

Public Member Functions

 fio_StartTransaction_t ()
 fio_StartTransaction_t (ivd_TransNumber_t a_transNumber, ivd_FileBufSize_t a_transSize, ivd_AlterNumber_t a_alterNumber, UInt32_t a_FreedVector, UInt32_t a_UsedVector)
void Init (fio_JourHandle &m_jourHnd_p)
bool operator== (fio_StartTransaction_t a)
bool operator== (fio_EndTransaction_t a)

Static Public Member Functions

static ivd_FilePosition_t FindStart (fio_JourHandle &m_jourHnd_p)
static ivd_FilePosition_t FindStart (fio_File &f, ivd_FilePosition_t startPos)

Public Attributes

char Prefix [fio_START_TRANS_STR_LEN_d]
ivd_TransNumber_t TransNumber
ivd_FileBufSize_t TransSize
ivd_AlterNumber_t AlterNumber
time_t Time
unsigned short MilliTime
UInt32_t FreedVector
UInt32_t UsedVector
 log_CLASSID_m

Friends

ostream & operator<< (ostream &a_os, fio_StartTransaction_t &a_startTrans)
 Operator prints fio_StartTransaction to stream.

Detailed Description

Definition at line 93 of file fio_Transaction.h.


Constructor & Destructor Documentation

fio_StartTransaction_t::fio_StartTransaction_t (  )  [inline]

Definition at line 94 of file fio_Transaction.h.

{};

fio_StartTransaction_t::fio_StartTransaction_t ( ivd_TransNumber_t  a_transNumber,
ivd_FileBufSize_t  a_transSize,
ivd_AlterNumber_t  a_alterNumber,
UInt32_t  a_FreedVector,
UInt32_t  a_UsedVector 
)

Definition at line 139 of file fio_Transaction.cpp.

References c_StartTransString, c_StartTransStrLen, cmn_Time::GetMilliTime(), cmn_Time::GetTime_t(), MilliTime, Prefix, and Time.

            :
            TransNumber(a_transNumber),
            TransSize(a_transSize),
            AlterNumber(a_alterNumber),
            FreedVector(a_FreedVector),
            UsedVector(a_UsedVector)
{
    strncpy(Prefix, c_StartTransString, c_StartTransStrLen);  
    
    cmn_Time t;
    Time      = t.GetTime_t();
    MilliTime = t.GetMilliTime();
}

Here is the call graph for this function:


Member Function Documentation

ivd_FilePosition_t fio_StartTransaction_t::FindStart ( fio_JourHandle m_jourHnd_p  )  [static]

Definition at line 202 of file fio_Transaction.cpp.

References fio_JourHandle::GetJourFile(), and fio_JourHandle::GetStartPosition().

Referenced by fio_JourHandle::FindNextTransHdr().

                                                                              {
    return FindStart(*(fio_File*)m_jourHnd.GetJourFile(), m_jourHnd.GetStartPosition() + 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FilePosition_t fio_StartTransaction_t::FindStart ( fio_File f,
ivd_FilePosition_t  startPos 
) [static]

Definition at line 208 of file fio_Transaction.cpp.

References cmn_FastFileSearch::Find(), fio_START_TRANS_STR_LEN_d, fio_START_TRANS_STRING_d, log_FUNC_m, and cmn_File::SeekEndF().

                                                                                             {
    log_FUNC_m(StartSearch);

    static cmn_SkipTbl4FS startTransSearchTbl(string(fio_START_TRANS_STRING_d,fio_START_TRANS_STR_LEN_d));

    static cmn_FastPattSearch fastSearch(&startTransSearchTbl);

    cmn_FastFileSearch ffs(&fastSearch, &f, 4096);

//DEL    ivd_FilePosition_t  pos = ffs.Find(startPos, f.SeekEndF());
    ivd_FilePosition_t  pos = ffs.Find(startPos);

    if (pos < 0) {           // if not found then
        pos =  f.SeekEndF(); // next start is at the end of the file
    }
    return pos;
}

Here is the call graph for this function:

void fio_StartTransaction_t::Init ( fio_JourHandle m_jourHnd_p  ) 

Definition at line 161 of file fio_Transaction.cpp.

References c_StartTransString, c_StartTransStrLen, dbg_NORM, fio_JourHandle::GetTransNumber(), ie_NOT_STARTTRANS_T, ivd_Error, fio_JourHandle::JourRead(), len, log_DBG_m, log_FUNC_m, Prefix, fio_JourHandle::ResetPosition(), fio_JourHandle::SetTransSize(), and TransNumber.

Referenced by fio_JourFile::Dump(), and fio_Transaction::ReadTransactionFromLog().

                                                           {
    log_FUNC_m(Init);
    a_jourHnd.SetTransSize(sizeof(fio_StartTransaction_t));
    unsigned int len = a_jourHnd.JourRead(this, sizeof(fio_StartTransaction_t));

    if (  (len == sizeof(fio_StartTransaction_t))
       && (strncmp(Prefix, c_StartTransString, c_StartTransStrLen) == 0)
       ) {
        if (  (TransNumber != 0)
           && (a_jourHnd.GetTransNumber() != 0)
           && (TransNumber != a_jourHnd.GetTransNumber() + 1)
           ) {
                log_DBG_m(dbg_NORM, "Trans number not in sequence! Last trans number =" << a_jourHnd.GetTransNumber()
                                    << *this);            
           }
        // Empty
    }
    else { // len > sizeof(Prefix) + sizeof(Version) && ...
        a_jourHnd.ResetPosition(); //  revert position
        ostringstream sstr;
        sstr << "Bad transaction header. TransNumber=" << TransNumber
             << ", but expect " << (a_jourHnd.GetTransNumber() + 1);
        throw ivd_Error(ie_NOT_STARTTRANS_T, sstr.str(), false);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool fio_StartTransaction_t::operator== ( fio_EndTransaction_t  a  ) 

Definition at line 196 of file fio_Transaction.cpp.

References fio_EndTransaction_t::TransNumber, and TransNumber.

                                                                {
    return  ( TransNumber == a.TransNumber );
}

bool fio_StartTransaction_t::operator== ( fio_StartTransaction_t  a  ) 

Definition at line 189 of file fio_Transaction.cpp.

References c_StartTransStrLen, Prefix, and TransNumber.

                                                                  {
    return  ( (strncmp(Prefix, a.Prefix, c_StartTransStrLen) == 0)
            &&(TransNumber == a.TransNumber) );
}


Friends And Related Function Documentation

ostream& operator<< ( ostream &  a_os,
fio_StartTransaction_t a_startTrans 
) [friend]

Operator prints fio_StartTransaction to stream.

Definition at line 228 of file fio_Transaction.cpp.

                                                                  {
    string pref(a_st.Prefix, fio_START_TRANS_STR_LEN_d);
    cmn_Time t(a_st.Time, a_st.MilliTime);
    a_os << "*** Start Trans Rec " << a_st.TransNumber << '\n';
//    a_os << "Prefix = " << pref                       << '\n';
//    a_os << "Number = " << a_st.TransNumber           << '\n'; 
    a_os << "Size   = " << a_st.TransSize             << '\n';
    a_os << "Time   = " << t.Time2YMDhmsm()           << '\n';
    a_os << "Alter  = " << a_st.AlterNumber           << '\n';
    a_os << "ReleVec= " << a_st.FreedVector           << '\n'; 
    a_os << "UsedVec= " << a_st.UsedVector            << '\n';
    a_os << "*** End\n";
    return a_os;
}


Member Data Documentation

Definition at line 114 of file fio_Transaction.h.

Referenced by operator<<(), and fio_Transaction::ReadTransactionFromLog().

Definition at line 117 of file fio_Transaction.h.

Referenced by operator<<(), and fio_Transaction::ReadTransactionFromLog().

Definition at line 120 of file fio_Transaction.h.

Definition at line 116 of file fio_Transaction.h.

Referenced by fio_StartTransaction_t(), and operator<<().

char fio_StartTransaction_t::Prefix[fio_START_TRANS_STR_LEN_d]

Definition at line 111 of file fio_Transaction.h.

Referenced by fio_StartTransaction_t(), Init(), operator<<(), and operator==().

Definition at line 115 of file fio_Transaction.h.

Referenced by fio_StartTransaction_t(), and operator<<().

Definition at line 118 of file fio_Transaction.h.

Referenced by operator<<(), and fio_Transaction::ReadTransactionFromLog().


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