summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api/remote')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_api.cpp6
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_network.cpp9
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_network.hpp18
3 files changed, 24 insertions, 9 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
index 34cb129e..99d77a5e 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
@@ -68,8 +68,8 @@ auto BazelApi::CreateAction(
auto const& info = artifacts_info[i];
if (IsTreeObject(info.type)) {
// read object infos from sub tree and call retrieve recursively
- auto const infos =
- network_->ReadTreeInfos(info.digest, output_paths[i]);
+ auto const infos = network_->RecursivelyReadTreeLeafs(
+ info.digest, output_paths[i]);
if (not infos or not RetrieveToPaths(infos->second, infos->first)) {
return false;
}
@@ -170,7 +170,7 @@ auto BazelApi::CreateAction(
std::vector<bazel_re::Digest> blob_digests{};
for (auto const& info : missing_artifacts_info) {
if (IsTreeObject(info.type)) {
- auto const infos = network_->ReadTreeInfosDirect(
+ auto const infos = network_->ReadDirectTreeEntries(
info.digest, std::filesystem::path{});
if (not infos or not RetrieveToCas(infos->second, api)) {
return false;
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
index 4fb9398b..681811cf 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
@@ -237,9 +237,10 @@ auto BazelNetwork::GetCachedActionResult(
instance_name_, action, false, false, output_files);
}
-auto BazelNetwork::ReadTreeInfos(bazel_re::Digest const& tree_digest,
- std::filesystem::path const& parent,
- bool request_remote_tree) const noexcept
+auto BazelNetwork::RecursivelyReadTreeLeafs(
+ bazel_re::Digest const& tree_digest,
+ std::filesystem::path const& parent,
+ bool request_remote_tree) const noexcept
-> std::optional<std::pair<std::vector<std::filesystem::path>,
std::vector<Artifact::ObjectInfo>>> {
std::optional<DirectoryMap> dir_map{std::nullopt};
@@ -279,7 +280,7 @@ auto BazelNetwork::ReadTreeInfos(bazel_re::Digest const& tree_digest,
return std::nullopt;
}
-auto BazelNetwork::ReadTreeInfosDirect(
+auto BazelNetwork::ReadDirectTreeEntries(
bazel_re::Digest const& tree_digest,
std::filesystem::path const& parent) const noexcept
-> std::optional<std::pair<std::vector<std::filesystem::path>,
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
index 7b0d69ae..2143b47a 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
@@ -78,14 +78,28 @@ class BazelNetwork {
std::vector<std::string> const& output_files) const noexcept
-> std::optional<bazel_re::ActionResult>;
- [[nodiscard]] auto ReadTreeInfos(
+ /// \brief Traverses a tree recursively and retrieves object infos of all
+ /// found blobs. Tree objects are not added to the result list, but
+ /// converted to a path name.
+ /// \param tree_digest Digest of the tree.
+ /// \param parent Local parent path.
+ /// \param request_remote_tree Query full tree from remote CAS.
+ /// \returns Pair of vectors, first containing filesystem paths, second
+ /// containing object infos.
+ [[nodiscard]] auto RecursivelyReadTreeLeafs(
bazel_re::Digest const& tree_digest,
std::filesystem::path const& parent,
bool request_remote_tree = false) const noexcept
-> std::optional<std::pair<std::vector<std::filesystem::path>,
std::vector<Artifact::ObjectInfo>>>;
- [[nodiscard]] auto ReadTreeInfosDirect(
+ /// \brief Reads the flat content of a tree and returns object infos of all
+ /// its direct entries (trees and blobs).
+ /// \param tree_digest Digest of the tree.
+ /// \param parent Local parent path.
+ /// \returns Pair of vectors, first containing filesystem paths, second
+ /// containing object infos.
+ [[nodiscard]] auto ReadDirectTreeEntries(
bazel_re::Digest const& tree_digest,
std::filesystem::path const& parent) const noexcept
-> std::optional<std::pair<std::vector<std::filesystem::path>,