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/buildtool/serve_api/remote/serve_api.hpp | |
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/buildtool/serve_api/remote/serve_api.hpp')
-rw-r--r-- | src/buildtool/serve_api/remote/serve_api.hpp | 26 |
1 files changed, 13 insertions, 13 deletions
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<LocalContext const*> const& local_context, gsl::not_null<RemoteContext const*> const& remote_context, gsl::not_null<ApiBundle const*> 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<std::string, GitLookupError> { + [[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<PragmaSpecial> const& resolve_symlinks = std::nullopt, - bool sync_tree = false) const noexcept - -> expected<std::string, GitLookupError> { + 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<std::unordered_map<std::string, std::string>> const& distfiles, - bool sync_tree = false) const noexcept - -> expected<std::string, GitLookupError> { + 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<std::string, GitLookupError> { + [[nodiscard]] auto RetrieveTreeFromForeignFile( + const std::string& content, + const std::string& name, + bool executable) const noexcept -> SourceTreeClient::result_t { return stc_.ServeForeignFileTree(content, name, executable); } |