#include <fsc_Split.h>


Definition at line 38 of file fsc_Split.h.
Public Member Functions | |
| fsc_Split () | |
| default constructor, all fields are zero and set as changed | |
| fsc_Split (fsc_MedPosMgr *a_medPosMgr_p, df_SplitInfo &a_splitInfo) | |
| If media position has got from some generation or copy should has same size as chunk and offset 0. | |
| fsc_Split (df_SplitInfo &a_splitInfo) | |
| newlly split generated from splitInfo | |
| fsc_Split (const fsc_Split_t &a_split) | |
| split generated from stored record into DB | |
| ~fsc_Split () | |
| bool | 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. | |
| fsc_MedPosMgr & | GetMediaPosMgr () |
| void | GetMediaPos (ivd_MediaPos_t &a_mediaPos) |
| Get all media position from copy. | |
| void | ReadMembers () |
| bool | Write2DB (fsc_Split_t &a_splitData, fio_Transaction &a_trans) |
| invoke next level write2DB and collect data for previous level | |
| bool | HasIntersection (df_SplitInfo &a_splitInfo) |
| Insert to split is actualy update null split instance that is generated by splitMgr when it's obvious that more than one split is used. | |
| bool | HasIntersection (fsc_Split &a_split) |
| bool | SplitsAreOverlaping (ivd_FilePosition_t a_currentSplitOffset, ivd_FileSize_t a_currentSplitSize, ivd_FilePosition_t a_addedSplitOffset, ivd_FileSize_t a_addedSplitSize) |
| bool | HasEqualSplit (df_SplitInfo &a_splitInfo) |
| bool | IsSplitEqual (fsc_Split &a_split) |
| void | Dump (ostream &os) |
| bool | TreeWalk (fsc_Collector &a_collector) |
| bool | IsZeroSizeSplit () |
Public Attributes | |
| ivd_FilePosition_t | m_offset |
| ivd_FileSize_t | m_size |
| ivd_DataType_t | m_dataType |
| all data type that are stored in splits | |
| bool | m_lastSplit |
| log_CLASSID_m | |
Friends | |
| ostream & | operator<< (ostream &a_os, const fsc_Split &a_split) |
| fsc_Split::fsc_Split | ( | ) |
default constructor, all fields are zero and set as changed
Definition at line 36 of file fsc_Split.cpp.
References log_FUNC_m.
Referenced by fsc_Split().
00037 : 00038 fsc_Entry(), 00039 m_offset(0), 00040 m_size(0), 00041 m_dataType(dlc_NotUsed), 00042 m_lastSplit(false) 00043 { 00044 log_FUNC_m(fsc_Split()); 00045 // Empty 00046 }

| fsc_Split::fsc_Split | ( | fsc_MedPosMgr * | a_medPosMgr_p, | |
| df_SplitInfo & | a_splitInfo | |||
| ) |
If media position has got from some generation or copy should has same size as chunk and offset 0.
Definition at line 49 of file fsc_Split.cpp.
References dlc_MediaPos, fsc_Split(), fsc_Entry::InitNextEntry(), and log_FUNC_m.
00052 : 00053 fsc_Entry(), 00054 m_offset(a_splitInfo.splitOffset), 00055 m_size(a_splitInfo.splitSize), 00056 m_dataType(a_splitInfo.dataType), 00057 m_lastSplit(a_splitInfo.lastSplit) 00058 { 00059 log_FUNC_m(fsc_Split(fsc_MedPosMgr, df_SplitInfo)); 00060 00061 fsc_Entry::InitNextEntry(dlc_MediaPos, a_medPosMgr_p); 00062 } //============================================================================//

| fsc_Split::fsc_Split | ( | df_SplitInfo & | a_splitInfo | ) |
newlly split generated from splitInfo
Definition at line 65 of file fsc_Split.cpp.
References dlc_MediaPos, fsc_Split(), fsc_Entry::InitNextEntry(), and log_FUNC_m.
00067 : 00068 fsc_Entry(), 00069 m_offset(a_splitInfo.splitOffset), 00070 m_size(a_splitInfo.splitSize), 00071 m_dataType(a_splitInfo.dataType), 00072 m_lastSplit(a_splitInfo.lastSplit) 00073 { 00074 log_FUNC_m(fsc_Split(df_SplitInfo)); 00075 00076 fsc_Entry::InitNextEntry(dlc_MediaPos, new fsc_MedPosMgr(a_splitInfo)); 00077 } //============================================================================//

| fsc_Split::fsc_Split | ( | const fsc_Split_t & | a_split | ) |
split generated from stored record into DB
Definition at line 80 of file fsc_Split.cpp.
References dlc_MediaPos, fsc_Split(), fsc_Entry::InitNextEntry(), log_FUNC_m, and fsc_Entry::m_nextEntry.
00082 : 00083 fsc_Entry(a_split.nextEntity), 00084 m_offset(a_split.dataOffset), 00085 m_size(a_split.dataSize), 00086 m_dataType(a_split.nextEntity.dataType), 00087 m_lastSplit(false) 00088 { 00089 log_FUNC_m(fsc_Split(fsc_Split_t)); 00090 fsc_Entry::InitNextEntry(dlc_MediaPos, new fsc_MedPosMgr(m_nextEntry)); 00091 } //============================================================================//

| fsc_Split::~fsc_Split | ( | ) |
| bool fsc_Split::Remove | ( | ivd_MediaKey_t | a_mediumKey, | |
| ivd_MedVolNum_t | a_medVolNum | |||
| ) |
remove all entries from particular volume.
Return true if removed.
Definition at line 99 of file fsc_Split.cpp.
References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, and fsc_MedPosMgr::Remove().
Referenced by Remove().
00100 { 00101 log_FUNC_m(Remove); 00102 switch (m_nextEntry.dlcType) { 00103 case dlc_NotUsed : 00104 return false; 00105 break; 00106 00107 case dlc_MediaPos : { 00108 fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00109 return p->Remove(a_mediumKey, a_medVolNum); 00110 } 00111 break; 00112 00113 default: 00114 throw ivd_InternalError(ie_INVALID_ARG, 00115 "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true); 00116 break; 00117 } 00118 }


| bool fsc_Split::Remove | ( | ivd_MediaKey_t | a_mediumKey, | |
| ivd_MedVolNum_t | a_medVolNum, | |||
| UInt32_t | a_blockOffs | |||
| ) |
Remove one particular entry.
Definition at line 121 of file fsc_Split.cpp.
References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, fsc_MedPosMgr::Remove(), and Remove().
00123 { 00124 log_FUNC_m(Remove); 00125 switch (m_nextEntry.dlcType) { 00126 case dlc_NotUsed : 00127 return false; 00128 break; 00129 00130 case dlc_MediaPos : { 00131 fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00132 return p->Remove(a_mediumKey, a_medVolNum, a_blockOffs); 00133 } 00134 break; 00135 00136 default: 00137 throw ivd_InternalError(ie_INVALID_ARG, 00138 "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true); 00139 break; 00140 } 00141 }

| fsc_MedPosMgr& fsc_Split::GetMediaPosMgr | ( | ) | [inline] |
Definition at line 80 of file fsc_Split.h.
References fsc_Entry::m_entryMgr_p.
Referenced by fsc_SplitMgr::AddSplit().
00080 { 00081 return *static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00082 };

| void fsc_Split::GetMediaPos | ( | ivd_MediaPos_t & | a_mediaPos | ) |
Get all media position from copy.
Definition at line 213 of file fsc_Split.cpp.
References cmn_Num2Str(), ivd_MediaPos_t::dataType, dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, fsc_MedPosMgr::GetMediaPos(), ie_INVALID_ARG, log_FUNC_m, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, m_offset, m_size, ivd_MediaPos_t::splitOffset, and ivd_MediaPos_t::splitSize.
Referenced by fsc_SplitMgr::GetMediaPos().
00213 { 00214 log_FUNC_m(GetMediaPos); 00215 00216 // ReadMembers(); 00217 00218 switch (m_nextEntry.dlcType) { 00219 case dlc_NotUsed : 00220 break; 00221 00222 case dlc_MediaPos : { 00223 fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00224 p->GetMediaPos(a_mediaPos); 00225 a_mediaPos.splitOffset = m_offset; 00226 a_mediaPos.splitSize = m_size; 00227 a_mediaPos.dataType = m_dataType; 00228 } 00229 break; 00230 00231 default: 00232 throw ivd_InternalError(ie_INVALID_ARG, 00233 "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true); 00234 break; 00235 } 00236 }


| void fsc_Split::ReadMembers | ( | ) |
| bool fsc_Split::Write2DB | ( | fsc_Split_t & | a_splitData, | |
| fio_Transaction & | a_trans | |||
| ) |
invoke next level write2DB and collect data for previous level
Definition at line 267 of file fsc_Split.cpp.
References cmn_Num2Str(), fsc_Split_t::dataOffset, fsc_Split_t::dataSize, fsc_NextEntity_t::dataType, dbg_DETAIL, dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_DBG_m, log_FUNC_m, fsc_Entry::m_changed, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, m_offset, m_size, fsc_Split_t::nextEntity, NULL, and fsc_MedPosMgr::Write2DB().
Referenced by fsc_SplitMgr::Write2DB().
00268 { 00269 log_FUNC_m(Write2DB); 00270 // log_DBG_m(dbg_DETAIL, "fsc_Split::Write2DB "); 00271 00272 bool vecIdxOrSizeChanged = false; 00273 00274 if (m_entryMgr_p != NULL) { 00275 // log_DBG_m(dbg_DETAIL, " m_entryMgr_p != NULL"); 00276 switch (m_nextEntry.dlcType) { 00277 00278 case dlc_NotUsed : 00279 a_splitData.nextEntity = m_nextEntry; 00280 // memset(&a_splitData, 0, sizeof(fsc_Split_t)); 00281 break; 00282 // Write and check if changed next entryes first 00283 case dlc_MediaPos : { 00284 fsc_MedPosMgr *medPosMgr_p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00285 vecIdxOrSizeChanged = medPosMgr_p->Write2DB(a_splitData.nextEntity); 00286 m_nextEntry = a_splitData.nextEntity; 00287 } 00288 break; 00289 00290 default: 00291 throw ivd_InternalError(ie_INVALID_ARG, 00292 "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true); 00293 break; 00294 } 00295 } 00296 else { // index and size are the same as at construct time 00297 // log_DBG_m(dbg_DETAIL, " m_entryMgr_p == NULL"); 00298 a_splitData.nextEntity = m_nextEntry; 00299 } 00300 // log_DBG_m(dbg_DETAIL, " dlcType = dlc_MediaPos" ); 00301 // a_splitData.nextEntity.Dbg(); 00302 00303 //set data, cause of moving vector. Doesn't mather if was not changed. 00304 a_splitData.dataOffset = m_offset; 00305 a_splitData.dataSize = m_size; 00306 a_splitData.nextEntity.dataType = m_dataType; 00307 00308 // if any data changed than send message that was changed 00309 log_DBG_m(dbg_DETAIL, " vecIdxOrSizeCahnged " << vecIdxOrSizeChanged 00310 << " m_changed " << m_changed); 00311 if ( vecIdxOrSizeChanged 00312 || m_changed) { 00313 00314 m_changed = false; 00315 return true; 00316 } 00317 return false; 00318 }


| bool fsc_Split::HasIntersection | ( | df_SplitInfo & | a_splitInfo | ) |
Insert to split is actualy update null split instance that is generated by splitMgr when it's obvious that more than one split is used.
check if current split has common parts of data within splitInfo
Definition at line 144 of file fsc_Split.cpp.
References log_FUNC_m, m_offset, m_size, df_SplitInfo::splitOffset, SplitsAreOverlaping(), and df_SplitInfo::splitSize.
Referenced by fsc_SplitMgr::AddSplit(), and HasIntersection().
00144 { 00145 log_FUNC_m(HasIntersection(df_SplitInfo)); 00146 00147 return SplitsAreOverlaping(m_offset, 00148 m_size, 00149 a_splitInfo.splitOffset, 00150 a_splitInfo.splitSize); 00151 }


| bool fsc_Split::HasIntersection | ( | fsc_Split & | a_split | ) |
Definition at line 154 of file fsc_Split.cpp.
References HasIntersection(), log_FUNC_m, m_offset, m_size, and SplitsAreOverlaping().
00154 { 00155 log_FUNC_m(HasIntersection(fsc_Split)); 00156 00157 return SplitsAreOverlaping (m_offset, 00158 m_size, 00159 a_split.m_offset, 00160 a_split.m_size); 00161 }

| bool fsc_Split::SplitsAreOverlaping | ( | ivd_FilePosition_t | a_currentSplitOffset, | |
| ivd_FileSize_t | a_currentSplitSize, | |||
| ivd_FilePosition_t | a_addedSplitOffset, | |||
| ivd_FileSize_t | a_addedSplitSize | |||
| ) |
Definition at line 164 of file fsc_Split.cpp.
References dbg_DETAIL, log_DBG_m, and log_FUNC_m.
Referenced by HasIntersection().
00167 { 00168 log_FUNC_m(SplitsAreOverlaping); 00169 00170 log_DBG_m(dbg_DETAIL, "add fsc_Split" 00171 << ", curr split offset: " << a_currentSplitOffset 00172 << ", curr split size: " << a_currentSplitSize 00173 << ", added split offset: " << a_addedSplitOffset 00174 << ", added split size: " << a_addedSplitSize); 00175 00176 bool intersect(true); 00177 /* 00178 It is much easier to find area where splits are not intersected 00179 and then just to invert results to find if they are intersected 00180 */ 00181 if ( (a_currentSplitOffset <= a_addedSplitOffset) 00182 && (a_currentSplitOffset + a_currentSplitSize <= a_addedSplitOffset) ) { 00183 intersect = false; 00184 } 00185 else if ( (a_currentSplitOffset >= a_addedSplitOffset + a_addedSplitSize) 00186 && (a_currentSplitOffset + a_currentSplitSize >= a_addedSplitOffset + a_addedSplitSize) ) { 00187 intersect = false; 00188 } 00189 00190 return intersect; 00191 }

| bool fsc_Split::HasEqualSplit | ( | df_SplitInfo & | a_splitInfo | ) |
Definition at line 194 of file fsc_Split.cpp.
References df_SplitInfo::blockOffset, fsc_MediaPosition_t::blockOffset, fsc_NextEntity_t::GetMedPos(), log_FUNC_m, fsc_Entry::m_nextEntry, df_SplitInfo::mediaKey, fsc_MediaPosition_t::mediaKey, df_SplitInfo::medVolNum, and fsc_MediaPosition_t::medVolNum.
00194 { 00195 log_FUNC_m(HasEqualSplit); 00196 00197 fsc_MediaPosition_t &mediaPosition = m_nextEntry.GetMedPos(); 00198 return ( mediaPosition.mediaKey == a_splitInfo.mediaKey 00199 && mediaPosition.medVolNum == a_splitInfo.medVolNum 00200 && mediaPosition.blockOffset == a_splitInfo.blockOffset); 00201 }

| bool fsc_Split::IsSplitEqual | ( | fsc_Split & | a_split | ) |
Definition at line 204 of file fsc_Split.cpp.
References fsc_MedPosMgr::IsItEqual(), and fsc_Entry::m_entryMgr_p.
Referenced by fsc_SplitMgr::AddSplit().
00204 { 00205 fsc_MedPosMgr *medPosMgr_p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00206 return medPosMgr_p->IsItEqual(*static_cast<fsc_MedPosMgr*>(a_split.m_entryMgr_p)); 00207 // fix bug 992 00208 // a_split.m_nextEntry.mediaPosition is not set if is constructted by SplitInfo???? 00209 // return m_nextEntry.mediaPosition == a_split.m_nextEntry.mediaPosition; 00210 }


| void fsc_Split::Dump | ( | ostream & | os | ) |
Definition at line 321 of file fsc_Split.cpp.
References cmn_GetMigFlags(), dlc_MediaPos, fsc_NextEntity_t::dlcType, fsc_MedPosMgr::Dump(), log_FUNC_m, m_dataType, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, m_offset, and m_size.
Referenced by fsc_Copy::AddSplit(), and fsc_SplitMgr::Dump().
00321 { 00322 log_FUNC_m(Dump); 00323 00324 // ReadMembers(); 00325 00326 os << " Split offset " << m_offset << endl; 00327 os << " Split size " << m_size << endl; 00328 os << " Data type " << hex << m_dataType << dec << " " 00329 << cmn_GetMigFlags(m_dataType) << endl; 00330 00331 switch (m_nextEntry.dlcType) { 00332 00333 case dlc_MediaPos : { 00334 fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00335 p->Dump(os); 00336 } 00337 break; 00338 00339 default: 00340 os << " Wrong dlcType " << (int)m_nextEntry.dlcType << endl; 00341 break; 00342 } 00343 }


| bool fsc_Split::TreeWalk | ( | fsc_Collector & | a_collector | ) |
Definition at line 239 of file fsc_Split.cpp.
References cmn_Num2Str(), dlc_MediaPos, dlc_NotUsed, fsc_NextEntity_t::dlcType, ie_INVALID_ARG, log_FUNC_m, fsc_Entry::m_entryMgr_p, fsc_Entry::m_nextEntry, fsc_Collector::ProcObjSplit(), and fsc_MedPosMgr::TreeWalk().
00239 { 00240 log_FUNC_m(TreeWalk); 00241 00242 // ReadMembers(); 00243 00244 if (!a_collector.ProcObjSplit(this)){ 00245 return false; 00246 } 00247 switch (m_nextEntry.dlcType) { 00248 case dlc_NotUsed : 00249 break; 00250 00251 case dlc_MediaPos : { 00252 a_collector.ProcObjSplit(this); 00253 fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(m_entryMgr_p); 00254 return p->TreeWalk(a_collector); 00255 } 00256 break; 00257 00258 default: 00259 throw ivd_InternalError(ie_INVALID_ARG, 00260 "Wrong dlcType =" + cmn_Num2Str((int)m_nextEntry.dlcType), true); 00261 break; 00262 } 00263 return true; 00264 }

| bool fsc_Split::IsZeroSizeSplit | ( | ) |
Definition at line 371 of file fsc_Split.cpp.
References dbg_DETAIL, ivd_ALTDATA_d, log_DBG_m, log_FUNC_m, m_dataType, m_offset, and m_size.
Referenced by fsc_SplitMgr::AddSplit(), and fsc_VolumeCheck::Check().
00371 { 00372 log_FUNC_m(IsZeroSizeSplit); 00373 00374 if ( (m_size == 0) && (m_offset > 0) ) { 00375 log_DBG_m(dbg_DETAIL, "Zero size split."); 00376 if (!(m_dataType & ivd_ALTDATA_d)) { 00377 log_DBG_m(dbg_DETAIL, "Zero size split is not ADS. FSC should not be updated."); 00378 return true; 00379 } 00380 } 00381 return false; 00382 }

| ostream& operator<< | ( | ostream & | a_os, | |
| const fsc_Split & | a_split | |||
| ) | [friend] |
Definition at line 346 of file fsc_Split.cpp.
00346 { 00347 // log_FUNC_m(Dump); 00348 00349 a_os << " Split offset " << a_split.m_offset << endl; 00350 a_os << " Split size " << a_split.m_size << endl; 00351 a_os << " Data type " << hex << a_split.m_dataType << dec << " " 00352 << cmn_GetMigFlags(a_split.m_dataType) << endl; 00353 00354 switch (a_split.m_nextEntry.dlcType) { 00355 00356 case dlc_MediaPos : { 00357 fsc_MedPosMgr* p = static_cast<fsc_MedPosMgr*>(a_split.m_entryMgr_p); 00358 p->Dump(a_os); 00359 } 00360 break; 00361 00362 default: 00363 a_os << " Wrong dlcType " << (int)a_split.m_nextEntry.dlcType << endl; 00364 break; 00365 } 00366 00367 return a_os; 00368 }
Definition at line 59 of file fsc_Split.h.
Referenced by fsc_SplitMgr::AddSplit(), Dump(), fsc_Copy::fsc_Copy(), fsc_SplitMgr::GetMediaPos(), GetMediaPos(), HasIntersection(), IsZeroSizeSplit(), operator<<(), fsc_SplitInfoCollector::ProcObjSplit(), and Write2DB().
Definition at line 60 of file fsc_Split.h.
Referenced by fsc_SplitMgr::AddSplit(), Dump(), fsc_SplitMgr::GetMediaPos(), GetMediaPos(), HasIntersection(), IsZeroSizeSplit(), operator<<(), fsc_SplitInfoCollector::ProcObjSplit(), and Write2DB().
all data type that are stored in splits
Definition at line 63 of file fsc_Split.h.
Referenced by fsc_Copy::AddSplit(), Dump(), fsc_SplitMgr::GetMediaPos(), GetMediaPos(), IsZeroSizeSplit(), operator<<(), fsc_SplitInfoCollector::ProcObjSplit(), and Write2DB().
1.5.6