summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-30 15:18:35 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-02-07 14:58:04 +0100
commit477c7d5e496b8eb5113b3b51f7152e05eae51fd7 (patch)
treedc66932c55fb9e7fd2353a6920bf1b0487209641
parent0a8dbe086a23bbb905514007d21e2e04cdaae1e8 (diff)
downloadjustbuild-477c7d5e496b8eb5113b3b51f7152e05eae51fd7.tar.gz
IExecutionApi: Rename IsAvailable to GetMissingDigests
-rw-r--r--src/buildtool/execution_api/common/common_api.hpp2
-rw-r--r--src/buildtool/execution_api/common/execution_api.hpp2
-rw-r--r--src/buildtool/execution_api/git/git_api.hpp2
-rw-r--r--src/buildtool/execution_api/local/local_api.hpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_api.cpp6
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_api.hpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_network.cpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_network.hpp2
-rw-r--r--src/buildtool/execution_api/serve/mr_git_api.hpp2
-rw-r--r--src/buildtool/execution_api/serve/mr_local_api.cpp9
-rw-r--r--src/buildtool/execution_api/serve/mr_local_api.hpp2
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp2
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp6
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp2
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp2
15 files changed, 23 insertions, 22 deletions
diff --git a/src/buildtool/execution_api/common/common_api.hpp b/src/buildtool/execution_api/common/common_api.hpp
index d5daa3dd..f58e4893 100644
--- a/src/buildtool/execution_api/common/common_api.hpp
+++ b/src/buildtool/execution_api/common/common_api.hpp
@@ -84,7 +84,7 @@ template <typename TValue, typename TIterator>
return std::nullopt;
}
}
- res.digests = api.IsAvailable(digests);
+ res.digests = api.GetMissingDigests(digests);
return res;
}
diff --git a/src/buildtool/execution_api/common/execution_api.hpp b/src/buildtool/execution_api/common/execution_api.hpp
index b868b57d..f0ea0e4e 100644
--- a/src/buildtool/execution_api/common/execution_api.hpp
+++ b/src/buildtool/execution_api/common/execution_api.hpp
@@ -129,7 +129,7 @@ class IExecutionApi {
[[nodiscard]] virtual auto IsAvailable(
ArtifactDigest const& digest) const noexcept -> bool = 0;
- [[nodiscard]] virtual auto IsAvailable(
+ [[nodiscard]] virtual auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> = 0;
diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp
index 7fd21005..5defc50a 100644
--- a/src/buildtool/execution_api/git/git_api.hpp
+++ b/src/buildtool/execution_api/git/git_api.hpp
@@ -328,7 +328,7 @@ class GitApi final : public IExecutionApi {
.has_value();
}
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> override {
std::unordered_set<ArtifactDigest> result;
diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp
index f1e448a0..a9d6b660 100644
--- a/src/buildtool/execution_api/local/local_api.hpp
+++ b/src/buildtool/execution_api/local/local_api.hpp
@@ -312,7 +312,7 @@ class LocalApi final : public IExecutionApi {
return found;
}
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> final {
std::unordered_set<ArtifactDigest> result;
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
index 66f81d01..ae5285df 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
@@ -117,7 +117,7 @@ namespace {
}
// Fetch unknown chunks.
- auto missing_artifact_digests = other_api.IsAvailable(
+ auto missing_artifact_digests = other_api.GetMissingDigests(
std::unordered_set(chunk_digests->begin(), chunk_digests->end()));
std::vector<ArtifactDigest> missing_digests;
@@ -570,7 +570,7 @@ auto BazelApi::CreateAction(
return network_->IsAvailable(ArtifactDigestFactory::ToBazel(digest));
}
-[[nodiscard]] auto BazelApi::IsAvailable(
+[[nodiscard]] auto BazelApi::GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> {
auto const back_map = BackMap<bazel_re::Digest, ArtifactDigest>::Make(
@@ -579,7 +579,7 @@ auto BazelApi::CreateAction(
return digests;
}
- auto const bazel_result = network_->IsAvailable(back_map->GetKeys());
+ auto const bazel_result = network_->FindMissingBlobs(back_map->GetKeys());
return back_map->GetValues(bazel_result);
}
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp
index de4662db..22680aac 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp
@@ -102,7 +102,7 @@ class BazelApi final : public IExecutionApi {
[[nodiscard]] auto IsAvailable(ArtifactDigest const& digest) const noexcept
-> bool final;
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> final;
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
index eb18a858..3f33136a 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp
@@ -47,7 +47,7 @@ auto BazelNetwork::IsAvailable(bazel_re::Digest const& digest) const noexcept
return cas_->FindMissingBlobs(instance_name_, {digest}).empty();
}
-auto BazelNetwork::IsAvailable(
+auto BazelNetwork::FindMissingBlobs(
std::unordered_set<bazel_re::Digest> const& digests) const noexcept
-> std::unordered_set<bazel_re::Digest> {
return cas_->FindMissingBlobs(instance_name_, digests);
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
index 0b141845..2e99de9f 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp
@@ -52,7 +52,7 @@ class BazelNetwork {
[[nodiscard]] auto IsAvailable(
bazel_re::Digest const& digest) const noexcept -> bool;
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto FindMissingBlobs(
std::unordered_set<bazel_re::Digest> const& digests) const noexcept
-> std::unordered_set<bazel_re::Digest>;
diff --git a/src/buildtool/execution_api/serve/mr_git_api.hpp b/src/buildtool/execution_api/serve/mr_git_api.hpp
index b03bfcf1..dbcedb61 100644
--- a/src/buildtool/execution_api/serve/mr_git_api.hpp
+++ b/src/buildtool/execution_api/serve/mr_git_api.hpp
@@ -123,7 +123,7 @@ class MRGitApi final : public IExecutionApi {
}
/// \brief Not implemented.
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& /*digests*/) const noexcept
-> std::unordered_set<ArtifactDigest> final {
// Not supported.
diff --git a/src/buildtool/execution_api/serve/mr_local_api.cpp b/src/buildtool/execution_api/serve/mr_local_api.cpp
index 5449b245..0e2f61e1 100644
--- a/src/buildtool/execution_api/serve/mr_local_api.cpp
+++ b/src/buildtool/execution_api/serve/mr_local_api.cpp
@@ -124,8 +124,9 @@ auto MRLocalApi::IsAvailable(ArtifactDigest const& digest) const noexcept
return compat_local_api_->IsAvailable(digest);
}
-auto MRLocalApi::IsAvailable(std::unordered_set<ArtifactDigest> const& digests)
- const noexcept -> std::unordered_set<ArtifactDigest> {
+auto MRLocalApi::GetMissingDigests(
+ std::unordered_set<ArtifactDigest> const& digests) const noexcept
+ -> std::unordered_set<ArtifactDigest> {
// This method can legitimately be called with both native and
// compatible digests when in compatible mode, therefore we need to
// interrogate the hash type of the input.
@@ -136,7 +137,7 @@ auto MRLocalApi::IsAvailable(std::unordered_set<ArtifactDigest> const& digests)
}
// native digests get dispatched to native local api
if (ProtocolTraits::IsNative(digests.begin()->GetHashType())) {
- return native_local_api_->IsAvailable(digests);
+ return native_local_api_->GetMissingDigests(digests);
}
// compatible digests get dispatched to compatible local api
if (compat_local_api_ == nullptr) {
@@ -144,5 +145,5 @@ auto MRLocalApi::IsAvailable(std::unordered_set<ArtifactDigest> const& digests)
"MRLocalApi: Unexpected digest type provided");
return {};
}
- return compat_local_api_->IsAvailable(digests);
+ return compat_local_api_->GetMissingDigests(digests);
}
diff --git a/src/buildtool/execution_api/serve/mr_local_api.hpp b/src/buildtool/execution_api/serve/mr_local_api.hpp
index c548241e..a4f6e0b1 100644
--- a/src/buildtool/execution_api/serve/mr_local_api.hpp
+++ b/src/buildtool/execution_api/serve/mr_local_api.hpp
@@ -126,7 +126,7 @@ class MRLocalApi final : public IExecutionApi {
/// \note The caller is responsible for passing vectors with digests of the
/// same type. For simplicity, this method takes the first digest of the
/// vector as representative for figuring out hash function type.
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> final;
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index af0b759e..308e59fc 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -319,7 +319,7 @@ class ExecutorImpl {
});
// find missing digests
- auto const missing_digests = api.IsAvailable(back_map->GetKeys());
+ auto const missing_digests = api.GetMissingDigests(back_map->GetKeys());
auto const missing_entries =
back_map->IterateReferences(&missing_digests);
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 44213cd9..02a935a4 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -416,7 +416,7 @@ auto CreateDistdirGitMap(
}
// try to supply the serve endpoint with the tree via the
// remote CAS
- if (digest and remote_api->IsAvailable({*digest})) {
+ if (digest and remote_api->IsAvailable(*digest)) {
// tell serve to set up the root from the remote CAS
// tree
if (serve->GetTreeFromRemote(*digest)) {
@@ -436,7 +436,7 @@ auto CreateDistdirGitMap(
}
// check if we have the tree in local CAS; if yes, upload it
// to remote for the serve endpoint to find it
- if (digest and local_api->IsAvailable({*digest})) {
+ if (digest and local_api->IsAvailable(*digest)) {
if (not local_api->RetrieveToCas(
{Artifact::ObjectInfo{
.digest = *digest,
@@ -481,7 +481,7 @@ auto CreateDistdirGitMap(
// if the root is not-absent, the order of checks is different;
// first, look in the local CAS
- if (digest and local_api->IsAvailable({*digest})) {
+ if (digest and local_api->IsAvailable(*digest)) {
ImportFromCASAndSetRoot(key,
*native_storage_config,
*native_storage,
diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp
index 9968053a..f6fac1d0 100644
--- a/src/other_tools/root_maps/tree_id_git_map.cpp
+++ b/src/other_tools/root_maps/tree_id_git_map.cpp
@@ -229,7 +229,7 @@ auto CreateTreeIdGitMap(
}
// check if tree in already in remote CAS
auto const digest = ArtifactDigest{key.tree_info.tree_hash, 0};
- if (remote_api->IsAvailable({digest})) {
+ if (remote_api->IsAvailable(digest)) {
// tell serve to set up the root from the remote CAS tree;
if (serve->GetTreeFromRemote(digest)) {
// set workspace root as absent
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index b36e5fba..2db9306b 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -249,7 +249,7 @@ class TestApi : public IExecutionApi {
return false;
}
}
- [[nodiscard]] auto IsAvailable(
+ [[nodiscard]] auto GetMissingDigests(
std::unordered_set<ArtifactDigest> const& digests) const noexcept
-> std::unordered_set<ArtifactDigest> final {
std::unordered_set<ArtifactDigest> result;