diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/main/build_utils.cpp | 14 | ||||
-rw-r--r-- | src/buildtool/main/build_utils.hpp | 10 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/buildtool/main/build_utils.cpp b/src/buildtool/main/build_utils.cpp index e15e5296..46773ca2 100644 --- a/src/buildtool/main/build_utils.cpp +++ b/src/buildtool/main/build_utils.cpp @@ -55,14 +55,22 @@ void WriteTargetCacheEntries( extra_infos, std::size_t jobs, gsl::not_null<IExecutionApi*> const& local_api, - gsl::not_null<IExecutionApi*> const& remote_api) { + gsl::not_null<IExecutionApi*> const& remote_api, + TargetCacheWriteStrategy strategy) { + if (strategy == TargetCacheWriteStrategy::Disable) { + return; + } if (!cache_targets.empty()) { Logger::Log(LogLevel::Info, "Backing up artifacts of {} export targets", cache_targets.size()); } - auto downloader = [&local_api, &remote_api, &jobs](auto infos) { - return remote_api->ParallelRetrieveToCas(infos, local_api, jobs, false); + auto downloader = [&local_api, &remote_api, &jobs, strategy](auto infos) { + return remote_api->ParallelRetrieveToCas( + infos, + local_api, + jobs, + strategy == TargetCacheWriteStrategy::Split); }; for (auto const& [key, target] : cache_targets) { if (auto entry = TargetCacheEntry::FromTarget(target, extra_infos)) { diff --git a/src/buildtool/main/build_utils.hpp b/src/buildtool/main/build_utils.hpp index 2db29839..e78d86d0 100644 --- a/src/buildtool/main/build_utils.hpp +++ b/src/buildtool/main/build_utils.hpp @@ -38,6 +38,13 @@ std::unordered_map<TargetCacheKey, AnalysedTargetPtr> const& cache_targets) -> std::vector<ArtifactDescription>; +enum class TargetCacheWriteStrategy { + Disable, ///< Do not create target-level cache entries + Sync, ///< Create target-level cache entries after syncing the artifacts + Split ///< Create target-level cache entries after syncing the artifacts; + ///< during artifact sync try to use blob splitting, if available +}; + #ifndef BOOTSTRAP_BUILD_TOOL void WriteTargetCacheEntries( std::unordered_map<TargetCacheKey, AnalysedTargetPtr> const& cache_targets, @@ -45,7 +52,8 @@ void WriteTargetCacheEntries( extra_infos, std::size_t jobs, gsl::not_null<IExecutionApi*> const& local_api, - gsl::not_null<IExecutionApi*> const& remote_api); + gsl::not_null<IExecutionApi*> const& remote_api, + TargetCacheWriteStrategy strategy = TargetCacheWriteStrategy::Sync); #endif // BOOTSTRAP_BUILD_TOOL #endif // INCLUDED_SRC_BUILDOOL_MAIN_BUILD_UTILS_HPP |