diff --git a/CMakeLists.txt b/CMakeLists.txt
index 121e6307..e42e29c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -646,7 +646,7 @@ list(APPEND LIBDWARFS_WRITER_SRC
src/dwarfs/category_parser.cpp
src/dwarfs/chmod_entry_transformer.cpp
src/dwarfs/console_writer.cpp
- src/dwarfs/entry.cpp
+ src/dwarfs/entry_factory.cpp
src/dwarfs/filesystem_block_category_resolver.cpp
src/dwarfs/filesystem_writer.cpp
src/dwarfs/filter_debug.cpp
@@ -655,6 +655,7 @@ list(APPEND LIBDWARFS_WRITER_SRC
src/dwarfs/inode_fragments.cpp
src/dwarfs/internal/block_manager.cpp
src/dwarfs/internal/chmod_transformer.cpp
+ src/dwarfs/internal/entry.cpp
src/dwarfs/internal/file_scanner.cpp
src/dwarfs/internal/fragment_chunkable.cpp
src/dwarfs/internal/global_entry_data.cpp
diff --git a/include/dwarfs/entry_factory.h b/include/dwarfs/entry_factory.h
new file mode 100644
index 00000000..4057716f
--- /dev/null
+++ b/include/dwarfs/entry_factory.h
@@ -0,0 +1,60 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/**
+ * \author Marcus Holland-Moritz (github@mhxnet.de)
+ * \copyright Copyright (c) Marcus Holland-Moritz
+ *
+ * This file is part of dwarfs.
+ *
+ * dwarfs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * dwarfs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with dwarfs. If not, see .
+ */
+
+#pragma once
+
+#include
+#include
+
+namespace dwarfs {
+
+class os_access;
+
+namespace internal {
+
+class entry;
+
+} // namespace internal
+
+class entry_factory {
+ public:
+ entry_factory();
+
+ std::shared_ptr
+ create(os_access const& os, std::filesystem::path const& path,
+ std::shared_ptr parent = nullptr) {
+ return impl_->create(os, path, parent);
+ }
+
+ class impl {
+ public:
+ virtual ~impl() = default;
+
+ virtual std::shared_ptr
+ create(os_access const& os, std::filesystem::path const& path,
+ std::shared_ptr parent) = 0;
+ };
+
+ private:
+ std::unique_ptr impl_;
+};
+
+} // namespace dwarfs
diff --git a/include/dwarfs/filter_debug.h b/include/dwarfs/filter_debug.h
index fa54b214..9e521ce0 100644
--- a/include/dwarfs/filter_debug.h
+++ b/include/dwarfs/filter_debug.h
@@ -25,7 +25,7 @@
namespace dwarfs {
-class entry;
+class entry_interface;
enum class debug_filter_mode {
OFF,
@@ -37,7 +37,7 @@ enum class debug_filter_mode {
ALL
};
-void debug_filter_output(std::ostream& os, bool exclude, entry const* pe,
- debug_filter_mode mode);
+void debug_filter_output(std::ostream& os, bool exclude,
+ entry_interface const& ei, debug_filter_mode mode);
} // namespace dwarfs
diff --git a/include/dwarfs/internal/chunkable.h b/include/dwarfs/internal/chunkable.h
index 4f79ec11..04d93cc2 100644
--- a/include/dwarfs/internal/chunkable.h
+++ b/include/dwarfs/internal/chunkable.h
@@ -26,10 +26,10 @@
namespace dwarfs {
-class file;
-
namespace internal {
+class file;
+
class chunkable {
public:
virtual ~chunkable() = default;
diff --git a/include/dwarfs/entry.h b/include/dwarfs/internal/entry.h
similarity index 83%
rename from include/dwarfs/entry.h
rename to include/dwarfs/internal/entry.h
index 6f179a4f..231e7b73 100644
--- a/include/dwarfs/entry.h
+++ b/include/dwarfs/internal/entry.h
@@ -46,21 +46,19 @@ class metadata;
} // namespace thrift::metadata
-class file;
-class link;
-class dir;
-class device;
class mmif;
class os_access;
namespace internal {
+class file;
+class link;
+class dir;
+class device;
class global_entry_data;
class inode;
class progress;
-} // namespace internal
-
class entry_visitor {
public:
virtual ~entry_visitor() = default;
@@ -92,10 +90,10 @@ class entry : public entry_interface {
virtual void walk(std::function const& f);
virtual void walk(std::function const& f) const;
void pack(thrift::metadata::inode_data& entry_v2,
- internal::global_entry_data const& data) const;
- void update(internal::global_entry_data& data) const;
+ global_entry_data const& data) const;
+ void update(global_entry_data& data) const;
virtual void accept(entry_visitor& v, bool preorder = false) = 0;
- virtual void scan(os_access const& os, internal::progress& prog) = 0;
+ virtual void scan(os_access const& os, progress& prog) = 0;
file_stat const& status() const { return stat_; }
void set_entry_index(uint32_t index) { entry_index_ = index; }
std::optional const& entry_index() const { return entry_index_; }
@@ -135,14 +133,14 @@ class file : public entry {
type_t type() const override;
std::string_view hash() const;
- void set_inode(std::shared_ptr ino);
- std::shared_ptr get_inode() const;
+ void set_inode(std::shared_ptr ino);
+ std::shared_ptr get_inode() const;
void accept(entry_visitor& v, bool preorder) override;
- void scan(os_access const& os, internal::progress& prog) override;
- void scan(mmif* mm, internal::progress& prog,
- std::optional const& hash_alg);
+ void scan(os_access const& os, progress& prog) override;
+ void
+ scan(mmif* mm, progress& prog, std::optional const& hash_alg);
void create_data();
- void hardlink(file* other, internal::progress& prog);
+ void hardlink(file* other, progress& prog);
uint32_t unique_file_id() const;
void set_inode_num(uint32_t ino) override;
@@ -163,7 +161,7 @@ class file : public entry {
};
std::shared_ptr data_;
- std::shared_ptr inode_;
+ std::shared_ptr inode_;
};
class dir : public entry {
@@ -176,13 +174,13 @@ class dir : public entry {
void walk(std::function const& f) const override;
void accept(entry_visitor& v, bool preorder) override;
void sort();
- void pack(thrift::metadata::metadata& mv2,
- internal::global_entry_data const& data) const;
+ void
+ pack(thrift::metadata::metadata& mv2, global_entry_data const& data) const;
void pack_entry(thrift::metadata::metadata& mv2,
- internal::global_entry_data const& data) const;
- void scan(os_access const& os, internal::progress& prog) override;
+ 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(internal::progress& prog);
+ void remove_empty_dirs(progress& prog);
void set_inode_num(uint32_t ino) override { inode_num_ = ino; }
std::optional const& inode_num() const override {
@@ -209,7 +207,7 @@ class link : public entry {
type_t type() const override;
const std::string& linkname() const;
void accept(entry_visitor& v, bool preorder) override;
- void scan(os_access const& os, internal::progress& prog) override;
+ void scan(os_access const& os, progress& prog) override;
void set_inode_num(uint32_t ino) override { inode_num_ = ino; }
std::optional const& inode_num() const override {
@@ -231,7 +229,7 @@ class device : public entry {
type_t type() const override;
void accept(entry_visitor& v, bool preorder) override;
- void scan(os_access const& os, internal::progress& prog) override;
+ void scan(os_access const& os, progress& prog) override;
uint64_t device_id() const;
void set_inode_num(uint32_t ino) override { inode_num_ = ino; }
@@ -243,14 +241,6 @@ class device : public entry {
std::optional inode_num_;
};
-class entry_factory {
- public:
- static std::unique_ptr create();
+} // namespace internal
- virtual ~entry_factory() = default;
-
- virtual std::shared_ptr
- create(os_access const& os, std::filesystem::path const& path,
- std::shared_ptr parent = nullptr) = 0;
-};
} // namespace dwarfs
diff --git a/include/dwarfs/internal/file_scanner.h b/include/dwarfs/internal/file_scanner.h
index e56c2aee..b7134f2b 100644
--- a/include/dwarfs/internal/file_scanner.h
+++ b/include/dwarfs/internal/file_scanner.h
@@ -28,7 +28,6 @@
namespace dwarfs {
-class file;
class logger;
class os_access;
class progress;
@@ -37,6 +36,7 @@ struct inode_options;
namespace internal {
+class file;
class inode_manager;
class worker_group;
diff --git a/include/dwarfs/internal/inode.h b/include/dwarfs/internal/inode.h
index eee5b54f..a46f7391 100644
--- a/include/dwarfs/internal/inode.h
+++ b/include/dwarfs/internal/inode.h
@@ -41,7 +41,6 @@ namespace thrift::metadata {
class chunk;
}
-class file;
class mmif;
class os_access;
class progress;
@@ -50,6 +49,8 @@ struct inode_options;
namespace internal {
+class file;
+
class inode : public object {
public:
using files_vector = small_vector;
diff --git a/include/dwarfs/internal/inode_manager.h b/include/dwarfs/internal/inode_manager.h
index 3096f6ff..6564b709 100644
--- a/include/dwarfs/internal/inode_manager.h
+++ b/include/dwarfs/internal/inode_manager.h
@@ -35,8 +35,6 @@
namespace dwarfs {
-class file;
-class inode;
class logger;
class os_access;
class progress;
@@ -46,6 +44,7 @@ struct inode_options;
namespace internal {
+class file;
class worker_group;
class inode_manager {
diff --git a/include/dwarfs/options.h b/include/dwarfs/options.h
index b860f559..758268a7 100644
--- a/include/dwarfs/options.h
+++ b/include/dwarfs/options.h
@@ -37,7 +37,7 @@
namespace dwarfs {
class categorizer_manager;
-class entry;
+class entry_interface;
enum class mlock_mode { NONE, TRY, MUST };
@@ -139,7 +139,8 @@ struct scanner_options {
bool pack_symlinks_index{false};
bool force_pack_string_tables{false};
bool no_create_timestamp{false};
- std::optional> debug_filter_function;
+ std::optional>
+ debug_filter_function;
size_t num_segmenter_workers{1};
bool enable_history{true};
std::optional> command_line_arguments;
diff --git a/src/dwarfs/console_writer.cpp b/src/dwarfs/console_writer.cpp
index fa8fd0fe..e88066b2 100644
--- a/src/dwarfs/console_writer.cpp
+++ b/src/dwarfs/console_writer.cpp
@@ -26,7 +26,6 @@
#include
#include
-#include
#include
#include
#include
@@ -34,6 +33,7 @@
#include
#include
+#include
#include
namespace dwarfs {
diff --git a/src/dwarfs/entry_factory.cpp b/src/dwarfs/entry_factory.cpp
new file mode 100644
index 00000000..b3a60b57
--- /dev/null
+++ b/src/dwarfs/entry_factory.cpp
@@ -0,0 +1,72 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/**
+ * \author Marcus Holland-Moritz (github@mhxnet.de)
+ * \copyright Copyright (c) Marcus Holland-Moritz
+ *
+ * This file is part of dwarfs.
+ *
+ * dwarfs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * dwarfs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with dwarfs. If not, see .
+ */
+
+#include
+#include
+
+#include
+
+namespace dwarfs {
+
+namespace internal {
+
+class entry_factory_ : public entry_factory::impl {
+ public:
+ std::shared_ptr
+ create(os_access const& os, std::filesystem::path const& path,
+ std::shared_ptr parent) override {
+ // TODO: just use `path` directly (need to fix test helpers, tho)?
+ std::filesystem::path p =
+ parent ? parent->fs_path() / path.filename() : path;
+
+ auto st = os.symlink_info(p);
+
+ switch (st.type()) {
+ case posix_file_type::regular:
+ return std::make_shared(path, std::move(parent), st);
+
+ case posix_file_type::directory:
+ return std::make_shared(path, std::move(parent), st);
+
+ case posix_file_type::symlink:
+ return std::make_shared(path, std::move(parent), st);
+
+ case posix_file_type::character:
+ case posix_file_type::block:
+ case posix_file_type::fifo:
+ case posix_file_type::socket:
+ return std::make_shared(path, std::move(parent), st);
+
+ default:
+ // TODO: warn
+ break;
+ }
+
+ return nullptr;
+ }
+};
+
+} // namespace internal
+
+entry_factory::entry_factory()
+ : impl_(std::make_unique()) {}
+
+} // namespace dwarfs
diff --git a/src/dwarfs/filter_debug.cpp b/src/dwarfs/filter_debug.cpp
index 3563eccc..1366aa77 100644
--- a/src/dwarfs/filter_debug.cpp
+++ b/src/dwarfs/filter_debug.cpp
@@ -21,13 +21,13 @@
#include
-#include
+#include
#include
namespace dwarfs {
-void debug_filter_output(std::ostream& os, bool exclude, entry const* pe,
- debug_filter_mode mode) {
+void debug_filter_output(std::ostream& os, bool exclude,
+ entry_interface const& ei, debug_filter_mode mode) {
if (exclude ? mode == debug_filter_mode::INCLUDED or
mode == debug_filter_mode::INCLUDED_FILES
: mode == debug_filter_mode::EXCLUDED or
@@ -39,7 +39,7 @@ void debug_filter_output(std::ostream& os, bool exclude, entry const* pe,
mode == debug_filter_mode::INCLUDED_FILES or
mode == debug_filter_mode::EXCLUDED_FILES;
- if (files_only and pe->type() == entry::E_DIR) {
+ if (files_only and ei.is_directory()) {
return;
}
@@ -49,7 +49,7 @@ void debug_filter_output(std::ostream& os, bool exclude, entry const* pe,
prefix = exclude ? "- " : "+ ";
}
- os << prefix << pe->unix_dpath() << "\n";
+ os << prefix << ei.unix_dpath() << "\n";
}
} // namespace dwarfs
diff --git a/src/dwarfs/entry.cpp b/src/dwarfs/internal/entry.cpp
similarity index 83%
rename from src/dwarfs/entry.cpp
rename to src/dwarfs/internal/entry.cpp
index eb129ce1..d80cb68b 100644
--- a/src/dwarfs/entry.cpp
+++ b/src/dwarfs/internal/entry.cpp
@@ -26,7 +26,6 @@
#include
#include
-#include
#include
#include
#include
@@ -34,6 +33,7 @@
#include
#include
+#include
#include
#include
#include
@@ -41,7 +41,7 @@
#include
-namespace dwarfs {
+namespace dwarfs::internal {
namespace {
@@ -146,7 +146,7 @@ void entry::walk(std::function const& f) { f(this); }
void entry::walk(std::function const& f) const { f(this); }
-void entry::update(internal::global_entry_data& data) const {
+void entry::update(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(internal::global_entry_data& data) const {
}
void entry::pack(thrift::metadata::inode_data& entry_v2,
- internal::global_entry_data const& data) const {
+ 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);
@@ -196,7 +196,7 @@ std::string_view file::hash() const {
return std::string_view(h.data(), h.size());
}
-void file::set_inode(std::shared_ptr ino) {
+void file::set_inode(std::shared_ptr ino) {
if (inode_) {
DWARFS_THROW(runtime_error, "inode already set for file");
}
@@ -204,28 +204,28 @@ void file::set_inode(std::shared_ptr ino) {
inode_ = std::move(ino);
}
-std::shared_ptr file::get_inode() const { return inode_; }
+std::shared_ptr file::get_inode() const { return inode_; }
void file::accept(entry_visitor& v, bool) { v.visit(this); }
-void file::scan(os_access const& /*os*/, internal::progress& /*prog*/) {
+void file::scan(os_access const& /*os*/, progress& /*prog*/) {
DWARFS_THROW(runtime_error, "file::scan() without hash_alg is not used");
}
-void file::scan(mmif* mm, internal::progress& prog,
+void file::scan(mmif* mm, progress& prog,
std::optional const& hash_alg) {
size_t s = size();
if (hash_alg) {
- internal::progress::scan_updater supd(prog.hash, s);
+ progress::scan_updater supd(prog.hash, s);
checksum cs(*hash_alg);
if (s > 0) {
- std::shared_ptr pctx;
+ std::shared_ptr pctx;
auto const chunk_size = prog.hash.chunk_size.load();
if (s >= 4 * chunk_size) {
- pctx = prog.create_context(
+ pctx = prog.create_context(
termcolor::MAGENTA, kHashContext, path_as_string(), s);
}
@@ -271,7 +271,7 @@ void file::create_data() {
data_ = std::make_shared();
}
-void file::hardlink(file* other, internal::progress& prog) {
+void file::hardlink(file* other, progress& prog) {
assert(!data_);
assert(other->data_);
prog.hardlink_size += size();
@@ -327,10 +327,10 @@ void dir::sort() {
});
}
-void dir::scan(os_access const&, internal::progress&) {}
+void dir::scan(os_access const&, progress&) {}
void dir::pack_entry(thrift::metadata::metadata& mv2,
- internal::global_entry_data const& data) const {
+ 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,
- internal::global_entry_data const& data) const {
+ global_entry_data const& data) const {
thrift::metadata::directory d;
if (has_parent()) {
auto pd = std::dynamic_pointer_cast(parent());
@@ -360,7 +360,7 @@ void dir::pack(thrift::metadata::metadata& mv2,
}
}
-void dir::remove_empty_dirs(internal::progress& prog) {
+void dir::remove_empty_dirs(progress& prog) {
auto last = std::remove_if(entries_.begin(), entries_.end(),
[&](std::shared_ptr const& e) {
if (auto d = dynamic_cast(e.get())) {
@@ -420,7 +420,7 @@ const std::string& link::linkname() const { return link_; }
void link::accept(entry_visitor& v, bool) { v.visit(this); }
-void link::scan(os_access const& os, internal::progress& prog) {
+void link::scan(os_access const& os, progress& prog) {
link_ = u8string_to_string(os.read_symlink(fs_path()).u8string());
prog.original_size += size();
prog.symlink_size += size();
@@ -438,47 +438,8 @@ entry::type_t device::type() const {
void device::accept(entry_visitor& v, bool) { v.visit(this); }
-void device::scan(os_access const&, internal::progress&) {}
+void device::scan(os_access const&, progress&) {}
uint64_t device::device_id() const { return status().rdev; }
-class entry_factory_ : public entry_factory {
- public:
- std::shared_ptr
- create(os_access const& os, std::filesystem::path const& path,
- std::shared_ptr parent) override {
- // TODO: just use `path` directly (need to fix test helpers, tho)?
- std::filesystem::path p =
- parent ? parent->fs_path() / path.filename() : path;
-
- auto st = os.symlink_info(p);
-
- switch (st.type()) {
- case posix_file_type::regular:
- return std::make_shared(path, std::move(parent), st);
-
- case posix_file_type::directory:
- return std::make_shared(path, std::move(parent), st);
-
- case posix_file_type::symlink:
- return std::make_shared(path, std::move(parent), st);
-
- case posix_file_type::character:
- case posix_file_type::block:
- case posix_file_type::fifo:
- case posix_file_type::socket:
- return std::make_shared(path, std::move(parent), st);
-
- default:
- // TODO: warn
- break;
- }
-
- return nullptr;
- }
-};
-
-std::unique_ptr entry_factory::create() {
- return std::make_unique();
-}
-} // namespace dwarfs
+} // namespace dwarfs::internal
diff --git a/src/dwarfs/internal/file_scanner.cpp b/src/dwarfs/internal/file_scanner.cpp
index 92e7debf..5c67e2be 100644
--- a/src/dwarfs/internal/file_scanner.cpp
+++ b/src/dwarfs/internal/file_scanner.cpp
@@ -33,7 +33,6 @@
#include
#include
-#include
#include
#include
#include
@@ -41,6 +40,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/dwarfs/internal/fragment_chunkable.cpp b/src/dwarfs/internal/fragment_chunkable.cpp
index 8f12dd2a..a16d599b 100644
--- a/src/dwarfs/internal/fragment_chunkable.cpp
+++ b/src/dwarfs/internal/fragment_chunkable.cpp
@@ -22,10 +22,10 @@
#include
#include
-#include
#include
#include
+#include
#include
#include
diff --git a/src/dwarfs/internal/inode_element_view.cpp b/src/dwarfs/internal/inode_element_view.cpp
index 8e6c4734..6edaf666 100644
--- a/src/dwarfs/internal/inode_element_view.cpp
+++ b/src/dwarfs/internal/inode_element_view.cpp
@@ -23,8 +23,7 @@
#include
-#include
-
+#include
#include
#include
diff --git a/src/dwarfs/internal/inode_manager.cpp b/src/dwarfs/internal/inode_manager.cpp
index d334ba93..6c8324c1 100644
--- a/src/dwarfs/internal/inode_manager.cpp
+++ b/src/dwarfs/internal/inode_manager.cpp
@@ -42,7 +42,6 @@
#include
#include
-#include
#include
#include
#include
@@ -52,6 +51,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/dwarfs/internal/inode_ordering.cpp b/src/dwarfs/internal/inode_ordering.cpp
index 635d5b03..8d2bd627 100644
--- a/src/dwarfs/internal/inode_ordering.cpp
+++ b/src/dwarfs/internal/inode_ordering.cpp
@@ -21,10 +21,10 @@
#include
-#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/dwarfs/scanner.cpp b/src/dwarfs/scanner.cpp
index 0ed5b0fe..48b5eace 100644
--- a/src/dwarfs/scanner.cpp
+++ b/src/dwarfs/scanner.cpp
@@ -39,7 +39,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -58,6 +58,7 @@
#include
#include
+#include
#include
#include
#include
@@ -356,7 +357,7 @@ scanner_::add_entry(std::filesystem::path const& name,
}
if (debug_filter) {
- (*options_.debug_filter_function)(exclude, pe.get());
+ (*options_.debug_filter_function)(exclude, *pe);
}
if (exclude) {
diff --git a/src/dwarfs/segmenter.cpp b/src/dwarfs/segmenter.cpp
index 4f0c25a6..445bdf8f 100644
--- a/src/dwarfs/segmenter.cpp
+++ b/src/dwarfs/segmenter.cpp
@@ -43,7 +43,6 @@
#include
#include
-#include
#include
#include
#include
@@ -54,6 +53,7 @@
#include
#include
#include
+#include
#include
namespace dwarfs {
diff --git a/src/mkdwarfs_main.cpp b/src/mkdwarfs_main.cpp
index 1522af1b..c7409d39 100644
--- a/src/mkdwarfs_main.cpp
+++ b/src/mkdwarfs_main.cpp
@@ -66,7 +66,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -906,8 +906,8 @@ int mkdwarfs_main(int argc, sys_char** argv, iolayer const& iol) {
if (auto it = debug_filter_modes.find(debug_filter);
it != debug_filter_modes.end()) {
options.debug_filter_function =
- [&iol, mode = it->second](bool exclude, entry const* pe) {
- debug_filter_output(iol.out, exclude, pe, mode);
+ [&iol, mode = it->second](bool exclude, entry_interface const& ei) {
+ debug_filter_output(iol.out, exclude, ei, mode);
};
no_progress = true;
} else {
@@ -1346,10 +1346,12 @@ int mkdwarfs_main(int argc, sys_char** argv, iolayer const& iol) {
auto sf = std::make_shared(
lgr, prog, options.inode.categorizer_mgr, sf_config);
+ auto ef = std::make_shared();
+
thread_pool scanner_pool(lgr, *iol.os, "scanner", num_scanner_workers);
- scanner s(lgr, scanner_pool, std::move(sf), entry_factory::create(),
- iol.os, std::move(script), options);
+ scanner s(lgr, scanner_pool, std::move(sf), std::move(ef), iol.os,
+ std::move(script), options);
s.scan(*fsw, path, prog, input_list, iol.file);
diff --git a/test/dwarfs_benchmark.cpp b/test/dwarfs_benchmark.cpp
index feb856f3..a0bf3106 100644
--- a/test/dwarfs_benchmark.cpp
+++ b/test/dwarfs_benchmark.cpp
@@ -26,7 +26,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -124,9 +124,10 @@ std::string make_filesystem(::benchmark::State const& state) {
writer_progress prog;
auto sf = std::make_shared(lgr, prog, cfg);
+ auto ef = std::make_shared();
- scanner s(lgr, pool, sf, entry_factory::create(), os,
- std::make_shared(), options);
+ scanner s(lgr, pool, sf, ef, os, std::make_shared(),
+ options);
std::ostringstream oss;
diff --git a/test/dwarfs_test.cpp b/test/dwarfs_test.cpp
index 76edf08b..25ee1d1e 100644
--- a/test/dwarfs_test.cpp
+++ b/test/dwarfs_test.cpp
@@ -36,7 +36,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -95,8 +95,9 @@ build_dwarfs(logger& lgr, std::shared_ptr input,
sf_cfg.bloom_filter_size.set_default(cfg.bloom_filter_size);
auto sf = std::make_shared(lgr, *prog, sf_cfg);
+ auto ef = std::make_shared();
- scanner s(lgr, pool, sf, entry_factory::create(), input, scr, options);
+ scanner s(lgr, pool, sf, ef, input, scr, options);
std::ostringstream oss;
@@ -929,15 +930,17 @@ class filter_test
scanner_options options;
options.remove_empty_dirs = false;
- options.debug_filter_function = [&](bool exclude, entry const* pe) {
- debug_filter_output(oss, exclude, pe, mode);
+ options.debug_filter_function = [&](bool exclude,
+ entry_interface const& ei) {
+ debug_filter_output(oss, exclude, ei, mode);
};
writer_progress prog;
thread_pool pool(lgr, *input, "worker", 1);
auto sf = std::make_shared(lgr, prog,
segmenter_factory::config{});
- scanner s(lgr, pool, sf, entry_factory::create(), input, scr, options);
+ auto ef = std::make_shared();
+ scanner s(lgr, pool, sf, ef, input, scr, options);
block_compressor bc("null");
std::ostringstream null;
diff --git a/test/entry_test.cpp b/test/entry_test.cpp
index e720988b..8af154ec 100644
--- a/test/entry_test.cpp
+++ b/test/entry_test.cpp
@@ -21,7 +21,9 @@
#include
-#include
+#include
+
+#include
#include "test_helpers.h"
@@ -37,11 +39,11 @@ struct entry_test : public ::testing::Test {
#endif
(1, fs::path::preferred_separator)};
std::shared_ptr os;
- std::unique_ptr ef;
+ std::optional ef;
void SetUp() override {
os = test::os_access_mock::create_test_instance();
- ef = entry_factory::create();
+ ef.emplace();
}
void TearDown() override {
@@ -51,6 +53,8 @@ struct entry_test : public ::testing::Test {
};
TEST_F(entry_test, path) {
+ using entry = internal::entry;
+
auto e1 = ef->create(*os, sep);
auto e2 = ef->create(*os, fs::path("somelink"), e1);
auto e3 = ef->create(*os, fs::path("somedir"), e1);
diff --git a/test/segmenter_benchmark.cpp b/test/segmenter_benchmark.cpp
index 91906ed1..2aa5df4a 100644
--- a/test/segmenter_benchmark.cpp
+++ b/test/segmenter_benchmark.cpp
@@ -42,7 +42,7 @@ class bench_chunkable : public dwarfs::internal::chunkable {
bench_chunkable(std::vector data)
: data_{std::move(data)} {}
- dwarfs::file const* get_file() const override { return nullptr; }
+ dwarfs::internal::file const* get_file() const override { return nullptr; }
size_t size() const override { return data_.size(); }