#include <fsc_RawReorgScanDataCollector.h>


Collected data are stored into m_fileLocationData member of ivd_FileLocationData_t structure type. Method ProcRecMedPosMgr() is lief in FSC generation tree hierarchy and when called a complete information about one data location (split) is got. Data location information is stored to particular medium volume storage. Medium volume storage is searched inside m_cache member by using cache element key. If medium volume storage doesn't exist then is generated.
Definition at line 43 of file fsc_RawReorgScanDataCollector.h.
Public Member Functions | |
| fsc_RawReorgScanDataCollector (const string &a_partName, ivd_Time32_t a_expDate, UInt32_t a_numGener) | |
| ~fsc_RawReorgScanDataCollector (void) | |
| virtual bool | ProcFileID (ivd_RecordIDX_t a_fileID) |
| Called when new file in process. | |
| virtual bool | ProcVecGeneration (fsc_Generation_v_t &a_gen_v) |
| Called when all generations are packed in vector. | |
| virtual bool | ProcRecGeneration (fsc_Generation_t &a_gen, UInt32_t a_status) |
| Called for each generation. | |
| virtual bool | ProcRecSplit (fsc_Split_t &a_split) |
| Called when generation or copy has splits. | |
| virtual bool | ProcRecMedPosMgr (fsc_MediaPosition_t &a_medPos) |
| Called when media position is known. | |
| UInt32_t | GetMedPosCounter () |
Public Attributes | |
| log_CLASSID_m | |
Private Member Functions | |
| bool | IsReorgCandidate () |
| UInt64_t | KeyGen (ivd_MediaKey_t a_mediaKey, ivd_MedVolNum_t a_medVolNum) |
| Key to searc element in stx_cache. | |
Private Attributes | |
| const string | m_partName |
| const ivd_MigrationID_t | m_expGen |
| const UInt32_t | m_maxNumOfGen |
| ivd_FileLocationData_t | m_fileLocationData |
| Collected data are stored to this structure. | |
| bool | m_removeGen |
| Set if file is deleted and last data mig is oldest than m_expGener. | |
| UInt32_t | m_fileDataGenCount |
| count only generations that contaion data. | |
| ivd_MigrationID_t | m_migIdOfLastGen |
| ivd_MigrationID_t | m_migIdOfLastDataGen |
| ivd_FileSize_t | m_streamSize |
| stream size stored in generation | |
| UInt8_t | m_dataType |
| each generation set this member | |
| stx_Cache | m_reorgCache |
| MedVolume file storage. | |
| stx_Cache | m_contentCache |
| UInt32_t | m_medPosCounter |
Friends | |
| class | ut_fsc_RawReorgScanDataCollector |
| fsc_RawReorgScanDataCollector::fsc_RawReorgScanDataCollector | ( | const string & | a_partName, | |
| ivd_Time32_t | a_expDate, | |||
| UInt32_t | a_numGener | |||
| ) |
Definition at line 40 of file fsc_RawReorgScanDataCollector.cpp.
References cmn_CleanDir(), dbg_DETAIL, fsc_GetReorgDir(), log_DBG_m, log_FUNC_m, and m_partName.
00043 : 00044 m_partName(a_partName), 00045 m_expGen((ivd_MigrationID_t)a_expDate << 8), 00046 m_maxNumOfGen(a_numGen), 00047 m_removeGen(false), 00048 m_fileDataGenCount(0), 00049 m_migIdOfLastGen(0), 00050 m_migIdOfLastDataGen(0), 00051 m_streamSize(0), 00052 m_dataType(0), 00053 m_reorgCache(1024 * 64), // cache size 00054 m_contentCache(1024 * 64), // cache size 00055 m_medPosCounter(0) 00056 { 00057 log_FUNC_m(fsc_RawReorgScanDataCollector); 00058 cmn_Path reorgDir = fsc_GetReorgDir(m_partName); 00059 log_DBG_m(dbg_DETAIL, "Create dir for reorg scan results : '" << reorgDir << "'"); 00060 cmn_CleanDir(reorgDir); 00061 } //============================================================================//

| fsc_RawReorgScanDataCollector::~fsc_RawReorgScanDataCollector | ( | void | ) | [inline] |
| bool fsc_RawReorgScanDataCollector::ProcFileID | ( | ivd_RecordIDX_t | a_fileID | ) | [virtual] |
Called when new file in process.
Reimplemented from fsc_RawCollector.
Definition at line 64 of file fsc_RawReorgScanDataCollector.cpp.
References dbg_DETAIL, ivd_FileLocationData_t::fileID, log_DBG_m, log_FUNC_m, m_fileDataGenCount, m_fileLocationData, m_migIdOfLastDataGen, m_migIdOfLastGen, and m_removeGen.
00064 { 00065 log_FUNC_m(ProcFileID); 00066 m_fileLocationData.fileID = a_fileID; 00067 log_DBG_m(dbg_DETAIL, "New locData. fileID = " << m_fileLocationData.fileID); 00068 m_fileDataGenCount = 0; 00069 m_migIdOfLastGen = 0; 00070 m_migIdOfLastDataGen = 0; 00071 m_removeGen = false; 00072 return true; 00073 }
| bool fsc_RawReorgScanDataCollector::ProcVecGeneration | ( | fsc_Generation_v_t & | a_gen_v | ) | [virtual] |
Called when all generations are packed in vector.
Definition at line 76 of file fsc_RawReorgScanDataCollector.cpp.
References fsc_NextEntity_t::dataType, dbg_DETAIL, ivd_FileLocationData_t::fileID, ivd_DATA_d, log_DBG_m, log_FUNC_m, fsc_RawCollector::m_curNSNameType, m_expGen, m_fileLocationData, m_removeGen, fsc_Generation_t::migrationID, fsc_Generation_t::nextEntity, and nit_DELETED.
00076 { 00077 log_FUNC_m(ProcVecGeneration); 00078 if (m_curNSNameType == nit_DELETED) { 00079 // check if all generations need to be removed 00080 // Last data generation is older than m_expGen 00081 bool isDir(true); 00082 fsc_Generation_t *ip = &(*a_gen_v.begin()); 00083 fsc_Generation_t *ep = &(*a_gen_v.end()); 00084 fsc_Generation_t *delGenIp = &(*a_gen_v.begin()); 00085 for (; ip < ep; ip++) { 00086 if (ip->nextEntity.dataType & ivd_DATA_d) { // find first generation with data 00087 // Directory generations can't contain data 00088 isDir = false; 00089 if (ip->migrationID < m_expGen) { 00090 m_removeGen = true; 00091 delGenIp = ip; 00092 } 00093 break; 00094 } 00095 } 00096 00097 // If isDir is true then delGenIp points to a_gen_v.begin() 00098 if ( (isDir) && (delGenIp->migrationID < m_expGen) ) { 00099 m_removeGen = true; 00100 } 00101 if (m_removeGen) { 00102 log_DBG_m(dbg_DETAIL, "File with fileID:" << m_fileLocationData.fileID 00103 << " is deleted and its data was migrated before expiration date, so remove it." 00104 << " migID:" << delGenIp->migrationID); 00105 } 00106 } 00107 return true; 00108 }
| bool fsc_RawReorgScanDataCollector::ProcRecGeneration | ( | fsc_Generation_t & | a_gen, | |
| UInt32_t | a_status | |||
| ) | [virtual] |
Called for each generation.
Reimplemented from fsc_RawCollector.
Definition at line 111 of file fsc_RawReorgScanDataCollector.cpp.
References fsc_NextEntity_t::dataType, ivd_DATA_d, m_dataType, m_fileDataGenCount, m_fileLocationData, m_migIdOfLastDataGen, m_migIdOfLastGen, m_streamSize, fsc_Generation_t::migrationID, ivd_FileLocationData_t::migrationID, fsc_Generation_t::nextEntity, fsc_Generation_t::size, and ivd_FileLocationData_t::splitSize.
00112 { 00113 // log_FUNC_m(ProcRecGeneration); 00114 m_fileLocationData.migrationID = a_gen.migrationID; 00115 m_streamSize = m_fileLocationData.splitSize = a_gen.size; 00116 m_dataType = a_gen.nextEntity.dataType; 00117 if (m_migIdOfLastGen == 0) { 00118 m_migIdOfLastGen = a_gen.migrationID; 00119 } 00120 00121 if (m_dataType & ivd_DATA_d) { 00122 m_fileDataGenCount++; 00123 if (m_migIdOfLastDataGen == 0) { 00124 m_migIdOfLastDataGen = a_gen.migrationID; 00125 } 00126 } 00127 return true; 00128 }
| bool fsc_RawReorgScanDataCollector::ProcRecSplit | ( | fsc_Split_t & | a_split | ) | [virtual] |
Called when generation or copy has splits.
Reimplemented from fsc_RawCollector.
Definition at line 131 of file fsc_RawReorgScanDataCollector.cpp.
References fsc_Split_t::dataSize, m_fileLocationData, and ivd_FileLocationData_t::splitSize.
00131 { 00132 // log_FUNC_m(ProcRecSplit); 00133 m_fileLocationData.splitSize = a_split.dataSize; 00134 return true; 00135 }
| bool fsc_RawReorgScanDataCollector::ProcRecMedPosMgr | ( | fsc_MediaPosition_t & | a_medPos | ) | [virtual] |
Called when media position is known.
Reimplemented from fsc_RawCollector.
Definition at line 138 of file fsc_RawReorgScanDataCollector.cpp.
References fsc_MediaPosition_t::blockOffset, ivd_FileLocationData_t::blockOffset, dbg_DETAIL, ivd_FileLocationData_t::fileID, stx_Cache::Get(), stx_Cache::Insert(), IsReorgCandidate(), KeyGen(), log_DBG_m, log_FUNC_m, m_contentCache, m_fileLocationData, m_medPosCounter, m_partName, m_reorgCache, m_streamSize, fsc_MediaPosition_t::mediaKey, fsc_MediaPosition_t::medVolNum, ivd_FileLocationData_t::migrationID, NULL, ivd_FileLocationData_t::splitSize, and fsc_ReorgScanDataVolStorage::Write().
00138 { 00139 log_FUNC_m(ProcRecMedPosMgr); 00140 00141 m_medPosCounter++; 00142 00143 m_fileLocationData.blockOffset = a_medPos.blockOffset; 00144 00145 UInt64_t key = KeyGen(a_medPos.mediaKey, a_medPos.medVolNum); 00146 00147 fsc_ReorgScanReorgVolStorage *reorgVolStor = (fsc_ReorgScanReorgVolStorage*)(m_reorgCache.Get(key)); 00148 if (reorgVolStor == NULL) { 00149 reorgVolStor = new fsc_ReorgScanReorgVolStorage(key, 00150 m_partName, 00151 a_medPos.mediaKey, 00152 a_medPos.medVolNum, 00153 true); 00154 m_reorgCache.Insert(reorgVolStor); 00155 } 00156 00157 fsc_ReorgScanContentVolStorage *contentVolStor = (fsc_ReorgScanContentVolStorage*)(m_contentCache.Get(key)); 00158 if (contentVolStor == NULL) { 00159 contentVolStor = new fsc_ReorgScanContentVolStorage(key, 00160 m_partName, 00161 a_medPos.mediaKey, 00162 a_medPos.medVolNum, 00163 true); 00164 m_contentCache.Insert(contentVolStor); 00165 } 00166 //write all files to content 00167 contentVolStor->Write(&m_fileLocationData); 00168 00169 if (IsReorgCandidate()){ 00170 reorgVolStor->Write(&m_fileLocationData); 00171 } 00172 00173 log_DBG_m(dbg_DETAIL, "Write locData = " 00174 << "\n blockOffset " << m_fileLocationData.blockOffset 00175 << "\n fileID " << m_fileLocationData.fileID 00176 << "\n migrationID " << m_fileLocationData.migrationID 00177 << "\n splitSize " << m_fileLocationData.splitSize); 00178 00179 // set to whole size, that other copies of same generation has splitSize set properlly 00180 m_fileLocationData.splitSize = m_streamSize; 00181 return true; 00182 }

| UInt32_t fsc_RawReorgScanDataCollector::GetMedPosCounter | ( | ) | [inline] |
| bool fsc_RawReorgScanDataCollector::IsReorgCandidate | ( | ) | [inline, private] |
Definition at line 72 of file fsc_RawReorgScanDataCollector.h.
References ivd_DATA_d, m_dataType, m_expGen, m_fileDataGenCount, m_fileLocationData, m_maxNumOfGen, m_migIdOfLastDataGen, m_migIdOfLastGen, m_removeGen, and ivd_FileLocationData_t::migrationID.
Referenced by ProcRecMedPosMgr().
00072 { 00073 return !m_removeGen // not for removed AND 00074 // newest generation is always to reorg 00075 && ( (m_migIdOfLastGen == m_fileLocationData.migrationID) 00076 // newest data generation too 00077 || (m_migIdOfLastDataGen == m_fileLocationData.migrationID) 00078 || ( (m_dataType & ivd_DATA_d) // contain data 00079 && (m_fileLocationData.migrationID >= m_expGen) // and is fresh 00080 && ( (m_maxNumOfGen == 0) // and if max number of gen is defined 00081 || (m_maxNumOfGen >= m_fileDataGenCount) // check amount of newest data gen 00082 ) 00083 ) 00084 ); 00085 };

| UInt64_t fsc_RawReorgScanDataCollector::KeyGen | ( | ivd_MediaKey_t | a_mediaKey, | |
| ivd_MedVolNum_t | a_medVolNum | |||
| ) | [inline, private] |
Key to searc element in stx_cache.
Definition at line 88 of file fsc_RawReorgScanDataCollector.h.
Referenced by ProcRecMedPosMgr().
00089 { 00090 return UInt64_t(a_mediaKey << 8) + a_medVolNum; 00091 };

friend class ut_fsc_RawReorgScanDataCollector [friend] |
Definition at line 44 of file fsc_RawReorgScanDataCollector.h.
const string fsc_RawReorgScanDataCollector::m_partName [private] |
Definition at line 91 of file fsc_RawReorgScanDataCollector.h.
Referenced by fsc_RawReorgScanDataCollector(), and ProcRecMedPosMgr().
const ivd_MigrationID_t fsc_RawReorgScanDataCollector::m_expGen [private] |
Definition at line 95 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), and ProcVecGeneration().
const UInt32_t fsc_RawReorgScanDataCollector::m_maxNumOfGen [private] |
Collected data are stored to this structure.
Definition at line 99 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), ProcFileID(), ProcRecGeneration(), ProcRecMedPosMgr(), ProcRecSplit(), and ProcVecGeneration().
bool fsc_RawReorgScanDataCollector::m_removeGen [private] |
Set if file is deleted and last data mig is oldest than m_expGener.
Definition at line 102 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), ProcFileID(), and ProcVecGeneration().
count only generations that contaion data.
Definition at line 105 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), ProcFileID(), and ProcRecGeneration().
Definition at line 107 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), ProcFileID(), and ProcRecGeneration().
Definition at line 108 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), ProcFileID(), and ProcRecGeneration().
stream size stored in generation
Definition at line 111 of file fsc_RawReorgScanDataCollector.h.
Referenced by ProcRecGeneration(), and ProcRecMedPosMgr().
each generation set this member
Definition at line 114 of file fsc_RawReorgScanDataCollector.h.
Referenced by IsReorgCandidate(), and ProcRecGeneration().
MedVolume file storage.
Definition at line 117 of file fsc_RawReorgScanDataCollector.h.
Referenced by ProcRecMedPosMgr().
1.5.6