From 0d3860c4bbfe81c7003f0ea1f1a01fc3a866daed Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 22 Jan 2024 18:40:37 +0100 Subject: just-mr async maps: Wrap passed raw pointers This is to uphold the coding style guide we employ. --- src/other_tools/ops_maps/archive_fetch_map.cpp | 32 ++++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/other_tools/ops_maps/archive_fetch_map.cpp') diff --git a/src/other_tools/ops_maps/archive_fetch_map.cpp b/src/other_tools/ops_maps/archive_fetch_map.cpp index c91cdcf9..f2b5842b 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.cpp +++ b/src/other_tools/ops_maps/archive_fetch_map.cpp @@ -26,20 +26,21 @@ namespace { -void ProcessContent(std::filesystem::path const& content_path, - std::filesystem::path const& target_name, - IExecutionApi* local_api, - IExecutionApi* remote_api, - std::string const& content, - ArtifactDigest const& digest, - 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 const& local_api, + std::optional> const& remote_api, + std::string const& content, + ArtifactDigest const& digest, + ArchiveFetchMap::SetterPtr const& setter, + ArchiveFetchMap::LoggerPtr const& logger) { // try to back up to remote CAS - if (local_api != nullptr and remote_api != nullptr) { + if (remote_api) { if (not local_api->RetrieveToCas( {Artifact::ObjectInfo{.digest = digest, .type = ObjectType::File}}, - remote_api)) { + *remote_api)) { // give a warning (*logger)(fmt::format("Failed to back up content {} from local CAS " "to remote", @@ -67,11 +68,12 @@ void ProcessContent(std::filesystem::path const& content_path, } // namespace -auto CreateArchiveFetchMap(gsl::not_null const& content_cas_map, - std::filesystem::path const& fetch_dir, - IExecutionApi* local_api, - IExecutionApi* remote_api, - std::size_t jobs) -> ArchiveFetchMap { +auto CreateArchiveFetchMap( + gsl::not_null const& content_cas_map, + std::filesystem::path const& fetch_dir, + gsl::not_null const& local_api, + std::optional> const& remote_api, + std::size_t jobs) -> ArchiveFetchMap { auto fetch_archive = [content_cas_map, fetch_dir, local_api, remote_api]( auto ts, auto setter, -- cgit v1.2.3