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 get_base_path(
const std::string &collection_name);
144 std::filesystem::path
148 compaire_vectors(std::vector<FileParseEntry> &base,
149 std::vector<std::filesystem::path> &books_files);
152 compare_function1(
const std::filesystem::path &book_path,
157 const std::filesystem::path &book_path);
160 check_hashes(std::vector<FileParseEntry> *base,
161 std::vector<std::filesystem::path> *books_files);
164 hash_thread(
const std::filesystem::path &file_to_hash,
165 std::vector<FileParseEntry> *base);
168 refreshBookMarks(
const std::shared_ptr<BaseKeeper> &bk);
170 std::shared_ptr<AuxFunc> af;
172 bool remove_empty =
false;
173 bool fast_refresh =
false;
174 bool refresh_bookmarks =
false;
175 std::shared_ptr<BookMarks> bookmarks;
177 std::string collection_name;
180 std::atomic<uintmax_t> bytes_summ;
183 std::mutex already_hashedmtx;
184 std::mutex need_to_parsemtx;
186 std::mutex newthrmtx;
187 std::condition_variable continue_hashing;
190 uintmax_t bytes_summ = 0;
192 omp_lock_t already_hashedmtx;
193 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.