diff options
Diffstat (limited to 'src/buildtool/serve_api/serve_service/target.hpp')
-rw-r--r-- | src/buildtool/serve_api/serve_service/target.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
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<IExecutionApi::Ptr> 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<Logger> 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<Logger> const& logger) + -> std::optional<std::filesystem::path>; + + /// \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<RepositoryConfig*> const& repository_config, + std::shared_ptr<Logger> const& logger) -> std::optional<std::string>; + /// \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. |