Index: src/libchcore/TOverlappedReaderFB.cpp =================================================================== diff -u -N -r8aa9ecb7ccb06d721b9717a4bb664651b0b8b10e -rf1d25f23712f5de7459f690ab51b2640d0f81b91 --- src/libchcore/TOverlappedReaderFB.cpp (.../TOverlappedReaderFB.cpp) (revision 8aa9ecb7ccb06d721b9717a4bb664651b0b8b10e) +++ src/libchcore/TOverlappedReaderFB.cpp (.../TOverlappedReaderFB.cpp) (revision f1d25f23712f5de7459f690ab51b2640d0f81b91) @@ -23,21 +23,34 @@ namespace chcore { - TOverlappedReaderFB::TOverlappedReaderFB(const TFilesystemFileFeedbackWrapperPtr& spSrcFile, const TSubTaskStatsInfoPtr& spStats, + TOverlappedReaderFB::TOverlappedReaderFB(const IFilesystemPtr& spFilesystem, + const IFeedbackHandlerPtr& spFeedbackHandler, + TWorkerThreadController& rThreadController, + const TSubTaskStatsInfoPtr& spStats, const TFileInfoPtr& spSrcFileInfo, - const logger::TLogFileDataPtr& spLogFileData, const TBufferListPtr& spEmptyBuffers, - unsigned long long ullFilePos, DWORD dwChunkSize) : - m_spReader(std::make_shared(spLogFileData, spEmptyBuffers, ullFilePos, dwChunkSize)), - m_spSrcFile(spSrcFile), + const logger::TLogFileDataPtr& spLogFileData, + const TBufferListPtr& spEmptyBuffers, + const TOverlappedProcessorRangePtr& spDataRange, + DWORD dwChunkSize, + bool bNoBuffering, + bool bProtectReadOnlyFiles) : + m_spReader(std::make_shared(spLogFileData, spEmptyBuffers, spDataRange, dwChunkSize)), + m_spFilesystem(spFilesystem), + m_spSrcFile(), m_spStats(spStats), m_spSrcFileInfo(spSrcFileInfo) { - if(!spSrcFile) - throw TCoreException(eErr_InvalidArgument, L"spSrcFile is NULL", LOCATION); + if(!spFeedbackHandler) + throw TCoreException(eErr_InvalidArgument, L"spFeedbackHandler is NULL", LOCATION); + if(!spFilesystem) + throw TCoreException(eErr_InvalidArgument, L"spFilesystem is NULL", LOCATION); if(!spStats) throw TCoreException(eErr_InvalidArgument, L"spStats is NULL", LOCATION); if(!spSrcFileInfo) throw TCoreException(eErr_InvalidArgument, L"spSrcFileInfo is NULL", LOCATION); + + IFilesystemFilePtr fileSrc = m_spFilesystem->CreateFileObject(IFilesystemFile::eMode_Read, m_spSrcFileInfo->GetFullFilePath(), bNoBuffering, bProtectReadOnlyFiles); + m_spSrcFile = std::make_shared(fileSrc, spFeedbackHandler, spLogFileData, rThreadController, spFilesystem); } TOverlappedReaderFB::~TOverlappedReaderFB() @@ -46,6 +59,17 @@ TSubTaskBase::ESubOperationResult TOverlappedReaderFB::Start() { + TSubTaskBase::ESubOperationResult eResult = UpdateFileStats(); + return eResult; + } + + TOverlappedReaderPtr TOverlappedReaderFB::GetReader() const + { + return m_spReader; + } + + TSubTaskBase::ESubOperationResult TOverlappedReaderFB::UpdateFileStats() + { // update the source file size (it might differ from the time this file was originally scanned). // NOTE: this kind of update could be also done when copying chunks of data beyond the original end-of-file, // but it would require frequent total size updates and thus - serializations).