mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-15 07:16:13 -04:00
refactor(block_merger): replace folly::gen with ranges
This commit is contained in:
parent
522efd04f7
commit
89cdb7e325
@ -772,7 +772,7 @@ target_link_libraries(dwarfs_common PUBLIC dwarfs_folly_lite)
|
||||
target_link_libraries(dwarfs_common PRIVATE PkgConfig::LIBCRYPTO xxHash::xxhash phmap)
|
||||
target_link_libraries(dwarfs_reader PUBLIC dwarfs_common)
|
||||
target_link_libraries(dwarfs_writer PUBLIC dwarfs_common dwarfs_compression_metadata)
|
||||
target_link_libraries(dwarfs_writer PRIVATE phmap)
|
||||
target_link_libraries(dwarfs_writer PRIVATE phmap range-v3::range-v3)
|
||||
target_link_libraries(dwarfs_extractor PUBLIC dwarfs_reader)
|
||||
target_link_libraries(dwarfs_tool PUBLIC dwarfs_common)
|
||||
|
||||
@ -971,6 +971,7 @@ if(WITH_TESTS)
|
||||
|
||||
target_link_libraries(block_cache_test PRIVATE mkdwarfs_main)
|
||||
|
||||
target_link_libraries(block_merger_test PRIVATE range-v3::range-v3)
|
||||
target_link_libraries(ricepp_compressor_test PRIVATE range-v3::range-v3)
|
||||
|
||||
foreach(tgt fits_categorizer_test
|
||||
|
@ -34,8 +34,11 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <folly/Function.h>
|
||||
#include <folly/String.h>
|
||||
#include <folly/gen/String.h>
|
||||
|
||||
#include <range/v3/range/conversion.hpp>
|
||||
#include <range/v3/view/all.hpp>
|
||||
#include <range/v3/view/join.hpp>
|
||||
#include <range/v3/view/transform.hpp>
|
||||
|
||||
#include <dwarfs/block_merger.h>
|
||||
#include <dwarfs/terminal.h>
|
||||
@ -194,12 +197,13 @@ class multi_queue_block_merger_impl : public block_merger_base,
|
||||
continue;
|
||||
}
|
||||
|
||||
auto const queued_sizes = folly::join(
|
||||
", ", folly::gen::from(q) | folly::gen::map([this](auto const& blk) {
|
||||
return blk.has_value()
|
||||
? std::to_string(this->block_size(*blk))
|
||||
: "&";
|
||||
}) | folly::gen::as<std::vector<std::string>>());
|
||||
auto const queued_sizes =
|
||||
ranges::views::all(q) |
|
||||
ranges::views::transform([this](auto const& blk) {
|
||||
return blk.has_value() ? std::to_string(this->block_size(*blk))
|
||||
: "&";
|
||||
}) |
|
||||
ranges::views::join(", ") | ranges::to<std::string>();
|
||||
|
||||
auto const text =
|
||||
fmt::format("blocks({}): {} -> {}", src, q.size(), queued_sizes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user