mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-11 13:30:47 -04:00
refactor: move all movable things
This commit is contained in:
parent
5702bd0a12
commit
2940b9cf56
@ -141,32 +141,34 @@ class filesystem_v2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_stat getattr(inode_view entry, std::error_code& ec) const {
|
file_stat getattr(inode_view entry, std::error_code& ec) const {
|
||||||
return impl_->getattr(entry, ec);
|
return impl_->getattr(std::move(entry), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_stat getattr(inode_view entry) const { return impl_->getattr(entry); }
|
file_stat getattr(inode_view entry) const {
|
||||||
|
return impl_->getattr(std::move(entry));
|
||||||
|
}
|
||||||
|
|
||||||
file_stat getattr(inode_view entry, getattr_options const& opts,
|
file_stat getattr(inode_view entry, getattr_options const& opts,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
return impl_->getattr(entry, opts, ec);
|
return impl_->getattr(std::move(entry), opts, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_stat getattr(inode_view entry, getattr_options const& opts) const {
|
file_stat getattr(inode_view entry, getattr_options const& opts) const {
|
||||||
return impl_->getattr(entry, opts);
|
return impl_->getattr(std::move(entry), opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool access(inode_view entry, int mode, file_stat::uid_type uid,
|
bool access(inode_view entry, int mode, file_stat::uid_type uid,
|
||||||
file_stat::gid_type gid) const {
|
file_stat::gid_type gid) const {
|
||||||
return impl_->access(entry, mode, uid, gid);
|
return impl_->access(std::move(entry), mode, uid, gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void access(inode_view entry, int mode, file_stat::uid_type uid,
|
void access(inode_view entry, int mode, file_stat::uid_type uid,
|
||||||
file_stat::gid_type gid, std::error_code& ec) const {
|
file_stat::gid_type gid, std::error_code& ec) const {
|
||||||
impl_->access(entry, mode, uid, gid, ec);
|
impl_->access(std::move(entry), mode, uid, gid, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<directory_view> opendir(inode_view entry) const {
|
std::optional<directory_view> opendir(inode_view entry) const {
|
||||||
return impl_->opendir(entry);
|
return impl_->opendir(std::move(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<dir_entry_view>
|
std::optional<dir_entry_view>
|
||||||
@ -178,24 +180,24 @@ class filesystem_v2 {
|
|||||||
|
|
||||||
std::string
|
std::string
|
||||||
readlink(inode_view entry, readlink_mode mode, std::error_code& ec) const {
|
readlink(inode_view entry, readlink_mode mode, std::error_code& ec) const {
|
||||||
return impl_->readlink(entry, mode, ec);
|
return impl_->readlink(std::move(entry), mode, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string readlink(inode_view entry, std::error_code& ec) const {
|
std::string readlink(inode_view entry, std::error_code& ec) const {
|
||||||
return impl_->readlink(entry, readlink_mode::preferred, ec);
|
return impl_->readlink(std::move(entry), readlink_mode::preferred, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string readlink(inode_view entry,
|
std::string readlink(inode_view entry,
|
||||||
readlink_mode mode = readlink_mode::preferred) const {
|
readlink_mode mode = readlink_mode::preferred) const {
|
||||||
return impl_->readlink(entry, mode);
|
return impl_->readlink(std::move(entry), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void statvfs(vfs_stat* stbuf) const { impl_->statvfs(stbuf); }
|
void statvfs(vfs_stat* stbuf) const { impl_->statvfs(stbuf); }
|
||||||
|
|
||||||
int open(inode_view entry) const { return impl_->open(entry); }
|
int open(inode_view entry) const { return impl_->open(std::move(entry)); }
|
||||||
|
|
||||||
int open(inode_view entry, std::error_code& ec) const {
|
int open(inode_view entry, std::error_code& ec) const {
|
||||||
return impl_->open(entry, ec);
|
return impl_->open(std::move(entry), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string read_string(uint32_t inode) const {
|
std::string read_string(uint32_t inode) const {
|
||||||
@ -321,11 +323,11 @@ class filesystem_v2 {
|
|||||||
history const& get_history() const { return impl_->get_history(); }
|
history const& get_history() const { return impl_->get_history(); }
|
||||||
|
|
||||||
nlohmann::json get_inode_info(inode_view entry) const {
|
nlohmann::json get_inode_info(inode_view entry) const {
|
||||||
return impl_->get_inode_info(entry);
|
return impl_->get_inode_info(std::move(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json get_inode_info(inode_view entry, size_t max_chunks) const {
|
nlohmann::json get_inode_info(inode_view entry, size_t max_chunks) const {
|
||||||
return impl_->get_inode_info(entry, max_chunks);
|
return impl_->get_inode_info(std::move(entry), max_chunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> get_all_block_categories() const {
|
std::vector<std::string> get_all_block_categories() const {
|
||||||
|
@ -114,16 +114,16 @@ class metadata_v2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_stat getattr(inode_view iv, std::error_code& ec) const {
|
file_stat getattr(inode_view iv, std::error_code& ec) const {
|
||||||
return impl_->getattr(iv, ec);
|
return impl_->getattr(std::move(iv), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_stat getattr(inode_view iv, getattr_options const& opts,
|
file_stat getattr(inode_view iv, getattr_options const& opts,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
return impl_->getattr(iv, opts, ec);
|
return impl_->getattr(std::move(iv), opts, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<directory_view> opendir(inode_view iv) const {
|
std::optional<directory_view> opendir(inode_view iv) const {
|
||||||
return impl_->opendir(iv);
|
return impl_->opendir(std::move(iv));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<dir_entry_view>
|
std::optional<dir_entry_view>
|
||||||
@ -135,16 +135,16 @@ class metadata_v2 {
|
|||||||
|
|
||||||
void access(inode_view iv, int mode, file_stat::uid_type uid,
|
void access(inode_view iv, int mode, file_stat::uid_type uid,
|
||||||
file_stat::gid_type gid, std::error_code& ec) const {
|
file_stat::gid_type gid, std::error_code& ec) const {
|
||||||
impl_->access(iv, mode, uid, gid, ec);
|
impl_->access(std::move(iv), mode, uid, gid, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int open(inode_view iv, std::error_code& ec) const {
|
int open(inode_view iv, std::error_code& ec) const {
|
||||||
return impl_->open(iv, ec);
|
return impl_->open(std::move(iv), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
readlink(inode_view iv, readlink_mode mode, std::error_code& ec) const {
|
readlink(inode_view iv, readlink_mode mode, std::error_code& ec) const {
|
||||||
return impl_->readlink(iv, mode, ec);
|
return impl_->readlink(std::move(iv), mode, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void statvfs(vfs_stat* stbuf) const { impl_->statvfs(stbuf); }
|
void statvfs(vfs_stat* stbuf) const { impl_->statvfs(stbuf); }
|
||||||
@ -158,7 +158,7 @@ class metadata_v2 {
|
|||||||
bool has_symlinks() const { return impl_->has_symlinks(); }
|
bool has_symlinks() const { return impl_->has_symlinks(); }
|
||||||
|
|
||||||
nlohmann::json get_inode_info(inode_view iv, size_t max_chunks) const {
|
nlohmann::json get_inode_info(inode_view iv, size_t max_chunks) const {
|
||||||
return impl_->get_inode_info(iv, max_chunks);
|
return impl_->get_inode_info(std::move(iv), max_chunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> get_block_category(size_t block_number) const {
|
std::optional<std::string> get_block_category(size_t block_number) const {
|
||||||
|
@ -215,7 +215,7 @@ class typed_metadata_requirement_base
|
|||||||
value_parser_type value_parser)
|
value_parser_type value_parser)
|
||||||
: checked_metadata_requirement_base<Meta>(name)
|
: checked_metadata_requirement_base<Meta>(name)
|
||||||
, mp_{mp}
|
, mp_{mp}
|
||||||
, value_parser_{value_parser} {}
|
, value_parser_{std::move(value_parser)} {}
|
||||||
|
|
||||||
void check(Meta const& m) const override { check_value(m.*mp_); }
|
void check(Meta const& m) const override { check_value(m.*mp_); }
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class entry_factory {
|
|||||||
std::shared_ptr<internal::entry>
|
std::shared_ptr<internal::entry>
|
||||||
create(os_access const& os, std::filesystem::path const& path,
|
create(os_access const& os, std::filesystem::path const& path,
|
||||||
std::shared_ptr<internal::entry> parent = nullptr) {
|
std::shared_ptr<internal::entry> parent = nullptr) {
|
||||||
return impl_->create(os, path, parent);
|
return impl_->create(os, path, std::move(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
class impl {
|
class impl {
|
||||||
|
@ -64,7 +64,7 @@ class scanner {
|
|||||||
writer_progress& prog,
|
writer_progress& prog,
|
||||||
std::optional<std::span<std::filesystem::path const>> list = std::nullopt,
|
std::optional<std::span<std::filesystem::path const>> list = std::nullopt,
|
||||||
std::shared_ptr<file_access const> fa = nullptr) {
|
std::shared_ptr<file_access const> fa = nullptr) {
|
||||||
impl_->scan(fsw, path, prog, list, fa);
|
impl_->scan(fsw, path, prog, list, std::move(fa));
|
||||||
}
|
}
|
||||||
|
|
||||||
class impl {
|
class impl {
|
||||||
|
@ -155,7 +155,9 @@ class block_request {
|
|||||||
promise_.set_value(block_range(std::move(block), begin_, end_ - begin_));
|
promise_.set_value(block_range(std::move(block), begin_, end_ - begin_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void error(std::exception_ptr error) { promise_.set_exception(error); }
|
void error(std::exception_ptr error) {
|
||||||
|
promise_.set_exception(std::move(error));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t begin_{0};
|
size_t begin_{0};
|
||||||
|
@ -29,7 +29,7 @@ namespace dwarfs::writer {
|
|||||||
|
|
||||||
category_parser::category_parser(
|
category_parser::category_parser(
|
||||||
std::shared_ptr<category_resolver const> resolver)
|
std::shared_ptr<category_resolver const> resolver)
|
||||||
: resolver_{resolver} {}
|
: resolver_{std::move(resolver)} {}
|
||||||
|
|
||||||
std::vector<fragment_category::value_type>
|
std::vector<fragment_category::value_type>
|
||||||
category_parser::parse(std::string_view arg) const {
|
category_parser::parse(std::string_view arg) const {
|
||||||
|
@ -163,7 +163,7 @@ void output_context_line(terminal const& term, std::ostream& os,
|
|||||||
console_writer::console_writer(std::shared_ptr<terminal const> term,
|
console_writer::console_writer(std::shared_ptr<terminal const> term,
|
||||||
std::ostream& os, progress_mode pg_mode,
|
std::ostream& os, progress_mode pg_mode,
|
||||||
display_mode mode, logger_options const& options)
|
display_mode mode, logger_options const& options)
|
||||||
: stream_logger(term, os, options)
|
: stream_logger(std::move(term), os, options)
|
||||||
, pg_mode_(pg_mode)
|
, pg_mode_(pg_mode)
|
||||||
, mode_(mode) {}
|
, mode_(mode) {}
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ void filesystem_writer_<LoggerPolicy>::write_block_impl(
|
|||||||
auto fsb = std::make_unique<fsblock>(section_type::BLOCK, bc, std::move(data),
|
auto fsb = std::make_unique<fsblock>(section_type::BLOCK, bc, std::move(data),
|
||||||
pctx, std::move(physical_block_cb));
|
pctx, std::move(physical_block_cb));
|
||||||
|
|
||||||
fsb->compress(wg_, meta);
|
fsb->compress(wg_, std::move(meta));
|
||||||
|
|
||||||
merger_->add(cat, std::move(fsb));
|
merger_->add(cat, std::move(fsb));
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace dwarfs::writer::internal {
|
|||||||
|
|
||||||
scanner_progress::scanner_progress(std::string_view context, std::string file,
|
scanner_progress::scanner_progress(std::string_view context, std::string file,
|
||||||
size_t size)
|
size_t size)
|
||||||
: scanner_progress(termcolor::YELLOW, context, file, size) {}
|
: scanner_progress(termcolor::YELLOW, context, std::move(file), size) {}
|
||||||
|
|
||||||
scanner_progress::scanner_progress(termcolor color, std::string_view context,
|
scanner_progress::scanner_progress(termcolor color, std::string_view context,
|
||||||
std::string file, size_t size)
|
std::string file, size_t size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user