From 0cdd6595bae75e4c8a223bb9fe497ed1b0d42c31 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 5 Dec 2023 11:46:09 +0100 Subject: just serve: Implement server-side ServeTree RPC --- src/buildtool/serve_api/serve_service/source_tree.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/buildtool/serve_api/serve_service/source_tree.hpp') diff --git a/src/buildtool/serve_api/serve_service/source_tree.hpp b/src/buildtool/serve_api/serve_service/source_tree.hpp index 03687df4..1204d9b7 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.hpp +++ b/src/buildtool/serve_api/serve_service/source_tree.hpp @@ -42,6 +42,7 @@ class SourceTreeService final ::justbuild::just_serve::ServeArchiveTreeResponse; using ServeContentResponse = ::justbuild::just_serve::ServeContentResponse; + using ServeTreeResponse = ::justbuild::just_serve::ServeTreeResponse; // Retrieve the Git-subtree identifier from a given Git commit. // @@ -69,6 +70,14 @@ class SourceTreeService final const ::justbuild::just_serve::ServeContentRequest* request, ServeContentResponse* response) -> ::grpc::Status override; + // Make a given tree identifier available in remote CAS, + // if tree is known. + // + // There are no method-specific errors. + auto ServeTree(::grpc::ServerContext* context, + const ::justbuild::just_serve::ServeTreeRequest* request, + ServeTreeResponse* response) -> ::grpc::Status override; + private: mutable std::shared_mutex mutex_; std::shared_ptr logger_{std::make_shared("serve-service")}; @@ -123,6 +132,11 @@ class SourceTreeService final std::optional const& resolve_special, bool sync_tree, ServeArchiveTreeResponse* response) -> ::grpc::Status; + + [[nodiscard]] static auto IsTreeInRepo( + std::string const& tree_id, + std::filesystem::path const& repo_path, + std::shared_ptr const& logger) -> bool; }; #endif // INCLUDED_SRC_BUILDTOOL_SERVE_API_SERVE_SERVICE_SOURCE_TREE_HPP -- cgit v1.2.3