diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-26 09:38:36 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-27 11:24:20 +0200 |
commit | 76badf37b88c23081db72c206445d5f0bf4e28a4 (patch) | |
tree | 2376106b12c7664f80d9195e41371d3d31d0988d /src/other_tools/root_maps | |
parent | 915d3f2b0119f8bd31d026e686dbaf9124186e61 (diff) | |
download | justbuild-76badf37b88c23081db72c206445d5f0bf4e28a4.tar.gz |
Pass ServeApi to just-mr maps by raw pointer
...since it is used for capturing in lambdas for AsyncMaps and mustn't be temporary.
Diffstat (limited to 'src/other_tools/root_maps')
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 14 | ||||
-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 | 28 | ||||
-rw-r--r-- | src/other_tools/root_maps/content_git_map.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 12 | ||||
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/foreign_file_git_map.cpp | 8 | ||||
-rw-r--r-- | src/other_tools/root_maps/foreign_file_git_map.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/fpath_git_map.cpp | 20 | ||||
-rw-r--r-- | src/other_tools/root_maps/fpath_git_map.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/tree_id_git_map.cpp | 8 | ||||
-rw-r--r-- | src/other_tools/root_maps/tree_id_git_map.hpp | 2 |
12 files changed, 51 insertions, 51 deletions
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index 65585afc..22f85f35 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -61,12 +61,12 @@ namespace { void EnsureRootAsAbsent(std::string const& tree_id, std::filesystem::path const& repo_root, GitRepoInfo const& repo_info, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, CommitGitMap::SetterPtr const& ws_setter, CommitGitMap::LoggerPtr const& logger) { // this is an absent root - if (serve) { + if (serve != nullptr) { // check if the serve endpoint has this root auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger); if (not has_tree) { @@ -409,7 +409,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, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, bool fetch_absent, @@ -508,7 +508,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, // no id file association exists JustMRProgress::Instance().TaskTracker().Start(repo_info.origin); // check if commit is known to remote serve service - if (serve) { + if (serve != nullptr) { // if root purely absent, request only the subdir tree if (repo_info.absent and not fetch_absent) { auto serve_result = @@ -921,7 +921,7 @@ auto CreateCommitGitMap( MirrorsPtr const& additional_mirrors, std::string const& git_bin, std::vector<std::string> const& launcher, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, bool fetch_absent, @@ -932,7 +932,7 @@ auto CreateCommitGitMap( additional_mirrors, git_bin, launcher, - &serve, + serve, local_api, remote_api, fetch_absent](auto ts, @@ -973,7 +973,7 @@ auto CreateCommitGitMap( import_to_git_map, git_bin, launcher, - &serve, + serve, 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 14766018..78c67800 100644 --- a/src/other_tools/root_maps/commit_git_map.hpp +++ b/src/other_tools/root_maps/commit_git_map.hpp @@ -81,7 +81,7 @@ using CommitGitMap = MirrorsPtr const& additional_mirrors, std::string const& git_bin, std::vector<std::string> const& launcher, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* 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 a6d0fa15..eb4177d3 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -54,13 +54,13 @@ namespace { /// the setter on success. void EnsureRootAsAbsent(std::string const& tree_id, ArchiveRepoInfo const& key, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, bool is_cache_hit, ContentGitMap::SetterPtr const& ws_setter, ContentGitMap::LoggerPtr const& logger) { // this is an absent root - if (serve) { + if (serve != nullptr) { // check if the serve endpoint has this root auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger); if (not has_tree) { @@ -174,7 +174,7 @@ void ResolveContentTree( GitCASPtr const& just_git_cas, bool is_cache_hit, bool is_absent, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, @@ -230,7 +230,7 @@ void ResolveContentTree( is_cache_hit, key, is_absent, - &serve, + serve, remote_api, ts, ws_setter, @@ -272,7 +272,7 @@ void ResolveContentTree( key, tree_id_file, is_absent, - &serve, + serve, remote_api, is_cache_hit, ws_setter, @@ -363,7 +363,7 @@ void WriteIdFileAndSetWSRoot( GitCASPtr const& just_git_cas, std::filesystem::path const& archive_tree_id_file, bool is_absent, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, @@ -424,7 +424,7 @@ void ExtractAndImportToGit( std::filesystem::path const& content_cas_path, std::filesystem::path const& archive_tree_id_file, bool is_absent, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, @@ -460,7 +460,7 @@ void ExtractAndImportToGit( archive_tree_id_file, key, is_absent, - &serve, + serve, remote_api, critical_git_op_map, resolve_symlinks_map, @@ -508,7 +508,7 @@ auto CreateContentGitMap( CAInfoPtr const& ca_info, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, bool fetch_absent, std::size_t jobs) -> ContentGitMap { @@ -519,7 +519,7 @@ auto CreateContentGitMap( just_mr_paths, additional_mirrors, ca_info, - &serve, + serve, remote_api, fetch_absent](auto ts, auto setter, @@ -555,7 +555,7 @@ auto CreateContentGitMap( [archive_tree_id = *archive_tree_id, key, fetch_absent, - &serve, + serve, remote_api, critical_git_op_map, resolve_symlinks_map, @@ -622,7 +622,7 @@ auto CreateContentGitMap( if (key.absent and not fetch_absent) { // request the resolved subdir tree from the serve endpoint, if // given - if (serve) { + if (serve != nullptr) { auto serve_result = serve->RetrieveTreeFromArchive(key.archive.content, key.repo_type, @@ -701,7 +701,7 @@ auto CreateContentGitMap( just_mr_paths, additional_mirrors, ca_info, - &serve, + serve, remote_api, ts, setter, @@ -847,7 +847,7 @@ auto CreateContentGitMap( content_cas_path, archive_tree_id_file, /*is_absent=*/false, - /*serve=*/std::nullopt, + /*serve=*/nullptr, /*remote_api=*/nullptr, critical_git_op_map, import_to_git_map, diff --git a/src/other_tools/root_maps/content_git_map.hpp b/src/other_tools/root_maps/content_git_map.hpp index 4a20f98b..959edaa9 100644 --- a/src/other_tools/root_maps/content_git_map.hpp +++ b/src/other_tools/root_maps/content_git_map.hpp @@ -43,7 +43,7 @@ using ContentGitMap = CAInfoPtr const& ca_info, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, bool fetch_absent, std::size_t jobs) -> ContentGitMap; diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index bc9838eb..46a2b9bf 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -132,14 +132,14 @@ auto CreateDistdirGitMap( gsl::not_null<ContentCASMap*> const& content_cas_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, std::size_t jobs) -> DistdirGitMap { auto distdir_to_git = [content_cas_map, import_to_git_map, critical_git_op_map, - &serve, + serve, local_api, remote_api](auto ts, auto setter, @@ -175,7 +175,7 @@ auto CreateDistdirGitMap( [distdir_tree_id = *distdir_tree_id, content_id = key.content_id, key, - &serve, + serve, remote_api, setter, logger](auto const& values) { @@ -189,7 +189,7 @@ auto CreateDistdirGitMap( // subdir is "." here, so no need to deal with the Git cache // and we can simply set the workspace root if (key.absent) { - if (serve) { + if (serve != nullptr) { // check if serve endpoint has this root auto has_tree = CheckServeHasAbsentRoot( *serve, distdir_tree_id, logger); @@ -331,7 +331,7 @@ auto CreateDistdirGitMap( // up the absent root without actually checking the local status of // each content blob individually if (key.absent) { - if (serve) { + if (serve != nullptr) { // first check if serve endpoint has tree auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger); @@ -483,7 +483,7 @@ auto CreateDistdirGitMap( } // now ask serve endpoint if it can set up the root; as this is for // a present root, a corresponding remote endpoint is needed - if (serve and remote_api != nullptr) { + if (serve != nullptr and remote_api != nullptr) { auto serve_result = serve->RetrieveTreeFromDistdir(key.content_list, /*sync_tree=*/true); diff --git a/src/other_tools/root_maps/distdir_git_map.hpp b/src/other_tools/root_maps/distdir_git_map.hpp index 77717344..c83b9512 100644 --- a/src/other_tools/root_maps/distdir_git_map.hpp +++ b/src/other_tools/root_maps/distdir_git_map.hpp @@ -54,7 +54,7 @@ using DistdirGitMap = gsl::not_null<ContentCASMap*> const& content_cas_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, std::size_t jobs) -> DistdirGitMap; diff --git a/src/other_tools/root_maps/foreign_file_git_map.cpp b/src/other_tools/root_maps/foreign_file_git_map.cpp index 9a69ef8e..809c34fc 100644 --- a/src/other_tools/root_maps/foreign_file_git_map.cpp +++ b/src/other_tools/root_maps/foreign_file_git_map.cpp @@ -113,7 +113,7 @@ void UseCacheHit(const std::string& tree_id, } void HandleAbsentForeignFile(ForeignFileInfo const& key, - std::optional<ServeApi> const& serve, + ServeApi const* serve, ForeignFileGitMap::SetterPtr const& setter, ForeignFileGitMap::LoggerPtr const& logger) { // Compute tree in memory @@ -137,7 +137,7 @@ void HandleAbsentForeignFile(ForeignFileInfo const& key, return; } auto tree_id = ToHexString(tree->first); - if (serve) { + if (serve != nullptr) { auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger); if (not has_tree) { return; @@ -195,11 +195,11 @@ void HandleAbsentForeignFile(ForeignFileInfo const& key, [[nodiscard]] auto CreateForeignFileGitMap( gsl::not_null<ContentCASMap*> const& content_cas_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, bool fetch_absent, std::size_t jobs) -> ForeignFileGitMap { auto setup_foreign_file = - [content_cas_map, import_to_git_map, fetch_absent, &serve]( + [content_cas_map, import_to_git_map, fetch_absent, serve]( auto ts, auto setter, auto logger, diff --git a/src/other_tools/root_maps/foreign_file_git_map.hpp b/src/other_tools/root_maps/foreign_file_git_map.hpp index 2cf34df1..941d28f7 100644 --- a/src/other_tools/root_maps/foreign_file_git_map.hpp +++ b/src/other_tools/root_maps/foreign_file_git_map.hpp @@ -34,7 +34,7 @@ using ForeignFileGitMap = [[nodiscard]] auto CreateForeignFileGitMap( gsl::not_null<ContentCASMap*> const& content_cas_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, bool fetch_absent, std::size_t jobs) -> ForeignFileGitMap; diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp index 2c918133..3f47d237 100644 --- a/src/other_tools/root_maps/fpath_git_map.cpp +++ b/src/other_tools/root_maps/fpath_git_map.cpp @@ -36,14 +36,14 @@ namespace { void CheckServeAndSetRoot(std::string const& tree_id, std::string const& repo_root, bool absent, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, FilePathGitMap::SetterPtr const& ws_setter, FilePathGitMap::LoggerPtr const& logger) { // if serve endpoint is given, try to ensure it has this tree available to // be able to build against it. If root is not absent, do not fail if we // don't have a suitable remote endpoint, but warn user nonetheless. - if (serve) { + if (serve != nullptr) { auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger); if (not has_tree) { return; // fatal @@ -100,7 +100,7 @@ void ResolveFilePathTree( bool absent, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, gsl::not_null<TaskSystem*> const& ts, FilePathGitMap::SetterPtr const& ws_setter, @@ -145,7 +145,7 @@ void ResolveFilePathTree( tree_hash, tree_id_file, absent, - &serve, + serve, remote_api, ts, ws_setter, @@ -186,7 +186,7 @@ void ResolveFilePathTree( [resolved_tree_id, tree_id_file, absent, - &serve, + serve, remote_api, ws_setter, logger](auto const& values) { @@ -254,7 +254,7 @@ auto CreateFilePathGitMap( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, std::size_t jobs, std::string multi_repo_tool_name, @@ -263,7 +263,7 @@ auto CreateFilePathGitMap( critical_git_op_map, import_to_git_map, resolve_symlinks_map, - &serve, + serve, remote_api, multi_repo_tool_name, build_tool_name](auto ts, @@ -302,7 +302,7 @@ auto CreateFilePathGitMap( repo_root = std::move(*repo_root), critical_git_op_map, resolve_symlinks_map, - &serve, + serve, remote_api, ts, setter, @@ -362,7 +362,7 @@ auto CreateFilePathGitMap( absent, critical_git_op_map, resolve_symlinks_map, - &serve, + serve, remote_api, ts, setter, @@ -451,7 +451,7 @@ auto CreateFilePathGitMap( absent = key.absent, critical_git_op_map, resolve_symlinks_map, - &serve, + serve, remote_api, ts, setter, diff --git a/src/other_tools/root_maps/fpath_git_map.hpp b/src/other_tools/root_maps/fpath_git_map.hpp index 49550249..772cdc74 100644 --- a/src/other_tools/root_maps/fpath_git_map.hpp +++ b/src/other_tools/root_maps/fpath_git_map.hpp @@ -54,7 +54,7 @@ using FilePathGitMap = AsyncMapConsumer<FpathInfo, nlohmann::json>; gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, - std::optional<ServeApi> const& serve, + ServeApi const* serve, IExecutionApi const* remote_api, std::size_t jobs, std::string multi_repo_tool_name, diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp index ecbda9c0..b6bf3a22 100644 --- a/src/other_tools/root_maps/tree_id_git_map.cpp +++ b/src/other_tools/root_maps/tree_id_git_map.cpp @@ -147,7 +147,7 @@ auto CreateTreeIdGitMap( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, bool fetch_absent, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, std::size_t jobs) -> TreeIdGitMap { @@ -155,7 +155,7 @@ auto CreateTreeIdGitMap( critical_git_op_map, import_to_git_map, fetch_absent, - &serve, + serve, local_api, remote_api](auto ts, auto setter, @@ -167,7 +167,7 @@ auto CreateTreeIdGitMap( // found on the serve endpoint or it can be made available to it; // otherwise, error out if (key.absent and not fetch_absent) { - if (serve) { + if (serve != nullptr) { // check serve endpoint auto has_tree = CheckServeHasAbsentRoot(*serve, key.tree_info.hash, logger); @@ -238,7 +238,7 @@ auto CreateTreeIdGitMap( critical_git_op_map->ConsumeAfterKeysReady( ts, {std::move(op_key)}, - [&serve, + [serve, digest, import_to_git_map, local_api, diff --git a/src/other_tools/root_maps/tree_id_git_map.hpp b/src/other_tools/root_maps/tree_id_git_map.hpp index d1a28351..d2de005f 100644 --- a/src/other_tools/root_maps/tree_id_git_map.hpp +++ b/src/other_tools/root_maps/tree_id_git_map.hpp @@ -69,7 +69,7 @@ using TreeIdGitMap = gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ImportToGitMap*> const& import_to_git_map, bool fetch_absent, - std::optional<ServeApi> const& serve, + ServeApi const* serve, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, std::size_t jobs) -> TreeIdGitMap; |