#include <hsm_FHcache.h>


NOTE It is not tread safe by itself, but each FH that need to be managed throught cache must be locked by inode.
Definition at line 80 of file hsm_FHcache.h.
Public Member Functions | |
| hsm_FHcache (UInt32_t a_hashSize) | |
| Constructor for creating a vector (STK container) of size a_hashSize. | |
| virtual | ~hsm_FHcache () |
| UInt32_t | HashFunc (UInt32_t a_inode) |
| void | Insert (hsm_FileHeader *a_FileHObj) |
| void | InsertDirWithTest (hsm_FileHeader **a_FileHObj) |
| If Dir FH that is going to be inserted is already in cache than cache delete it and update pointer to FH that point to FH known by cache. | |
| void | Remove (hsm_FileHeader *a_FileHObj) |
| bool | RemoveLastButOne (hsm_FileHeader *a_FileHObj) |
| remove if only one reference stay | |
| hsm_FileHeader * | GetFH (ivd_GenInode_t a_generalInode) |
Public Attributes | |
| log_CLASSID_m | |
Private Attributes | |
| const UInt32_t | m_hashSize |
| hsm_FHcache::hsm_FHcache | ( | UInt32_t | a_hashSize | ) |
Constructor for creating a vector (STK container) of size a_hashSize.
| a_hashSize | number opf elements, which vector should take |
Definition at line 180 of file hsm_FHcache.cpp.
References dbg_DETAIL, log_DBG_m, log_FUNC_m, and m_hashSize.
00181 : 00182 m_hashSize(a_hashSize) 00183 { 00184 log_FUNC_m(hsm_FHcache); 00185 resize(m_hashSize); 00186 // prepare all FH pointer vector managers 00187 for (hsm_FHpVM_p_i iter = begin(); iter != end(); iter++) { 00188 *iter = new hsm_FHpVecMgr; 00189 } 00190 log_DBG_m(dbg_DETAIL, ">>Cache List with " << m_hashSize << " elements IS_CREATED."); 00191 } //============================================================================//
| hsm_FHcache::~hsm_FHcache | ( | ) | [virtual] |
Definition at line 195 of file hsm_FHcache.cpp.
References dbg_LOW, log_DBG_m, log_FUNC_m, and NULL.
00195 { 00196 00197 log_FUNC_m(~hsm_FHcache); 00198 log_DBG_m(dbg_LOW, " ~hsm_FHcache: delete its elements"); 00199 for (hsm_FHpVM_p_i iter = begin(); iter != end(); iter++) { 00200 if (*iter != NULL) { 00201 delete *iter; 00202 } 00203 } 00204 }
Definition at line 92 of file hsm_FHcache.h.
References m_hashSize.
Referenced by GetFH(), Insert(), InsertDirWithTest(), Remove(), and RemoveLastButOne().
00092 { 00093 return (a_inode % m_hashSize); 00094 };

| void hsm_FHcache::Insert | ( | hsm_FileHeader * | a_FileHObj | ) |
Definition at line 208 of file hsm_FHcache.cpp.
References hsm_FileHeader::GetShortInode(), and HashFunc().
Referenced by hsm_ActiveFH::ActiveToList(), fs_api::AddGenericEvent(), fs_api::EventDataOffline(), fs_api::EventDelete(), fs_api::EventMove(), hsmGetFH(), and hsm_ActiveFH::OrphanedToMigList().
00208 { 00209 operator[](HashFunc(a_FileHObj->GetShortInode()))->Insert(a_FileHObj); 00210 }


| void hsm_FHcache::InsertDirWithTest | ( | hsm_FileHeader ** | a_FileHObj | ) |
If Dir FH that is going to be inserted is already in cache than cache delete it and update pointer to FH that point to FH known by cache.
Definition at line 214 of file hsm_FHcache.cpp.
References HashFunc().
Referenced by fs_api::GetDirFH(), and hsmGetDirFH().
00214 { 00215 operator[](HashFunc((*a_FileHObj)->GetShortInode()))->InsertDirWithTest(a_FileHObj); 00216 }


| void hsm_FHcache::Remove | ( | hsm_FileHeader * | a_FileHObj | ) |
Definition at line 220 of file hsm_FHcache.cpp.
References hsm_FileHeader::GetShortInode(), and HashFunc().
Referenced by fs_api::AddGenericEvent(), and hsm_FileHeader::Event().
00220 { 00221 operator[](HashFunc(a_FileHObj->GetShortInode()))->Remove(a_FileHObj); 00222 }


| bool hsm_FHcache::RemoveLastButOne | ( | hsm_FileHeader * | a_FileHObj | ) |
remove if only one reference stay
Definition at line 226 of file hsm_FHcache.cpp.
References hsm_FileHeader::GetShortInode(), and HashFunc().
Referenced by hsm_FileHeader::CompleteMigIsDone(), hsm_FileHeader::EventOffline(), hsm_FileHeader::Recalled(), and hsm_DirWaitList::TaskTime().
00226 { 00227 return operator[](HashFunc(a_FileHObj->GetShortInode()))->RemoveLastButOne(a_FileHObj); 00228 }


| hsm_FileHeader * hsm_FHcache::GetFH | ( | ivd_GenInode_t | a_generalInode | ) |
Definition at line 232 of file hsm_FHcache.cpp.
References HashFunc(), and IVD_FILE_INO.
Referenced by hsm_ActiveFH::ActiveToList(), TreeWalk::CheckDir(), fs_api::FindAndPrepareFH(), fs_api::GetDirFH(), hsmGetDirFH(), hsmGetFH(), hsm_ActiveFH::OrphanedToMigList(), and hsm_FHrelc::Truncate().
00232 { 00233 return operator[](HashFunc(IVD_FILE_INO(a_generalInode)))->GetFH(a_generalInode); 00234 }


const UInt32_t hsm_FHcache::m_hashSize [private] |
Definition at line 89 of file hsm_FHcache.h.
1.5.6