summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps/distdir_git_map.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-10-24 11:18:49 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-10-25 13:00:43 +0200
commit4018960c59d3fd0702c714e404ac913b2e83c3f5 (patch)
tree1de10348b25c7d6b9ea0f4de424b75f0cb7da11a /src/other_tools/root_maps/distdir_git_map.cpp
parent3d0003c7a61d77af534ef5d79a395849684518f7 (diff)
downloadjustbuild-4018960c59d3fd0702c714e404ac913b2e83c3f5.tar.gz
serve service: Respond also with digest in serve repository tree RPCs
...besides the simple Git hash, if syncing was done. This way one can know what digest to ask for from the remote. The serve client also needs to now know what hash function the remote expects. The serve service proto file is updated accordingly.
Diffstat (limited to 'src/other_tools/root_maps/distdir_git_map.cpp')
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 82c0c623..ef460949 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -224,21 +224,20 @@ auto CreateDistdirGitMap(
if (not *has_tree) {
// try to see if serve endpoint has the
// information to prepare the root itself
- auto serve_result =
+ auto const serve_result =
serve->RetrieveTreeFromDistdir(
key.content_list,
/*sync_tree=*/false);
if (serve_result) {
// if serve has set up the tree, it must
// match what we expect
- auto const& served_tree_id = *serve_result;
- if (distdir_tree_id != served_tree_id) {
+ if (distdir_tree_id != serve_result->tree) {
(*logger)(
fmt::format(
"Mismatch in served root tree "
"id:\nexpected {}, but got {}",
distdir_tree_id,
- served_tree_id),
+ serve_result->tree),
/*fatal=*/true);
return;
}
@@ -376,19 +375,18 @@ auto CreateDistdirGitMap(
}
// try to see if serve endpoint has the information to
// prepare the root itself
- auto serve_result =
+ auto const serve_result =
serve->RetrieveTreeFromDistdir(key.content_list,
/*sync_tree=*/false);
if (serve_result) {
// if serve has set up the tree, it must match what we
// expect
- auto const& served_tree_id = *serve_result;
- if (tree_id != served_tree_id) {
+ if (tree_id != serve_result->tree) {
(*logger)(
fmt::format("Mismatch in served root tree "
"id:\nexpected {}, but got {}",
tree_id,
- served_tree_id),
+ serve_result->tree),
/*fatal=*/true);
return;
}
@@ -520,18 +518,17 @@ auto CreateDistdirGitMap(
// now ask serve endpoint if it can set up the root; as this is for
// a present root, a corresponding remote endpoint is needed
if (serve != nullptr and remote_api != nullptr) {
- auto serve_result =
+ auto const serve_result =
serve->RetrieveTreeFromDistdir(key.content_list,
/*sync_tree=*/true);
if (serve_result) {
// if serve has set up the tree, it must match what we
// expect
- auto const& served_tree_id = *serve_result;
- if (tree_id != served_tree_id) {
+ if (tree_id != serve_result->tree) {
(*logger)(fmt::format("Mismatch in served root tree "
"id:\nexpected {}, but got {}",
tree_id,
- served_tree_id),
+ serve_result->tree),
/*fatal=*/true);
return;
}