The RefreshCollection class. More...
#include <RefreshCollection.h>
Public Member Functions | |
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. | |
virtual | ~RefreshCollection () |
RefreshCollection destructor. | |
void | refreshCollection () |
Refreshes whole collection. | |
void | refreshFile (const BookBaseEntry &bbe) |
Refreshes iformation about particular file. | |
bool | editBook (const BookBaseEntry &bbe_old, const BookBaseEntry &bbe_new) |
Replaces information in database. | |
bool | refreshBook (const BookBaseEntry &bbe) |
Refreshes information in database about particular book. | |
void | set_rar_support (const bool &rar_support) |
Enables support of rar archives. | |
![]() | |
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. | |
virtual | ~CreateCollection () |
CreateCollection destructor. | |
void | createCollection () |
Starts collection creation. | |
![]() | |
Hasher (const std::shared_ptr< AuxFunc > &af) | |
Hasher constructor. | |
std::string | buf_hashing (const std::string &buf) |
Creates hash sum for given buffer. | |
std::string | file_hashing (const std::filesystem::path &filepath) |
Creates hash sum for given file. | |
void | cancelAll () |
Stops all operations. | |
Public Attributes | |
std::function< void(const double &total_hash)> | total_bytes_to_hash |
"Total bytes to hash" signal. | |
std::function< void(const double &hashed)> | bytes_hashed |
"Total bytes hashed" signal. | |
![]() | |
std::function< void()> | pulse |
"Pulse" callback. | |
std::function< void(const double &)> | signal_total_bytes |
"Total bytes" callback. | |
std::function< void(const double &progress)> | progress |
"Progress" callback. | |
Additional Inherited Members | |
![]() | |
CreateCollection (const std::shared_ptr< AuxFunc > &af, const int &num_threads) | |
CreateCollection constructor. | |
void | threadRegulator () |
Threads regulator. | |
void | openBaseFile () |
Opens database file for writing. | |
void | closeBaseFile () |
Finishes database writing. | |
void | write_file_to_base (const FileParseEntry &fe) |
Writes file data to database. | |
![]() | |
std::filesystem::path | base_path |
Absolute path to database. | |
std::filesystem::path | books_path |
Absolute path to books directory. | |
bool | rar_support = false |
If true, rar archives will be processed, otherwise - not. | |
std::vector< std::tuple< std::filesystem::path, std::string > > | already_hashed |
Hashed files. | |
std::vector< std::filesystem::path > | need_to_parse |
"Need to parse" vector. | |
std::atomic< double > | current_bytes |
Keeps quantity of bytes have been processed. | |
![]() | |
std::atomic< bool > | cancel |
Stops all operations if true. | |
std::function< void()> | stop_all_signal |
Stop signal for heir classes. | |
The RefreshCollection class.
This class contains various methods for collection database refreshing in case of any changes were made to collection files.
RefreshCollection::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.
af | smart pointer to AuxFunc object. |
collection_name | collection name. |
num_threads | number of threads to be used (see also CreateCollection::CreateCollection()). |
remove_empty | if true, empty directories and files will be removed. |
fast_refresh | if true, file hashes calculations will not be carried out (hashes of all collection files will be recalculated otherwise). |
refresh_bookmarks | if true, bookmarks pointing to absent books will be removed. |
bookmarks | smart pointer to BookMarks object. |
bool RefreshCollection::editBook | ( | const BookBaseEntry & | bbe_old, |
const BookBaseEntry & | bbe_new ) |
Replaces information in database.
Use this method, if you need to edit database entries manually.
bbe_old | existing BookBaseEntry (see BaseKeeper::searchBook()). |
bbe_new | BookBaseEntry containing new information. |
bool RefreshCollection::refreshBook | ( | const BookBaseEntry & | bbe | ) |
Refreshes information in database about particular book.
bbe | BookBaseEntry object (see BaseKeeper::searchBook()). |
void RefreshCollection::refreshCollection | ( | ) |
Refreshes whole collection.
Caries out collection refreshing.
void RefreshCollection::refreshFile | ( | const BookBaseEntry & | bbe | ) |
Refreshes iformation about particular file.
bbe | BookBaseEntry object (see BaseKeeper::searchBook()). |
void RefreshCollection::set_rar_support | ( | const bool & | rar_support | ) |
Enables support of rar archives.
Set rar_support to true, if you need to parse rar archives (see also CreateCollection::CreateCollection()).
rar_support | if true, rar archives will be parsed. |
std::function<void(const double &hashed)> RefreshCollection::bytes_hashed |
"Total bytes hashed" signal.
Emitted after file has been hashed, to indicate total quantity of bytes have been hashed. Bind your method to bytes_hashed, if you need such information.
std::function<void(const double &total_hash)> RefreshCollection::total_bytes_to_hash |
"Total bytes to hash" signal.
Emitted after files for refreshing have been collected, to indicate total quantity bytes to be hashed. Bind your method to total_bytes_to_hash, if you need such information.