diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-01-22 18:40:37 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-01-26 14:51:43 +0100 |
commit | 0d3860c4bbfe81c7003f0ea1f1a01fc3a866daed (patch) | |
tree | a31eca399b533159f636c194d288716b4abdf7d8 /src/other_tools/ops_maps/archive_fetch_map.cpp | |
parent | 395c0c8cffc97ae6e29f12715bb5496db121ae01 (diff) | |
download | justbuild-0d3860c4bbfe81c7003f0ea1f1a01fc3a866daed.tar.gz |
just-mr async maps: Wrap passed raw pointers
This is to uphold the coding style guide we employ.
Diffstat (limited to 'src/other_tools/ops_maps/archive_fetch_map.cpp')
-rw-r--r-- | src/other_tools/ops_maps/archive_fetch_map.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
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<IExecutionApi*> const& local_api, + std::optional<gsl::not_null<IExecutionApi*>> 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<ContentCASMap*> 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<ContentCASMap*> const& content_cas_map, + std::filesystem::path const& fetch_dir, + gsl::not_null<IExecutionApi*> const& local_api, + std::optional<gsl::not_null<IExecutionApi*>> const& remote_api, + std::size_t jobs) -> ArchiveFetchMap { auto fetch_archive = [content_cas_map, fetch_dir, local_api, remote_api]( auto ts, auto setter, |