diff options
| author | Dan Engelbrecht <[email protected]> | 2025-10-14 18:24:17 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-10-14 18:24:17 +0200 |
| commit | 74c90983853f5ef0966be35544173d6efd85db17 (patch) | |
| tree | e4fe6faa53697f2b1503e3919527d5ad18260890 /src/zenremotestore/include | |
| parent | refactor builds cmd part2 (#572) (diff) | |
| download | zen-74c90983853f5ef0966be35544173d6efd85db17.tar.xz zen-74c90983853f5ef0966be35544173d6efd85db17.zip | |
refactor builds cmd part3 (#573)
* move lambdas to member functions
* add BuildsOperationValidateBuildPart
Diffstat (limited to 'src/zenremotestore/include')
| -rw-r--r-- | src/zenremotestore/include/zenremotestore/builds/buildstorageoperations.h | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/src/zenremotestore/include/zenremotestore/builds/buildstorageoperations.h b/src/zenremotestore/include/zenremotestore/builds/buildstorageoperations.h index 8ba32127a..be6720d5d 100644 --- a/src/zenremotestore/include/zenremotestore/builds/buildstorageoperations.h +++ b/src/zenremotestore/include/zenremotestore/builds/buildstorageoperations.h @@ -374,6 +374,8 @@ private: const std::vector<IoHash>& m_LooseChunkHashes; const Options m_Options; const std::filesystem::path m_CacheFolderPath; + const std::filesystem::path m_TempDownloadFolderPath; + const std::filesystem::path m_TempBlockFolderPath; }; struct FindBlocksStatistics @@ -513,6 +515,11 @@ public: LooseChunksStatistics m_LooseChunksStats; private: + std::vector<std::filesystem::path> ParseManifest(const std::filesystem::path& Path, const std::filesystem::path& ManifestPath); + + bool IsAcceptedFolder(const std::string_view& RelativePath) const; + bool IsAcceptedFile(const std::string_view& RelativePath) const; + std::vector<size_t> FindReuseBlocks(const std::vector<ChunkBlockDescription>& KnownBlocks, std::span<const IoHash> ChunkHashes, std::span<const uint32_t> ChunkIndexes, @@ -611,14 +618,64 @@ private: const Options m_Options; }; -void DownloadLargeBlob(BuildStorage& Storage, - const std::filesystem::path& DownloadFolder, - const Oid& BuildId, - const IoHash& ChunkHash, - const std::uint64_t PreferredMultipartChunkSize, - ParallelWork& Work, - WorkerThreadPool& NetworkPool, - DownloadStatistics& DownloadStats, - std::function<void(IoBuffer&& Payload)>&& OnDownloadComplete); +struct ValidateStatistics +{ + uint64_t BuildBlobSize = 0; + uint64_t BuildPartSize = 0; + uint64_t ChunkAttachmentCount = 0; + uint64_t BlockAttachmentCount = 0; + std::atomic<uint64_t> VerifiedAttachmentCount = 0; + std::atomic<uint64_t> VerifiedByteCount = 0; + uint64_t ElapsedWallTimeUS = 0; +}; + +class BuildsOperationValidateBuildPart +{ +public: + struct Options + { + bool IsQuiet = false; + bool IsVerbose = false; + }; + BuildsOperationValidateBuildPart(BuildOpLogOutput& LogOutput, + BuildStorage& Storage, + std::atomic<bool>& AbortFlag, + std::atomic<bool>& PauseFlag, + WorkerThreadPool& IOWorkerPool, + WorkerThreadPool& NetworkPool, + const Oid& BuildId, + const Oid& BuildPartId, + const std::string_view BuildPartName, + const Options& Options); + + void Execute(); + + ValidateStatistics m_ValidateStats; + DownloadStatistics m_DownloadStats; + +private: + ChunkBlockDescription ValidateChunkBlock(IoBuffer&& Payload, + const IoHash& BlobHash, + uint64_t& OutCompressedSize, + uint64_t& OutDecompressedSize); + + BuildOpLogOutput& m_LogOutput; + BuildStorage& m_Storage; + std::atomic<bool>& m_AbortFlag; + std::atomic<bool>& m_PauseFlag; + WorkerThreadPool& m_IOWorkerPool; + WorkerThreadPool& m_NetworkPool; + const Oid m_BuildId; + Oid m_BuildPartId; + const std::string m_BuildPartName; + const Options m_Options; +}; + +CompositeBuffer ValidateBlob(std::atomic<bool>& AbortFlag, + BuildStorage& Storage, + const Oid& BuildId, + const IoHash& BlobHash, + uint64_t& OutCompressedSize, + uint64_t& OutDecompressedSize); } // namespace zen |