mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-10 13:04:15 -04:00
refactor(global_entry_data): move to internal namespace
This commit is contained in:
parent
509aca8247
commit
ae87825243
@ -653,7 +653,7 @@ list(APPEND LIBDWARFS_WRITER_SRC
|
||||
src/dwarfs/fragment_category.cpp
|
||||
src/dwarfs/fragment_chunkable.cpp
|
||||
src/dwarfs/fragment_order_parser.cpp
|
||||
src/dwarfs/global_entry_data.cpp
|
||||
src/dwarfs/internal/global_entry_data.cpp
|
||||
src/dwarfs/inode_element_view.cpp
|
||||
src/dwarfs/inode_fragments.cpp
|
||||
src/dwarfs/inode_manager.cpp
|
||||
|
@ -54,8 +54,13 @@ class inode;
|
||||
class mmif;
|
||||
class os_access;
|
||||
class progress;
|
||||
|
||||
namespace internal {
|
||||
|
||||
class global_entry_data;
|
||||
|
||||
}
|
||||
|
||||
class entry_visitor {
|
||||
public:
|
||||
virtual ~entry_visitor() = default;
|
||||
@ -87,8 +92,8 @@ class entry : public entry_interface {
|
||||
virtual void walk(std::function<void(entry*)> const& f);
|
||||
virtual void walk(std::function<void(const entry*)> const& f) const;
|
||||
void pack(thrift::metadata::inode_data& entry_v2,
|
||||
global_entry_data const& data) const;
|
||||
void update(global_entry_data& data) const;
|
||||
internal::global_entry_data const& data) const;
|
||||
void update(internal::global_entry_data& data) const;
|
||||
virtual void accept(entry_visitor& v, bool preorder = false) = 0;
|
||||
virtual void scan(os_access const& os, progress& prog) = 0;
|
||||
file_stat const& status() const { return stat_; }
|
||||
@ -171,10 +176,10 @@ class dir : public entry {
|
||||
void walk(std::function<void(const entry*)> const& f) const override;
|
||||
void accept(entry_visitor& v, bool preorder) override;
|
||||
void sort();
|
||||
void
|
||||
pack(thrift::metadata::metadata& mv2, global_entry_data const& data) const;
|
||||
void pack(thrift::metadata::metadata& mv2,
|
||||
internal::global_entry_data const& data) const;
|
||||
void pack_entry(thrift::metadata::metadata& mv2,
|
||||
global_entry_data const& data) const;
|
||||
internal::global_entry_data const& data) const;
|
||||
void scan(os_access const& os, progress& prog) override;
|
||||
bool empty() const { return entries_.empty(); }
|
||||
void remove_empty_dirs(progress& prog);
|
||||
|
@ -34,6 +34,8 @@ namespace dwarfs {
|
||||
|
||||
struct scanner_options;
|
||||
|
||||
namespace internal {
|
||||
|
||||
class global_entry_data {
|
||||
public:
|
||||
using uid_type = file_stat::uid_type;
|
||||
@ -112,4 +114,6 @@ class global_entry_data {
|
||||
scanner_options const& options_;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
} // namespace dwarfs
|
@ -29,8 +29,8 @@
|
||||
#include <dwarfs/entry.h>
|
||||
#include <dwarfs/error.h>
|
||||
#include <dwarfs/file_type.h>
|
||||
#include <dwarfs/global_entry_data.h>
|
||||
#include <dwarfs/inode.h>
|
||||
#include <dwarfs/internal/global_entry_data.h>
|
||||
#include <dwarfs/mmif.h>
|
||||
#include <dwarfs/nilsimsa.h>
|
||||
#include <dwarfs/options.h>
|
||||
@ -146,7 +146,7 @@ void entry::walk(std::function<void(entry*)> const& f) { f(this); }
|
||||
|
||||
void entry::walk(std::function<void(const entry*)> const& f) const { f(this); }
|
||||
|
||||
void entry::update(global_entry_data& data) const {
|
||||
void entry::update(internal::global_entry_data& data) const {
|
||||
data.add_uid(stat_.uid);
|
||||
data.add_gid(stat_.gid);
|
||||
data.add_mode(stat_.mode);
|
||||
@ -156,7 +156,7 @@ void entry::update(global_entry_data& data) const {
|
||||
}
|
||||
|
||||
void entry::pack(thrift::metadata::inode_data& entry_v2,
|
||||
global_entry_data const& data) const {
|
||||
internal::global_entry_data const& data) const {
|
||||
entry_v2.mode_index() = data.get_mode_index(stat_.mode);
|
||||
entry_v2.owner_index() = data.get_uid_index(stat_.uid);
|
||||
entry_v2.group_index() = data.get_gid_index(stat_.gid);
|
||||
@ -330,7 +330,7 @@ void dir::sort() {
|
||||
void dir::scan(os_access const&, progress&) {}
|
||||
|
||||
void dir::pack_entry(thrift::metadata::metadata& mv2,
|
||||
global_entry_data const& data) const {
|
||||
internal::global_entry_data const& data) const {
|
||||
auto& de = mv2.dir_entries()->emplace_back();
|
||||
de.name_index() = has_parent() ? data.get_name_index(name()) : 0;
|
||||
de.inode_num() = DWARFS_NOTHROW(inode_num().value());
|
||||
@ -338,7 +338,7 @@ void dir::pack_entry(thrift::metadata::metadata& mv2,
|
||||
}
|
||||
|
||||
void dir::pack(thrift::metadata::metadata& mv2,
|
||||
global_entry_data const& data) const {
|
||||
internal::global_entry_data const& data) const {
|
||||
thrift::metadata::directory d;
|
||||
if (has_parent()) {
|
||||
auto pd = std::dynamic_pointer_cast<dir>(parent());
|
||||
|
@ -22,10 +22,10 @@
|
||||
#include <folly/gen/Base.h>
|
||||
|
||||
#include <dwarfs/error.h>
|
||||
#include <dwarfs/global_entry_data.h>
|
||||
#include <dwarfs/internal/global_entry_data.h>
|
||||
#include <dwarfs/options.h>
|
||||
|
||||
namespace dwarfs {
|
||||
namespace dwarfs::internal {
|
||||
|
||||
template <typename T, typename U>
|
||||
std::vector<T> global_entry_data::get_vector(map_type<T, U> const& map) const {
|
||||
@ -137,4 +137,4 @@ void global_entry_data::add_ctime(uint64_t time) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dwarfs
|
||||
} // namespace dwarfs::internal
|
@ -49,11 +49,11 @@
|
||||
#include <dwarfs/file_scanner.h>
|
||||
#include <dwarfs/filesystem_writer.h>
|
||||
#include <dwarfs/fragment_chunkable.h>
|
||||
#include <dwarfs/global_entry_data.h>
|
||||
#include <dwarfs/history.h>
|
||||
#include <dwarfs/inode.h>
|
||||
#include <dwarfs/inode_manager.h>
|
||||
#include <dwarfs/inode_ordering.h>
|
||||
#include <dwarfs/internal/global_entry_data.h>
|
||||
#include <dwarfs/logger.h>
|
||||
#include <dwarfs/metadata_freezer.h>
|
||||
#include <dwarfs/mmif.h>
|
||||
@ -149,7 +149,7 @@ class pipe_set_inode_visitor : public visitor_base {
|
||||
|
||||
class names_and_symlinks_visitor : public visitor_base {
|
||||
public:
|
||||
explicit names_and_symlinks_visitor(global_entry_data& data)
|
||||
explicit names_and_symlinks_visitor(internal::global_entry_data& data)
|
||||
: data_(data) {}
|
||||
|
||||
void visit(file* p) override { data_.add_name(p->name()); }
|
||||
@ -168,7 +168,7 @@ class names_and_symlinks_visitor : public visitor_base {
|
||||
}
|
||||
|
||||
private:
|
||||
global_entry_data& data_;
|
||||
internal::global_entry_data& data_;
|
||||
};
|
||||
|
||||
class save_directories_visitor : public visitor_base {
|
||||
@ -179,7 +179,8 @@ class save_directories_visitor : public visitor_base {
|
||||
|
||||
void visit(dir* p) override { directories_.at(p->inode_num().value()) = p; }
|
||||
|
||||
void pack(thrift::metadata::metadata& mv2, global_entry_data& ge_data) {
|
||||
void
|
||||
pack(thrift::metadata::metadata& mv2, internal::global_entry_data& ge_data) {
|
||||
for (auto p : directories_) {
|
||||
if (!p->has_parent()) {
|
||||
p->set_entry_index(mv2.dir_entries()->size());
|
||||
@ -681,7 +682,7 @@ void scanner_<LoggerPolicy>::scan(
|
||||
}
|
||||
}
|
||||
|
||||
global_entry_data ge_data(options_);
|
||||
internal::global_entry_data ge_data(options_);
|
||||
thrift::metadata::metadata mv2;
|
||||
feature_set features;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user