Index: src/libchcore/TFileInfoArray.cpp =================================================================== diff -u -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -165,7 +165,9 @@ } boost::unique_lock lock(m_lock); - m_vFiles = vEntries; + m_vFiles = std::move(vEntries); + m_bComplete = !m_vFiles.empty(); // we're marking empty/non-empty based on scanned file count; this is due to the + // fact, that no scanned files are stored in DB unless scanning is complete; } void TFileInfoArray::InitColumns(const ISerializerContainerPtr& spContainer) const Index: src/libchcore/TSubTaskArray.cpp =================================================================== diff -u -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -66,6 +66,7 @@ void TSubTasksArray::Init(const TOperationPlan& rOperationPlan) { m_vSubTasks.clear(); + m_rSubTaskContext.GetFilesCache().Clear(); m_oidSubOperationIndex.store(0, boost::memory_order_release); m_eOperationType = rOperationPlan.GetOperationType(); Index: src/libchcore/TSubTaskContext.cpp =================================================================== diff -u -rb193a95402f2bf4c456fb9d65d111caaf6994823 -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -29,13 +29,12 @@ BEGIN_CHCORE_NAMESPACE TSubTaskContext::TSubTaskContext(TConfig& rConfig, const TBasePathDataContainerPtr& spBasePaths, - const TFileFiltersArray& rFilters, TFileInfoArray& rFilesCache, + const TFileFiltersArray& rFilters, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, const IFeedbackHandlerPtr& spFeedbackHandler, TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal) : m_rConfig(rConfig), m_eOperationType(eOperation_None), m_spBasePaths(spBasePaths), - m_rFilesCache(rFilesCache), m_pathDestination(), m_rCfgTracker(rCfgTracker), m_rLog(rLog), @@ -77,12 +76,12 @@ TFileInfoArray& TSubTaskContext::GetFilesCache() { - return m_rFilesCache; + return m_tFilesCache; } const TFileInfoArray& TSubTaskContext::GetFilesCache() const { - return m_rFilesCache; + return m_tFilesCache; } chcore::TSmartPath TSubTaskContext::GetDestinationPath() const Index: src/libchcore/TSubTaskContext.h =================================================================== diff -u -rc6d96d4152aab0785a5f850b5ed9eb4a3584fd91 -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision c6d96d4152aab0785a5f850b5ed9eb4a3584fd91) +++ src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -28,6 +28,7 @@ #include "EOperationTypes.h" #include "IFeedbackHandler.h" #include "TBasePathData.h" +#include "TFileInfoArray.h" namespace icpf { @@ -39,7 +40,6 @@ class TWorkerThreadController; class TTaskConfigTracker; class TLocalFilesystem; -class TFileInfoArray; class TConfig; class TFileFiltersArray; @@ -50,7 +50,7 @@ { public: TSubTaskContext(TConfig& rConfig, const TBasePathDataContainerPtr& spBasePaths, - const TFileFiltersArray& rFilters, TFileInfoArray& rFilesCache, + const TFileFiltersArray& rFilters, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, const IFeedbackHandlerPtr& spFeedbackHandler, TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal); ~TSubTaskContext(); @@ -102,7 +102,7 @@ const TFileFiltersArray& m_rFilters; // data on which to operate - TFileInfoArray& m_rFilesCache; + TFileInfoArray m_tFilesCache; TSmartPath m_pathDestination; Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -r16df8fcf9d5b3317338aece64762771419beaf4a -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 16df8fcf9d5b3317338aece64762771419beaf4a) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -100,6 +100,9 @@ // begin at index which wasn't processed previously file_count_t fcSize = rFilesCache.GetSize(); + file_count_t fcIndex = m_tSubTaskStats.GetCurrentIndex(); + unsigned long long ullCurrentItemProcessedSize = m_tSubTaskStats.GetCurrentItemProcessedSize(); + bool bIgnoreFolders = GetTaskPropValue(rConfig); bool bForceDirectories = GetTaskPropValue(rConfig); @@ -113,7 +116,6 @@ AdjustBufferIfNeeded(ccp.dbBuffer, ccp.tBufferSizes); - file_count_t fcIndex = m_tSubTaskStats.GetCurrentIndex(); // log TString strFormat; strFormat = _T("Processing files/folders (ProcessFiles):\r\n\tOnlyCreate: %create\r\n\tFiles/folders count: %filecount\r\n\tIgnore Folders: %ignorefolders\r\n\tDest path: %dstpath\r\n\tCurrent index (0-based): %currindex"); @@ -127,8 +129,6 @@ for(; fcIndex < fcSize; fcIndex++) { - m_tSubTaskStats.SetCurrentIndex(fcIndex); - // should we kill ? if(rThreadController.KillRequested()) { @@ -142,9 +142,11 @@ TSmartPath pathCurrent = spFileInfo->GetFullFilePath(); // new stats + m_tSubTaskStats.SetCurrentIndex(fcIndex); m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(pathCurrent.ToString()); - m_tSubTaskStats.SetCurrentItemProcessedSize(0); + m_tSubTaskStats.SetCurrentItemProcessedSize(ullCurrentItemProcessedSize); // preserve the processed size for the first item + ullCurrentItemProcessedSize = 0; m_tSubTaskStats.SetCurrentItemTotalSize(spFileInfo->GetLength64()); // set dest path with filename Index: src/libchcore/TTask.cpp =================================================================== diff -u -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -45,10 +45,9 @@ m_log(), m_spFeedbackHandler(spFeedbackHandler), m_spSrcPaths(new TBasePathDataContainer), - m_files(), m_bForce(false), m_bContinue(false), - m_tSubTaskContext(m_tConfiguration, m_spSrcPaths, m_afFilters, m_files, + m_tSubTaskContext(m_tConfiguration, m_spSrcPaths, m_afFilters, m_cfgTracker, m_log, spFeedbackHandler, m_workerThread, m_fsLocal), m_tSubTasksArray(m_tSubTaskContext), m_spSerializer(spSerializer) @@ -71,7 +70,6 @@ m_tBaseData.SetTaskName(rTaskDefinition.GetTaskName()); m_tSubTasksArray.Init(rTaskDefinition.GetOperationPlan()); - m_files.Clear(); m_tSubTaskContext.SetOperationType(m_tSubTasksArray.GetOperationType()); m_tSubTaskContext.SetDestinationPath(m_tBaseData.GetDestinationPath()); } @@ -147,7 +145,7 @@ m_spSrcPaths->Load(spContainer); spContainer = m_spSerializer->GetContainer(_T("scanned_files")); - m_files.Load(spContainer, m_spSrcPaths); + m_tSubTaskContext.GetFilesCache().Load(spContainer, m_spSrcPaths); spContainer = m_spSerializer->GetContainer(_T("task_config")); m_tConfiguration.Load(spContainer); @@ -221,7 +219,7 @@ m_spSrcPaths->Store(spContainer); spContainer = m_spSerializer->GetContainer(_T("scanned_files")); - m_files.Store(spContainer); + m_tSubTaskContext.GetFilesCache().Store(spContainer); spContainer = m_spSerializer->GetContainer(_T("task_config")); m_tConfiguration.Store(spContainer); @@ -542,8 +540,8 @@ } // if the files cache is not completely read - clean it up - if(!m_files.IsComplete()) - m_files.Clear(); // get rid of m_files contents; rare state not modified, since incomplete cache is not being stored + if(!m_tSubTaskContext.GetFilesCache().IsComplete()) + m_tSubTaskContext.GetFilesCache().Clear(); // get rid of m_files contents; rare state not modified, since incomplete cache is not being stored // save progress before killed Store(); Index: src/libchcore/TTask.h =================================================================== diff -u -r320c4eb6ba3a38dcd6fbda6a9a12a8350a153e41 -r121d674474766192b5bf02afda67fb962635f56b --- src/libchcore/TTask.h (.../TTask.h) (revision 320c4eb6ba3a38dcd6fbda6a9a12a8350a153e41) +++ src/libchcore/TTask.h (.../TTask.h) (revision 121d674474766192b5bf02afda67fb962635f56b) @@ -29,7 +29,6 @@ #include "TTaskLocalStats.h" #include "..\libicpf\log.h" #include "TLocalFilesystem.h" -#include "TFileInfoArray.h" #include "TSubTaskArray.h" #include "TSubTaskContext.h" #include "TTaskStatsSnapshot.h" @@ -153,8 +152,6 @@ TTaskConfigTracker m_cfgTracker; // current task state (derivatives of the task initial information) - // changing slowly or only partially - TFileInfoArray m_files; // list of files/directories found during operating on the task input data (filled by search for files) // task settings TFileFiltersArray m_afFilters; // filtering settings for files (will be filtered according to the rules inside when searching for files)