From 93b92ef2669bed7345eadabbf71ee30c4b7929af Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 11 Dec 2023 12:25:55 +0100 Subject: serve target: Move server-side helper methods in own library --- src/buildtool/serve_api/serve_service/target.hpp | 34 ++---------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (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 5cb18426..b8257152 100644 --- a/src/buildtool/serve_api/serve_service/target.hpp +++ b/src/buildtool/serve_api/serve_service/target.hpp @@ -18,12 +18,13 @@ #include #include #include +#include #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/common/execution_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/logging/logger.hpp" @@ -77,37 +78,6 @@ class TargetService final : public justbuild::just_serve::Target::Service { // used for storing and retrieving target-level cache entries 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. - [[nodiscard]] static auto GetBlobContent( - std::filesystem::path const& repo_path, - std::string const& tree_id, - std::string const& rel_path, - std::shared_ptr const& logger) - -> std::optional>>; }; #endif // INCLUDED_SRC_BUILD_SERVE_API_SERVE_SERVICE_TARGET_HPP -- cgit v1.2.3