diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-05 09:33:44 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-07 14:43:19 +0200 |
commit | c1edc2e21ecf381470d71767dc38a83c85f57d23 (patch) | |
tree | cf14c408ee080df389c9f79d3be95eb253285839 /src/buildtool/execution_api/remote/bazel/bazel_response.hpp | |
parent | 7012f6c0762cf11e7b1c22304f8fb0b3b330cd0a (diff) | |
download | justbuild-c1edc2e21ecf381470d71767dc38a83c85f57d23.tar.gz |
Avoid deep copies of containers in responses.
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.hpp')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_response.hpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp index 30a70d7f..6e37d344 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_RESPONSE_HPP #define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_RESPONSE_HPP +#include <optional> #include <string> #include <utility> // std::move #include <vector> @@ -53,22 +54,20 @@ class BazelResponse final : public IExecutionResponse { return output_.cached_result; }; - auto ActionDigest() const noexcept -> std::string final { + auto ActionDigest() const noexcept -> std::string const& final { return action_id_; } - auto Artifacts() noexcept -> ArtifactInfos final; - - auto ArtifactsWithDirSymlinks() noexcept - -> std::pair<ArtifactInfos, DirSymlinks> final; + auto Artifacts() noexcept -> ArtifactInfos const& final; + auto DirectorySymlinks() noexcept -> DirSymlinks const& final; private: std::string action_id_{}; std::shared_ptr<BazelNetwork> const network_{}; BazelExecutionClient::ExecutionOutput output_{}; - ArtifactInfos artifacts_{}; - DirSymlinks dir_symlinks_{}; - bool populated_{false}; + ArtifactInfos artifacts_; + DirSymlinks dir_symlinks_; + bool populated_ = false; explicit BazelResponse(std::string action_id, std::shared_ptr<BazelNetwork> network, @@ -85,7 +84,7 @@ class BazelResponse final : public IExecutionResponse { return id.size_bytes() != 0; } - [[nodiscard]] auto Populate() noexcept -> bool; + void Populate() noexcept; [[nodiscard]] auto UploadTreeMessageDirectories( bazel_re::Tree const& tree) const -> std::optional<ArtifactDigest>; |