summaryrefslogtreecommitdiff
path: root/src/buildtool/serve_api/serve_service/source_tree.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-12-05 11:46:09 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-12-07 10:00:12 +0100
commit0cdd6595bae75e4c8a223bb9fe497ed1b0d42c31 (patch)
tree24f539b2fa4b76c8011210352a02265aba22a11c /src/buildtool/serve_api/serve_service/source_tree.hpp
parentf4e9235d86a35faeccf6e0ad88d17c401d5b9150 (diff)
downloadjustbuild-0cdd6595bae75e4c8a223bb9fe497ed1b0d42c31.tar.gz
just serve: Implement server-side ServeTree RPC
Diffstat (limited to 'src/buildtool/serve_api/serve_service/source_tree.hpp')
-rw-r--r--src/buildtool/serve_api/serve_service/source_tree.hpp14
1 files changed, 14 insertions, 0 deletions
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> logger_{std::make_shared<Logger>("serve-service")};
@@ -123,6 +132,11 @@ class SourceTreeService final
std::optional<PragmaSpecial> 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<Logger> const& logger) -> bool;
};
#endif // INCLUDED_SRC_BUILDTOOL_SERVE_API_SERVE_SERVICE_SOURCE_TREE_HPP