Public Member Functions | Public Attributes

fsc_Copy Class Reference
[File System Catalog]

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

#include <fsc_Copy.h>

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

List of all members.

Public Member Functions

 fsc_Copy ()
 Default constructor.
 fsc_Copy (fsc_MedPosMgr *a_medPosMgr_p, df_SplitInfo &a_splitInfo)
 Move media position instance from higher level to copy splitInfor is only for set common data.
 fsc_Copy (fsc_dlcType_e a_dclType, fsc_EntryMgr *a_entryMgr_p, ivd_DataType_t a_dataType)
 fsc_Copy (df_SplitInfo &a_splitInfo)
 fsc_Copy (fsc_Split *a_split_p)
 NOTE a_split_p must be used or deleted.
 fsc_Copy (const fsc_Copy_t &a_copy)
 ~fsc_Copy ()
sp_State_e AddSplit (fsc_Split *a_split_p, fsc_Split_p_l_i &a_possibleInsertPoint, fsc_Split_p_l_t &a_replacedSplit_p_l)
void AddSplit (fsc_Split_p_l_i &a_insertPoint, fsc_Split *a_split_p)
void Remove (ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum, fsc_Split_p_l_t &a_replacedSplit_p_l)
 remove all entries from particular volume.
bool Remove (ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum, UInt32_t a_blockOffs, fsc_Split_p_l_t &a_replacedSplit_p_l)
 Remove one particular entry.
bool isEqual (df_SplitInfo &a_splitInfo)
 check if current copy has common parts of data in its splits
bool isReorganized ()
void GetMediaPos (ivd_MediaPos_v_t &a_mediaPos_v, fsc_MigInfo_t &migInfo)
 Get all media position from copy.
void ReadMembers ()
 create and read next level members
bool Write2DB (fsc_Copy_t &a_copyData, fio_Transaction &a_trans)
 invoke next level write2DB and collect data for previous level
void Dump (ostream &os)
bool TreeWalk (fsc_Collector &a_collector)

Public Attributes

ivd_DataType_t m_dataType
 all data type that are stored in splits
bool m_reorganized
 log_CLASSID_m

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 51 of file fsc_Copy.h.


Constructor & Destructor Documentation

fsc_Copy::fsc_Copy (  ) 

Default constructor.

Definition at line 51 of file fsc_Copy.cpp.

            : 
            fsc_Entry(),
            m_dataType(dlc_NotUsed),
            m_reorganized(false)
{
//    log_FUNC_m(fsc_Copy());
    // Empty
}

fsc_Copy::fsc_Copy ( fsc_MedPosMgr a_medPosMgr_p,
df_SplitInfo a_splitInfo 
)

Move media position instance from higher level to copy splitInfor is only for set common data.

fsc_Copy::fsc_Copy ( fsc_dlcType_e  a_dclType,
fsc_EntryMgr a_entryMgr_p,
ivd_DataType_t  a_dataType 
)

Definition at line 62 of file fsc_Copy.cpp.

            :
// fix bug 
            fsc_Entry(a_dclType, a_entryMgr_p),
            m_dataType(a_dataType),
            m_reorganized(false)
{
//    log_FUNC_m(fsc_Copy(fsc_dlcType_e, fsc_EntryMgr, ivd_DataType_t));
}

fsc_Copy::fsc_Copy ( df_SplitInfo a_splitInfo  ) 

Definition at line 76 of file fsc_Copy.cpp.

References dlc_MediaPos, dlc_Split, fsc_Entry::InitNextEntry(), df_SplitInfo::lastSplit, and df_SplitInfo::splitOffset.

            :
            fsc_Entry(),
            m_dataType(a_splitInfo.dataType),
            m_reorganized(false)
{
//    log_FUNC_m(fsc_Copy(df_SplitInfo));

    if ( !a_splitInfo.lastSplit
       || a_splitInfo.splitOffset > 0) { //FIX  bug 680  if split then generate another empty
        fsc_Entry::InitNextEntry(dlc_Split, new fsc_SplitMgr(a_splitInfo));   

    }
    else {   // not last split create media position 
        fsc_Entry::InitNextEntry(dlc_MediaPos, new fsc_MedPosMgr(a_splitInfo));        

    }
}

Here is the call graph for this function:

fsc_Copy::fsc_Copy ( fsc_Split a_split_p  ) 

NOTE a_split_p must be used or deleted.

Definition at line 96 of file fsc_Copy.cpp.

References dlc_MediaPos, dlc_Split, fsc_Entry::InitNextEntry(), fsc_Entry::m_entryMgr_p, fsc_Split::m_lastSplit, and fsc_Split::m_offset.

            :
            fsc_Entry(),
            m_dataType(a_split_p->m_dataType),
            m_reorganized(false)
{
//    log_FUNC_m(fsc_Copy(fsc_Split*));
    
    if ( !a_split_p->m_lastSplit
       || a_split_p->m_offset > 0) { //FIX  bug 680  if split then generate another empty
        fsc_Entry::InitNextEntry(dlc_Split, new fsc_SplitMgr(a_split_p));   

    }
    else {   // not last split use only media position 
// FIX bug 832
        fsc_Entry::InitNextEntry(dlc_MediaPos, a_split_p->m_entryMgr_p);        
        a_split_p->m_entryMgr_p = NULL; // to prevent delete 
        delete a_split_p;
    }
}

Here is the call graph for this function:

fsc_Copy::fsc_Copy ( const fsc_Copy_t a_copy  ) 

Definition at line 118 of file fsc_Copy.cpp.

            :
            fsc_Entry(a_copy.nextEntity),
//            m_copyID(a_copy.copyID),
            m_dataType(a_copy.nextEntity.dataType),
            m_reorganized(false)
{
//    log_FUNC_m(fsc_Copy(fsc_Copy_t));
}

fsc_Copy::~fsc_Copy (  ) 

Definition at line 129 of file fsc_Copy.cpp.

{
}


Member Function Documentation

sp_State_e fsc_Copy::AddSplit ( fsc_Split a_split_p,
fsc_Split_p_l_i a_possibleInsertPoint,
fsc_Split_p_l_t a_replacedSplit_p_l 
)

Definition at line 134 of file fsc_Copy.cpp.

References fsc_SplitMgr::AddSplit(), cmn_Num2Str(), dbg_DETAIL, dlc_MediaPos, dlc_Split, fsc_NextEntity_t::dlcType, fsc_Split::Dump(), ie_INVALID_ARG, fsc_MedPosMgr::IsItEqual(), log_DBG_m, log_FUNC_m, fsc_Entry::m_changed, fsc_Split::m_dataType, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, and ReadMembers().

Referenced by AddSplit().

                                                                     {

    ReadMembers();

    // check if some new data type is add
    ivd_DataType_t dataType = m_dataType | a_split_p->m_dataType;
    
    switch (m_nextEntry.dlcType) {
        case dlc_Split : {
                if ( dataType != m_dataType) {
                    m_dataType = dataType;
                    m_changed  = true;
                }
                fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
                return p->AddSplit(a_split_p, a_possibleInsertPoint, a_replacedSplit_p_l);
            }
            break;

        case dlc_MediaPos : {  
                fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
                if (p->IsItEqual(*static_cast<fsc_MedPosMgr*>(a_split_p->m_entryMgr_p))) {
                    log_FUNC_m(AddSplit);
                    // correct data type if neccesary.
                    // because of bug 4491. 
                    // bug when data type is changed before copy (split) is realocated,
                    // so its realocated data type is changed.
                    log_DBG_m(dbg_DETAIL, "m_dataType: " << m_dataType
                                        << ", a_split_p->m_dataType: " << a_split_p->m_dataType);
                    if (m_dataType != a_split_p->m_dataType) {
                        m_dataType = a_split_p->m_dataType; 
                        m_changed  = true;
                    }
                    return sp_ALREADY_ADDED;
                }
                return sp_NEW_COPY;
            }
            break;

        default:
            stringstream dump;
            a_split_p->Dump(dump);
            log_FUNC_m(AddSplit);
            throw ivd_InternalError(ie_INVALID_ARG, 
                "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType) + dump.str(), true);
            break;
    }
    return sp_INSERTTED;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_Copy::AddSplit ( fsc_Split_p_l_i a_insertPoint,
fsc_Split a_split_p 
)

Definition at line 186 of file fsc_Copy.cpp.

References AddSplit(), cmn_Num2Str(), dlc_Split, fsc_NextEntity_t::dlcType, fsc_Split::Dump(), ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_changed, fsc_Split::m_dataType, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, and fsc_SplitMgr::m_split_p_l.

                                                    {

//    log_FUNC_m(AddSplit(fsc_Split_p_l_i&, fsc_Split*));

// it is called after upper AddSplit(...) method so it already has members
//    ReadMembers();

    // check if some new data type is add
    ivd_DataType_t dataType = m_dataType | a_split_p->m_dataType; 
    if ( dataType != m_dataType) {
        m_dataType = dataType;
        m_changed  = true;
    }

    switch (m_nextEntry.dlcType) {
    case dlc_Split : {
            fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
            p->m_split_p_l.insert(a_insertPoint, a_split_p);
        }
        break;

    default:
        log_FUNC_m(AddSplit(fsc_Split_p_l_i&, fsc_Split*));
        stringstream dump;
        a_split_p->Dump(dump);
        throw ivd_InternalError(ie_INVALID_ARG, 
            "Only splits are alowed here. dlcType =" +
                cmn_Num2Str((int)m_nextEntry.dlcType) +
                dump.str(), true);
        break;
    }
}

Here is the call graph for this function:

void fsc_Copy::Dump ( ostream &  os  ) 

Definition at line 516 of file fsc_Copy.cpp.

References cmn_GetMigFlags(), dlc_MediaPos, dlc_NotUsed, dlc_Split, fsc_NextEntity_t::dlcType, fsc_MedPosMgr::Dump(), fsc_SplitMgr::Dump(), log_FUNC_m, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, and ReadMembers().

Referenced by fsc_CopyMgr::GetCopiesPos().

                               {
    log_FUNC_m(Dump);

    ReadMembers();
    os << "           Data type: "  << hex << m_dataType <<  dec << "  "
        << cmn_GetMigFlags(m_dataType) << endl;

    switch (m_nextEntry.dlcType) {
    case dlc_NotUsed :
        os << "               Copy not used" << endl;
        break;

    case dlc_Split : { // TODO check copy ID and no of copies
        fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
        p->Dump(os);
        }
        break;

    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_Copy::GetMediaPos ( ivd_MediaPos_v_t a_mediaPos_v,
fsc_MigInfo_t migInfo 
)

Get all media position from copy.

Definition at line 352 of file fsc_Copy.cpp.

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

Referenced by fsc_CopyMgr::GetCopiesPos().

                                                                                 {
//    log_FUNC_m(GetMediaPos);

    ReadMembers();

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

    case dlc_Split : { // TODO check copy ID and no of copies
        fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
        p->GetMediaPos(a_mediaPos_v, migInfo);
        }
        break;

    case dlc_MediaPos : {  
        a_mediaPos_v.resize(1); // one split
        fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
        ivd_MediaPos_t &mediaPos = a_mediaPos_v[0];
        p->GetMediaPos(mediaPos);
        // in case that copy hold media location than 
        // size and data type is get from migInfo
        mediaPos.splitOffset = 0;   
        mediaPos.splitSize   = migInfo.m_size;
        mediaPos.dataType    = migInfo.m_dataType;
        }
        break;

    default:
        log_FUNC_m(GetMediaPos);
        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_Copy::isEqual ( df_SplitInfo a_splitInfo  ) 

check if current copy has common parts of data in its splits

check if current copy is equal to new to insert it

bool fsc_Copy::isReorganized (  )  [inline]

Definition at line 110 of file fsc_Copy.h.

References m_reorganized.

{ return m_reorganized; };

void fsc_Copy::ReadMembers (  ) 

create and read next level members

Definition at line 423 of file fsc_Copy.cpp.

References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, dlc_Split, fsc_NextEntity_t::dlcType, fsc_Vector_t::entryIdx, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, NULL, fsc_Vector_t::numOfElement, and fsc_NextEntity_t::vector.

Referenced by AddSplit(), Dump(), GetMediaPos(), Remove(), and TreeWalk().

                           {

    if (  m_entryMgr_p == NULL) {
            switch (m_nextEntry.dlcType) {
            case dlc_NotUsed :
                break;
//            case    dlc_Chunk,
            case dlc_Split :
                m_entryMgr_p = new fsc_SplitMgr(m_nextEntry.vector.numOfElement, 
                                                m_nextEntry.vector.entryIdx);

                break;

            case dlc_MediaPos :
                m_entryMgr_p = new fsc_MedPosMgr(m_nextEntry);

                break;

            default:
                log_FUNC_m(ReadMembers);
                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_Copy::Remove ( ivd_MediaKey_t  a_mediumKey,
ivd_MedVolNum_t  a_medVolNum,
UInt32_t  a_blockOffs,
fsc_Split_p_l_t a_replacedSplit_p_l 
)

Remove one particular entry.

Definition at line 255 of file fsc_Copy.cpp.

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

                                                            {
    log_FUNC_m(Remove);
    
    ReadMembers();

    switch (m_nextEntry.dlcType) {

    case dlc_NotUsed :
        return false;

    case dlc_Split : {
                fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
                m_reorganized = p->Remove(a_mediumKey, a_medVolNum, a_blockOffs, a_replacedSplit_p_l);
                return m_reorganized;
            }
            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;
    }
    return false;
}

Here is the call graph for this function:

void fsc_Copy::Remove ( ivd_MediaKey_t  a_mediumKey,
ivd_MedVolNum_t  a_medVolNum,
fsc_Split_p_l_t a_replacedSplit_p_l 
)

remove all entries from particular volume.

Definition at line 221 of file fsc_Copy.cpp.

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

Referenced by Remove().

                                                            {
    log_FUNC_m(Remove);

    ReadMembers();

    switch (m_nextEntry.dlcType) {

    case dlc_NotUsed :
        return;

    case dlc_Split : {
                fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
                m_reorganized = p->Remove(a_mediumKey, a_medVolNum, a_replacedSplit_p_l);
                return;
            }
            break;

        case dlc_MediaPos : {
                fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
                p->Remove(a_mediumKey, a_medVolNum);        
                return;
            }
            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_Copy::TreeWalk ( fsc_Collector a_collector  ) 

Definition at line 389 of file fsc_Copy.cpp.

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

                                                    {

    ReadMembers();

    if (!a_collector.ProcObjCopy(this)){
        return false;
    }

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

    case dlc_Split : { // TODO check copy ID and no of copies
        fsc_SplitMgr* p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
        return p->TreeWalk(a_collector);
        }
        break;

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

    default:
        log_FUNC_m(TreeWalk);
        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_Copy::Write2DB ( fsc_Copy_t a_copyData,
fio_Transaction a_trans 
)

invoke next level write2DB and collect data for previous level

Definition at line 453 of file fsc_Copy.cpp.

References cmn_Num2Str(), fsc_NextEntity_t::dataType, dbg_DETAIL, dlc_MediaPos, dlc_NotUsed, dlc_Split, 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, fsc_Copy_t::nextEntity, NULL, fsc_Copy_t::reserved, fsc_MedPosMgr::Write2DB(), and fsc_SplitMgr::Write2DB().

Referenced by fsc_CopyMgr::Write2DB().

                                                  {
    log_FUNC_m(Write2DB);
//    log_DBG_m(dbg_DETAIL, "fsc_Copy::Write2DB ");

    bool vecIdxOrSizeChanged  = false;

    if (m_entryMgr_p != NULL) {

        log_DBG_m(dbg_DETAIL, " m_nextEntry.dlcType = " << (int)m_nextEntry.dlcType );
        // Write and check if changed next entryes first
        switch (m_nextEntry.dlcType) {

        case dlc_NotUsed : 
            a_copyData.nextEntity = m_nextEntry;
//            memset(&a_copyData, 0, sizeof(fsc_Copy_t));
            break;

        case dlc_Split : {
                fsc_SplitMgr *splitMgr_p = static_cast<fsc_SplitMgr*>(m_entryMgr_p);
                // update next level data 
                vecIdxOrSizeChanged = splitMgr_p->Write2DB(a_copyData.nextEntity,
                                                           a_trans);
                m_nextEntry = a_copyData.nextEntity;
            }
            break;

        case dlc_MediaPos : {
                fsc_MedPosMgr *medPosMgr_p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p);
                vecIdxOrSizeChanged = medPosMgr_p->Write2DB(a_copyData.nextEntity);
                m_nextEntry = a_copyData.nextEntity;
            }
            break;

        default:
            log_FUNC_m(Write2DB);
            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_copyData.nextEntity = m_nextEntry;
    }
//    a_copyData.nextEntity.Dbg();

    //set data, cause of moving vector. Doesn't mather if was not changed.
    a_copyData.nextEntity.dataType = m_dataType;
    a_copyData.reserved = 0;

    // if any data changed 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:


Member Data Documentation

Reimplemented from fsc_Entry.

Definition at line 81 of file fsc_Copy.h.

all data type that are stored in splits

Definition at line 77 of file fsc_Copy.h.

Referenced by AddSplit(), Dump(), fsc_CopyMgr::GetCopiesPos(), and Write2DB().

Definition at line 78 of file fsc_Copy.h.

Referenced by isReorganized(), and Remove().


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