mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 00:10:03 -04:00
refactor(filesystem_v2): move entries if possible
This commit is contained in:
parent
a57a7afe3d
commit
0e69a4f07c
@ -34,6 +34,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <version>
|
#include <version>
|
||||||
|
|
||||||
@ -281,10 +282,11 @@ class filesystem_ final {
|
|||||||
bool has_symlinks() const { return meta_.has_symlinks(); }
|
bool has_symlinks() const { return meta_.has_symlinks(); }
|
||||||
history const& get_history() const { return history_; }
|
history const& get_history() const { return history_; }
|
||||||
nlohmann::json get_inode_info(inode_view entry) const {
|
nlohmann::json get_inode_info(inode_view entry) const {
|
||||||
return meta_.get_inode_info(entry, std::numeric_limits<size_t>::max());
|
return meta_.get_inode_info(std::move(entry),
|
||||||
|
std::numeric_limits<size_t>::max());
|
||||||
}
|
}
|
||||||
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 meta_.get_inode_info(entry, max_chunks);
|
return meta_.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 {
|
||||||
return meta_.get_all_block_categories();
|
return meta_.get_all_block_categories();
|
||||||
@ -783,14 +785,14 @@ template <typename LoggerPolicy>
|
|||||||
file_stat filesystem_<LoggerPolicy>::getattr(inode_view entry,
|
file_stat filesystem_<LoggerPolicy>::getattr(inode_view entry,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(getattr_ec)
|
PERFMON_CLS_SCOPED_SECTION(getattr_ec)
|
||||||
return meta_.getattr(entry, ec);
|
return meta_.getattr(std::move(entry), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
file_stat filesystem_<LoggerPolicy>::getattr(inode_view entry) const {
|
file_stat filesystem_<LoggerPolicy>::getattr(inode_view entry) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(getattr)
|
PERFMON_CLS_SCOPED_SECTION(getattr)
|
||||||
return call_ec_throw(
|
return call_ec_throw(
|
||||||
[&](std::error_code& ec) { return meta_.getattr(entry, ec); });
|
[&](std::error_code& ec) { return meta_.getattr(std::move(entry), ec); });
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
@ -798,7 +800,7 @@ file_stat filesystem_<LoggerPolicy>::getattr(inode_view entry,
|
|||||||
getattr_options const& opts,
|
getattr_options const& opts,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(getattr_opts_ec)
|
PERFMON_CLS_SCOPED_SECTION(getattr_opts_ec)
|
||||||
return meta_.getattr(entry, opts, ec);
|
return meta_.getattr(std::move(entry), opts, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
@ -806,8 +808,9 @@ file_stat
|
|||||||
filesystem_<LoggerPolicy>::getattr(inode_view entry,
|
filesystem_<LoggerPolicy>::getattr(inode_view entry,
|
||||||
getattr_options const& opts) const {
|
getattr_options const& opts) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(getattr_opts)
|
PERFMON_CLS_SCOPED_SECTION(getattr_opts)
|
||||||
return call_ec_throw(
|
return call_ec_throw([&](std::error_code& ec) {
|
||||||
[&](std::error_code& ec) { return meta_.getattr(entry, opts, ec); });
|
return meta_.getattr(std::move(entry), opts, ec);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
@ -816,7 +819,7 @@ bool filesystem_<LoggerPolicy>::access(inode_view entry, int mode,
|
|||||||
file_stat::gid_type gid) const {
|
file_stat::gid_type gid) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(access)
|
PERFMON_CLS_SCOPED_SECTION(access)
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
meta_.access(entry, mode, uid, gid, ec);
|
meta_.access(std::move(entry), mode, uid, gid, ec);
|
||||||
return !ec;
|
return !ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,14 +829,14 @@ void filesystem_<LoggerPolicy>::access(inode_view entry, int mode,
|
|||||||
file_stat::gid_type gid,
|
file_stat::gid_type gid,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(access_ec)
|
PERFMON_CLS_SCOPED_SECTION(access_ec)
|
||||||
meta_.access(entry, mode, uid, gid, ec);
|
meta_.access(std::move(entry), mode, uid, gid, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
std::optional<directory_view>
|
std::optional<directory_view>
|
||||||
filesystem_<LoggerPolicy>::opendir(inode_view entry) const {
|
filesystem_<LoggerPolicy>::opendir(inode_view entry) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(opendir)
|
PERFMON_CLS_SCOPED_SECTION(opendir)
|
||||||
return meta_.opendir(entry);
|
return meta_.opendir(std::move(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
@ -854,15 +857,16 @@ std::string
|
|||||||
filesystem_<LoggerPolicy>::readlink(inode_view entry, readlink_mode mode,
|
filesystem_<LoggerPolicy>::readlink(inode_view entry, readlink_mode mode,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(readlink_ec)
|
PERFMON_CLS_SCOPED_SECTION(readlink_ec)
|
||||||
return meta_.readlink(entry, mode, ec);
|
return meta_.readlink(std::move(entry), mode, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
std::string filesystem_<LoggerPolicy>::readlink(inode_view entry,
|
std::string filesystem_<LoggerPolicy>::readlink(inode_view entry,
|
||||||
readlink_mode mode) const {
|
readlink_mode mode) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(readlink)
|
PERFMON_CLS_SCOPED_SECTION(readlink)
|
||||||
return call_ec_throw(
|
return call_ec_throw([&](std::error_code& ec) {
|
||||||
[&](std::error_code& ec) { return meta_.readlink(entry, mode, ec); });
|
return meta_.readlink(std::move(entry), mode, ec);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
@ -876,14 +880,14 @@ template <typename LoggerPolicy>
|
|||||||
int filesystem_<LoggerPolicy>::open(inode_view entry,
|
int filesystem_<LoggerPolicy>::open(inode_view entry,
|
||||||
std::error_code& ec) const {
|
std::error_code& ec) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(open_ec)
|
PERFMON_CLS_SCOPED_SECTION(open_ec)
|
||||||
return meta_.open(entry, ec);
|
return meta_.open(std::move(entry), ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
int filesystem_<LoggerPolicy>::open(inode_view entry) const {
|
int filesystem_<LoggerPolicy>::open(inode_view entry) const {
|
||||||
PERFMON_CLS_SCOPED_SECTION(open)
|
PERFMON_CLS_SCOPED_SECTION(open)
|
||||||
return call_ec_throw(
|
return call_ec_throw(
|
||||||
[&](std::error_code& ec) { return meta_.open(entry, ec); });
|
[&](std::error_code& ec) { return meta_.open(std::move(entry), ec); });
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename LoggerPolicy>
|
template <typename LoggerPolicy>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user