From caac34fc4d965f8ff974fe1dc4b7d5cbb779ef23 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 1 Dec 2023 10:46:10 +0100 Subject: just serve: Orchestrate remote build for uncached export targets --- src/buildtool/serve_api/serve_service/target.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/buildtool/serve_api/serve_service/target.hpp') diff --git a/src/buildtool/serve_api/serve_service/target.hpp b/src/buildtool/serve_api/serve_service/target.hpp index 64143776..5cb18426 100644 --- a/src/buildtool/serve_api/serve_service/target.hpp +++ b/src/buildtool/serve_api/serve_service/target.hpp @@ -22,6 +22,7 @@ #include "gsl/gsl" #include "justbuild/just_serve/just_serve.grpc.pb.h" #include "src/buildtool/common/remote/remote_common.hpp" +#include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/execution_api/common/create_execution_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/logging/logger.hpp" @@ -77,6 +78,27 @@ class TargetService final : public justbuild::just_serve::Target::Service { gsl::not_null const local_api_{ CreateExecutionApi(std::nullopt)}; + /// \brief Check if tree exists in the given repository. + [[nodiscard]] static auto IsTreeInRepo( + std::string const& tree_id, + std::filesystem::path const& repo_path, + std::shared_ptr const& logger) -> bool; + + /// \brief For a given tree id, find the known repository that can serve it. + [[nodiscard]] static auto GetServingRepository( + std::string const& tree_id, + std::shared_ptr const& logger) + -> std::optional; + + /// \brief Parse the stored repository configuration blob and populate the + /// RepositoryConfig instance. + /// \returns nullopt on success, error message as a string otherwise. + [[nodiscard]] static auto DetermineRoots( + std::string const& main_repo, + std::filesystem::path const& repo_config_path, + gsl::not_null const& repository_config, + std::shared_ptr const& logger) -> std::optional; + /// \brief Get the blob content at given path inside a Git tree. /// \returns If tree found, pair of "no-internal-errors" flag and content of /// blob at the path specified if blob exists, nullopt otherwise. -- cgit v1.2.3