mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 12:28:13 -04:00
refactor: pass perfmon shared_ptr
by const reference
This commit is contained in:
parent
ba0bdbdc91
commit
fdddf95bfc
@ -75,16 +75,17 @@ class filesystem_v2 {
|
||||
filesystem_v2(logger& lgr, os_access const& os,
|
||||
std::filesystem::path const& path);
|
||||
|
||||
filesystem_v2(logger& lgr, os_access const& os,
|
||||
std::filesystem::path const& path,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon = nullptr);
|
||||
filesystem_v2(
|
||||
logger& lgr, os_access const& os, std::filesystem::path const& path,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon = nullptr);
|
||||
|
||||
filesystem_v2(logger& lgr, os_access const& os, std::shared_ptr<mmif> mm);
|
||||
|
||||
filesystem_v2(logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon = nullptr);
|
||||
filesystem_v2(
|
||||
logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon = nullptr);
|
||||
|
||||
static int
|
||||
identify(logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
|
@ -55,7 +55,7 @@ class block_cache {
|
||||
public:
|
||||
block_cache(logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
const block_cache_options& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon);
|
||||
std::shared_ptr<performance_monitor const> const& perfmon);
|
||||
|
||||
size_t block_count() const { return impl_->block_count(); }
|
||||
|
||||
|
@ -54,7 +54,7 @@ class inode_reader_v2 {
|
||||
|
||||
inode_reader_v2(logger& lgr, block_cache&& bc,
|
||||
inode_reader_options const& opts,
|
||||
std::shared_ptr<performance_monitor const> perfmon);
|
||||
std::shared_ptr<performance_monitor const> const& perfmon);
|
||||
|
||||
inode_reader_v2& operator=(inode_reader_v2&&) = default;
|
||||
|
||||
|
@ -65,10 +65,11 @@ class metadata_v2 {
|
||||
metadata_v2(metadata_v2&&) = default;
|
||||
metadata_v2& operator=(metadata_v2&&) = default;
|
||||
|
||||
metadata_v2(logger& lgr, std::span<uint8_t const> schema,
|
||||
std::span<uint8_t const> data, metadata_options const& options,
|
||||
int inode_offset = 0, bool force_consistency_check = false,
|
||||
std::shared_ptr<performance_monitor const> perfmon = nullptr);
|
||||
metadata_v2(
|
||||
logger& lgr, std::span<uint8_t const> schema,
|
||||
std::span<uint8_t const> data, metadata_options const& options,
|
||||
int inode_offset = 0, bool force_consistency_check = false,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon = nullptr);
|
||||
|
||||
void check_consistency() const { impl_->check_consistency(); }
|
||||
|
||||
|
@ -153,11 +153,10 @@ metadata_v2
|
||||
make_metadata(logger& lgr, std::shared_ptr<mmif> mm,
|
||||
section_map const& sections, std::vector<uint8_t>& schema_buffer,
|
||||
std::vector<uint8_t>& meta_buffer,
|
||||
const metadata_options& options, int inode_offset = 0,
|
||||
bool force_buffers = false,
|
||||
mlock_mode lock_mode = mlock_mode::NONE,
|
||||
bool force_consistency_check = false,
|
||||
std::shared_ptr<performance_monitor const> perfmon = nullptr) {
|
||||
const metadata_options& options, int inode_offset,
|
||||
bool force_buffers, mlock_mode lock_mode,
|
||||
bool force_consistency_check,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon) {
|
||||
LOG_PROXY(debug_logger_policy, lgr);
|
||||
auto schema_it = sections.find(section_type::METADATA_V2_SCHEMA);
|
||||
auto meta_it = sections.find(section_type::METADATA_V2);
|
||||
@ -217,7 +216,7 @@ class filesystem_ final : public filesystem_v2::impl {
|
||||
public:
|
||||
filesystem_(logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
const filesystem_options& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon);
|
||||
std::shared_ptr<performance_monitor const> const& perfmon);
|
||||
|
||||
int check(filesystem_check_level level, size_t num_threads) const override;
|
||||
void dump(std::ostream& os, fsinfo_options const& opts) const override;
|
||||
@ -438,7 +437,7 @@ template <typename LoggerPolicy>
|
||||
filesystem_<LoggerPolicy>::filesystem_(
|
||||
logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon)
|
||||
std::shared_ptr<performance_monitor const> const& perfmon)
|
||||
: LOG_PROXY_INIT(lgr)
|
||||
, os_{os}
|
||||
, mm_{std::move(mm)}
|
||||
@ -1106,24 +1105,24 @@ filesystem_v2::filesystem_v2(logger& lgr, os_access const& os,
|
||||
std::filesystem::path const& path)
|
||||
: filesystem_v2(lgr, os, os.map_file(os.canonical(path))) {}
|
||||
|
||||
filesystem_v2::filesystem_v2(logger& lgr, os_access const& os,
|
||||
std::filesystem::path const& path,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon)
|
||||
filesystem_v2::filesystem_v2(
|
||||
logger& lgr, os_access const& os, std::filesystem::path const& path,
|
||||
filesystem_options const& options,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon)
|
||||
: filesystem_v2(lgr, os, os.map_file(os.canonical(path)), options,
|
||||
std::move(perfmon)) {}
|
||||
perfmon) {}
|
||||
|
||||
filesystem_v2::filesystem_v2(logger& lgr, os_access const& os,
|
||||
std::shared_ptr<mmif> mm)
|
||||
: filesystem_v2(lgr, os, std::move(mm), filesystem_options()) {}
|
||||
|
||||
filesystem_v2::filesystem_v2(logger& lgr, os_access const& os,
|
||||
std::shared_ptr<mmif> mm,
|
||||
const filesystem_options& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon)
|
||||
filesystem_v2::filesystem_v2(
|
||||
logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
const filesystem_options& options,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon)
|
||||
: impl_(make_unique_logging_object<filesystem_v2::impl,
|
||||
internal::filesystem_, logger_policies>(
|
||||
lgr, os, std::move(mm), options, std::move(perfmon))) {}
|
||||
lgr, os, std::move(mm), options, perfmon)) {}
|
||||
|
||||
int filesystem_v2::identify(logger& lgr, os_access const& os,
|
||||
std::shared_ptr<mmif> mm, std::ostream& output,
|
||||
|
@ -219,7 +219,7 @@ class block_cache_ final : public block_cache::impl {
|
||||
public:
|
||||
block_cache_(logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
block_cache_options const& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon
|
||||
std::shared_ptr<performance_monitor const> const& perfmon
|
||||
[[maybe_unused]])
|
||||
: cache_(0)
|
||||
, mm_(std::move(mm))
|
||||
@ -802,11 +802,11 @@ class block_cache_ final : public block_cache::impl {
|
||||
|
||||
} // namespace
|
||||
|
||||
block_cache::block_cache(logger& lgr, os_access const& os,
|
||||
std::shared_ptr<mmif> mm,
|
||||
const block_cache_options& options,
|
||||
std::shared_ptr<performance_monitor const> perfmon)
|
||||
block_cache::block_cache(
|
||||
logger& lgr, os_access const& os, std::shared_ptr<mmif> mm,
|
||||
const block_cache_options& options,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon)
|
||||
: impl_(make_unique_logging_object<impl, block_cache_, logger_policies>(
|
||||
lgr, os, std::move(mm), options, std::move(perfmon))) {}
|
||||
lgr, os, std::move(mm), options, perfmon)) {}
|
||||
|
||||
} // namespace dwarfs::reader::internal
|
||||
|
@ -99,7 +99,7 @@ template <typename LoggerPolicy>
|
||||
class inode_reader_ final : public inode_reader_v2::impl {
|
||||
public:
|
||||
inode_reader_(logger& lgr, block_cache&& bc, inode_reader_options const& opts,
|
||||
std::shared_ptr<performance_monitor const> perfmon
|
||||
std::shared_ptr<performance_monitor const> const& perfmon
|
||||
[[maybe_unused]])
|
||||
: cache_(std::move(bc))
|
||||
, opts_{opts}
|
||||
@ -457,9 +457,9 @@ size_t inode_reader_<LoggerPolicy>::readv(iovec_read_buf& buf, uint32_t inode,
|
||||
|
||||
inode_reader_v2::inode_reader_v2(
|
||||
logger& lgr, block_cache&& bc, inode_reader_options const& opts,
|
||||
std::shared_ptr<performance_monitor const> perfmon)
|
||||
std::shared_ptr<performance_monitor const> const& perfmon)
|
||||
: impl_(make_unique_logging_object<inode_reader_v2::impl, inode_reader_,
|
||||
logger_policies>(
|
||||
lgr, std::move(bc), opts, std::move(perfmon))) {}
|
||||
logger_policies>(lgr, std::move(bc),
|
||||
opts, perfmon)) {}
|
||||
|
||||
} // namespace dwarfs::reader::internal
|
||||
|
@ -397,7 +397,8 @@ class metadata_ final : public metadata_v2::impl {
|
||||
metadata_(logger& lgr, std::span<uint8_t const> schema,
|
||||
std::span<uint8_t const> data, metadata_options const& options,
|
||||
int inode_offset, bool force_consistency_check,
|
||||
std::shared_ptr<performance_monitor const> perfmon [[maybe_unused]])
|
||||
std::shared_ptr<performance_monitor const> const& perfmon
|
||||
[[maybe_unused]])
|
||||
: data_(data)
|
||||
, meta_(
|
||||
check_frozen(map_frozen<thrift::metadata::metadata>(schema, data_)))
|
||||
@ -2193,14 +2194,14 @@ std::vector<file_stat::gid_type> metadata_<LoggerPolicy>::get_all_gids() const {
|
||||
return rv;
|
||||
}
|
||||
|
||||
metadata_v2::metadata_v2(logger& lgr, std::span<uint8_t const> schema,
|
||||
std::span<uint8_t const> data,
|
||||
metadata_options const& options, int inode_offset,
|
||||
bool force_consistency_check,
|
||||
std::shared_ptr<performance_monitor const> perfmon)
|
||||
metadata_v2::metadata_v2(
|
||||
logger& lgr, std::span<uint8_t const> schema, std::span<uint8_t const> data,
|
||||
metadata_options const& options, int inode_offset,
|
||||
bool force_consistency_check,
|
||||
std::shared_ptr<performance_monitor const> const& perfmon)
|
||||
: impl_(make_unique_logging_object<metadata_v2::impl, metadata_,
|
||||
logger_policies>(
|
||||
lgr, schema, data, options, inode_offset, force_consistency_check,
|
||||
std::move(perfmon))) {}
|
||||
perfmon)) {}
|
||||
|
||||
} // namespace dwarfs::reader::internal
|
||||
|
Loading…
x
Reference in New Issue
Block a user