From 7fb3ee34da91c7db0c6a98b35abd97b521581007 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 29 Feb 2024 17:47:52 +0100 Subject: archive_fetch_map: only have the actual archive content in the interface ... as this is the only part this map depends on, and not the information on what to do with the archive, like style of unpacking, etc. In this way, this map will also be reusable for fetching foreign files. --- src/other_tools/just_mr/fetch.cpp | 4 ++-- src/other_tools/ops_maps/archive_fetch_map.cpp | 16 +++++++--------- src/other_tools/ops_maps/archive_fetch_map.hpp | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index 8779a7bd..74fc8fa8 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -132,7 +132,7 @@ auto MultiRepoFetch(std::shared_ptr const& config, Logger::Log(LogLevel::Info, "Fetching to {}", fetch_dir->string()); // gather all repos to be fetched - std::vector archives_to_fetch{}; + std::vector archives_to_fetch{}; std::vector git_trees_to_fetch{}; archives_to_fetch.reserve( fetch_repos->to_include.size()); // pre-reserve a maximum size @@ -217,7 +217,7 @@ auto MultiRepoFetch(std::shared_ptr const& config, if (not archive_repo_info->absent or common_args.fetch_absent) { archives_to_fetch.emplace_back( - std::move(*archive_repo_info)); + archive_repo_info->archive); } } break; case CheckoutType::GitTree: { diff --git a/src/other_tools/ops_maps/archive_fetch_map.cpp b/src/other_tools/ops_maps/archive_fetch_map.cpp index ab4ca7e8..1e89025d 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.cpp +++ b/src/other_tools/ops_maps/archive_fetch_map.cpp @@ -82,19 +82,18 @@ auto CreateArchiveFetchMap( auto const& key) { // get corresponding distfile auto distfile = - (key.archive.distfile ? key.archive.distfile.value() - : std::filesystem::path(key.archive.fetch_url) - .filename() - .string()); + (key.distfile + ? key.distfile.value() + : std::filesystem::path(key.fetch_url).filename().string()); auto target_name = fetch_dir / distfile; // make sure content is in CAS content_cas_map->ConsumeAfterKeysReady( ts, - {key.archive}, + {key}, [target_name, local_api, remote_api, - content = key.archive.content, + content = key.content, setter, logger]([[maybe_unused]] auto const& values) { // content is in local CAS now @@ -111,8 +110,7 @@ auto CreateArchiveFetchMap( setter, logger); }, - [logger, content = key.archive.content](auto const& msg, - bool fatal) { + [logger, content = key.content](auto const& msg, bool fatal) { (*logger)( fmt::format("While ensuring content {} is in CAS:\n{}", content, @@ -120,5 +118,5 @@ auto CreateArchiveFetchMap( fatal); }); }; - return AsyncMapConsumer(fetch_archive, jobs); + return AsyncMapConsumer(fetch_archive, jobs); } diff --git a/src/other_tools/ops_maps/archive_fetch_map.hpp b/src/other_tools/ops_maps/archive_fetch_map.hpp index 89550996..9724a09b 100644 --- a/src/other_tools/ops_maps/archive_fetch_map.hpp +++ b/src/other_tools/ops_maps/archive_fetch_map.hpp @@ -23,7 +23,7 @@ #include "src/other_tools/ops_maps/content_cas_map.hpp" /// \brief Maps an archive content hash to a status flag. -using ArchiveFetchMap = AsyncMapConsumer; +using ArchiveFetchMap = AsyncMapConsumer; [[nodiscard]] auto CreateArchiveFetchMap( gsl::not_null const& content_cas_map, @@ -32,4 +32,4 @@ using ArchiveFetchMap = AsyncMapConsumer; std::optional> const& remote_api, std::size_t jobs) -> ArchiveFetchMap; -#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_ARCHIVE_FETCH_MAP_HPP \ No newline at end of file +#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_ARCHIVE_FETCH_MAP_HPP -- cgit v1.2.3