summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-21 11:39:34 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-01-23 16:50:37 +0100
commit432fd50358cfb7d90ca98bbf702d4909b30f74e8 (patch)
tree3836794aff374bf5298c0b07dd0abdba179e2793 /src/other_tools/root_maps
parentbbfd7d286ee5ed4e3caceb20d9debb0f971adb19 (diff)
downloadjustbuild-432fd50358cfb7d90ca98bbf702d4909b30f74e8.tar.gz
Call serve directly instead of EnsureAbsentRootOnServe.
Diffstat (limited to 'src/other_tools/root_maps')
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp26
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp38
2 files changed, 15 insertions, 49 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 422a89cd..49329908 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -417,17 +417,8 @@ auto CreateDistdirGitMap(
// remote CAS
if (digest and remote_api->IsAvailable({*digest})) {
// tell serve to set up the root from the remote CAS
- // tree; upload can be skipped
- if (EnsureAbsentRootOnServe(
- *serve,
- tree_id,
- /*repo_path=*/"",
- native_storage_config,
- /*compat_storage_config=*/nullptr,
- /*local_api=*/nullptr,
- /*remote_api=*/nullptr,
- logger,
- /*no_sync_is_fatal=*/true)) {
+ // tree
+ if (serve->GetTreeFromRemote(*digest)) {
// set workspace root as absent
(*setter)(std::pair(
nlohmann::json::array(
@@ -457,17 +448,8 @@ auto CreateDistdirGitMap(
return;
}
// tell serve to set up the root from the remote CAS
- // tree; upload can be skipped
- if (EnsureAbsentRootOnServe(
- *serve,
- tree_id,
- /*repo_path=*/"",
- native_storage_config,
- /*compat_storage_config=*/nullptr,
- /*local_api=*/nullptr,
- /*remote_api=*/nullptr,
- logger,
- /*no_sync_is_fatal=*/true)) {
+ // tree
+ if (serve->GetTreeFromRemote(*digest)) {
// set workspace root as absent
(*setter)(std::pair(
nlohmann::json::array(
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 6fe0f5ee..8ab53daa 100644
--- a/src/other_tools/root_maps/tree_id_git_map.cpp
+++ b/src/other_tools/root_maps/tree_id_git_map.cpp
@@ -74,24 +74,18 @@ void UploadToServeAndSetRoot(
return;
}
// tell serve to set up the root from the remote CAS tree;
- // upload can be skipped
- if (EnsureAbsentRootOnServe(serve,
- tree_id,
- /*repo_path=*/"",
- native_storage_config,
- /*compat_storage_config=*/nullptr,
- /*local_api=*/nullptr,
- /*remote_api=*/nullptr,
- logger,
- /*no_sync_is_fatal=*/true)) {
- // set workspace root as absent
- auto root = nlohmann::json::array(
- {ignore_special ? FileRoot::kGitTreeIgnoreSpecialMarker
- : FileRoot::kGitTreeMarker,
- tree_id});
- (*setter)(std::pair(std::move(root), /*is_cache_hit=*/false));
+ if (not serve.GetTreeFromRemote(digest)) {
+ (*logger)(
+ fmt::format("Serve endpoint failed to sync root tree {}.", tree_id),
+ /*fatal=*/true);
return;
}
+ // set workspace root as absent
+ auto root = nlohmann::json::array(
+ {ignore_special ? FileRoot::kGitTreeIgnoreSpecialMarker
+ : FileRoot::kGitTreeMarker,
+ tree_id});
+ (*setter)(std::pair(std::move(root), /*is_cache_hit=*/false));
}
/// \brief Guarantees it terminates by either calling the setter or calling the
@@ -233,17 +227,7 @@ auto CreateTreeIdGitMap(
auto const digest = ArtifactDigest{key.tree_info.tree_hash, 0};
if (remote_api->IsAvailable({digest})) {
// tell serve to set up the root from the remote CAS tree;
- // upload can be skipped
- if (EnsureAbsentRootOnServe(
- *serve,
- key.tree_info.tree_hash.Hash(),
- /*repo_path=*/"",
- native_storage_config,
- /*compat_storage_config=*/nullptr,
- /*local_api=*/nullptr,
- /*remote_api=*/nullptr,
- logger,
- /*no_sync_is_fatal=*/true)) {
+ if (serve->GetTreeFromRemote(digest)) {
// set workspace root as absent
auto root = nlohmann::json::array(
{key.ignore_special