diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 2 | ||||
-rw-r--r-- | src/other_tools/just_mr/setup.cpp | 10 | ||||
-rw-r--r-- | src/other_tools/just_mr/setup_utils.cpp | 11 | ||||
-rw-r--r-- | src/other_tools/just_mr/setup_utils.hpp | 8 | ||||
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 16 | ||||
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/content_git_map.cpp | 10 | ||||
-rw-r--r-- | src/other_tools/root_maps/content_git_map.hpp | 2 |
8 files changed, 31 insertions, 30 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index 70322d98..16dcda22 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -269,7 +269,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, nr == 1 ? "archive" : "archives"); // setup the APIs for archive fetches - auto remote_api = JustMR::Utils::SetupRemoteApi( + auto remote_api = JustMR::Utils::GetRemoteApi( common_args.remote_execution_address, auth_args); IExecutionApi::Ptr local_api{remote_api ? std::make_unique<LocalApi>() : nullptr}; diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp index 5aab7095..b71ae3bb 100644 --- a/src/other_tools/just_mr/setup.cpp +++ b/src/other_tools/just_mr/setup.cpp @@ -90,13 +90,13 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, } // setup the APIs for archive fetches - auto remote_api = JustMR::Utils::SetupRemoteApi( + auto remote_api = JustMR::Utils::GetRemoteApi( common_args.remote_execution_address, auth_args); IExecutionApi::Ptr local_api{remote_api ? std::make_unique<LocalApi>() : nullptr}; - // setup the API for serving trees of Gti repos or archives - auto serve_api = JustMR::Utils::SetupServeApi( + // setup the API for serving trees of Git repos or archives + auto serve_api_exists = JustMR::Utils::SetupServeApi( common_args.remote_serve_address, auth_args); // setup the required async maps @@ -123,7 +123,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, common_args.alternative_mirrors, common_args.git_path->string(), *common_args.local_launcher, - serve_api ? &(*serve_api) : nullptr, + serve_api_exists, local_api ? &(*local_api) : nullptr, remote_api ? &(*remote_api) : nullptr, common_args.fetch_absent, @@ -136,7 +136,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, common_args.ca_info, &resolve_symlinks_map, &critical_git_op_map, - serve_api ? &(*serve_api) : nullptr, + serve_api_exists, local_api ? &(*local_api) : nullptr, remote_api ? &(*remote_api) : nullptr, common_args.fetch_absent, diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 332503ea..839b47a3 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -238,8 +238,8 @@ auto ReadConfiguration( } } -auto SetupRemoteApi(std::optional<std::string> const& remote_exec_addr, - MultiRepoRemoteAuthArguments const& auth) +auto GetRemoteApi(std::optional<std::string> const& remote_exec_addr, + MultiRepoRemoteAuthArguments const& auth) -> IExecutionApi::Ptr { // we only allow remotes in native mode if (remote_exec_addr and not Compatibility::IsCompatible()) { @@ -262,7 +262,7 @@ auto SetupRemoteApi(std::optional<std::string> const& remote_exec_addr, } auto SetupServeApi(std::optional<std::string> const& remote_serve_addr, - MultiRepoRemoteAuthArguments const& auth) -> ServeApi::Ptr { + MultiRepoRemoteAuthArguments const& auth) -> bool { if (remote_serve_addr) { // setup authentication SetupAuthConfig(auth); @@ -273,10 +273,9 @@ auto SetupServeApi(std::optional<std::string> const& remote_serve_addr, *remote_serve_addr); std::exit(kExitConfigError); } - auto address = RemoteServeConfig::RemoteAddress(); - return std::make_unique<ServeApi>(address->host, address->port); + return true; } - return nullptr; + return false; } } // namespace JustMR::Utils diff --git a/src/other_tools/just_mr/setup_utils.hpp b/src/other_tools/just_mr/setup_utils.hpp index 9530cc95..d66a1ba1 100644 --- a/src/other_tools/just_mr/setup_utils.hpp +++ b/src/other_tools/just_mr/setup_utils.hpp @@ -59,15 +59,17 @@ void DefaultReachableRepositories( std::optional<std::filesystem::path> const& absent_file_opt) noexcept -> std::shared_ptr<Configuration>; -/// \brief Setup of a remote API based on just-mr arguments. -[[nodiscard]] auto SetupRemoteApi( +/// \brief Get a remote API instance based on just-mr arguments. +/// \returns Pointer to a configured remote API, or nullptr. +[[nodiscard]] auto GetRemoteApi( std::optional<std::string> const& remote_exec_addr, MultiRepoRemoteAuthArguments const& auth) -> IExecutionApi::Ptr; /// \brief Setup of a 'just serve' remote API based on just-mr arguments. +/// \returns Flag stating whether a serve API is available or not. [[nodiscard]] auto SetupServeApi( std::optional<std::string> const& remote_serve_addr, - MultiRepoRemoteAuthArguments const& auth) -> ServeApi::Ptr; + MultiRepoRemoteAuthArguments const& auth) -> bool; } // namespace Utils diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index ad269b5e..35d162f9 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -94,7 +94,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, gsl::not_null<ImportToGitMap*> const& import_to_git_map, std::string const& git_bin, std::vector<std::string> const& launcher, - ServeApi* serve_api, + bool serve_api_exists, IExecutionApi* local_api, IExecutionApi* remote_api, bool fetch_absent, @@ -176,11 +176,11 @@ void EnsureCommit(GitRepoInfo const& repo_info, JustMRProgress::Instance().TaskTracker().Start(repo_info.origin); // check if commit is known to remote serve service, if asked for an // absent root - if (serve_api != nullptr) { + if (serve_api_exists) { // if fetching absent, request (and sync) the whole commit tree, // to ensure we maintain the id file association if (fetch_absent) { - if (auto root_tree_id = serve_api->RetrieveTreeFromCommit( + if (auto root_tree_id = ServeApi::RetrieveTreeFromCommit( repo_info.hash, /*subdir = */ ".", /*sync_tree = */ true)) { @@ -315,7 +315,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, } // if not fetching absent, request the subdir tree directly else { - if (auto tree_id = serve_api->RetrieveTreeFromCommit( + if (auto tree_id = ServeApi::RetrieveTreeFromCommit( repo_info.hash, repo_info.subdir, /*sync_tree = */ false)) { @@ -624,7 +624,7 @@ auto CreateCommitGitMap( MirrorsPtr const& additional_mirrors, std::string const& git_bin, std::vector<std::string> const& launcher, - ServeApi* serve_api, + bool serve_api_exists, IExecutionApi* local_api, IExecutionApi* remote_api, bool fetch_absent, @@ -635,7 +635,7 @@ auto CreateCommitGitMap( additional_mirrors, git_bin, launcher, - serve_api, + serve_api_exists, local_api, remote_api, fetch_absent](auto ts, @@ -675,7 +675,7 @@ auto CreateCommitGitMap( import_to_git_map, git_bin, launcher, - serve_api, + serve_api_exists, local_api, remote_api, fetch_absent, @@ -708,7 +708,7 @@ auto CreateCommitGitMap( import_to_git_map, git_bin, launcher, - serve_api, + serve_api_exists, local_api, remote_api, fetch_absent, diff --git a/src/other_tools/root_maps/commit_git_map.hpp b/src/other_tools/root_maps/commit_git_map.hpp index 70623598..4bf4100b 100644 --- a/src/other_tools/root_maps/commit_git_map.hpp +++ b/src/other_tools/root_maps/commit_git_map.hpp @@ -76,7 +76,7 @@ using CommitGitMap = MirrorsPtr const& additional_mirrors, std::string const& git_bin, std::vector<std::string> const& launcher, - ServeApi* serve_api, + bool serve_api_exists, IExecutionApi* local_api, IExecutionApi* remote_api, bool fetch_absent, diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp index 79500f5d..344fec0b 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -306,7 +306,7 @@ auto CreateContentGitMap( CAInfoPtr const& ca_info, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - ServeApi* serve_api, + bool serve_api_exists, IExecutionApi* local_api, IExecutionApi* remote_api, bool fetch_absent, @@ -318,7 +318,7 @@ auto CreateContentGitMap( just_mr_paths, additional_mirrors, ca_info, - serve_api, + serve_api_exists, local_api, remote_api, fetch_absent](auto ts, @@ -469,13 +469,13 @@ auto CreateContentGitMap( return; } // check if content is known to remote serve service - if (serve_api != nullptr) { + if (serve_api_exists) { // if fetching absent, request (and sync) the whole archive // tree, UNRESOLVED, to ensure we maintain the id file // association if (fetch_absent) { if (auto root_tree_id = - serve_api->RetrieveTreeFromArchive( + ServeApi::RetrieveTreeFromArchive( key.archive.content, key.repo_type, /*subdir = */ ".", @@ -810,7 +810,7 @@ auto CreateContentGitMap( // if not fetching absent, request the resolved subdir // tree directly else { - if (auto tree_id = serve_api->RetrieveTreeFromArchive( + if (auto tree_id = ServeApi::RetrieveTreeFromArchive( key.archive.content, key.repo_type, key.subdir, diff --git a/src/other_tools/root_maps/content_git_map.hpp b/src/other_tools/root_maps/content_git_map.hpp index 986a0531..4dc3180e 100644 --- a/src/other_tools/root_maps/content_git_map.hpp +++ b/src/other_tools/root_maps/content_git_map.hpp @@ -38,7 +38,7 @@ using ContentGitMap = CAInfoPtr const& ca_info, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - ServeApi* serve_api, + bool serve_api_exists, IExecutionApi* local_api, IExecutionApi* remote_api, bool fetch_absent, |