Public Member Functions | Private Member Functions | Private Attributes

fsc_ColectorExpFile Class Reference
[G_new_group]

#include <fsc_ColectorExpFile.h>

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

List of all members.

Public Member Functions

 fsc_ColectorExpFile (ui_MsgWriter &a_msgw, i_HSM_ptr a_ihsm, fsc_FileExpiration &a_fileExp, const char a_clientPathSeparator)
 ~fsc_ColectorExpFile (void)
bool ProcDirElement (fsc_nsElement_t &a_nsElem, const df_StandardAttr_t &a_attr, const cmn_Path &a_path, const string &a_name)

Private Member Functions

void FlushPackage ()

Private Attributes

 log_CLASSID_m
i_HSM_var m_ihsm
ui_MsgWriterm_msgw
fsc_FileExpirationm_fileExp
i_FileAgeList_t m_files
const char m_clientPathSeparator
const UInt32_t m_time
const int m_maxFileNum
int m_fileNum
const int m_maxPackageSize
int m_packageSize
ivd_RecordIDX_t m_currOwnerID
Int32_t m_currExpAge

Detailed Description

Definition at line 47 of file fsc_ColectorExpFile.h.


Constructor & Destructor Documentation

fsc_ColectorExpFile::fsc_ColectorExpFile ( ui_MsgWriter a_msgw,
i_HSM_ptr  a_ihsm,
fsc_FileExpiration a_fileExp,
const char  a_clientPathSeparator 
)
fsc_ColectorExpFile::~fsc_ColectorExpFile ( void   ) 

Definition at line 80 of file fsc_ColectorExpFile.cpp.

References FlushPackage(), and log_FUNC_m.

Here is the call graph for this function:


Member Function Documentation

void fsc_ColectorExpFile::FlushPackage (  )  [private]

Definition at line 132 of file fsc_ColectorExpFile.cpp.

References cmn_Num2Str(), dbg_DETAIL, ui_MsgWriter::DisplayMessage(), ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_fileNum, m_files, m_ihsm, m_maxFileNum, m_msgw, and m_packageSize.

Referenced by ProcDirElement(), and ~fsc_ColectorExpFile().

                                       {
    log_FUNC_m(FlushPackage);
    log_DBG_m(dbg_DETAIL, "Package size " << m_packageSize 
                       << ", num of files " << m_fileNum);
    if (m_packageSize) {
        m_files.length(m_fileNum);
        m_msgw.DisplayMessage(
                        "Found " + cmn_Num2Str(m_fileNum) + " expired files.");
        i_Count_t missing = 0;
        ipc_EXEC_m(
            i_Count_t deleted = m_ihsm->DoDeletion(m_files, missing);
            
            ostringstream ostr;
            ostr << "Deleted " << deleted << " files from file system, " 
                << missing << " files not found.";
            m_msgw.DisplayMessage(ostr.str());
            m_fileNum     = 0;
            m_packageSize = 0;
            m_files.length(0);
            m_files.length(m_maxFileNum);
        )
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool fsc_ColectorExpFile::ProcDirElement ( fsc_nsElement_t a_nsElem,
const df_StandardAttr_t a_attr,
const cmn_Path a_path,
const string &  a_name 
) [virtual]

Reimplemented from fsc_RawCollector.

Definition at line 86 of file fsc_ColectorExpFile.cpp.

References cmn_ConvToTime_t(), dbg_DETAIL, i_FileAge_t::expAge, i_FileAge_t::filePath, FlushPackage(), fsc_FileExpiration::GetExpirationAge(), log_DBG_m, log_FUNC_m, m_clientPathSeparator, m_currExpAge, m_currOwnerID, m_fileExp, m_fileNum, m_files, m_maxFileNum, m_maxPackageSize, m_packageSize, m_time, fsc_nsElement_t::ownerIdx, and df_StandardAttr_t::timeModify.

                                                                 {
    log_FUNC_m(ProcDirElement);

    ivd_Time32_t timeModify = cmn_ConvToTime_t(a_attr.timeModify);

    ivd_Time32_t fileAge = m_time - timeModify;
     // optimization, ask for expAge when owner changed
    log_DBG_m(dbg_DETAIL, "m_currOwnerID != a_nsElem.ownerIdx " << m_currOwnerID << " != " << a_nsElem.ownerIdx);
    if (m_currOwnerID != a_nsElem.ownerIdx) {
        m_currExpAge  = m_fileExp.GetExpirationAge(a_path);
        m_currOwnerID = a_nsElem.ownerIdx;
    }
    
    log_DBG_m(dbg_DETAIL, "file path " << a_path << " name " << a_name
                       << " file age " << fileAge 
                       << " exp age " << m_currExpAge);

    if (fileAge > m_currExpAge) {
        // prepare path with client path separator
        
        string filePath(a_path);
        
        if (filePath.length() == 1) { // files on mount point
            filePath += a_name;
        }
        else {
            filePath += m_clientPathSeparator + a_name;
        }
        
        i_FileAge_t &fileAge = m_files[m_fileNum];
        fileAge.filePath = CORBA::string_dup(filePath.c_str());
        fileAge.expAge   = m_currExpAge;
        m_packageSize += filePath.size() + sizeof(fileAge.expAge);
        m_fileNum++;
        if (m_fileNum >= m_maxFileNum
           || m_packageSize > m_maxPackageSize) {
           FlushPackage();
        }
    }
    return true;                                         
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from fsc_RawCollector.

Definition at line 67 of file fsc_ColectorExpFile.h.

Definition at line 74 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 85 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 84 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 70 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 79 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), and ProcDirElement().

Definition at line 72 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), fsc_ColectorExpFile(), and ProcDirElement().

i_HSM_var fsc_ColectorExpFile::m_ihsm [private]

Definition at line 68 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), and fsc_ColectorExpFile().

const int fsc_ColectorExpFile::m_maxFileNum [private]

Definition at line 78 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), fsc_ColectorExpFile(), and ProcDirElement().

Definition at line 81 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 69 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage().

Definition at line 82 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), and ProcDirElement().

Definition at line 76 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().


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