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.


Detailed Description

Definition at line 33 of file fsc_ColectorExpFile.h.


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

Constructor & Destructor Documentation

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

Definition at line 41 of file fsc_ColectorExpFile.cpp.

References ipc_EXEC_m, log_FUNC_m, m_files, m_ihsm, and m_maxFileNum.

00045     : 
00046     m_msgw(a_msgw),
00047     m_fileExp(a_fileExp),
00048     m_clientPathSeparator(a_clientPathSeparator),
00049     m_time(time(NULL)),
00050     m_maxFileNum(fsc_maxFileNum_c),
00051     m_fileNum(0),
00052     m_maxPackageSize(fsc_maxPackageSize_c),
00053     m_packageSize(0),
00054     m_currOwnerID(0),
00055     m_currExpAge(m_fileExp.GetExpirationAge("/")) // get exp Age for root
00056 {
00057     log_FUNC_m(fsc_ColectorExpFile);
00058     
00059     ipc_EXEC_m(
00060         m_ihsm = a_ihsm;
00061     );
00062     m_files.length(m_maxFileNum);
00063 }

fsc_ColectorExpFile::~fsc_ColectorExpFile ( void   ) 

Definition at line 66 of file fsc_ColectorExpFile.cpp.

References FlushPackage(), and log_FUNC_m.

00066                                               {
00067     log_FUNC_m(~fsc_ColectorExpFile);
00068     FlushPackage();
00069 }

Here is the call graph for this function:


Member Function Documentation

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 72 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.

00075                                                                  {
00076     log_FUNC_m(ProcDirElement);
00077 
00078     ivd_Time32_t timeModify = cmn_ConvToTime_t(a_attr.timeModify);
00079 
00080     ivd_Time32_t fileAge = m_time - timeModify;
00081      // optimization, ask for expAge when owner changed
00082     log_DBG_m(dbg_DETAIL, "m_currOwnerID != a_nsElem.ownerIdx " << m_currOwnerID << " != " << a_nsElem.ownerIdx);
00083     if (m_currOwnerID != a_nsElem.ownerIdx) {
00084         m_currExpAge  = m_fileExp.GetExpirationAge(a_path);
00085         m_currOwnerID = a_nsElem.ownerIdx;
00086     }
00087     
00088     log_DBG_m(dbg_DETAIL, "file path " << a_path << " name " << a_name
00089                        << " file age " << fileAge 
00090                        << " exp age " << m_currExpAge);
00091 
00092     if (fileAge > m_currExpAge) {
00093         // prepare path with client path separator
00094         
00095         string filePath(a_path);
00096         
00097         if (filePath.length() == 1) { // files on mount point
00098             filePath += a_name;
00099         }
00100         else {
00101             filePath += m_clientPathSeparator + a_name;
00102         }
00103         
00104         i_FileAge_t &fileAge = m_files[m_fileNum];
00105         fileAge.filePath = CORBA::string_dup(filePath.c_str());
00106         fileAge.expAge   = m_currExpAge;
00107         m_packageSize += filePath.size() + sizeof(fileAge.expAge);
00108         m_fileNum++;
00109         if (m_fileNum >= m_maxFileNum
00110            || m_packageSize > m_maxPackageSize) {
00111            FlushPackage();
00112         }
00113     }
00114     return true;                                         
00115 }

Here is the call graph for this function:

void fsc_ColectorExpFile::FlushPackage (  )  [private]

Definition at line 118 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().

00118                                        {
00119     log_FUNC_m(FlushPackage);
00120     log_DBG_m(dbg_DETAIL, "Package size " << m_packageSize 
00121                        << ", num of files " << m_fileNum);
00122     if (m_packageSize) {
00123         m_files.length(m_fileNum);
00124         m_msgw.DisplayMessage(
00125                         "Found " + cmn_Num2Str(m_fileNum) + " expired files.");
00126         i_Count_t missing = 0;
00127         ipc_EXEC_m(
00128             i_Count_t deleted = m_ihsm->DoDeletion(m_files, missing);
00129             
00130             ostringstream ostr;
00131             ostr << "Deleted " << deleted << " files from file system, " 
00132                 << missing << " files not found.";
00133             m_msgw.DisplayMessage(ostr.str());
00134             m_fileNum     = 0;
00135             m_packageSize = 0;
00136             m_files.length(0);
00137             m_files.length(m_maxFileNum);
00138         )
00139     }
00140 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from fsc_RawCollector.

Definition at line 53 of file fsc_ColectorExpFile.h.

i_HSM_var fsc_ColectorExpFile::m_ihsm [private]

Definition at line 54 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), and fsc_ColectorExpFile().

Definition at line 55 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage().

Definition at line 56 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 58 of file fsc_ColectorExpFile.h.

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

Definition at line 60 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 62 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

const int fsc_ColectorExpFile::m_maxFileNum [private]

Definition at line 64 of file fsc_ColectorExpFile.h.

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

Definition at line 65 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), and ProcDirElement().

Definition at line 67 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 68 of file fsc_ColectorExpFile.h.

Referenced by FlushPackage(), and ProcDirElement().

Definition at line 70 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().

Definition at line 71 of file fsc_ColectorExpFile.h.

Referenced by ProcDirElement().


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

Generated on Mon Feb 27 19:19:05 2012 for OPENARCHIVE by  doxygen 1.5.6