From 4018960c59d3fd0702c714e404ac913b2e83c3f5 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 24 Oct 2024 11:18:49 +0200 Subject: 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. --- src/buildtool/serve_api/remote/serve_api.hpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/buildtool/serve_api/remote/serve_api.hpp') diff --git a/src/buildtool/serve_api/remote/serve_api.hpp b/src/buildtool/serve_api/remote/serve_api.hpp index 23c87982..ee60f4f1 100644 --- a/src/buildtool/serve_api/remote/serve_api.hpp +++ b/src/buildtool/serve_api/remote/serve_api.hpp @@ -46,7 +46,9 @@ class ServeApi final { gsl::not_null const& local_context, gsl::not_null const& remote_context, gsl::not_null const& apis) noexcept - : stc_{address, remote_context}, + : stc_{address, + &local_context->storage_config->hash_function, + remote_context}, tc_{address, local_context->storage, remote_context, apis}, cc_{address, remote_context} {} @@ -71,10 +73,10 @@ class ServeApi final { return std::nullopt; } - [[nodiscard]] auto RetrieveTreeFromCommit(std::string const& commit, - std::string const& subdir = ".", - bool sync_tree = false) - const noexcept -> expected { + [[nodiscard]] auto RetrieveTreeFromCommit( + std::string const& commit, + std::string const& subdir = ".", + bool sync_tree = false) const noexcept -> SourceTreeClient::result_t { return stc_.ServeCommitTree(commit, subdir, sync_tree); } @@ -83,8 +85,7 @@ class ServeApi final { std::string const& archive_type = "archive", std::string const& subdir = ".", std::optional const& resolve_symlinks = std::nullopt, - bool sync_tree = false) const noexcept - -> expected { + bool sync_tree = false) const noexcept -> SourceTreeClient::result_t { return stc_.ServeArchiveTree( content, archive_type, subdir, resolve_symlinks, sync_tree); } @@ -92,15 +93,14 @@ class ServeApi final { [[nodiscard]] auto RetrieveTreeFromDistdir( std::shared_ptr> const& distfiles, - bool sync_tree = false) const noexcept - -> expected { + bool sync_tree = false) const noexcept -> SourceTreeClient::result_t { return stc_.ServeDistdirTree(distfiles, sync_tree); } - [[nodiscard]] auto RetrieveTreeFromForeignFile(const std::string& content, - const std::string& name, - bool executable) - const noexcept -> expected { + [[nodiscard]] auto RetrieveTreeFromForeignFile( + const std::string& content, + const std::string& name, + bool executable) const noexcept -> SourceTreeClient::result_t { return stc_.ServeForeignFileTree(content, name, executable); } -- cgit v1.2.3