diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-11 16:07:50 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-18 12:05:10 +0200 |
commit | ec447408d17c530ce2023d8148dd34a6d8138535 (patch) | |
tree | c644991efe281d3a7fa91451fa2d4fa70884f763 /src/other_tools/root_maps/root_utils.cpp | |
parent | 651af149098289b60cdfb062d36eb435d8e49c52 (diff) | |
download | justbuild-ec447408d17c530ce2023d8148dd34a6d8138535.tar.gz |
Pass ServeApi to just-mr maps by reference
...instead of using singleton calls.
Diffstat (limited to 'src/other_tools/root_maps/root_utils.cpp')
-rw-r--r-- | src/other_tools/root_maps/root_utils.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/other_tools/root_maps/root_utils.cpp b/src/other_tools/root_maps/root_utils.cpp index f0269b33..38c1e205 100644 --- a/src/other_tools/root_maps/root_utils.cpp +++ b/src/other_tools/root_maps/root_utils.cpp @@ -20,12 +20,12 @@ #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/execution_api/git/git_api.hpp" #include "src/buildtool/file_system/object_type.hpp" -#include "src/buildtool/serve_api/remote/serve_api.hpp" -auto CheckServeHasAbsentRoot(std::string const& tree_id, +auto CheckServeHasAbsentRoot(ServeApi const& serve, + std::string const& tree_id, AsyncMapConsumerLoggerPtr const& logger) -> std::optional<bool> { - if (auto has_tree = ServeApi::Instance().CheckRootTree(tree_id)) { + if (auto has_tree = serve.CheckRootTree(tree_id)) { return *has_tree; } (*logger)(fmt::format("Checking that the serve endpoint knows tree " @@ -36,6 +36,7 @@ auto CheckServeHasAbsentRoot(std::string const& tree_id, } auto EnsureAbsentRootOnServe( + ServeApi const& serve, std::string const& tree_id, std::filesystem::path const& repo_path, std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, @@ -64,7 +65,7 @@ auto EnsureAbsentRootOnServe( } } // ask serve endpoint to retrieve the uploaded tree - if (not ServeApi::Instance().GetTreeFromRemote(tree_id)) { + if (not serve.GetTreeFromRemote(tree_id)) { // respond based on no_sync_is_fatal flag (*logger)( fmt::format("Serve endpoint failed to sync root tree {}.", tree_id), |