17#ifndef CREATECOLLECTION_H
18#define CREATECOLLECTION_H
21#include <FileParseEntry.h>
31#include <condition_variable>
56 const std::filesystem::path &collection_path,
207 fb2_thread(
const std::filesystem::path &file_col_path,
208 const std::filesystem::path &resolved);
211 epub_thread(
const std::filesystem::path &file_col_path,
212 const std::filesystem::path &resolved);
215 pdf_thread(
const std::filesystem::path &file_col_path,
216 const std::filesystem::path &resolved);
219 djvu_thread(
const std::filesystem::path &file_col_path,
220 const std::filesystem::path &resolved);
223 odt_thread(
const std::filesystem::path &file_col_path,
224 const std::filesystem::path &resolved);
227 arch_thread(
const std::filesystem::path &file_col_path,
228 const std::filesystem::path &resolved);
231 book_entry_to_file_entry(std::string &file_entry,
232 const std::string &book_entry);
234 std::shared_ptr<AuxFunc> af;
236 std::fstream base_strm;
238 std::vector<void *> archp_obj;
241 std::mutex archp_obj_mtx;
243 std::mutex run_threads_mtx;
244 std::condition_variable run_threads_var;
245 std::mutex base_strm_mtx;
247 omp_lock_t archp_obj_mtx;
std::function< void(const double &)> signal_total_bytes
"Total bytes" callback.
Definition CreateCollection.h:88
void closeBaseFile()
Finishes database writing.
std::vector< std::filesystem::path > need_to_parse
"Need to parse" vector.
Definition CreateCollection.h:184
bool rar_support
If true, rar archives will be processed, otherwise - not.
Definition CreateCollection.h:165
std::vector< std::tuple< std::filesystem::path, std::string > > already_hashed
Hashed files.
Definition CreateCollection.h:175
void createCollection()
Starts collection creation.
virtual ~CreateCollection()
CreateCollection destructor.
std::function< void()> pulse
"Pulse" callback.
Definition CreateCollection.h:79
void write_file_to_base(const FileParseEntry &fe)
Writes file data to database.
CreateCollection(const std::shared_ptr< AuxFunc > &af, const std::filesystem::path &collection_path, const std::filesystem::path &books_path, const bool &rar_support, const int &num_threads)
CreateCollection constructor.
CreateCollection(const std::shared_ptr< AuxFunc > &af, const int &num_threads)
CreateCollection constructor.
std::filesystem::path base_path
Absolute path to database.
Definition CreateCollection.h:151
std::filesystem::path books_path
Absolute path to books directory.
Definition CreateCollection.h:158
std::function< void(const double &progress)> progress
"Progress" callback.
Definition CreateCollection.h:97
void threadRegulator()
Threads regulator.
void openBaseFile()
Opens database file for writing.
std::atomic< double > current_bytes
Keeps quantity of bytes have been processed.
Definition CreateCollection.h:192
The FileParseEntry class.
Definition FileParseEntry.h:31
Hasher(const std::shared_ptr< AuxFunc > &af)
Hasher constructor.