diff options
| author | Dan Engelbrecht <[email protected]> | 2026-03-15 11:21:25 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2026-03-15 11:21:25 +0100 |
| commit | 35d31fba5e71e7827f6c0ace2737c386ae371364 (patch) | |
| tree | f8a107ce2c83f2ac86a58da8c555aa249523f8fe /src | |
| parent | operator on CompositeBuffer for block building (diff) | |
| download | zen-35d31fba5e71e7827f6c0ace2737c386ae371364.tar.xz zen-35d31fba5e71e7827f6c0ace2737c386ae371364.zip | |
clang fixes, nicer reuse report
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenremotestore/projectstore/remoteprojectstore.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/src/zenremotestore/projectstore/remoteprojectstore.cpp b/src/zenremotestore/projectstore/remoteprojectstore.cpp index 39e2f2413..cbdd23fa9 100644 --- a/src/zenremotestore/projectstore/remoteprojectstore.cpp +++ b/src/zenremotestore/projectstore/remoteprojectstore.cpp @@ -924,10 +924,7 @@ namespace remotestore_impl { std::unordered_map<IoHash, std::pair<uint64_t, IoBuffer>, IoHash::Hasher>& LooseUploadAttachments, JobContext* OptionalContext) { - if (UploadAttachments.empty()) - { - return; - } + ZEN_ASSERT(!UploadAttachments.empty()); Stopwatch UploadAttachmentsTimer; RwLock ResolveLock; @@ -1052,7 +1049,7 @@ namespace remotestore_impl { if (UploadAttachment->Size > MaxChunkEmbedSize) { TGetAttachmentBufferFunc FetchFunc = [&ChunkStore](const IoHash& RawHash) { - return CompositeBuffer(SharedBuffer(std::move(ChunkStore.FindChunkByCid(RawHash)))); + return CompositeBuffer(SharedBuffer(ChunkStore.FindChunkByCid(RawHash))); }; RwLock::ExclusiveLockScope _(ResolveLock); LargeChunkAttachments.insert_or_assign(RawHash, std::move(FetchFunc)); @@ -2774,21 +2771,38 @@ BuildContainer(CidStore& ChunkStore, std::unordered_map<IoHash, TGetAttachmentBufferFunc, IoHash::Hasher> LargeChunkAttachments; std::unordered_map<IoHash, std::pair<uint64_t, IoBuffer>, IoHash::Hasher> LooseUploadAttachments; - remotestore_impl::ReportMessage(OptionalContext, - fmt::format("Resolving {} attachments from {} ops", UploadAttachments.size(), TotalOpCount)); + if (UploadAttachments.empty()) + { + if (ReusedAttachmentCount != 0) + { + remotestore_impl::ReportMessage( + OptionalContext, + fmt::format("Found all {} attachments from {} ops in existing blocks", ReusedAttachmentCount, TotalOpCount)); + } + } + else + { + remotestore_impl::ReportMessage( + OptionalContext, + fmt::format("Resolving {} attachments from {} ops ({} ({}%) found in existing blocks)", + UploadAttachments.size(), + TotalOpCount, + ReusedAttachmentCount, + UploadAttachments.size() == 0 ? 100 : (100 * ReusedAttachmentCount) / UploadAttachments.size())); - ResolveAttachments(ChunkStore, - WorkerPool, - MaxChunkEmbedSize, - AttachmentTempPath, - UploadAttachments, - LargeChunkAttachments, - LooseUploadAttachments, - OptionalContext); + ResolveAttachments(ChunkStore, + WorkerPool, + MaxChunkEmbedSize, + AttachmentTempPath, + UploadAttachments, + LargeChunkAttachments, + LooseUploadAttachments, + OptionalContext); - if (remotestore_impl::IsCancelled(OptionalContext)) - { - return {}; + if (remotestore_impl::IsCancelled(OptionalContext)) + { + return {}; + } } std::unordered_set<IoHash, IoHash::Hasher> LargeChunkHashes; @@ -2812,9 +2826,6 @@ BuildContainer(CidStore& ChunkStore, if (remotestore_impl::IsCancelled(OptionalContext)) { - RemoteResult.SetError(gsl::narrow<int>(HttpResponseCode::OK), "Operation cancelled", ""); - remotestore_impl::ReportMessage(OptionalContext, - fmt::format("Aborting ({}): {}", RemoteResult.GetError(), RemoteResult.GetErrorReason())); return {}; } |