diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-06-03 13:08:55 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-06-04 13:47:11 +0200 |
commit | f556af6129667569ff7d0ef1d5c3e12959233822 (patch) | |
tree | c32142efd1af8359348df61b176e930cc57c8eca /src | |
parent | 94cfdd9fd62c8e21ef4d0881d2a248154afc1a00 (diff) | |
download | justbuild-f556af6129667569ff7d0ef1d5c3e12959233822.tar.gz |
bazel_network: Change UploadBlobs to also accept an rvalue
This unifies the signature of all uploader functions consuming a
BlobContainer type.
Diffstat (limited to 'src')
5 files changed, 7 insertions, 5 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp index c46de66b..f96f4774 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp @@ -72,7 +72,8 @@ auto BazelAction::Execute(Logger const* logger) noexcept } } - if (ExecutionEnabled(cache_flag_) and network_->UploadBlobs(blobs)) { + if (ExecutionEnabled(cache_flag_) and + network_->UploadBlobs(std::move(blobs))) { if (auto output = network_->ExecuteBazelActionSync(action)) { if (cache_flag_ == CacheFlag::PretendCached) { // ensure the same id is created as if caching were enabled diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index 00f7308c..0a48a748 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -440,7 +440,8 @@ auto BazelApi::CreateAction( [[nodiscard]] auto BazelApi::Upload(ArtifactBlobContainer&& blobs, bool skip_find_missing) noexcept -> bool { auto bazel_blobs = ConvertToBazelBlobContainer(std::move(blobs)); - return bazel_blobs ? network_->UploadBlobs(*bazel_blobs, skip_find_missing) + return bazel_blobs ? network_->UploadBlobs(std::move(*bazel_blobs), + skip_find_missing) : false; } diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp index 85bb53d9..0b543d9b 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp @@ -99,7 +99,7 @@ auto BazelNetwork::DoUploadBlobs(T_Iter const& first, } } -auto BazelNetwork::UploadBlobs(BazelBlobContainer const& blobs, +auto BazelNetwork::UploadBlobs(BazelBlobContainer&& blobs, bool skip_find_missing) noexcept -> bool { if (skip_find_missing) { auto blob_range = blobs.Blobs(); diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp index 3e2c03fe..1aa5c1f7 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp @@ -90,7 +90,7 @@ class BazelNetwork { /// \param blobs The blobs to upload /// \param skip_find_missing Skip finding missing blobs, just upload all /// \returns True if upload was successful, false otherwise - [[nodiscard]] auto UploadBlobs(BazelBlobContainer const& blobs, + [[nodiscard]] auto UploadBlobs(BazelBlobContainer&& blobs, bool skip_find_missing = false) noexcept -> bool; diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp index 39196bf9..aea90ba8 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp @@ -229,7 +229,7 @@ auto BazelResponse::UploadTreeMessageDirectories( dir_blobs.Emplace(std::move(*subdir_blob)); } - if (not network_->UploadBlobs(dir_blobs)) { + if (not network_->UploadBlobs(std::move(dir_blobs))) { Logger::Log(LogLevel::Error, "uploading Tree's Directory messages failed"); return std::nullopt; |