Public Member Functions | Public Attributes | Private Attributes

hsm_JobElemVecMgr Class Reference
[Classes for managing object list]

#include <hsm_joblistmgr.h>

Collaboration diagram for hsm_JobElemVecMgr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 hsm_JobElemVecMgr ()
void Reserve (UInt32_t a_size)
 reserve amount of space for all job's elements
bool ReleaseElement (UInt32_t a_idx, ivd_FileSize_t a_fileSize)
 release proper job element return true If is already released return false
bool ReleaseElement (UInt32_t a_idx)
bool ReleaseElementNoLock (UInt32_t a_idx)
bool ReleaseJobWithTest ()
 release only if all elements are released
bool ReleaseJobWithTest (UInt32_t &a_numOfHandledFiles, UInt64_t &a_sizeOfHandledFiles)
void ReleaseJob ()
 release always
UInt32_t Insert (hsm_FileHeader *a_fh_p)
hsm_FileHeaderAt (UInt32_t a_jobElemIdx)
 return pointer to job element
UInt32_t GetNumOfReleasedElem ()
UInt64_t GetSizeOfHandledFiles ()
UInt32_t GetNumOfHandledFiles ()
UInt32_t GetReservedSize ()
ivd_MigrationID_t GetMigrationID ()
UInt64_t GetPMJobID ()
void SetMigJobID (UInt64_t a_pmJobID, ivd_MigrationID_t a_migID)
void SetJobStatus (hsm_JobStatus_e a_jobStatus)
hsm_JobStatus_e GetJobStatus ()
void JobToSequence (i_JobRequestList_t &seqTFileList)

Public Attributes

cmn_Mutex m_jobElemVecMgr_x
 log_CLASSID_m

Private Attributes

UInt32_t m_numOfReleasedElem
 number of already released job elements
UInt64_t m_sizeOfHandledFiles
 The size of data of succeed handled files.
UInt32_t m_numOfHandledFiles
 The number of succeed handled files.
UInt32_t m_reservedSize
 the initial vector space real vector size can be extend later by adding dependent FH
ivd_MigrationID_t m_migID
 vhen used in job list the migrationID is set
UInt64_t m_pmJobID
 JobID got from partition manager set at reservation.
hsm_JobStatus_e m_jobStatus

Detailed Description

Definition at line 105 of file hsm_joblistmgr.h.


Constructor & Destructor Documentation

hsm_JobElemVecMgr::hsm_JobElemVecMgr (  )  [inline]

Member Function Documentation

hsm_FileHeader * hsm_JobElemVecMgr::At ( UInt32_t  a_jobElemIdx  ) 

return pointer to job element

Definition at line 167 of file hsm_joblistmgr.cpp.

References cmn_Num2Str(), ie_HSM_INVJOBELEMIDX, log_FUNC_m, and size.

Referenced by i_HSM_i::CompleteMigration(), i_HSM_i::DoMigrationJob(), i_HSM_i::EfficientRecall(), hsm_Recall::IsFileFromDFforRecall(), and i_HSM_i::Recall().

                                                           {
    log_FUNC_m(At);

    if (size() > a_jobElemIdx) {
        return at(a_jobElemIdx);
    }
    else {
        throw ivd_InternalError(ie_HSM_INVJOBELEMIDX, 
            "JobElemIdx " + cmn_Num2Str(a_jobElemIdx) +
            "  VecSize " + cmn_Num2Str(size()), true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

hsm_JobStatus_e hsm_JobElemVecMgr::GetJobStatus (  )  [inline]

Definition at line 185 of file hsm_joblistmgr.h.

References m_jobStatus.

Referenced by hsm_JobListMgr::MigrateFailedJob().

{ return m_jobStatus;};

Here is the caller graph for this function:

ivd_MigrationID_t hsm_JobElemVecMgr::GetMigrationID (  )  [inline]

Definition at line 179 of file hsm_joblistmgr.h.

References m_migID.

Referenced by hsm_JobListMgr::MigrateFailedJob().

{ return m_migID;};

Here is the caller graph for this function:

UInt32_t hsm_JobElemVecMgr::GetNumOfHandledFiles (  )  [inline]

Definition at line 175 of file hsm_joblistmgr.h.

References m_numOfHandledFiles.

{ return m_numOfHandledFiles; };

UInt32_t hsm_JobElemVecMgr::GetNumOfReleasedElem (  )  [inline]

Definition at line 172 of file hsm_joblistmgr.h.

References m_numOfReleasedElem.

{ return m_numOfReleasedElem; };

UInt64_t hsm_JobElemVecMgr::GetPMJobID (  )  [inline]

Definition at line 181 of file hsm_joblistmgr.h.

References m_pmJobID.

{ return m_pmJobID;};

UInt32_t hsm_JobElemVecMgr::GetReservedSize (  )  [inline]

Definition at line 177 of file hsm_joblistmgr.h.

References m_reservedSize.

{ return m_reservedSize; };

UInt64_t hsm_JobElemVecMgr::GetSizeOfHandledFiles (  )  [inline]

Definition at line 174 of file hsm_joblistmgr.h.

References m_sizeOfHandledFiles.

{ return m_sizeOfHandledFiles; };

UInt32_t hsm_JobElemVecMgr::Insert ( hsm_FileHeader a_fh_p  ) 

Definition at line 154 of file hsm_joblistmgr.cpp.

References hsm_FileHeader::IncrRef(), log_FUNC_m, m_jobElemVecMgr_x, push_back(), and size.

                                                         {
    log_FUNC_m(Insert);

    cmn_MutexLock l(m_jobElemVecMgr_x);
    Int32_t idx = size();
//    a_fh_p->SetJobElemIdx(static_cast<Int32_t>(size()));
    
    push_back(a_fh_p);
    a_fh_p->IncrRef();    
    return idx;
}

Here is the call graph for this function:

void hsm_JobElemVecMgr::JobToSequence ( i_JobRequestList_t seqTFileList  ) 

Definition at line 197 of file hsm_joblistmgr.cpp.

References dbg_DETAIL, hsm_FileHeader::FileToSeqElem(), g_hsm_fhLock, hsm_FileHeader::GetInode(), hsm_ListPos::GetJobElemIdx(), cmn_Mutex::Lock(), log_DBG_m, log_FUNC_m, m_jobElemVecMgr_x, NULL, size, and cmn_Mutex::Unlock().

Referenced by hsm_JobListMgr::MigrateFailedJob().

                                                                      {
    log_FUNC_m(MigrateFailedJob);

    m_jobElemVecMgr_x.Lock();    
    int jobSize = size();
    seqTFileList.length(jobSize);

    UInt32_t    numfiles = 0;

    hsm_FileHeader** ip = &*begin();
    hsm_FileHeader** ep = &*end();
    for (; ip != ep; ++ip) {
        hsm_FileHeader &fh = (**ip);
        if (&fh == NULL) {
            log_DBG_m(dbg_DETAIL, "fh == NULL. Changed in meantime.");
            continue; // probably moved to dirty list
        }
        ivd_GenInode_t inode = fh.GetInode();
        if (!g_hsm_fhLock.CanLockByID(inode)) {
            log_DBG_m(dbg_DETAIL, "Already locked.");
            continue;  // can't use this FH already locked (changed), so skip it,
        }
        m_jobElemVecMgr_x.Unlock();
        if (fh.GetJobElemIdx() == -1 ) {
            log_DBG_m(dbg_DETAIL, "Element idx == -1. No more in job list.");
            g_hsm_fhLock.UnLockByID(inode);
            continue; // probably moved to dirty list            
        }
        fh.FileToSeqElem(seqTFileList[numfiles++]);            
        g_hsm_fhLock.UnLockByID(inode);
        m_jobElemVecMgr_x.Lock();    
    }
    m_jobElemVecMgr_x.Unlock();
    seqTFileList.length(numfiles);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_JobElemVecMgr::ReleaseElement ( UInt32_t  a_idx,
ivd_FileSize_t  a_fileSize 
)

release proper job element return true If is already released return false

Definition at line 66 of file hsm_joblistmgr.cpp.

References log_FUNC_A_m, m_jobElemVecMgr_x, m_numOfHandledFiles, m_sizeOfHandledFiles, and ReleaseElementNoLock().

Referenced by hsm_JobListMgr::ReleaseElement(), ReleaseElement(), and ReleaseElementNoLock().

                                                                                {
    log_FUNC_A_m(ReleaseElement, "a_idx: " << a_idx << ", a_fileSize: " << a_fileSize);

    cmn_MutexLock l(m_jobElemVecMgr_x);
    if (ReleaseElementNoLock(a_idx)) {
        m_sizeOfHandledFiles += a_fileSize;
        ++m_numOfHandledFiles;
        return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_JobElemVecMgr::ReleaseElement ( UInt32_t  a_idx  ) 

Definition at line 79 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_jobElemVecMgr_x, ReleaseElement(), and ReleaseElementNoLock().

Here is the call graph for this function:

bool hsm_JobElemVecMgr::ReleaseElementNoLock ( UInt32_t  a_idx  ) 

Definition at line 87 of file hsm_joblistmgr.cpp.

References cmn_Num2Str(), hsm_FileHeader::DecrRef(), ie_INVALID_ARG, log_FUNC_m, m_numOfReleasedElem, NULL, ReleaseElement(), and size.

Referenced by ReleaseElement().

                                                           {
    log_FUNC_m(ReleaseElementNoLock);

    UInt32_t elemNum = size();

    if ( a_idx >= elemNum ) {
        log_FUNC_m(ReleaseElement);
        throw ivd_InternalError(ie_INVALID_ARG, 
            "Job element vector index exceed vector size. " + cmn_Num2Str(a_idx), true);
    }

    hsm_FileHeader* fh_p = operator[](a_idx);
    if (fh_p != NULL) {
        fh_p->DecrRef();
        operator[](a_idx)  = NULL;
        ++m_numOfReleasedElem;
        return true;  
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_JobElemVecMgr::ReleaseJob (  ) 

release always

Definition at line 140 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_jobStatus, m_migID, m_numOfHandledFiles, m_numOfReleasedElem, m_pmJobID, m_reservedSize, and m_sizeOfHandledFiles.

Referenced by ReleaseJobWithTest().

Here is the caller graph for this function:

bool hsm_JobElemVecMgr::ReleaseJobWithTest ( UInt32_t a_numOfHandledFiles,
UInt64_t a_sizeOfHandledFiles 
)

Definition at line 123 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_jobElemVecMgr_x, m_numOfHandledFiles, m_sizeOfHandledFiles, NULL, ReleaseJob(), and ReleaseJobWithTest().

                                                                           {
    log_FUNC_m(ReleaseJobWithTest);

    cmn_MutexLock l(m_jobElemVecMgr_x);
    for (hsm_JobElem_v_i iter = begin(); iter != end(); iter++) {
        if (*iter != NULL) {
            return false;
        }
    }
    a_numOfHandledFiles  = m_numOfHandledFiles;
    a_sizeOfHandledFiles = m_sizeOfHandledFiles;
    ReleaseJob();
    return true;
}

Here is the call graph for this function:

bool hsm_JobElemVecMgr::ReleaseJobWithTest (  ) 

release only if all elements are released

Definition at line 109 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_jobElemVecMgr_x, NULL, and ReleaseJob().

Referenced by hsm_JobListMgr::ReleaseJobIdxWithTest(), and ReleaseJobWithTest().

                                           {
    log_FUNC_m(ReleaseJobWithTest);

    cmn_MutexLock l(m_jobElemVecMgr_x);
    for (hsm_JobElem_v_i iter = begin(); iter != end(); iter++) {
        if (*iter != NULL) {
            return false;
        }
    }
    ReleaseJob();
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_JobElemVecMgr::Reserve ( UInt32_t  a_size  ) 

reserve amount of space for all job's elements

Definition at line 57 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_jobElemVecMgr_x, and m_reservedSize.

                                               {
    log_FUNC_m(Reserve);

    cmn_MutexLock l(m_jobElemVecMgr_x);
    m_reservedSize = a_size;
    reserve(a_size);
}

void hsm_JobElemVecMgr::SetJobStatus ( hsm_JobStatus_e  a_jobStatus  ) 

Definition at line 189 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_jobElemVecMgr_x, and m_jobStatus.

Referenced by i_HSM_i::CompleteMigration(), i_HSM_i::DoMigrationJob(), and hsm_JobListMgr::MigrateFailedJob().

Here is the caller graph for this function:

void hsm_JobElemVecMgr::SetMigJobID ( UInt64_t  a_pmJobID,
ivd_MigrationID_t  a_migID 
)

Definition at line 181 of file hsm_joblistmgr.cpp.

References log_FUNC_m, m_migID, and m_pmJobID.

Referenced by i_HSM_i::DoMigrationJob(), and hsm_JobListMgr::MigrateFailedJob().

                                                                                 {
    log_FUNC_m(SetMigJobID);

    m_migID   = a_migID;
    m_pmJobID = a_pmJobID;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 146 of file hsm_joblistmgr.h.

Definition at line 140 of file hsm_joblistmgr.h.

Referenced by GetJobStatus(), ReleaseJob(), and SetJobStatus().

vhen used in job list the migrationID is set

Definition at line 134 of file hsm_joblistmgr.h.

Referenced by GetMigrationID(), ReleaseJob(), and SetMigJobID().

The number of succeed handled files.

Definition at line 127 of file hsm_joblistmgr.h.

Referenced by GetNumOfHandledFiles(), ReleaseElement(), ReleaseJob(), and ReleaseJobWithTest().

number of already released job elements

Definition at line 117 of file hsm_joblistmgr.h.

Referenced by GetNumOfReleasedElem(), ReleaseElementNoLock(), and ReleaseJob().

JobID got from partition manager set at reservation.

Definition at line 138 of file hsm_joblistmgr.h.

Referenced by GetPMJobID(), ReleaseJob(), and SetMigJobID().

the initial vector space real vector size can be extend later by adding dependent FH

Definition at line 131 of file hsm_joblistmgr.h.

Referenced by GetReservedSize(), ReleaseJob(), and Reserve().

The size of data of succeed handled files.

Definition at line 124 of file hsm_joblistmgr.h.

Referenced by GetSizeOfHandledFiles(), ReleaseElement(), ReleaseJob(), and ReleaseJobWithTest().


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