diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-12-01 10:46:10 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-12-05 10:52:23 +0100 |
commit | caac34fc4d965f8ff974fe1dc4b7d5cbb779ef23 (patch) | |
tree | 64663306a0145df9a33380fda8b7816f62dd781d /src/buildtool/serve_api/serve_service/target.hpp | |
parent | 73d7feb6a9ce885863213bfeffbbdec0ad7c2935 (diff) | |
download | justbuild-caac34fc4d965f8ff974fe1dc4b7d5cbb779ef23.tar.gz |
just serve: Orchestrate remote build for uncached export targets
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. |