Public Member Functions | Public Attributes | Friends

fsc_Split Class Reference
[File System Catalog]

<Description:> A more elaborate class description that describes all aspects of class usage etc. More...

#include <fsc_Split.h>

Inheritance diagram for fsc_Split:
Inheritance graph
[legend]
Collaboration diagram for fsc_Split:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 fsc_Split ()
 default constructor, all fields are zero and set as changed
 fsc_Split (fsc_MedPosMgr *a_medPosMgr_p, df_SplitInfo &a_splitInfo)
 If media position has got from some generation or copy should has same size as chunk and offset 0.
 fsc_Split (df_SplitInfo &a_splitInfo)
 newlly split generated from splitInfo
 fsc_Split (const fsc_Split_t &a_split)
 split generated from stored record into DB
 ~fsc_Split ()
bool Remove (ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum)
 remove all entries from particular volume.
bool Remove (ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum, UInt32_t a_blockOffs)
 Remove one particular entry.
fsc_MedPosMgrGetMediaPosMgr ()
void GetMediaPos (ivd_MediaPos_t &a_mediaPos)
 Get all media position from copy.
void ReadMembers ()
bool Write2DB (fsc_Split_t &a_splitData, fio_Transaction &a_trans)
 invoke next level write2DB and collect data for previous level
bool HasIntersection (df_SplitInfo &a_splitInfo)
 Insert to split is actualy update null split instance that is generated by splitMgr when it's obvious that more than one split is used.
bool HasIntersection (fsc_Split &a_split)
bool SplitsAreOverlaping (ivd_FilePosition_t a_currentSplitOffset, ivd_FileSize_t a_currentSplitSize, ivd_FilePosition_t a_addedSplitOffset, ivd_FileSize_t a_addedSplitSize)
bool HasEqualSplit (df_SplitInfo &a_splitInfo)
bool IsSplitEqual (fsc_Split &a_split)
void Dump (ostream &os)
bool TreeWalk (fsc_Collector &a_collector)
bool IsZeroSizeSplit ()

Public Attributes

ivd_FilePosition_t m_offset
ivd_FileSize_t m_size
ivd_DataType_t m_dataType
 all data type that are stored in splits
bool m_lastSplit
 log_CLASSID_m

Friends

ostream & operator<< (ostream &a_os, const fsc_Split &a_split)

Detailed Description

<Description:> A more elaborate class description that describes all aspects of class usage etc.

Author:
Dejan Volk Lupo, HERMES SoftLab
See also:
<reference>

Definition at line 52 of file fsc_Split.h.


Constructor & Destructor Documentation

fsc_Split::fsc_Split (  ) 

default constructor, all fields are zero and set as changed

Definition at line 50 of file fsc_Split.cpp.

References log_FUNC_m.

Referenced by fsc_Split().

Here is the caller graph for this function:

fsc_Split::fsc_Split ( fsc_MedPosMgr a_medPosMgr_p,
df_SplitInfo a_splitInfo 
)

If media position has got from some generation or copy should has same size as chunk and offset 0.

Definition at line 63 of file fsc_Split.cpp.

References dlc_MediaPos, fsc_Split(), fsc_Entry::InitNextEntry(), and log_FUNC_m.

Here is the call graph for this function:

fsc_Split::fsc_Split ( df_SplitInfo a_splitInfo  ) 

newlly split generated from splitInfo

Definition at line 79 of file fsc_Split.cpp.

References dlc_MediaPos, fsc_Split(), fsc_Entry::InitNextEntry(), and log_FUNC_m.

Here is the call graph for this function:

fsc_Split::fsc_Split ( const fsc_Split_t a_split  ) 

split generated from stored record into DB

Definition at line 94 of file fsc_Split.cpp.

References dlc_MediaPos, fsc_Split(), fsc_Entry::InitNextEntry(), log_FUNC_m, and fsc_Entry::m_nextEntry.

Here is the call graph for this function:

fsc_Split::~fsc_Split (  ) 

Definition at line 108 of file fsc_Split.cpp.

{
}


Member Function Documentation

void fsc_Split::Dump ( ostream &  os  ) 

Definition at line 335 of file fsc_Split.cpp.

References cmn_GetMigFlags(), dlc_MediaPos, fsc_NextEntity_t::dlcType, fsc_MedPosMgr::Dump(), log_FUNC_m, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, m_offset, and m_size.

Referenced by fsc_Copy::AddSplit(), and fsc_SplitMgr::Dump().

                                {
    log_FUNC_m(Dump);

//    ReadMembers();

    os << "             Split offset   "  << m_offset << endl;
    os << "             Split size     "  << m_size << endl;
    os << "             Data type      "  << hex << m_dataType <<  dec << "  "
        << cmn_GetMigFlags(m_dataType) << endl;

    switch (m_nextEntry.dlcType) {

    case dlc_MediaPos : {
            fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
            p->Dump(os);
            }
        break;

    default:
        os << "                   Wrong dlcType "  << (int)m_nextEntry.dlcType << endl;
        break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_Split::GetMediaPos ( ivd_MediaPos_t a_mediaPos  ) 

Get all media position from copy.

Definition at line 227 of file fsc_Split.cpp.

References cmn_Num2Str(), ivd_MediaPos_t::dataType, dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, fsc_MedPosMgr::GetMediaPos(), ie_INVALID_ARG, log_FUNC_m, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, m_offset, m_size, ivd_MediaPos_t::splitOffset, and ivd_MediaPos_t::splitSize.

Referenced by fsc_SplitMgr::GetMediaPos().

                                                      {
    log_FUNC_m(GetMediaPos);

//    ReadMembers();

    switch (m_nextEntry.dlcType) {
    case dlc_NotUsed :
         break;

    case dlc_MediaPos : {
            fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
            p->GetMediaPos(a_mediaPos);
            a_mediaPos.splitOffset = m_offset;
            a_mediaPos.splitSize   = m_size;
            a_mediaPos.dataType    = m_dataType;
            }
        break;

    default:
        throw ivd_InternalError(ie_INVALID_ARG, 
            "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true);
        break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

fsc_MedPosMgr& fsc_Split::GetMediaPosMgr (  )  [inline]

Definition at line 94 of file fsc_Split.h.

References fsc_Entry::m_entryMgr_p.

Referenced by fsc_SplitMgr::AddSplit().

                                    {            
        return  *static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
    };

Here is the caller graph for this function:

bool fsc_Split::HasEqualSplit ( df_SplitInfo a_splitInfo  ) 

Definition at line 208 of file fsc_Split.cpp.

References df_SplitInfo::blockOffset, fsc_MediaPosition_t::blockOffset, fsc_NextEntity_t::GetMedPos(), log_FUNC_m, fsc_Entry::m_nextEntry, df_SplitInfo::mediaKey, fsc_MediaPosition_t::mediaKey, df_SplitInfo::medVolNum, and fsc_MediaPosition_t::medVolNum.

                                                        {
    log_FUNC_m(HasEqualSplit);

    fsc_MediaPosition_t &mediaPosition = m_nextEntry.GetMedPos();
    return (  mediaPosition.mediaKey    == a_splitInfo.mediaKey
           && mediaPosition.medVolNum   == a_splitInfo.medVolNum
           && mediaPosition.blockOffset == a_splitInfo.blockOffset);
}

Here is the call graph for this function:

bool fsc_Split::HasIntersection ( fsc_Split a_split  ) 

Definition at line 168 of file fsc_Split.cpp.

References HasIntersection(), log_FUNC_m, m_offset, m_size, and SplitsAreOverlaping().

Here is the call graph for this function:

bool fsc_Split::HasIntersection ( df_SplitInfo a_splitInfo  ) 

Insert to split is actualy update null split instance that is generated by splitMgr when it's obvious that more than one split is used.

check if current split has common parts of data within splitInfo

Definition at line 158 of file fsc_Split.cpp.

References log_FUNC_m, m_offset, m_size, df_SplitInfo::splitOffset, SplitsAreOverlaping(), and df_SplitInfo::splitSize.

Referenced by fsc_SplitMgr::AddSplit(), and HasIntersection().

Here is the call graph for this function:

Here is the caller graph for this function:

bool fsc_Split::IsSplitEqual ( fsc_Split a_split  ) 

Definition at line 218 of file fsc_Split.cpp.

References fsc_MedPosMgr::IsItEqual(), and fsc_Entry::m_entryMgr_p.

Referenced by fsc_SplitMgr::AddSplit().

                                               {
    fsc_MedPosMgr *medPosMgr_p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
    return medPosMgr_p->IsItEqual(*static_cast<fsc_MedPosMgr*>(a_split.m_entryMgr_p));
// fix bug 992
// a_split.m_nextEntry.mediaPosition is not set if is constructted by SplitInfo????
//    return m_nextEntry.mediaPosition == a_split.m_nextEntry.mediaPosition;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool fsc_Split::IsZeroSizeSplit (  ) 

Definition at line 385 of file fsc_Split.cpp.

References dbg_DETAIL, ivd_ALTDATA_d, log_DBG_m, log_FUNC_m, m_dataType, m_offset, and m_size.

Referenced by fsc_SplitMgr::AddSplit(), and fsc_VolumeCheck::Check().

                                {
    log_FUNC_m(IsZeroSizeSplit);

    if ( (m_size == 0) && (m_offset > 0) ) {
        log_DBG_m(dbg_DETAIL, "Zero size split.");
        if (!(m_dataType & ivd_ALTDATA_d)) {
            log_DBG_m(dbg_DETAIL, "Zero size split is not ADS. FSC should not be updated.");
            return true;
        }
    }    
    return false;
}

Here is the caller graph for this function:

void fsc_Split::ReadMembers (  ) 
bool fsc_Split::Remove ( ivd_MediaKey_t  a_mediumKey,
ivd_MedVolNum_t  a_medVolNum,
UInt32_t  a_blockOffs 
)

Remove one particular entry.

Definition at line 135 of file fsc_Split.cpp.

References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, fsc_MedPosMgr::Remove(), and Remove().

                                                        {
    log_FUNC_m(Remove);
    switch (m_nextEntry.dlcType) {
    case dlc_NotUsed :
         return false;
        break;

    case dlc_MediaPos : {
            fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
            return p->Remove(a_mediumKey, a_medVolNum, a_blockOffs);
        }
        break;

    default:
        throw ivd_InternalError(ie_INVALID_ARG, 
            "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true);
        break;
    }
}

Here is the call graph for this function:

bool fsc_Split::Remove ( ivd_MediaKey_t  a_mediumKey,
ivd_MedVolNum_t  a_medVolNum 
)

remove all entries from particular volume.

Return true if removed.

Definition at line 113 of file fsc_Split.cpp.

References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, and fsc_MedPosMgr::Remove().

Referenced by Remove().

                                                        {
    log_FUNC_m(Remove);
    switch (m_nextEntry.dlcType) {
    case dlc_NotUsed :
         return false;
        break;

    case dlc_MediaPos : {
            fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
            return p->Remove(a_mediumKey, a_medVolNum);
        }
        break;

    default:
        throw ivd_InternalError(ie_INVALID_ARG, 
            "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true);
        break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool fsc_Split::SplitsAreOverlaping ( ivd_FilePosition_t  a_currentSplitOffset,
ivd_FileSize_t  a_currentSplitSize,
ivd_FilePosition_t  a_addedSplitOffset,
ivd_FileSize_t  a_addedSplitSize 
)

Definition at line 178 of file fsc_Split.cpp.

References dbg_DETAIL, log_DBG_m, and log_FUNC_m.

Referenced by HasIntersection().

                                                                     {
    log_FUNC_m(SplitsAreOverlaping);

    log_DBG_m(dbg_DETAIL, "add fsc_Split"
                        << ", curr split offset:  " << a_currentSplitOffset 
                        << ", curr split size:    " << a_currentSplitSize
                        << ", added split offset: " << a_addedSplitOffset 
                        << ", added split size:   " << a_addedSplitSize);
    
    bool intersect(true);
    /*
    It is much easier to find area where splits are not intersected
    and then just to invert results to find if they are intersected
    */
    if (   (a_currentSplitOffset <= a_addedSplitOffset) 
        && (a_currentSplitOffset + a_currentSplitSize <= a_addedSplitOffset) ) {
            intersect = false;
    }
    else if (   (a_currentSplitOffset >= a_addedSplitOffset + a_addedSplitSize)
             && (a_currentSplitOffset + a_currentSplitSize >= a_addedSplitOffset + a_addedSplitSize) ) {
            intersect = false;        
    }       

    return intersect;
}

Here is the caller graph for this function:

bool fsc_Split::TreeWalk ( fsc_Collector a_collector  ) 

Definition at line 253 of file fsc_Split.cpp.

References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, fsc_Collector::ProcObjSplit(), and fsc_MedPosMgr::TreeWalk().

                                                     {
    log_FUNC_m(TreeWalk);

//    ReadMembers();

    if (!a_collector.ProcObjSplit(this)){
        return false;
    }
    switch (m_nextEntry.dlcType) {
    case dlc_NotUsed :
         break;

    case dlc_MediaPos : {
            a_collector.ProcObjSplit(this);
            fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
            return p->TreeWalk(a_collector);
            }
        break;

    default:
        throw ivd_InternalError(ie_INVALID_ARG, 
            "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true);
        break;
    }
    return true;
}

Here is the call graph for this function:

bool fsc_Split::Write2DB ( fsc_Split_t a_splitData,
fio_Transaction a_trans 
)

invoke next level write2DB and collect data for previous level

Definition at line 281 of file fsc_Split.cpp.

References cmn_Num2Str(), fsc_Split_t::dataOffset, fsc_Split_t::dataSize, fsc_NextEntity_t::dataType, dbg_DETAIL, dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_DBG_m, log_FUNC_m, fsc_Entry::m_changed, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, m_offset, m_size, fsc_Split_t::nextEntity, NULL, and fsc_MedPosMgr::Write2DB().

Referenced by fsc_SplitMgr::Write2DB().

                                                   {
    log_FUNC_m(Write2DB);
//    log_DBG_m(dbg_DETAIL, "fsc_Split::Write2DB ");
    
    bool vecIdxOrSizeChanged = false;

    if (m_entryMgr_p != NULL) {
//        log_DBG_m(dbg_DETAIL, "      m_entryMgr_p != NULL");
        switch (m_nextEntry.dlcType) {

        case dlc_NotUsed : 
            a_splitData.nextEntity = m_nextEntry;
//            memset(&a_splitData, 0, sizeof(fsc_Split_t));
            break;
        // Write and check if changed next entryes first
        case dlc_MediaPos : {
                fsc_MedPosMgr *medPosMgr_p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
                vecIdxOrSizeChanged = medPosMgr_p->Write2DB(a_splitData.nextEntity);
                m_nextEntry = a_splitData.nextEntity;
            }
            break;

        default:
            throw ivd_InternalError(ie_INVALID_ARG, 
                "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true);
            break;
        }
    }
    else { // index and size are the same as at construct time
//        log_DBG_m(dbg_DETAIL, "    m_entryMgr_p == NULL");
        a_splitData.nextEntity = m_nextEntry;
    }
//    log_DBG_m(dbg_DETAIL, "      dlcType = dlc_MediaPos" );
//    a_splitData.nextEntity.Dbg();
    
    //set data, cause of moving vector. Doesn't mather if was not changed.
    a_splitData.dataOffset = m_offset;
    a_splitData.dataSize   = m_size;
    a_splitData.nextEntity.dataType = m_dataType;

    // if any data changed than send message that was changed
    log_DBG_m(dbg_DETAIL, " vecIdxOrSizeCahnged " << vecIdxOrSizeChanged
                       << " m_changed " << m_changed);
    if (  vecIdxOrSizeChanged 
       || m_changed) {

        m_changed = false;
        return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

ostream& operator<< ( ostream &  a_os,
const fsc_Split a_split 
) [friend]

Definition at line 360 of file fsc_Split.cpp.

                                                             {
//    log_FUNC_m(Dump);

    a_os << "             Split offset   "  << a_split.m_offset << endl;
    a_os << "             Split size     "  << a_split.m_size << endl;
    a_os << "             Data type      "  << hex << a_split.m_dataType <<  dec << "  "
        << cmn_GetMigFlags(a_split.m_dataType) << endl;

    switch (a_split.m_nextEntry.dlcType) {

    case dlc_MediaPos : {
            fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(a_split.m_entryMgr_p);
            p->Dump(a_os);
            }
        break;

    default:
        a_os << "                   Wrong dlcType "  << (int)a_split.m_nextEntry.dlcType << endl;
        break;
    }
    
    return a_os;    
}


Member Data Documentation

Reimplemented from fsc_Entry.

Definition at line 82 of file fsc_Split.h.

all data type that are stored in splits

Definition at line 77 of file fsc_Split.h.

Referenced by fsc_Copy::AddSplit(), Dump(), fsc_SplitMgr::GetMediaPos(), GetMediaPos(), IsZeroSizeSplit(), operator<<(), fsc_SplitInfoCollector::ProcObjSplit(), and Write2DB().

Definition at line 79 of file fsc_Split.h.

Referenced by fsc_Copy::fsc_Copy().


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