aboutsummaryrefslogtreecommitdiff
path: root/src/zenremotestore/projectstore/projectstoreoperations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenremotestore/projectstore/projectstoreoperations.cpp')
-rw-r--r--src/zenremotestore/projectstore/projectstoreoperations.cpp258
1 files changed, 117 insertions, 141 deletions
diff --git a/src/zenremotestore/projectstore/projectstoreoperations.cpp b/src/zenremotestore/projectstore/projectstoreoperations.cpp
index becac3d4c..ba4b74825 100644
--- a/src/zenremotestore/projectstore/projectstoreoperations.cpp
+++ b/src/zenremotestore/projectstore/projectstoreoperations.cpp
@@ -3,13 +3,14 @@
#include <zenremotestore/projectstore/projectstoreoperations.h>
#include <zencore/compactbinaryutil.h>
+#include <zencore/fmtutils.h>
#include <zencore/parallelwork.h>
#include <zencore/scopeguard.h>
#include <zencore/timer.h>
#include <zenremotestore/builds/buildstorageutil.h>
#include <zenremotestore/chunking/chunkedfile.h>
-#include <zenremotestore/operationlogoutput.h>
#include <zenremotestore/projectstore/remoteprojectstore.h>
+#include <zenutil/progress.h>
namespace zen {
@@ -17,11 +18,11 @@ using namespace std::literals;
//////////////////////////// ProjectStoreOperationOplogState
-ProjectStoreOperationOplogState::ProjectStoreOperationOplogState(OperationLogOutput& OperationLogOutput,
- StorageInstance& Storage,
- const Oid& BuildId,
- const Options& Options)
-: m_LogOutput(OperationLogOutput)
+ProjectStoreOperationOplogState::ProjectStoreOperationOplogState(LoggerRef Log,
+ StorageInstance& Storage,
+ const Oid& BuildId,
+ const Options& Options)
+: m_Log(Log)
, m_Storage(Storage)
, m_BuildId(BuildId)
, m_Options(Options)
@@ -48,10 +49,7 @@ ProjectStoreOperationOplogState::LoadBuildObject()
{
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Read build {} from locally cached file in {}",
- m_BuildId,
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Read build {} from locally cached file in {}", m_BuildId, NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
return m_BuildObject;
}
@@ -61,11 +59,10 @@ ProjectStoreOperationOplogState::LoadBuildObject()
m_BuildObject = m_Storage.BuildStorage->GetBuild(m_BuildId);
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Fetched build {} from {} in {}",
- m_BuildId,
- m_Storage.BuildStorageHttp->GetBaseUri(),
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Fetched build {} from {} in {}",
+ m_BuildId,
+ m_Storage.BuildStorageHttp->GetBaseUri(),
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
CreateDirectories(CachedBuildObjectPath.parent_path());
TemporaryFile::SafeWriteFile(CachedBuildObjectPath, m_BuildObject.GetBuffer().GetView());
@@ -122,11 +119,10 @@ ProjectStoreOperationOplogState::LoadBuildPartsObject()
{
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Read build part {}/{} from locally cached file in {}",
- m_BuildId,
- BuildPartId,
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Read build part {}/{} from locally cached file in {}",
+ m_BuildId,
+ BuildPartId,
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
return m_BuildPartsObject;
}
@@ -136,12 +132,11 @@ ProjectStoreOperationOplogState::LoadBuildPartsObject()
m_BuildPartsObject = m_Storage.BuildStorage->GetBuildPart(m_BuildId, BuildPartId);
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Fetched build part {}/{} from {} in {}",
- m_BuildId,
- BuildPartId,
- m_Storage.BuildStorageHttp->GetBaseUri(),
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Fetched build part {}/{} from {} in {}",
+ m_BuildId,
+ BuildPartId,
+ m_Storage.BuildStorageHttp->GetBaseUri(),
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
CreateDirectories(CachedBuildPartObjectPath.parent_path());
TemporaryFile::SafeWriteFile(CachedBuildPartObjectPath, m_BuildPartsObject.GetBuffer().GetView());
@@ -168,11 +163,7 @@ ProjectStoreOperationOplogState::LoadOpsSectionObject()
}
else if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Read {}/{}/ops from locally cached file in {}",
- BuildPartId,
- m_BuildId,
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Read {}/{}/ops from locally cached file in {}", BuildPartId, m_BuildId, NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
return m_OpsSectionObject;
}
}
@@ -193,11 +184,10 @@ ProjectStoreOperationOplogState::LoadOpsSectionObject()
}
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Decompressed and validated oplog payload {} -> {} in {}",
- NiceBytes(OpsSection.GetSize()),
- NiceBytes(m_OpsSectionObject.GetSize()),
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Decompressed and validated oplog payload {} -> {} in {}",
+ NiceBytes(OpsSection.GetSize()),
+ NiceBytes(m_OpsSectionObject.GetSize()),
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
if (m_OpsSectionObject)
{
@@ -226,12 +216,11 @@ ProjectStoreOperationOplogState::LoadArrayFromBuildPart(std::string_view ArrayNa
{
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Read {}/{}/{} from locally cached file in {}",
- BuildPartId,
- m_BuildId,
- ArrayName,
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Read {}/{}/{} from locally cached file in {}",
+ BuildPartId,
+ m_BuildId,
+ ArrayName,
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
CbArray Result = CbArray(SharedBuffer(std::move(Payload)));
return Result;
@@ -290,7 +279,8 @@ ProjectStoreOperationOplogState::LoadChunksArray()
//////////////////////////// ProjectStoreOperationDownloadAttachments
-ProjectStoreOperationDownloadAttachments::ProjectStoreOperationDownloadAttachments(OperationLogOutput& OperationLogOutput,
+ProjectStoreOperationDownloadAttachments::ProjectStoreOperationDownloadAttachments(LoggerRef Log,
+ ProgressBase& Progress,
StorageInstance& Storage,
std::atomic<bool>& AbortFlag,
std::atomic<bool>& PauseFlag,
@@ -299,7 +289,8 @@ ProjectStoreOperationDownloadAttachments::ProjectStoreOperationDownloadAttachmen
ProjectStoreOperationOplogState& State,
std::span<const IoHash> AttachmentHashes,
const Options& Options)
-: m_LogOutput(OperationLogOutput)
+: m_Log(Log)
+, m_Progress(Progress)
, m_Storage(Storage)
, m_AbortFlag(AbortFlag)
, m_PauseFlag(PauseFlag)
@@ -325,9 +316,9 @@ ProjectStoreOperationDownloadAttachments::Execute()
};
auto EndProgress =
- MakeGuard([&]() { m_LogOutput.SetLogOperationProgress((uint32_t)TaskSteps::StepCount, (uint32_t)TaskSteps::StepCount); });
+ MakeGuard([&]() { m_Progress.SetLogOperationProgress((uint32_t)TaskSteps::StepCount, (uint32_t)TaskSteps::StepCount); });
- m_LogOutput.SetLogOperationProgress((uint32_t)TaskSteps::ReadAttachmentData, (uint32_t)TaskSteps::StepCount);
+ m_Progress.SetLogOperationProgress((uint32_t)TaskSteps::ReadAttachmentData, (uint32_t)TaskSteps::StepCount);
Stopwatch Timer;
tsl::robin_map<IoHash, uint64_t, IoHash::Hasher> ChunkSizes;
@@ -415,30 +406,29 @@ ProjectStoreOperationDownloadAttachments::Execute()
FilesToDechunk.size() > 0
? fmt::format("\n{} file{} needs to be dechunked", FilesToDechunk.size(), FilesToDechunk.size() == 1 ? "" : "s")
: "";
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Need to download {} block{} and {} chunk{}{}",
- BlocksToDownload.size(),
- BlocksToDownload.size() == 1 ? "" : "s",
- LooseChunksToDownload.size(),
- LooseChunksToDownload.size() == 1 ? "" : "s",
- DechunkInfo);
+ ZEN_INFO("Need to download {} block{} and {} chunk{}{}",
+ BlocksToDownload.size(),
+ BlocksToDownload.size() == 1 ? "" : "s",
+ LooseChunksToDownload.size(),
+ LooseChunksToDownload.size() == 1 ? "" : "s",
+ DechunkInfo);
}
auto GetBuildBlob = [this](const IoHash& RawHash, const std::filesystem::path& OutputPath) {
IoBuffer Payload;
- if (m_Storage.BuildCacheStorage)
+ if (m_Storage.CacheStorage)
{
- Payload = m_Storage.BuildCacheStorage->GetBuildBlob(m_State.GetBuildId(), RawHash);
+ Payload = m_Storage.CacheStorage->GetBuildBlob(m_State.GetBuildId(), RawHash);
}
if (!Payload)
{
Payload = m_Storage.BuildStorage->GetBuildBlob(m_State.GetBuildId(), RawHash);
- if (m_Storage.BuildCacheStorage && m_Options.PopulateCache)
+ if (m_Storage.CacheStorage && m_Options.PopulateCache)
{
- m_Storage.BuildCacheStorage->PutBuildBlob(m_State.GetBuildId(),
- RawHash,
- Payload.GetContentType(),
- CompositeBuffer(SharedBuffer(Payload)));
+ m_Storage.CacheStorage->PutBuildBlob(m_State.GetBuildId(),
+ RawHash,
+ Payload.GetContentType(),
+ CompositeBuffer(SharedBuffer(Payload)));
}
}
uint64_t PayloadSize = Payload.GetSize();
@@ -470,18 +460,15 @@ ProjectStoreOperationDownloadAttachments::Execute()
std::filesystem::path TempAttachmentPath = MakeSafeAbsolutePath(m_Options.AttachmentOutputPath) / ".tmp";
CreateDirectories(TempAttachmentPath);
auto _0 = MakeGuard([this, &TempAttachmentPath]() {
- if (true)
+ if (!m_Options.IsQuiet)
{
- if (!m_Options.IsQuiet)
- {
- ZEN_OPERATION_LOG_INFO(m_LogOutput, "Cleaning up temporary directory");
- }
- CleanDirectory(TempAttachmentPath, true);
- RemoveDir(TempAttachmentPath);
+ ZEN_INFO("Cleaning up temporary directory");
}
+ CleanDirectory(TempAttachmentPath, true);
+ RemoveDir(TempAttachmentPath);
});
- m_LogOutput.SetLogOperationProgress((uint32_t)TaskSteps::Download, (uint32_t)TaskSteps::StepCount);
+ m_Progress.SetLogOperationProgress((uint32_t)TaskSteps::Download, (uint32_t)TaskSteps::StepCount);
std::filesystem::path BlocksPath = TempAttachmentPath / "blocks";
CreateDirectories(BlocksPath);
@@ -492,11 +479,9 @@ ProjectStoreOperationDownloadAttachments::Execute()
std::filesystem::path LooseChunksPath = TempAttachmentPath / "loosechunks";
CreateDirectories(LooseChunksPath);
- std::unique_ptr<OperationLogOutput::ProgressBar> ProgressBarPtr(m_LogOutput.CreateProgressBar("Downloading"));
- OperationLogOutput::ProgressBar& DownloadProgressBar(*ProgressBarPtr);
+ std::unique_ptr<ProgressBase::ProgressBar> ProgressBar = m_Progress.CreateProgressBar("Downloading");
- std::atomic<bool> PauseFlag;
- ParallelWork Work(m_AbortFlag, m_PauseFlag, WorkerThreadPool::EMode::EnableBacklog);
+ ParallelWork Work(m_AbortFlag, m_PauseFlag, WorkerThreadPool::EMode::EnableBacklog);
std::atomic<size_t> LooseChunksCompleted;
std::atomic<size_t> BlocksCompleted;
@@ -511,7 +496,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
if (m_Options.ForceDownload || !IsFile(LooseChunkOutputPath))
{
GetBuildBlob(RawHash, LooseChunkOutputPath);
- ZEN_OPERATION_LOG_DEBUG(m_LogOutput, "Downloaded chunk {}", RawHash);
+ ZEN_DEBUG("Downloaded chunk {}", RawHash);
}
Work.ScheduleWork(m_IOWorkerPool, [&, LooseChunkIndex, LooseChunkOutputPath](std::atomic<bool>&) {
@@ -547,7 +532,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
{
ChunkOutput.Close();
RemoveFile(ChunkOutputPath);
- throw std::runtime_error(fmt::format("Failed to decompress chunk {} to ", RawHash, ChunkOutputPath));
+ throw std::runtime_error(fmt::format("Failed to decompress chunk {} to '{}'", RawHash, ChunkOutputPath));
}
}
else
@@ -555,7 +540,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
TemporaryFile::SafeWriteFile(ChunkOutputPath, CompressedChunk.GetCompressed());
}
- ZEN_OPERATION_LOG_DEBUG(m_LogOutput, "Wrote loose chunk {} to '{}'", RawHash, ChunkOutputPath);
+ ZEN_DEBUG("Wrote loose chunk {} to '{}'", RawHash, ChunkOutputPath);
LooseChunksCompleted++;
});
});
@@ -572,7 +557,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
if (m_Options.ForceDownload || !IsFile(BlockOutputPath))
{
GetBuildBlob(RawHash, BlockOutputPath);
- ZEN_OPERATION_LOG_DEBUG(m_LogOutput, "Downloaded block {}", RawHash);
+ ZEN_DEBUG("Downloaded block {}", RawHash);
}
Work.ScheduleWork(m_IOWorkerPool, [&, BlockIndex, BlockOutputPath](std::atomic<bool>&) {
@@ -607,7 +592,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
ChunkOutput.Close();
RemoveFile(ChunkOutputPath);
throw std::runtime_error(
- fmt::format("Failed to decompress chunk {} to ", ChunkHash, ChunkOutputPath));
+ fmt::format("Failed to decompress chunk {} to '{}'", ChunkHash, ChunkOutputPath));
}
}
else
@@ -615,7 +600,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
TemporaryFile::SafeWriteFile(ChunkOutputPath, CompressedChunk.GetCompressed());
}
- ZEN_OPERATION_LOG_DEBUG(m_LogOutput, "Wrote block chunk {} to '{}'", ChunkHash, ChunkOutputPath);
+ ZEN_DEBUG("Wrote block chunk {} to '{}'", ChunkHash, ChunkOutputPath);
}
if (ChunkedFileRawHashes.contains(ChunkHash))
{
@@ -635,7 +620,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
});
}
- Work.Wait(m_LogOutput.GetProgressUpdateDelayMS(), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t PendingWork) {
+ Work.Wait(m_Progress.GetProgressUpdateDelayMS(), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t PendingWork) {
ZEN_UNUSED(IsAborted, IsPaused, PendingWork);
std::string Details = fmt::format("{}/{} blocks, {}/{} chunks downloaded",
@@ -643,39 +628,37 @@ ProjectStoreOperationDownloadAttachments::Execute()
BlocksToDownload.size(),
LooseChunksCompleted.load(),
LooseChunksToDownload.size());
- DownloadProgressBar.UpdateState({.Task = "Downloading",
- .Details = Details,
- .TotalCount = BlocksToDownload.size() + LooseChunksToDownload.size(),
- .RemainingCount = BlocksToDownload.size() + LooseChunksToDownload.size() -
- (BlocksCompleted.load() + LooseChunksCompleted.load()),
- .Status = OperationLogOutput::ProgressBar::State::CalculateStatus(IsAborted, IsPaused)},
- false);
+ ProgressBar->UpdateState({.Task = "Downloading",
+ .Details = Details,
+ .TotalCount = BlocksToDownload.size() + LooseChunksToDownload.size(),
+ .RemainingCount = BlocksToDownload.size() + LooseChunksToDownload.size() -
+ (BlocksCompleted.load() + LooseChunksCompleted.load()),
+ .Status = ProgressBase::ProgressBar::State::CalculateStatus(IsAborted, IsPaused)},
+ false);
});
- DownloadProgressBar.Finish();
+ ProgressBar->Finish();
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "{} block{} downloaded, {} loose chunk{} downloaded in {}",
- BlocksToDownload.size(),
- BlocksToDownload.size() == 1 ? "" : "s",
- LooseChunksToDownload.size(),
- LooseChunksToDownload.size() == 1 ? "" : "s",
- NiceTimeSpanMs(DownloadTimer.GetElapsedTimeMs()));
+ ZEN_INFO("{} block{} downloaded, {} loose chunk{} downloaded in {}",
+ BlocksToDownload.size(),
+ BlocksToDownload.size() == 1 ? "" : "s",
+ LooseChunksToDownload.size(),
+ LooseChunksToDownload.size() == 1 ? "" : "s",
+ NiceTimeSpanMs(DownloadTimer.GetElapsedTimeMs()));
}
}
if (!ChunkedFileInfos.empty())
{
- m_LogOutput.SetLogOperationProgress((uint32_t)TaskSteps::AnalyzeDechunk, (uint32_t)TaskSteps::StepCount);
+ m_Progress.SetLogOperationProgress((uint32_t)TaskSteps::AnalyzeDechunk, (uint32_t)TaskSteps::StepCount);
std::filesystem::path ChunkedFilesPath = TempAttachmentPath / "chunkedfiles";
CreateDirectories(ChunkedFilesPath);
try
{
- std::unique_ptr<OperationLogOutput::ProgressBar> ProgressBarPtr(m_LogOutput.CreateProgressBar("Dechunking"));
- OperationLogOutput::ProgressBar& DechunkingProgressBar(*ProgressBarPtr);
+ std::unique_ptr<ProgressBase::ProgressBar> ProgressBar = m_Progress.CreateProgressBar("Dechunking");
std::atomic<uint64_t> ChunksWritten;
@@ -729,7 +712,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
PrepareFileForScatteredWrite(OpenChunkedFiles.back()->Handle(), ChunkedFileInfo.RawSize);
}
- m_LogOutput.SetLogOperationProgress((uint32_t)TaskSteps::Dechunk, (uint32_t)TaskSteps::StepCount);
+ m_Progress.SetLogOperationProgress((uint32_t)TaskSteps::Dechunk, (uint32_t)TaskSteps::StepCount);
std::vector<std::atomic<uint8_t>> ChunkWrittenFlags(ChunkOpenFileTargets.size());
@@ -755,7 +738,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
}))
{
std::error_code DummyEc;
- throw std::runtime_error(fmt::format("Failed to decompress chunk {} at offset {} to {}",
+ throw std::runtime_error(fmt::format("Failed to decompress chunk {} at offset {} to '{}'",
CompressedChunkBuffer.DecodeRawHash(),
ChunkTarget.Offset,
PathFromHandle(OutputFile.Handle(), DummyEc)));
@@ -768,8 +751,7 @@ ProjectStoreOperationDownloadAttachments::Execute()
{
Stopwatch DechunkTimer;
- std::atomic<bool> PauseFlag;
- ParallelWork Work(m_AbortFlag, m_PauseFlag, WorkerThreadPool::EMode::EnableBacklog);
+ ParallelWork Work(m_AbortFlag, m_PauseFlag, WorkerThreadPool::EMode::EnableBacklog);
std::vector<IoHash> LooseChunks(LooseChunksToDownload.begin(), LooseChunksToDownload.end());
@@ -819,26 +801,24 @@ ProjectStoreOperationDownloadAttachments::Execute()
}
});
}
- Work.Wait(m_LogOutput.GetProgressUpdateDelayMS(), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t PendingWork) {
+ Work.Wait(m_Progress.GetProgressUpdateDelayMS(), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t PendingWork) {
ZEN_UNUSED(IsAborted, IsPaused, PendingWork);
std::string Details = fmt::format("{}/{} chunks written", ChunksWritten.load(), ChunkOpenFileTargets.size());
- DechunkingProgressBar.UpdateState(
- {.Task = "Dechunking ",
- .Details = Details,
- .TotalCount = ChunkOpenFileTargets.size(),
- .RemainingCount = ChunkOpenFileTargets.size() - ChunksWritten.load(),
- .Status = OperationLogOutput::ProgressBar::State::CalculateStatus(IsAborted, IsPaused)},
- false);
+ ProgressBar->UpdateState({.Task = "Dechunking ",
+ .Details = Details,
+ .TotalCount = ChunkOpenFileTargets.size(),
+ .RemainingCount = ChunkOpenFileTargets.size() - ChunksWritten.load(),
+ .Status = ProgressBase::ProgressBar::State::CalculateStatus(IsAborted, IsPaused)},
+ false);
});
- DechunkingProgressBar.Finish();
+ ProgressBar->Finish();
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "{} file{} dechunked in {}",
- ChunkedFileInfos.size(),
- ChunkedFileInfos.size() == 1 ? "" : "s",
- NiceTimeSpanMs(DechunkTimer.GetElapsedTimeMs()));
+ ZEN_INFO("{} file{} dechunked in {}",
+ ChunkedFileInfos.size(),
+ ChunkedFileInfos.size() == 1 ? "" : "s",
+ NiceTimeSpanMs(DechunkTimer.GetElapsedTimeMs()));
}
}
}
@@ -853,12 +833,10 @@ ProjectStoreOperationDownloadAttachments::Execute()
throw;
}
{
- Stopwatch VerifyTimer;
- std::unique_ptr<OperationLogOutput::ProgressBar> ProgressBarPtr(m_LogOutput.CreateProgressBar("Verifying"));
- OperationLogOutput::ProgressBar& VerifyProgressBar(*ProgressBarPtr);
+ Stopwatch VerifyTimer;
+ std::unique_ptr<ProgressBase::ProgressBar> ProgressBar = m_Progress.CreateProgressBar("Verifying");
- std::atomic<bool> PauseFlag;
- ParallelWork Work(m_AbortFlag, m_PauseFlag, WorkerThreadPool::EMode::EnableBacklog);
+ ParallelWork Work(m_AbortFlag, m_PauseFlag, WorkerThreadPool::EMode::EnableBacklog);
std::atomic<size_t> DechunkedFilesMoved;
@@ -875,43 +853,41 @@ ProjectStoreOperationDownloadAttachments::Execute()
}
std::filesystem::path ChunkOutputPath = m_Options.AttachmentOutputPath / fmt::format("{}", ChunkedFileInfo.RawHash);
RenameFile(ChunkedFilePath, ChunkOutputPath);
- ZEN_OPERATION_LOG_DEBUG(m_LogOutput, "Moved dechunked file {} to '{}'", ChunkedFileInfo.RawHash, ChunkOutputPath);
+ ZEN_DEBUG("Moved dechunked file {} to '{}'", ChunkedFileInfo.RawHash, ChunkOutputPath);
DechunkedFilesMoved++;
});
}
- Work.Wait(m_LogOutput.GetProgressUpdateDelayMS(), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t PendingWork) {
+ Work.Wait(m_Progress.GetProgressUpdateDelayMS(), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t PendingWork) {
ZEN_UNUSED(IsAborted, IsPaused, PendingWork);
std::string Details = fmt::format("{}/{} files verified", DechunkedFilesMoved.load(), ChunkedFileInfos.size());
- VerifyProgressBar.UpdateState({.Task = "Verifying ",
- .Details = Details,
- .TotalCount = ChunkedFileInfos.size(),
- .RemainingCount = ChunkedFileInfos.size() - DechunkedFilesMoved.load(),
- .Status = OperationLogOutput::ProgressBar::State::CalculateStatus(IsAborted, IsPaused)},
- false);
+ ProgressBar->UpdateState({.Task = "Verifying ",
+ .Details = Details,
+ .TotalCount = ChunkedFileInfos.size(),
+ .RemainingCount = ChunkedFileInfos.size() - DechunkedFilesMoved.load(),
+ .Status = ProgressBase::ProgressBar::State::CalculateStatus(IsAborted, IsPaused)},
+ false);
});
- VerifyProgressBar.Finish();
+ ProgressBar->Finish();
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Verified {} chunked file{} in {}",
- ChunkedFileInfos.size(),
- ChunkedFileInfos.size() == 1 ? "" : "s",
- NiceTimeSpanMs(VerifyTimer.GetElapsedTimeMs()));
+ ZEN_INFO("Verified {} chunked file{} in {}",
+ ChunkedFileInfos.size(),
+ ChunkedFileInfos.size() == 1 ? "" : "s",
+ NiceTimeSpanMs(VerifyTimer.GetElapsedTimeMs()));
}
}
}
if (!m_Options.IsQuiet)
{
- ZEN_OPERATION_LOG_INFO(m_LogOutput,
- "Downloaded {} attachment{} to '{}' in {}",
- m_AttachmentHashes.size(),
- m_AttachmentHashes.size() == 1 ? "" : "s",
- m_Options.AttachmentOutputPath,
- NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
+ ZEN_INFO("Downloaded {} attachment{} to '{}' in {}",
+ m_AttachmentHashes.size(),
+ m_AttachmentHashes.size() == 1 ? "" : "s",
+ m_Options.AttachmentOutputPath,
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
- m_LogOutput.SetLogOperationProgress((uint32_t)TaskSteps::Cleanup, (uint32_t)TaskSteps::StepCount);
+ m_Progress.SetLogOperationProgress((uint32_t)TaskSteps::Cleanup, (uint32_t)TaskSteps::StepCount);
}
} // namespace zen