#include <fsc_DataL.h>


Definition at line 51 of file fsc_DataL.h.
Public Member Functions | |
| fsc_DataL () | |
| fsc_DataL (df_SplitInfo &a_splitInfo) | |
| fsc_DataL (ivd_RecordIDX_t a_fileID) | |
| ~fsc_DataL () | |
| virtual void | RemoveNotification () |
| write changes to DB before it's removed from cache | |
| fsc_DataL_t * | GetDataLPtr () |
| bool | IsFree () |
| void | Insert (df_SplitInfo &a_splitInfo) |
| Insert a split into Data location tree. | |
| void | Remove (ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum) |
| Remove all entries from particular volume. | |
| bool | Remove (ivd_MediaKey_t a_mediumKey, ivd_MedVolNum_t a_medVolNum, UInt32_t a_blockOffs) |
| Remove one particular entry. | |
| void | WriteToBuff (fsc_DataL_t *a_datal_p) |
| void | GetCopiesPos (ivd_CopiesPos_v_t &a_copiesPos_v, ivd_MigrationID_t &a_migID, ivd_FileSize_t a_fileSize) |
| void | CheckLastGen (string &a_status, i_FSCfileState_t &a_FSCFileState, const i_IvdfsFileInfo_t &a_ivdFSfileInfo, ivd_MigrationID_t &a_migID) |
| void | ReadMembers () |
| void | Dump (ostream &os) |
| bool | TreeWalk (fsc_Collector &a_collector) |
| void | GetFullPath (ivd_MigrationID_t &a_nscMigID, string &a_path) |
Public Attributes | |
| log_CLASSID_m | |
Private Member Functions | |
| void | Write2DB (fio_Transaction &a_trans) |
| Write is called at remove from cache Write2DB method count unused media position records reserved for many copies or splits. | |
Private Attributes | |
| fsc_GenerationMgr * | m_generationMgr_p |
| bool | m_changed |
| ivd_RecordIDX_t | m_fileID |
| fsc_DataL_t | m_dataL |
| fsc_nsElement * | m_nsElement |
Friends | |
| class | fsc_SplitInfoCollector |
| fsc_DataL::fsc_DataL | ( | ) |
Definition at line 39 of file fsc_DataL.cpp.
Referenced by fsc_DataL().
00040 : 00041 stx_CacheEl(0), 00042 m_generationMgr_p(NULL), 00043 m_changed(false), 00044 m_fileID(0), 00045 m_nsElement(NULL) 00046 { 00047 // empty 00048 } //============================================================================//

| fsc_DataL::fsc_DataL | ( | df_SplitInfo & | a_splitInfo | ) |
Definition at line 52 of file fsc_DataL.cpp.
References df_SplitInfo::fileID, df_SplitInfo::fileType, fsc_nsCreateElementObj(), g_updateNSC, giaNEWEST_GEN, ift_DIR, fsc_nsElement::InsertSplit(), m_dataL, m_generationMgr_p, m_nsElement, NULL, and fsc_DataL_t::numOfMigration.
00053 : 00054 stx_CacheEl(a_splitInfo.fileID), 00055 m_generationMgr_p(NULL), 00056 m_changed(false), 00057 m_fileID(a_splitInfo.fileID) 00058 { 00059 // log_FUNC_m(fsc_DataL(df_SplitInfo)); 00060 m_dataL.numOfMigration = 1; // history reasons 00061 //if (a_splitInfo.fileType == ift_DIR) { 00062 // m_dataL.flags = dlfDirectory; 00063 //} 00064 00065 m_generationMgr_p = new fsc_GenerationMgr(a_splitInfo); 00066 00067 if (g_updateNSC) { 00068 m_nsElement = fsc_nsCreateElementObj(a_splitInfo.fileID, 00069 a_splitInfo.fileType == ift_DIR); 00070 m_nsElement->InsertSplit(a_splitInfo, giaNEWEST_GEN); // new gen 00071 } 00072 else { 00073 m_nsElement = NULL; 00074 } 00075 } //============================================================================//

| fsc_DataL::fsc_DataL | ( | ivd_RecordIDX_t | a_fileID | ) |
Definition at line 79 of file fsc_DataL.cpp.
References cmn_HexDump(), dbg_DETAIL, fsc_DataL_t::flags, fsc_DataL(), fsc_DataL_t::generationIdx, log_DBG_m, log_FUNC_m, m_dataL, m_fileID, fsc_DataL_t::numOfAllGen, and fsc_DataL_t::numOfElement.
00080 : 00081 stx_CacheEl(a_fileID), 00082 m_generationMgr_p(NULL), 00083 m_changed(false), 00084 m_fileID(a_fileID), 00085 m_dataL(a_fileID), 00086 m_nsElement(NULL) 00087 { 00088 log_FUNC_m(fsc_DataL(fsc_DataL)); 00089 log_DBG_m(dbg_DETAIL, "R DataL from idx (fileID) = " << m_fileID << endl 00090 << " flags " << hex << (int)m_dataL.flags << dec << endl 00091 << " numOfAllGen " << m_dataL.numOfAllGen << endl 00092 << " numOfElement " << (int)m_dataL.numOfElement << endl 00093 << " generationIdx " << m_dataL.generationIdx << endl 00094 << cmn_HexDump(&m_dataL, sizeof(fsc_DataL_t), sizeof(fsc_DataL_t), false) ); 00095 } //============================================================================//

| fsc_DataL::~fsc_DataL | ( | ) | [inline] |
Definition at line 58 of file fsc_DataL.h.
References fsc_nsRemoveElementObj(), m_generationMgr_p, m_nsElement, and NULL.
00058 { 00059 if (m_generationMgr_p != NULL) { 00060 delete m_generationMgr_p; 00061 } 00062 if (m_nsElement != NULL) { 00063 // todo call fsc_nsRemoveElementObj 00064 fsc_nsRemoveElementObj(m_nsElement); 00065 } 00066 };

| virtual void fsc_DataL::RemoveNotification | ( | ) | [inline, virtual] |
write changes to DB before it's removed from cache
Reimplemented from stx_CacheEl.
Definition at line 70 of file fsc_DataL.h.
References g_fsc_trans_p, and Write2DB().
00070 { 00071 Write2DB(*g_fsc_trans_p); 00072 };

| fsc_DataL_t* fsc_DataL::GetDataLPtr | ( | ) | [inline] |
| bool fsc_DataL::IsFree | ( | ) | [inline] |
Definition at line 90 of file fsc_DataL.h.
References fsc_DataL_t::generationIdx, m_dataL, m_generationMgr_p, and NULL.
Referenced by fsc_DataLMgr::FastInsert().
00090 { return m_dataL.generationIdx == 0 00091 && m_generationMgr_p == NULL; };

| void fsc_DataL::Insert | ( | df_SplitInfo & | a_splitInfo | ) |
Insert a split into Data location tree.
Definition at line 99 of file fsc_DataL.cpp.
References cmn_Global::dbg, dbg_DETAIL, dbg_NORM, df_SplitInfo::Dump(), df_SplitInfo::fileID, df_SplitInfo::fileType, fsc_nsCreateElementObj(), g_cmn, g_updateNSC, fsc_GenerationMgr::GetGenInsertAct(), log_Debugger::GetLevel(), ift_DIR, fsc_GenerationMgr::Insert(), fsc_nsElement::InsertSplit(), log_DBG_m, log_FUNC_m, m_generationMgr_p, m_nsElement, NULL, and ReadMembers().
Referenced by fsc_DataLMgr::FastInsert().
00099 { 00100 log_FUNC_m(Insert); 00101 00102 if (g_cmn.dbg.GetLevel() == dbg_DETAIL) { 00103 log_DBG_m(dbg_DETAIL, a_splitInfo.Dump()); 00104 } 00105 else { 00106 log_DBG_m(dbg_NORM, "InsertSplit FileID = " << a_splitInfo.fileID); 00107 } 00108 00109 ReadMembers(); 00110 if (m_generationMgr_p == NULL) { 00111 m_generationMgr_p = new fsc_GenerationMgr(a_splitInfo); 00112 } 00113 else { 00114 m_generationMgr_p->Insert(a_splitInfo); 00115 } 00116 00117 if (g_updateNSC) { 00118 if (m_nsElement == NULL) { 00119 m_nsElement = fsc_nsCreateElementObj(a_splitInfo.fileID, 00120 a_splitInfo.fileType == ift_DIR); 00121 } 00122 m_nsElement->InsertSplit(a_splitInfo, m_generationMgr_p->GetGenInsertAct()); 00123 } 00124 }


| void fsc_DataL::Remove | ( | ivd_MediaKey_t | a_mediumKey, | |
| ivd_MedVolNum_t | a_medVolNum | |||
| ) |
Remove all entries from particular volume.
Remove entries from particular volume.
Definition at line 128 of file fsc_DataL.cpp.
References fsc_nsCreateElementObj(), log_FUNC_m, m_fileID, m_generationMgr_p, m_nsElement, nse_CREATE_PARENT, NULL, ReadMembers(), and fsc_GenerationMgr::Remove().
Referenced by fsc_DataLMgr::Remove(), and Remove().
00129 { 00130 log_FUNC_m(Remove); 00131 ReadMembers(); 00132 if (m_nsElement == NULL) { 00133 m_nsElement = fsc_nsCreateElementObj(m_fileID, nse_CREATE_PARENT); 00134 } 00135 if (m_generationMgr_p != NULL) { 00136 m_generationMgr_p->Remove(a_mediumKey, a_medVolNum); 00137 } 00138 }


| bool fsc_DataL::Remove | ( | ivd_MediaKey_t | a_mediumKey, | |
| ivd_MedVolNum_t | a_medVolNum, | |||
| UInt32_t | a_blockOffs | |||
| ) |
Remove one particular entry.
Definition at line 141 of file fsc_DataL.cpp.
References fsc_nsCreateElementObj(), log_FUNC_m, m_fileID, m_generationMgr_p, m_nsElement, nse_CREATE_PARENT, NULL, ReadMembers(), fsc_GenerationMgr::Remove(), and Remove().
00143 { 00144 log_FUNC_m(Remove(split)); 00145 00146 ReadMembers(); 00147 if (m_nsElement == NULL) { 00148 m_nsElement = fsc_nsCreateElementObj(m_fileID, nse_CREATE_PARENT); 00149 } 00150 if (m_generationMgr_p != NULL) { 00151 return m_generationMgr_p->Remove(a_mediumKey, a_medVolNum, a_blockOffs); 00152 } 00153 return false; 00154 }

| void fsc_DataL::WriteToBuff | ( | fsc_DataL_t * | a_datal_p | ) | [inline] |
| void fsc_DataL::GetCopiesPos | ( | ivd_CopiesPos_v_t & | a_copiesPos_v, | |
| ivd_MigrationID_t & | a_migID, | |||
| ivd_FileSize_t | a_fileSize | |||
| ) |
Definition at line 157 of file fsc_DataL.cpp.
References dbg_DETAIL, dbg_NORM, evt_ERROR, fsc_nsCreateElementObj(), g_updateNSC, fsc_GenerationMgr::GetCopiesPos(), fsc_nsElement::GetFileSize(), fsc_nsElement::IsDirectory(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), m_fileID, m_generationMgr_p, m_nsElement, NULL, ReadMembers(), and size.
Referenced by fsc_DataLMgr::CheckLastGen(), and fsc_DataLMgr::GetCopiesPos().
00159 { 00160 log_FUNC_m(GetCopiesPos); 00161 00162 ReadMembers(); 00163 if ( a_migID == 0 // get copies from newest generation 00164 && g_updateNSC) { 00165 if (m_nsElement == NULL) { 00166 m_nsElement = fsc_nsCreateElementObj(m_fileID); 00167 } 00168 // check if file Sizematch 00169 ivd_FileSize_t size = m_nsElement->GetFileSize(); 00170 if ( size > 0 // maybe attributes not set yet 00171 && a_fileSize > 0 // not need to check if is 0 00172 && size != a_fileSize) { 00173 string a_type = m_nsElement->IsDirectory()? "Dir" : "File"; 00174 ostringstream sstr; 00175 sstr << "File size for " << a_type 00176 << " item doesn't match. fileID = " << m_fileID 00177 << " HSMFS size = " << a_fileSize 00178 << " NSC size = " << size; 00179 if (m_nsElement->IsDirectory()) { 00180 log_DBG_m(dbg_NORM, sstr.str()); 00181 } 00182 else { 00183 log_ERR_m(sstr.str()); 00184 log_DBG_m(dbg_NORM, sstr.str()); 00185 log_WriteEvent(evt_ERROR, sstr.str()); 00186 return; // no copies possition found 00187 } 00188 } 00189 else { 00190 log_DBG_m(dbg_DETAIL, "FileID = " << m_fileID 00191 << " NSC size = " << size); 00192 } 00193 } 00194 00195 fsc_MigInfo_t migInfo(m_fileID); 00196 if (m_generationMgr_p != NULL) { 00197 m_generationMgr_p->GetCopiesPos(a_copiesPos_v, a_migID, migInfo); 00198 } 00199 }


| void fsc_DataL::CheckLastGen | ( | string & | a_status, | |
| i_FSCfileState_t & | a_FSCFileState, | |||
| const i_IvdfsFileInfo_t & | a_ivdFSfileInfo, | |||
| ivd_MigrationID_t & | a_migID | |||
| ) |
Definition at line 219 of file fsc_DataL.cpp.
References fsc_nsElement::CheckLastGen(), fsc_GenerationMgr::CheckLastGen(), i_IvdfsFileInfo_t::fileID, fsc_nsCreateElementObj(), g_updateNSC, fsc_DataL_t::generationIdx, log_FUNC_m, m_dataL, m_generationMgr_p, m_nsElement, NULL, and ReadMembers().
Referenced by fsc_DataLMgr::CheckLastGen().
00222 { 00223 log_FUNC_m(CheckLastGen); 00224 00225 if (m_dataL.generationIdx == 0) { 00226 a_status += " Missing in FSC.\n"; 00227 } 00228 else { 00229 ReadMembers(); 00230 if (m_generationMgr_p == NULL) { 00231 a_status += " Missing in FSC.\n"; 00232 } 00233 else { 00234 m_generationMgr_p->CheckLastGen(a_status, a_migID); 00235 if (!a_status.empty()) { 00236 return; 00237 } 00238 00239 if (g_updateNSC) { 00240 if (m_nsElement == NULL) { 00241 m_nsElement = fsc_nsCreateElementObj(a_ivdFSfileInfo.fileID); 00242 } 00243 // a_migID is updated by m_generationMgr_p->CheckLastGen() call 00244 m_nsElement->CheckLastGen(a_status, a_FSCFileState, a_ivdFSfileInfo, a_migID); 00245 } 00246 } 00247 } 00248 }


| void fsc_DataL::ReadMembers | ( | ) | [inline] |
Definition at line 118 of file fsc_DataL.h.
References fsc_DataL_t::generationIdx, m_dataL, m_generationMgr_p, and NULL.
Referenced by CheckLastGen(), Dump(), GetCopiesPos(), Insert(), Remove(), and TreeWalk().
00118 { 00119 if ( m_generationMgr_p == NULL 00120 && m_dataL.generationIdx > 0) { 00121 m_generationMgr_p = new fsc_GenerationMgr(m_dataL); 00122 } 00123 };

| void fsc_DataL::Write2DB | ( | fio_Transaction & | a_trans | ) | [private] |
Write is called at remove from cache Write2DB method count unused media position records reserved for many copies or splits.
If nothing is reaserved then DataLMgr could free DataL tree.
Definition at line 252 of file fsc_DataL.cpp.
References g_cmn, g_dataLRF_p, g_fsLog, g_updateNSC, fsc_DataL_t::generationIdx, fsc_nsElement::GetFullPath(), ie_FSC_NONSCELEMENTOBJ, m_changed, m_dataL, m_fileID, m_generationMgr_p, ivd_Product::m_nameShort, m_nsElement, NULL, fsc_DataL_t::numOfElement, path, cmn_Global::prod, fsc_nsElement::Remove(), log_ivdfs::Write(), fsc_nsElement::Write2DB(), fsc_GenerationMgr::Write2DB(), and fio_RelFile::WriteRec().
Referenced by RemoveNotification().
00252 { 00253 // log_FUNC_m(Write2DB); 00254 00255 bool change = m_changed; 00256 if ( m_generationMgr_p != NULL 00257 && m_generationMgr_p->Write2DB(m_dataL, 00258 a_trans)) { 00259 change = true; 00260 if ( m_dataL.generationIdx == 0 00261 && m_dataL.numOfElement == 0) { 00262 string path; 00263 if (g_updateNSC) { 00264 if (m_nsElement == NULL) { 00265 ostringstream sstr; 00266 sstr << "FileID:" << m_fileID << " has no more generations and NSC object is not created." 00267 << " Cannot remove NSC of this file."; 00268 throw ivd_InternalError(ie_FSC_NONSCELEMENTOBJ, sstr.str(), true); 00269 } 00270 // element will be updated below 00271 // but owner will be updatted when no members point to it 00272 m_nsElement->GetFullPath(path); 00273 m_nsElement->Remove(); 00274 } 00275 else { 00276 path = "NSC is not available."; 00277 } 00278 string log_msg = "Deleted from " + g_cmn.prod.m_nameShort + " System by reorganization."; 00279 g_fsLog.Write(m_fileID, 0, path, log_msg.c_str()); 00280 } 00281 } 00282 00283 if (change) { 00284 // log_DBG_m(dbg_DETAIL, "W DataL : idx = " << m_fileID << endl << 00285 // cmn_HexDump(&m_dataL, sizeof(fsc_DataL_t), sizeof(fsc_DataL_t), false) ); 00286 g_dataLRF_p->WriteRec(m_fileID, &m_dataL, 1, &a_trans); 00287 } 00288 if (m_nsElement != NULL) { 00289 m_nsElement->Write2DB(a_trans); 00290 } 00291 00292 m_changed = false; 00293 }


| void fsc_DataL::Dump | ( | ostream & | os | ) |
Definition at line 297 of file fsc_DataL.cpp.
References fsc_nsElement::Dump(), fsc_GenerationMgr::Dump(), fsc_nsCreateElementObj(), fsc_DataL_t::generationIdx, log_FUNC_m, m_dataL, m_fileID, m_generationMgr_p, m_nsElement, NULL, fsc_DataL_t::numOfAllGen, fsc_DataL_t::numOfElement, and ReadMembers().
Referenced by fsc_DataLMgr::DumpTree().
00297 { 00298 log_FUNC_m(Dump); 00299 /* if (m_dataL.flags & dlfDirectory) { 00300 os << " DIR\n"; 00301 } 00302 else { 00303 os << " FILE\n"; 00304 } 00305 */ 00306 os << " Generation idx = " << m_dataL.generationIdx << endl; 00307 // os << " First vec size = " << (int)m_dataL.numOfElement << endl; 00308 os << " Number of all gen = " << m_dataL.numOfAllGen << endl; 00309 00310 ReadMembers(); 00311 if (m_generationMgr_p == NULL) { 00312 os << " No generations for this file. size = " << m_dataL.numOfElement 00313 << " idx = " << m_dataL.generationIdx << endl; 00314 } 00315 else { 00316 m_generationMgr_p->Dump(os); 00317 } 00318 os << " NSC\n"; 00319 if (m_nsElement == NULL) { 00320 m_nsElement = fsc_nsCreateElementObj(m_fileID); 00321 } 00322 m_nsElement->Dump(os); 00323 }


| bool fsc_DataL::TreeWalk | ( | fsc_Collector & | a_collector | ) |
Definition at line 203 of file fsc_DataL.cpp.
References m_generationMgr_p, NULL, fsc_Collector::ProcObjDataL(), ReadMembers(), and fsc_GenerationMgr::TreeWalk().
Referenced by fsc_DataLMgr::GetHistory().
00203 { 00204 // log_FUNC_m(TreeWalk); 00205 00206 ReadMembers(); 00207 00208 if (!a_collector.ProcObjDataL(this)){ 00209 return false; 00210 } 00211 if (m_generationMgr_p != NULL) { 00212 return m_generationMgr_p->TreeWalk(a_collector); 00213 } 00214 return true; 00215 }


| void fsc_DataL::GetFullPath | ( | ivd_MigrationID_t & | a_nscMigID, | |
| string & | a_path | |||
| ) |
Definition at line 326 of file fsc_DataL.cpp.
References fsc_nsCreateElementObj(), fsc_nsElement::GetFullPath(), fsc_nsElement::GetMigID(), m_fileID, m_nsElement, and NULL.
Referenced by fsc_DataLMgr::GetHistory().
00327 { 00328 if (m_nsElement == NULL) { 00329 m_nsElement = fsc_nsCreateElementObj(m_fileID); 00330 } 00331 m_nsElement->GetFullPath(a_path); 00332 a_nscMigID = m_nsElement->GetMigID(); 00333 }


friend class fsc_SplitInfoCollector [friend] |
Definition at line 52 of file fsc_DataL.h.
fsc_GenerationMgr* fsc_DataL::m_generationMgr_p [private] |
Definition at line 72 of file fsc_DataL.h.
Referenced by CheckLastGen(), Dump(), fsc_DataL(), GetCopiesPos(), Insert(), IsFree(), ReadMembers(), Remove(), TreeWalk(), Write2DB(), and ~fsc_DataL().
bool fsc_DataL::m_changed [private] |
ivd_RecordIDX_t fsc_DataL::m_fileID [private] |
Definition at line 78 of file fsc_DataL.h.
Referenced by Dump(), fsc_DataL(), GetCopiesPos(), GetFullPath(), fsc_SplitInfoCollector::ProcObjDataL(), Remove(), and Write2DB().
fsc_DataL_t fsc_DataL::m_dataL [private] |
Definition at line 79 of file fsc_DataL.h.
Referenced by CheckLastGen(), Dump(), fsc_DataL(), GetDataLPtr(), IsFree(), ReadMembers(), and Write2DB().
fsc_nsElement* fsc_DataL::m_nsElement [private] |
Definition at line 82 of file fsc_DataL.h.
Referenced by CheckLastGen(), Dump(), fsc_DataL(), GetCopiesPos(), GetFullPath(), Insert(), Remove(), Write2DB(), and ~fsc_DataL().
1.5.6