summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote/bazel/bazel_response.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-12 17:45:14 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-16 10:01:34 +0200
commit49c2382ea5ea45966ef15140fce6ad89672e956c (patch)
treeda781f16f3315f662492af00648fc1469efa55a0 /src/buildtool/execution_api/remote/bazel/bazel_response.hpp
parent7d925d8d6c5fed37bb74506c5b7589b99f5d2885 (diff)
downloadjustbuild-49c2382ea5ea45966ef15140fce6ad89672e956c.tar.gz
execution_response: Allow failures to be reported while populating
As populating the containers from remote response only takes place once, no assumptions should be made that this cannot fail (for example if wrong or invalid entries were produced). Instead, return error messages on failure to callers that can log accordingly.
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.hpp')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp
index 6e37d344..ec3e9748 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp
@@ -20,9 +20,11 @@
#include <utility> // std::move
#include <vector>
+#include "gsl/gsl"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_network.hpp"
+#include "src/utils/cpp/expected.hpp"
class BazelAction;
@@ -58,8 +60,10 @@ class BazelResponse final : public IExecutionResponse {
return action_id_;
}
- auto Artifacts() noexcept -> ArtifactInfos const& final;
- auto DirectorySymlinks() noexcept -> DirSymlinks const& final;
+ auto Artifacts() noexcept
+ -> expected<gsl::not_null<ArtifactInfos const*>, std::string> final;
+ auto DirectorySymlinks() noexcept
+ -> expected<gsl::not_null<DirSymlinks const*>, std::string> final;
private:
std::string action_id_{};
@@ -84,7 +88,9 @@ class BazelResponse final : public IExecutionResponse {
return id.size_bytes() != 0;
}
- void Populate() noexcept;
+ /// \brief Populates the stored data, once.
+ /// \returns Error message on failure, nullopt on success.
+ [[nodiscard]] auto Populate() noexcept -> std::optional<std::string>;
[[nodiscard]] auto UploadTreeMessageDirectories(
bazel_re::Tree const& tree) const -> std::optional<ArtifactDigest>;