17#ifndef REFRESHCOLLECTION_H
18#define REFRESHCOLLECTION_H
21#include <BaseKeeper.h>
22#include <BookBaseEntry.h>
24#include <CreateCollection.h>
25#include <FileParseEntry.h>
67 const std::string &collection_name,
const int &num_threads,
68 const bool &remove_empty,
const bool &refresh_bookmarks,
69 const bool &fast_refresh,
70 const std::shared_ptr<BookMarks> &bookmarks);
141 std::filesystem::path
142 getBasePath(
const std::string &collection_name);
144 std::filesystem::path
148 compareVectors(std::vector<FileParseEntry> &base,
149 std::vector<std::filesystem::path> &books_files);
152 compareFunction1(
const std::filesystem::path &book_path,
157 const std::filesystem::path &book_path);
160 checkHashes(std::vector<FileParseEntry> *base,
161 std::vector<std::filesystem::path> *books_files);
164 hashThread(
const std::filesystem::path &file_to_hash,
165 std::vector<FileParseEntry> *base);
168 refreshBookMarks(
const std::shared_ptr<BaseKeeper> &bk);
171 getFilenamesFromArchives(
const std::filesystem::path &arch_path,
172 const std::string &prefix,
173 std::vector<std::string> &result,
void *la);
175 std::shared_ptr<AuxFunc> af;
177 bool remove_empty =
false;
178 bool fast_refresh =
false;
179 bool refresh_bookmarks =
false;
180 std::shared_ptr<BookMarks> bookmarks;
182 std::string collection_name;
185 std::atomic<uintmax_t> bytes_summ;
188 std::mutex already_hashedmtx;
189 std::mutex need_to_parsemtx;
191 std::mutex newthrmtx;
192 std::condition_variable continue_hashing;
193 std::vector<std::tuple<unsigned, bool>> thr_pool;
195 uintmax_t bytes_summ = 0;
197 omp_lock_t already_hashedmtx;
198 omp_lock_t need_to_parsemtx;
The BookBaseEntry class.
Definition BookBaseEntry.h:30
bool rar_support
If true, rar archives will be processed, otherwise - not.
Definition CreateCollection.h:165
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.
The FileParseEntry class.
Definition FileParseEntry.h:31
bool refreshBook(const BookBaseEntry &bbe)
Refreshes information in database about particular book.
void refreshCollection()
Refreshes whole collection.
bool editBook(const BookBaseEntry &bbe_old, const BookBaseEntry &bbe_new)
Replaces information in database.
RefreshCollection(const std::shared_ptr< AuxFunc > &af, const std::string &collection_name, const int &num_threads, const bool &remove_empty, const bool &refresh_bookmarks, const bool &fast_refresh, const std::shared_ptr< BookMarks > &bookmarks)
RefreshCollection constructor.
void set_rar_support(const bool &rar_support)
Enables support of rar archives.
std::function< void(const double &total_hash)> total_bytes_to_hash
"Total bytes to hash" signal.
Definition RefreshCollection.h:84
virtual ~RefreshCollection()
RefreshCollection destructor.
std::function< void(const double &hashed)> bytes_hashed
"Total bytes hashed" signal.
Definition RefreshCollection.h:93
void refreshFile(const BookBaseEntry &bbe)
Refreshes iformation about particular file.