diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-10-24 11:18:49 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-10-25 13:00:43 +0200 |
commit | 4018960c59d3fd0702c714e404ac913b2e83c3f5 (patch) | |
tree | 1de10348b25c7d6b9ea0f4de424b75f0cb7da11a /src/other_tools/root_maps/content_git_map.cpp | |
parent | 3d0003c7a61d77af534ef5d79a395849684518f7 (diff) | |
download | justbuild-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/content_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/content_git_map.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp index ecae60ac..2338c066 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -71,7 +71,7 @@ void EnsureRootAsAbsent( // try to see if serve endpoint has the information to prepare the // root itself; this is redundant if root is not already cached if (is_cache_hit) { - auto serve_result = serve->RetrieveTreeFromArchive( + auto const serve_result = serve->RetrieveTreeFromArchive( key.archive.content_hash.Hash(), key.repo_type, key.subdir, @@ -80,12 +80,11 @@ void EnsureRootAsAbsent( 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; } @@ -1047,7 +1046,7 @@ auto CreateContentGitMap( // request the resolved subdir tree from the serve endpoint, if // given if (serve != nullptr) { - auto serve_result = serve->RetrieveTreeFromArchive( + auto const serve_result = serve->RetrieveTreeFromArchive( key.archive.content_hash.Hash(), key.repo_type, key.subdir, @@ -1058,7 +1057,7 @@ auto CreateContentGitMap( progress->TaskTracker().Stop(key.archive.origin); (*setter)(std::pair( nlohmann::json::array( - {FileRoot::kGitTreeMarker, *serve_result}), + {FileRoot::kGitTreeMarker, serve_result->tree}), /*is_cache_hit = */ false)); return; } |