diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-24 12:20:32 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-25 13:59:48 +0200 |
commit | dbac8a19685b83dd1d656201da900a20e11428f2 (patch) | |
tree | 311ecff8b9498f3753d2df83b95d7301f11d90d8 | |
parent | f77492425703122c9b977ba3e0f9f5fdd80a08d1 (diff) | |
download | justbuild-dbac8a19685b83dd1d656201da900a20e11428f2.tar.gz |
Introduce a type allias for an optional ptr to IExecutionApi
...and replace verbose constructions.
24 files changed, 93 insertions, 103 deletions
diff --git a/src/buildtool/execution_api/common/execution_api.hpp b/src/buildtool/execution_api/common/execution_api.hpp index 72663c2e..b86ddd1f 100644 --- a/src/buildtool/execution_api/common/execution_api.hpp +++ b/src/buildtool/execution_api/common/execution_api.hpp @@ -35,6 +35,7 @@ class IExecutionApi { public: using Ptr = std::shared_ptr<IExecutionApi const>; + using OptionalPtr = std::optional<gsl::not_null<IExecutionApi const*>>; IExecutionApi() = default; IExecutionApi(IExecutionApi const&) = delete; @@ -70,7 +71,7 @@ class IExecutionApi { [[nodiscard]] virtual auto RetrieveToPaths( std::vector<Artifact::ObjectInfo> const& artifacts_info, std::vector<std::filesystem::path> const& output_paths, - std::optional<gsl::not_null<const IExecutionApi*>> const& alternative = + IExecutionApi::OptionalPtr const& alternative = std::nullopt) const noexcept -> bool = 0; /// \brief Retrieve artifacts from CAS and write to file descriptors. diff --git a/src/buildtool/execution_api/git/git_api.hpp b/src/buildtool/execution_api/git/git_api.hpp index 53184988..d35000fd 100644 --- a/src/buildtool/execution_api/git/git_api.hpp +++ b/src/buildtool/execution_api/git/git_api.hpp @@ -54,8 +54,7 @@ class GitApi final : public IExecutionApi { [[nodiscard]] auto RetrieveToPaths( std::vector<Artifact::ObjectInfo> const& artifacts_info, std::vector<std::filesystem::path> const& output_paths, - std::optional< - gsl::not_null<const IExecutionApi*>> const& /*alternative*/ + IExecutionApi::OptionalPtr const& /*alternative*/ = std::nullopt) const noexcept -> bool override { if (artifacts_info.size() != output_paths.size()) { Logger::Log(LogLevel::Error, diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index 928fb5b8..cbb904ef 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -78,9 +78,8 @@ class LocalApi final : public IExecutionApi { [[nodiscard]] auto RetrieveToPaths( std::vector<Artifact::ObjectInfo> const& artifacts_info, std::vector<std::filesystem::path> const& output_paths, - std::optional< - gsl::not_null<const IExecutionApi*>> const& /*alternative*/ - = std::nullopt) const noexcept -> bool final { + IExecutionApi::OptionalPtr const& /*alternative*/ = + std::nullopt) const noexcept -> bool final { if (artifacts_info.size() != output_paths.size()) { Logger::Log(LogLevel::Error, "different number of digests and output paths."); diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index b475dfe8..f636c265 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -221,8 +221,7 @@ auto BazelApi::CreateAction( [[nodiscard]] auto BazelApi::RetrieveToPaths( std::vector<Artifact::ObjectInfo> const& artifacts_info, std::vector<std::filesystem::path> const& output_paths, - std::optional<gsl::not_null<const IExecutionApi*>> const& alternative) - const noexcept -> bool { + IExecutionApi::OptionalPtr const& alternative) const noexcept -> bool { if (artifacts_info.size() != output_paths.size()) { Logger::Log(LogLevel::Warning, "different number of digests and output paths."); diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp index a9149450..e5669933 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp @@ -62,7 +62,7 @@ class BazelApi final : public IExecutionApi { [[nodiscard]] auto RetrieveToPaths( std::vector<Artifact::ObjectInfo> const& artifacts_info, std::vector<std::filesystem::path> const& output_paths, - std::optional<gsl::not_null<const IExecutionApi*>> const& alternative = + IExecutionApi::OptionalPtr const& alternative = std::nullopt) const noexcept -> bool final; [[nodiscard]] auto RetrieveToFds( diff --git a/src/other_tools/ops_maps/archive_fetch_map.cpp b/src/other_tools/ops_maps/archive_fetch_map.cpp index 883ffa76..db2fc319 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.cpp +++ b/src/other_tools/ops_maps/archive_fetch_map.cpp @@ -26,14 +26,13 @@ namespace { -void ProcessContent( - std::filesystem::path const& content_path, - std::filesystem::path const& target_name, - gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - std::string const& content, - ArchiveFetchMap::SetterPtr const& setter, - ArchiveFetchMap::LoggerPtr const& logger) { +void ProcessContent(std::filesystem::path const& content_path, + std::filesystem::path const& target_name, + gsl::not_null<IExecutionApi const*> const& local_api, + IExecutionApi::OptionalPtr const& remote_api, + std::string const& content, + ArchiveFetchMap::SetterPtr const& setter, + ArchiveFetchMap::LoggerPtr const& logger) { // try to back up to remote CAS if (remote_api) { if (not local_api->RetrieveToCas( @@ -68,12 +67,11 @@ void ProcessContent( } // namespace -auto CreateArchiveFetchMap( - gsl::not_null<ContentCASMap*> const& content_cas_map, - std::filesystem::path const& fetch_dir, - gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - std::size_t jobs) -> ArchiveFetchMap { +auto CreateArchiveFetchMap(gsl::not_null<ContentCASMap*> const& content_cas_map, + std::filesystem::path const& fetch_dir, + gsl::not_null<IExecutionApi const*> const& local_api, + IExecutionApi::OptionalPtr const& remote_api, + std::size_t jobs) -> ArchiveFetchMap { auto fetch_archive = [content_cas_map, fetch_dir, local_api, remote_api]( auto ts, auto setter, diff --git a/src/other_tools/ops_maps/archive_fetch_map.hpp b/src/other_tools/ops_maps/archive_fetch_map.hpp index f6e3d987..9f0b220d 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.hpp +++ b/src/other_tools/ops_maps/archive_fetch_map.hpp @@ -30,7 +30,7 @@ using ArchiveFetchMap = AsyncMapConsumer<ArchiveContent, bool>; gsl::not_null<ContentCASMap*> const& content_cas_map, std::filesystem::path const& fetch_dir, // should exist! gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> ArchiveFetchMap; #endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_ARCHIVE_FETCH_MAP_HPP diff --git a/src/other_tools/ops_maps/content_cas_map.cpp b/src/other_tools/ops_maps/content_cas_map.cpp index 4d1ca013..3cba65ef 100644 --- a/src/other_tools/ops_maps/content_cas_map.cpp +++ b/src/other_tools/ops_maps/content_cas_map.cpp @@ -110,7 +110,7 @@ auto CreateContentCASMap( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> ContentCASMap { auto ensure_in_cas = [just_mr_paths, additional_mirrors, diff --git a/src/other_tools/ops_maps/content_cas_map.hpp b/src/other_tools/ops_maps/content_cas_map.hpp index 25facd07..df8b0103 100644 --- a/src/other_tools/ops_maps/content_cas_map.hpp +++ b/src/other_tools/ops_maps/content_cas_map.hpp @@ -86,7 +86,7 @@ using ContentCASMap = AsyncMapConsumer<ArchiveContent, std::nullptr_t>; gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> ContentCASMap; namespace std { diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.cpp b/src/other_tools/ops_maps/git_tree_fetch_map.cpp index c518c9e9..b08da28a 100644 --- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp +++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp @@ -63,16 +63,15 @@ void BackupToRemote(std::string const& tree_id, /// \brief Moves the root tree from local CAS to the Git cache and sets the /// root. -void MoveCASTreeToGit( - std::string const& tree_id, - ArtifactDigest const& digest, - gsl::not_null<ImportToGitMap*> const& import_to_git_map, - gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - bool backup_to_remote, - gsl::not_null<TaskSystem*> const& ts, - GitTreeFetchMap::SetterPtr const& setter, - GitTreeFetchMap::LoggerPtr const& logger) { +void MoveCASTreeToGit(std::string const& tree_id, + ArtifactDigest const& digest, + gsl::not_null<ImportToGitMap*> const& import_to_git_map, + gsl::not_null<IExecutionApi const*> const& local_api, + IExecutionApi::OptionalPtr const& remote_api, + bool backup_to_remote, + gsl::not_null<TaskSystem*> const& ts, + GitTreeFetchMap::SetterPtr const& setter, + GitTreeFetchMap::LoggerPtr const& logger) { // Move tree from CAS to local Git storage auto tmp_dir = StorageConfig::CreateTypedTmpDir("fetch-remote-git-tree"); if (not tmp_dir) { @@ -131,7 +130,7 @@ auto CreateGitTreeFetchMap( std::vector<std::string> const& launcher, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, bool backup_to_remote, std::size_t jobs) -> GitTreeFetchMap { auto tree_to_cache = [critical_git_op_map, diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.hpp b/src/other_tools/ops_maps/git_tree_fetch_map.hpp index 82c858d5..be5a4252 100644 --- a/src/other_tools/ops_maps/git_tree_fetch_map.hpp +++ b/src/other_tools/ops_maps/git_tree_fetch_map.hpp @@ -62,7 +62,7 @@ using GitTreeFetchMap = AsyncMapConsumer<GitTreeInfo, bool>; std::vector<std::string> const& launcher, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, bool backup_to_remote, std::size_t jobs) -> GitTreeFetchMap; diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index a4681a6a..a4f2b8eb 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -58,14 +58,13 @@ namespace { /// root if it was marked absent. /// It guarantees the logger is called exactly once with fatal on failure, and /// the setter on success. -void EnsureRootAsAbsent( - std::string const& tree_id, - std::filesystem::path const& repo_root, - GitRepoInfo const& repo_info, - std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - CommitGitMap::SetterPtr const& ws_setter, - CommitGitMap::LoggerPtr const& logger) { +void EnsureRootAsAbsent(std::string const& tree_id, + std::filesystem::path const& repo_root, + GitRepoInfo const& repo_info, + std::optional<ServeApi> const& serve, + IExecutionApi::OptionalPtr const& remote_api, + CommitGitMap::SetterPtr const& ws_setter, + CommitGitMap::LoggerPtr const& logger) { // this is an absent root if (serve) { // check if the serve endpoint has this root @@ -401,23 +400,22 @@ void NetworkFetchAndSetPresentRoot( /// the root. /// It guarantees the logger is called exactly once with fatal on failure, and /// the setter on success. -void EnsureCommit( - GitRepoInfo const& repo_info, - std::filesystem::path const& repo_root, - std::string const& fetch_repo, - MirrorsPtr const& additional_mirrors, - GitCASPtr const& git_cas, - gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, - 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, - gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - bool fetch_absent, - gsl::not_null<TaskSystem*> const& ts, - CommitGitMap::SetterPtr const& ws_setter, - CommitGitMap::LoggerPtr const& logger) { +void EnsureCommit(GitRepoInfo const& repo_info, + std::filesystem::path const& repo_root, + std::string const& fetch_repo, + MirrorsPtr const& additional_mirrors, + GitCASPtr const& git_cas, + gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, + 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, + gsl::not_null<IExecutionApi const*> const& local_api, + IExecutionApi::OptionalPtr const& remote_api, + bool fetch_absent, + gsl::not_null<TaskSystem*> const& ts, + CommitGitMap::SetterPtr const& ws_setter, + CommitGitMap::LoggerPtr const& logger) { // link fake repo to odb auto git_repo = GitRepoRemote::Open(git_cas); if (not git_repo) { @@ -925,7 +923,7 @@ auto CreateCommitGitMap( std::vector<std::string> const& launcher, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, bool fetch_absent, std::size_t jobs) -> CommitGitMap { auto commit_to_git = [critical_git_op_map, diff --git a/src/other_tools/root_maps/commit_git_map.hpp b/src/other_tools/root_maps/commit_git_map.hpp index d9f1a941..b76c1888 100644 --- a/src/other_tools/root_maps/commit_git_map.hpp +++ b/src/other_tools/root_maps/commit_git_map.hpp @@ -83,7 +83,7 @@ using CommitGitMap = std::vector<std::string> const& launcher, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, bool fetch_absent, std::size_t jobs) -> CommitGitMap; diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp index 4052b963..440593d0 100644 --- a/src/other_tools/root_maps/content_git_map.cpp +++ b/src/other_tools/root_maps/content_git_map.cpp @@ -52,14 +52,13 @@ namespace { /// root if it was marked absent. /// It guarantees the logger is called exactly once with fatal on failure, and /// the setter on success. -void EnsureRootAsAbsent( - std::string const& tree_id, - ArchiveRepoInfo const& key, - std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - bool is_cache_hit, - ContentGitMap::SetterPtr const& ws_setter, - ContentGitMap::LoggerPtr const& logger) { +void EnsureRootAsAbsent(std::string const& tree_id, + ArchiveRepoInfo const& key, + std::optional<ServeApi> const& serve, + IExecutionApi::OptionalPtr const& remote_api, + bool is_cache_hit, + ContentGitMap::SetterPtr const& ws_setter, + ContentGitMap::LoggerPtr const& logger) { // this is an absent root if (serve) { // check if the serve endpoint has this root @@ -176,7 +175,7 @@ void ResolveContentTree( bool is_cache_hit, bool is_absent, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<TaskSystem*> const& ts, @@ -365,7 +364,7 @@ void WriteIdFileAndSetWSRoot( std::filesystem::path const& archive_tree_id_file, bool is_absent, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<TaskSystem*> const& ts, @@ -426,7 +425,7 @@ void ExtractAndImportToGit( std::filesystem::path const& archive_tree_id_file, bool is_absent, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, 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, @@ -510,7 +509,7 @@ auto CreateContentGitMap( gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, bool fetch_absent, std::size_t jobs) -> ContentGitMap { auto gitify_content = [content_cas_map, diff --git a/src/other_tools/root_maps/content_git_map.hpp b/src/other_tools/root_maps/content_git_map.hpp index d7f2c531..015895ec 100644 --- a/src/other_tools/root_maps/content_git_map.hpp +++ b/src/other_tools/root_maps/content_git_map.hpp @@ -44,7 +44,7 @@ using ContentGitMap = gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr 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 94f923c1..f21994ba 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -134,7 +134,7 @@ auto CreateDistdirGitMap( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> DistdirGitMap { auto distdir_to_git = [content_cas_map, import_to_git_map, diff --git a/src/other_tools/root_maps/distdir_git_map.hpp b/src/other_tools/root_maps/distdir_git_map.hpp index 1a350394..94ddbf9d 100644 --- a/src/other_tools/root_maps/distdir_git_map.hpp +++ b/src/other_tools/root_maps/distdir_git_map.hpp @@ -56,7 +56,7 @@ using DistdirGitMap = gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> DistdirGitMap; namespace std { diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp index 43cb0c24..3f941bf5 100644 --- a/src/other_tools/root_maps/fpath_git_map.cpp +++ b/src/other_tools/root_maps/fpath_git_map.cpp @@ -33,14 +33,13 @@ namespace { /// \brief Does the serve endpoint checks and sets the workspace root. /// It guarantees the logger is called exactly once with fatal on failure, and /// the setter on success. -void CheckServeAndSetRoot( - std::string const& tree_id, - std::string const& repo_root, - bool absent, - std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - FilePathGitMap::SetterPtr const& ws_setter, - FilePathGitMap::LoggerPtr const& logger) { +void CheckServeAndSetRoot(std::string const& tree_id, + std::string const& repo_root, + bool absent, + std::optional<ServeApi> const& serve, + IExecutionApi::OptionalPtr 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. @@ -102,7 +101,7 @@ void ResolveFilePathTree( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, gsl::not_null<TaskSystem*> const& ts, FilePathGitMap::SetterPtr const& ws_setter, FilePathGitMap::LoggerPtr const& logger) { @@ -256,7 +255,7 @@ auto CreateFilePathGitMap( gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs, std::string multi_repo_tool_name, std::string build_tool_name) -> FilePathGitMap { diff --git a/src/other_tools/root_maps/fpath_git_map.hpp b/src/other_tools/root_maps/fpath_git_map.hpp index a84ec947..f66413c0 100644 --- a/src/other_tools/root_maps/fpath_git_map.hpp +++ b/src/other_tools/root_maps/fpath_git_map.hpp @@ -55,7 +55,7 @@ using FilePathGitMap = AsyncMapConsumer<FpathInfo, nlohmann::json>; gsl::not_null<ImportToGitMap*> const& import_to_git_map, gsl::not_null<ResolveSymlinksMap*> const& resolve_symlinks_map, std::optional<ServeApi> const& serve, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs, std::string multi_repo_tool_name, std::string build_tool_name) -> FilePathGitMap; diff --git a/src/other_tools/root_maps/root_utils.cpp b/src/other_tools/root_maps/root_utils.cpp index efc4b6e0..1b9de917 100644 --- a/src/other_tools/root_maps/root_utils.cpp +++ b/src/other_tools/root_maps/root_utils.cpp @@ -35,13 +35,12 @@ auto CheckServeHasAbsentRoot(ServeApi const& serve, return std::nullopt; } -auto EnsureAbsentRootOnServe( - ServeApi const& serve, - std::string const& tree_id, - std::filesystem::path const& repo_path, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, - AsyncMapConsumerLoggerPtr const& logger, - bool no_sync_is_fatal) -> bool { +auto EnsureAbsentRootOnServe(ServeApi const& serve, + std::string const& tree_id, + std::filesystem::path const& repo_path, + IExecutionApi::OptionalPtr const& remote_api, + AsyncMapConsumerLoggerPtr const& logger, + bool no_sync_is_fatal) -> bool { if (remote_api) { // upload tree to remote CAS auto repo = RepositoryConfig{}; diff --git a/src/other_tools/root_maps/root_utils.hpp b/src/other_tools/root_maps/root_utils.hpp index 7e47dc81..d444176c 100644 --- a/src/other_tools/root_maps/root_utils.hpp +++ b/src/other_tools/root_maps/root_utils.hpp @@ -58,7 +58,7 @@ ServeApi const& serve, std::string const& tree_id, std::filesystem::path const& repo_path, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, AsyncMapConsumerLoggerPtr const& logger, bool no_sync_is_fatal) -> bool; 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 5366ee86..690f756e 100644 --- a/src/other_tools/root_maps/tree_id_git_map.cpp +++ b/src/other_tools/root_maps/tree_id_git_map.cpp @@ -150,7 +150,7 @@ auto CreateTreeIdGitMap( bool fetch_absent, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> TreeIdGitMap { auto tree_to_git = [git_tree_fetch_map, critical_git_op_map, 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 d9b7c1e4..d2a1c776 100644 --- a/src/other_tools/root_maps/tree_id_git_map.hpp +++ b/src/other_tools/root_maps/tree_id_git_map.hpp @@ -71,7 +71,7 @@ using TreeIdGitMap = bool fetch_absent, std::optional<ServeApi> const& serve, gsl::not_null<IExecutionApi const*> const& local_api, - std::optional<gsl::not_null<IExecutionApi const*>> const& remote_api, + IExecutionApi::OptionalPtr const& remote_api, std::size_t jobs) -> TreeIdGitMap; #endif // INCLUDED_SRC_OTHER_TOOLS_ROOT_MAPS_TREE_ID_GIT_MAP_HPP diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 26fd9b7d..b9772817 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -149,8 +149,8 @@ class TestApi : public IExecutionApi { [[nodiscard]] auto RetrieveToPaths( std::vector<Artifact::ObjectInfo> const& /*unused*/, std::vector<std::filesystem::path> const& /*unused*/, - std::optional<gsl::not_null<const IExecutionApi*>> const& /* unused */) - const noexcept -> bool final { + IExecutionApi::OptionalPtr const& /* unused */) const noexcept + -> bool final { return false; // not needed by Executor } [[nodiscard]] auto RetrieveToFds( |