From c1edc2e21ecf381470d71767dc38a83c85f57d23 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 5 Aug 2024 09:33:44 +0200 Subject: Avoid deep copies of containers in responses. --- .../execution_api/remote/bazel/bazel_response.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.hpp') 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 #include #include // std::move #include @@ -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 final; + auto Artifacts() noexcept -> ArtifactInfos const& final; + auto DirectorySymlinks() noexcept -> DirSymlinks const& final; private: std::string action_id_{}; std::shared_ptr 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 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; -- cgit v1.2.3