Index: src/libchcore/TBasePathData.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -71,122 +71,92 @@ ////////////////////////////////////////////////////////////////////////////// // TBasePathDataContainer -TBasePathDataContainer::TBasePathDataContainer(const TModPathContainer& tBasePaths) : - m_tBasePaths(tBasePaths) +TBasePathDataContainer::TBasePathDataContainer() { } TBasePathDataContainer::~TBasePathDataContainer() { + // clear works with critical section to avoid destruction while item in use Clear(); } -TBasePathDataPtr TBasePathDataContainer::GetAt(size_t stPos) const +bool TBasePathDataContainer::Exists(size_t stObjectID) const { boost::shared_lock lock(m_lock); - - if(stPos >= m_vEntries.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); - return m_vEntries.at(stPos); + bool bResult = m_mapEntries.find(stObjectID) != m_mapEntries.end(); + return bResult; } -void TBasePathDataContainer::SetAt(size_t stIndex, const TBasePathDataPtr& spEntry) +TBasePathDataPtr TBasePathDataContainer::GetExisting(size_t stObjectID) const { - if(!spEntry) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); - - boost::unique_lock lock(m_lock); + boost::shared_lock lock(m_lock); - if(stIndex >= m_vEntries.size()) + MapEntries::const_iterator iter = m_mapEntries.find(stObjectID); + if(iter == m_mapEntries.end()) THROW_CORE_EXCEPTION(eErr_BoundsExceeded); - - m_vEntries[stIndex] = spEntry; + + return iter->second; } -void TBasePathDataContainer::Add(const TBasePathDataPtr& spEntry) +chcore::TBasePathDataPtr TBasePathDataContainer::Get(size_t stObjectID) { - boost::unique_lock lock(m_lock); - m_vEntries.push_back(spEntry); + boost::upgrade_lock lock(m_lock); + + MapEntries::iterator iter = m_mapEntries.find(stObjectID); + if(iter == m_mapEntries.end()) + { + boost::upgrade_to_unique_lock upgraded_lock(lock); + iter = m_mapEntries.insert(std::make_pair(stObjectID, TBasePathDataPtr(new TBasePathData))).first; + } + + return iter->second; } -void TBasePathDataContainer::RemoveAt(size_t nIndex, size_t nCount) +void TBasePathDataContainer::Remove(size_t stObjectID) { boost::unique_lock lock(m_lock); - m_vEntries.erase(m_vEntries.begin() + nIndex, m_vEntries.begin() + nIndex + nCount); + m_mapEntries.erase(stObjectID); } void TBasePathDataContainer::Clear() { boost::unique_lock lock(m_lock); - m_vEntries.clear(); + m_mapEntries.clear(); } -void TBasePathDataContainer::SetCount(size_t stCount) +bool TBasePathDataContainer::GetSkipFurtherProcessing(size_t stObjectID) const { - boost::unique_lock lock(m_lock); - if(stCount > m_vEntries.size()) - { - size_t stCountToAdd = stCount - m_vEntries.size(); - while(stCountToAdd--) - { - TBasePathDataPtr spData(new TBasePathData); - m_vEntries.push_back(spData); - } - } + boost::shared_lock lock(m_lock); + + MapEntries::const_iterator iter = m_mapEntries.find(stObjectID); + if(iter == m_mapEntries.end()) + return false; + + return iter->second->GetSkipFurtherProcessing(); } -size_t TBasePathDataContainer::GetCount() const +chcore::TSmartPath TBasePathDataContainer::GetDestinationPath(size_t stObjectID) const { boost::shared_lock lock(m_lock); - return m_vEntries.size(); -} -void TBasePathDataContainer::Serialize(TReadBinarySerializer& rSerializer, bool bData) -{ - using Serializers::Serialize; + MapEntries::const_iterator iter = m_mapEntries.find(stObjectID); + if(iter == m_mapEntries.end()) + return TSmartPath(); - size_t stCount; - Serialize(rSerializer, stCount); - - boost::unique_lock lock(m_lock); - - if(!bData && m_vEntries.size() != stCount) - THROW_CORE_EXCEPTION(eErr_InternalProblem); - - if(bData) - { - m_vEntries.clear(); - m_vEntries.reserve(stCount); - } - - TBasePathDataPtr spEntry; - for(size_t stIndex = 0; stIndex < stCount; ++stIndex) - { - if(bData) - spEntry.reset(new TBasePathData); - else - spEntry = m_vEntries.at(stIndex); - spEntry->Serialize(rSerializer, bData); - - if(bData) - m_vEntries.push_back(spEntry); - } + return iter->second->GetDestinationPath(); } -void TBasePathDataContainer::Serialize(TWriteBinarySerializer& rSerializer, bool bData) +bool TBasePathDataContainer::IsDestinationPathSet(size_t stObjectID) const { - using Serializers::Serialize; - boost::shared_lock lock(m_lock); - // write data - size_t stCount = m_vEntries.size(); - Serialize(rSerializer, stCount); - BOOST_FOREACH(const TBasePathDataPtr& spEntry, m_vEntries) - { - spEntry->Serialize(rSerializer, bData); - } + MapEntries::const_iterator iter = m_mapEntries.find(stObjectID); + if(iter == m_mapEntries.end()) + return false; + + return iter->second->IsDestinationPathSet(); } END_CHCORE_NAMESPACE Index: src/libchcore/TBasePathData.h =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -61,35 +61,31 @@ { public: // constructors/destructor - explicit TBasePathDataContainer(const TModPathContainer& tBasePaths); + TBasePathDataContainer(); ~TBasePathDataContainer(); // standard access to data - TBasePathDataPtr GetAt(size_t iPos) const; + bool Exists(size_t stObjectID) const; + TBasePathDataPtr GetExisting(size_t stObjectID) const; + TBasePathDataPtr Get(size_t stObjectID); - void SetCount(size_t stCount); - size_t GetCount() const; - void Add(const TBasePathDataPtr& pEntry); - void SetAt(size_t nIndex, const TBasePathDataPtr& pEntry); - void RemoveAt(size_t nIndex, size_t nCount = 1); + void Remove(size_t stObjectID); void Clear(); - const TModPathContainer& GetBasePaths() const { return m_tBasePaths; } + // inner object read interface (to not create new inner objects when reading non-existent data) + bool GetSkipFurtherProcessing(size_t stObjectID) const; + TSmartPath GetDestinationPath(size_t stObjectID) const; + bool IsDestinationPathSet(size_t stObjectID) const; - // serialization - void Serialize(TReadBinarySerializer& rSerializer, bool bData); - void Serialize(TWriteBinarySerializer& rSerializer, bool bData); - private: TBasePathDataContainer(const TBasePathDataContainer& rSrc); TBasePathDataContainer& operator=(const TBasePathDataContainer& rSrc); protected: - const TModPathContainer& m_tBasePaths; - #pragma warning(push) #pragma warning(disable: 4251) - std::vector m_vEntries; + typedef std::map MapEntries; + MapEntries m_mapEntries; mutable boost::shared_mutex m_lock; #pragma warning(pop) }; Index: src/libchcore/TFileInfo.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -163,4 +163,11 @@ Serialize(rSerializer, m_uiFlags); } +size_t TFileInfo::GetSrcObjectID() const +{ + if(m_pBasePaths) + return m_pBasePaths->GetOidAt(m_stSrcIndex); + return std::numeric_limits::max(); +} + END_CHCORE_NAMESPACE Index: src/libchcore/TFileInfo.h =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -86,6 +86,8 @@ void SetSrcIndex(size_t stIndex) { m_stSrcIndex = stIndex; }; size_t GetSrcIndex() const { return m_stSrcIndex; }; + size_t GetSrcObjectID() const; + // operators bool operator==(const TFileInfo& rInfo); Index: src/libchcore/TModPathContainer.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -138,6 +138,15 @@ return iter->second.Value(); } +size_t TModPathContainer::GetOidAt(size_t stIndex) const +{ + if(stIndex > m_vPaths.size()) + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + + DataMap::const_iterator iter = m_vPaths.begin() + stIndex; + return iter->first; +} + // ============================================================================ /// chcore::TModPathContainer::SetAt /// @date 2009/11/30 Index: src/libchcore/TModPathContainer.h =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TModPathContainer.h (.../TModPathContainer.h) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TModPathContainer.h (.../TModPathContainer.h) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -42,6 +42,7 @@ const TSmartPath& GetAt(size_t stIndex) const; TSmartPath& GetAt(size_t stIndex); + size_t GetOidAt(size_t stIndex) const; void SetAt(size_t stIndex, const TSmartPath& spPath); Index: src/libchcore/TSubTaskBase.cpp =================================================================== diff -u -r9ba9390b8f79c7a3fd1f9d6d9e92038d92222621 -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision 9ba9390b8f79c7a3fd1f9d6d9e92038d92222621) +++ src/libchcore/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -45,9 +45,9 @@ { } -TSmartPath TSubTaskBase::CalculateDestinationPath(const TFileInfoPtr& spFileInfo, TSmartPath pathDst, int iFlags) const +TSmartPath TSubTaskBase::CalculateDestinationPath(const TFileInfoPtr& spFileInfo, TSmartPath pathDst, int iFlags) { - const TBasePathDataContainer& rSourcePathsInfo = GetContext().GetBasePathDataContainer(); + TBasePathDataContainer& rSourcePathsInfo = GetContext().GetBasePathDataContainer(); if(!spFileInfo) THROW_CORE_EXCEPTION(eErr_InvalidArgument); @@ -65,24 +65,25 @@ } else { - size_t stSrcIndex = spFileInfo->GetSrcIndex(); + size_t stSrcObjectID = spFileInfo->GetSrcObjectID(); - if(!(iFlags & 0x01) && stSrcIndex != std::numeric_limits::max()) + if(!(iFlags & 0x01) && stSrcObjectID != std::numeric_limits::max()) { // generate new dest name - if(!rSourcePathsInfo.GetAt(stSrcIndex)->IsDestinationPathSet()) + TBasePathDataPtr spPathData = rSourcePathsInfo.Get(stSrcObjectID); + if(!spPathData->IsDestinationPathSet()) { // generate something - if dest folder == src folder - search for copy if(pathDst == spFileInfo->GetFullFilePath().GetFileRoot()) { TSmartPath pathSubst = FindFreeSubstituteName(spFileInfo->GetFullFilePath(), pathDst); - rSourcePathsInfo.GetAt(stSrcIndex)->SetDestinationPath(pathSubst); + spPathData->SetDestinationPath(pathSubst); } else - rSourcePathsInfo.GetAt(stSrcIndex)->SetDestinationPath(spFileInfo->GetFullFilePath().GetFileName()); + spPathData->SetDestinationPath(spFileInfo->GetFullFilePath().GetFileName()); } - return pathDst + rSourcePathsInfo.GetAt(stSrcIndex)->GetDestinationPath() + spFileInfo->GetFilePath(); + return pathDst + spPathData->GetDestinationPath() + spFileInfo->GetFilePath(); } else return pathDst + spFileInfo->GetFullFilePath().GetFileName(); Index: src/libchcore/TSubTaskBase.h =================================================================== diff -u -ra5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8 -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskBase.h (.../TSubTaskBase.h) (revision a5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8) +++ src/libchcore/TSubTaskBase.h (.../TSubTaskBase.h) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -80,7 +80,7 @@ TSubTaskContext& GetContext() { return m_rContext; } const TSubTaskContext& GetContext() const { return m_rContext; } - TSmartPath CalculateDestinationPath(const TFileInfoPtr& spFileInfo, TSmartPath pathDst, int iFlags) const; + TSmartPath CalculateDestinationPath(const TFileInfoPtr& spFileInfo, TSmartPath pathDst, int iFlags); TSmartPath FindFreeSubstituteName(TSmartPath pathSrcPath, TSmartPath pathDstPath) const; private: Index: src/libchcore/TSubTaskContext.cpp =================================================================== diff -u -r458af7bf8c35950fdeb4b906950437596324aea1 -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision 458af7bf8c35950fdeb4b906950437596324aea1) +++ src/libchcore/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -27,12 +27,13 @@ BEGIN_CHCORE_NAMESPACE -TSubTaskContext::TSubTaskContext(TConfig& rConfig, +TSubTaskContext::TSubTaskContext(TConfig& rConfig, TModPathContainer& rBasePaths, TBasePathDataContainer& rBasePathDataContainer, TFileInfoArray& rFilesCache, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, const IFeedbackHandlerPtr& spFeedbackHandler, TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal) : m_rConfig(rConfig), m_eOperationType(eOperation_None), + m_rBasePaths(rBasePaths), m_rBasePathDataContainer(rBasePathDataContainer), m_rFilesCache(rFilesCache), m_pathDestination(), @@ -146,4 +147,14 @@ return m_rfsLocal; } +TModPathContainer& TSubTaskContext::GetBasePaths() +{ + return m_rBasePaths; +} + +const TModPathContainer& TSubTaskContext::GetBasePaths() const +{ + return m_rBasePaths; +} + END_CHCORE_NAMESPACE Index: src/libchcore/TSubTaskContext.h =================================================================== diff -u -r458af7bf8c35950fdeb4b906950437596324aea1 -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision 458af7bf8c35950fdeb4b906950437596324aea1) +++ src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -36,6 +36,7 @@ BEGIN_CHCORE_NAMESPACE class TWorkerThreadController; +class TModPathContainer; class TBasePathDataContainer; class TTaskConfigTracker; class TLocalFilesystem; @@ -50,7 +51,7 @@ class LIBCHCORE_API TSubTaskContext { public: - TSubTaskContext(TConfig& rConfig, + TSubTaskContext(TConfig& rConfig, TModPathContainer& rBasePaths, TBasePathDataContainer& rBasePathDataContainer, TFileInfoArray& rFilesCache, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, const IFeedbackHandlerPtr& spFeedbackHandler, TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal); @@ -65,6 +66,9 @@ TBasePathDataContainer& GetBasePathDataContainer(); const TBasePathDataContainer& GetBasePathDataContainer() const; + TModPathContainer& GetBasePaths(); + const TModPathContainer& GetBasePaths() const; + TFileInfoArray& GetFilesCache(); const TFileInfoArray& GetFilesCache() const; @@ -95,6 +99,7 @@ EOperationType m_eOperationType; // information about input paths + TModPathContainer& m_rBasePaths; TBasePathDataContainer& m_rBasePathDataContainer; // data on which to operate Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -1230,7 +1230,7 @@ IFeedbackHandlerPtr spFeedbackHandler = GetContext().GetFeedbackHandler(); TLocalFilesystem& rLocalFilesystem = GetContext().GetLocalFilesystem(); TFileInfoArray& rFilesCache = GetContext().GetFilesCache(); - const TModPathContainer& rSrcPaths = GetContext().GetBasePathDataContainer().GetBasePaths(); + const TModPathContainer& rSrcPaths = GetContext().GetBasePaths(); TSmartPath pathDestination = GetContext().GetDestinationPath(); ull_t ullNeededSize = 0, ullAvailableSize = 0; Index: src/libchcore/TSubTaskFastMove.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -118,14 +118,15 @@ IFeedbackHandlerPtr spFeedbackHandler = GetContext().GetFeedbackHandler(); TWorkerThreadController& rThreadController = GetContext().GetThreadController(); TBasePathDataContainer& rBasePathDataContainer = GetContext().GetBasePathDataContainer(); + TModPathContainer& rBasePaths = GetContext().GetBasePaths(); const TConfig& rConfig = GetContext().GetConfig(); TSmartPath pathDestination = GetContext().GetDestinationPath(); rLog.logi(_T("Performing initial fast-move operation...")); // new stats m_tSubTaskStats.SetCurrentBufferIndex(TBufferSizes::eBuffer_Default); - m_tSubTaskStats.SetTotalCount(rBasePathDataContainer.GetBasePaths().GetCount()); + m_tSubTaskStats.SetTotalCount(rBasePaths.GetCount()); m_tSubTaskStats.SetProcessedCount(0); m_tSubTaskStats.SetTotalSize(0); m_tSubTaskStats.SetProcessedSize(0); @@ -148,12 +149,14 @@ bool bRetry = true; bool bSkipInputPath = false; - size_t stSize = rBasePathDataContainer.GetBasePaths().GetCount(); + size_t stSize = rBasePaths.GetCount(); size_t stIndex = m_tProgressInfo.GetCurrentIndex(); for(; stIndex < stSize ; stIndex++) { - TSmartPath pathCurrent = rBasePathDataContainer.GetBasePaths().GetAt(stIndex); + size_t stSrcObjectID = rBasePaths.GetOidAt(stIndex); + TSmartPath pathCurrent = rBasePaths.GetAt(stIndex); + // store currently processed index m_tProgressInfo.SetCurrentIndex(stIndex); @@ -162,12 +165,8 @@ m_tSubTaskStats.SetCurrentPath(pathCurrent.ToString()); // retrieve base path data - TBasePathDataPtr spBasePathData = rBasePathDataContainer.GetAt(stIndex); - if(!spBasePathData) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); - // check if we want to process this path at all - if(spBasePathData->GetSkipFurtherProcessing()) + if(rBasePathDataContainer.GetSkipFurtherProcessing(stSrcObjectID)) continue; TFileInfoPtr spFileInfo(boost::make_shared()); @@ -178,7 +177,7 @@ bRetry = false; // read attributes of src file/folder - bool bExists = TLocalFilesystem::GetFileInfo(pathCurrent, spFileInfo, stIndex, &rBasePathDataContainer.GetBasePaths()); + bool bExists = TLocalFilesystem::GetFileInfo(pathCurrent, spFileInfo, stIndex, &rBasePaths); if(!bExists) { FEEDBACK_FILEERROR ferr = { pathCurrent.ToString(), NULL, eFastMoveError, ERROR_FILE_NOT_FOUND }; @@ -214,7 +213,7 @@ // does it match the input filter? if(!spFileInfo->IsDirectory() && !afFilters.Match(spFileInfo)) { - spBasePathData->SetSkipFurtherProcessing(true); + rBasePathDataContainer.Get(stSrcObjectID)->SetSkipFurtherProcessing(true); continue; } @@ -224,7 +223,7 @@ do { TSmartPath pathDestinationPath = CalculateDestinationPath(spFileInfo, pathDestination, 0); - TSmartPath pathSrc = rBasePathDataContainer.GetBasePaths().GetAt(stIndex); + TSmartPath pathSrc = rBasePaths.GetAt(stIndex); bResult = TLocalFilesystem::FastMove(pathSrc, pathDestinationPath); if(!bResult) { @@ -269,7 +268,7 @@ } } else - spBasePathData->SetSkipFurtherProcessing(true); // mark that this path should not be processed any further + rBasePathDataContainer.Get(stSrcObjectID)->SetSkipFurtherProcessing(true); // mark that this path should not be processed any further } while(!bResult && bRetry); Index: src/libchcore/TSubTaskScanDirectory.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -121,7 +121,7 @@ IFeedbackHandlerPtr spFeedbackHandler = GetContext().GetFeedbackHandler(); TWorkerThreadController& rThreadController = GetContext().GetThreadController(); TBasePathDataContainer& rBasePathDataContainer = GetContext().GetBasePathDataContainer(); - const TModPathContainer& rBasePaths = rBasePathDataContainer.GetBasePaths(); + const TModPathContainer& rBasePaths = GetContext().GetBasePaths(); const TConfig& rConfig = GetContext().GetConfig(); rLog.logi(_T("Searching for files...")); @@ -157,6 +157,7 @@ size_t stIndex = 0; // m_tProgressInfo.GetCurrentIndex() for(; stIndex < stSize; stIndex++) { + size_t stObjectID = rBasePaths.GetOidAt(stIndex); TSmartPath pathCurrent = rBasePaths.GetAt(stIndex); m_tProgressInfo.SetCurrentIndex(stIndex); @@ -168,13 +169,8 @@ bSkipInputPath = false; TFileInfoPtr spFileInfo(boost::make_shared()); - // retrieve base path data - TBasePathDataPtr spBasePathData = rBasePathDataContainer.GetAt(stIndex); - if(!spBasePathData) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); - // check if we want to process this path at all (might be already fast moved) - if(spBasePathData->GetSkipFurtherProcessing()) + if(rBasePathDataContainer.GetSkipFurtherProcessing(stObjectID)) continue; // try to get some info about the input path; let user know if the path does not exist. @@ -292,7 +288,7 @@ { TFileInfoArray& rFilesCache = GetContext().GetFilesCache(); TWorkerThreadController& rThreadController = GetContext().GetThreadController(); - const TModPathContainer& rBasePaths = GetContext().GetBasePathDataContainer().GetBasePaths(); + const TModPathContainer& rBasePaths = GetContext().GetBasePaths(); TLocalFilesystemFind finder = TLocalFilesystem::CreateFinderObject(pathDirName, PathFromString(_T("*"))); TFileInfoPtr spFileInfo(boost::make_shared()); Index: src/libchcore/TTask.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -r2efd22688b8d12be34c87bf2b024d8db6e317d60 --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision 2efd22688b8d12be34c87bf2b024d8db6e317d60) @@ -49,11 +49,11 @@ m_pathDestinationPath(m_bBaseDataChanged), m_log(), m_spFeedbackHandler(spFeedbackHandler), - m_arrSourcePathsInfo(m_vSourcePaths), + m_arrSourcePathsInfo(), m_files(m_vSourcePaths), m_bForce(false), m_bContinue(false), - m_tSubTaskContext(m_tConfiguration, m_arrSourcePathsInfo, m_files, m_cfgTracker, m_log, spFeedbackHandler, m_workerThread, m_fsLocal), + m_tSubTaskContext(m_tConfiguration, m_vSourcePaths, m_arrSourcePathsInfo, m_files, m_cfgTracker, m_log, spFeedbackHandler, m_workerThread, m_fsLocal), m_tSubTasksArray(), m_spSerializer(spSerializer), m_bWasSerialized(false) @@ -75,7 +75,6 @@ m_strTaskName = rTaskDefinition.GetTaskName(); m_tSubTasksArray.Init(rTaskDefinition.GetOperationPlan(), m_tSubTaskContext); - m_arrSourcePathsInfo.SetCount(m_vSourcePaths.GetCount()); m_files.Clear(); m_tSubTaskContext.SetOperationType(m_tSubTasksArray.GetOperationType()); m_tSubTaskContext.SetDestinationPath(m_pathDestinationPath);