RefreshCollection(3)

RefreshCollection(3) Library Functions Manual RefreshCollection(3)

NAME

RefreshCollection - The RefreshCollection class.

SYNOPSIS

#include <RefreshCollection.h>

Inherits CreateCollection.

Public Member Functions


RefreshCollection (const std::shared_ptr< MLBookProc > &mlbp, const int &threads_num=int(1))
RefreshCollection constructor. void refreshCollection (const std::filesystem::path &base_path, const bool &fast_refresh=bool(true))
void addFilesAndDirs (const std::filesystem::path &base_path, const std::vector< std::filesystem::path > &files_and_dirs)
void stopAll () override

Public Member Functions inherited from CreateCollection
CreateCollection (const std::shared_ptr< MLBookProc > &mlbp, const int &threads_num=int(1))
CreateCollection constructor. void createCollection (const std::vector< std::filesystem::path > &files_and_dirs, const std::filesystem::path &base_path)
void createInpxCollection (const std::filesystem::path &path_to_inpx, const std::filesystem::path &base_path)

Public Attributes


std::function< void(double processed, double total)> signal_file_hashed

Public Attributes inherited from CreateCollection
std::function< void(const size_t &files_found)> signal_files_collecting
std::function< void(double processed, double total)> signal_parsing_progress

Additional Inherited Members

Static Public Member Functions inherited from CreateCollection
static void saveBase (const std::filesystem::path &base_path, UDBase &col_base)

Protected Member Functions inherited from CreateCollection
void filesCollecting (const std::vector< std::filesystem::path > &files_and_dirs, UDBase &col_base)
size_t countFiles (const std::vector< UDBElement > &el_v)
std::vector< std::tuple< const std::vector< UDBElement > *, std::vector< UDBElement >::const_iterator > > getAllFiles (const std::vector< UDBElement > &el_v)
void removeDublicates (std::vector< std::tuple< const std::vector< UDBElement > *, std::vector< UDBElement >::const_iterator > > &files)
void processFiles (const std::vector< UDBElement > &items)
void fileParsing (UDBElement *file)
void cleanBase (std::vector< UDBElement > &items)
void fb2Parsing (UDBElement *file, const std::filesystem::path &file_path)
void epubParsing (UDBElement *file, const std::filesystem::path &file_path)
void pdfParsing (UDBElement *file, const std::filesystem::path &file_path)
void djvuParsing (UDBElement *file, const std::filesystem::path &file_path)
void odtParsing (UDBElement *file, const std::filesystem::path &file_path)
void txtParsing (UDBElement *file, const std::filesystem::path &file_path)
void docParsing (UDBElement *file, const std::filesystem::path &file_path)
void rtfParsing (UDBElement *file, const std::filesystem::path &file_path)
void docxParsing (UDBElement *file, const std::filesystem::path &file_path)
void mobiParsing (UDBElement *file, const std::filesystem::path &file_path)
void archiveParsing (UDBElement *file, const std::filesystem::path &file_path)
std::string bufferHash (const std::string &buf)
std::string fileHash (const std::filesystem::path &file_path)
void bufHash (UDBElement *file, const std::filesystem::path &file_path, const std::string &buf)

Protected Attributes inherited from CreateCollection
std::shared_ptr< MLBookProc > mlbp
std::shared_ptr< std::vector< std::tuple< unsigned, bool > > > threads_v
std::shared_ptr< std::mutex > threads_v_mtx
std::shared_ptr< std::condition_variable > threads_v_var
std::atomic< bool > cancel
std::vector< std::shared_ptr< ArchiveParser > > arch_proc
std::mutex arch_proc_mtx
std::vector< std::tuple< std::filesystem::path, std::string > > already_hashed
BaseID bid
std::atomic< double > processed
double total

Detailed Description

The RefreshCollection class.

This class contains methods used for collection maintenance.

Constructor & Destructor Documentation

RefreshCollection::RefreshCollection (const std::shared_ptr< MLBookProc > & mlbp, const int & threads_num = int(1))

RefreshCollection constructor.

Parameters

mlbp Smart pointer to MLBookProc object.
threads_num Maximum number of threads to be used in operations.

Member Function Documentation

void RefreshCollection::addFilesAndDirs (const std::filesystem::path & base_path, const std::vector< std::filesystem::path > & files_and_dirs)

Adds files, symlinks or directories to existing collection.

Parameters

base_path Path to collection database file.
files_and_dirs List of files, symlinks or directories to be added to collection.

void RefreshCollection::refreshCollection (const std::filesystem::path & base_path, const bool & fast_refresh = bool(true))

Refreshes given collection.

Checks files existance and sizes. If size of file is not equal its database entry, file will be reparsed. If fast_refresh set to false, checks all files hash sums, and if file hash sum not equal its database entry, file will be reparsed. If given collection type is 'legacy' or 'inpx', collection will be recreated as 'native'.

Parameters

base_path Path to collection database file.
fast_refresh If true, file hash sums will not be checked.

void RefreshCollection::stopAll () [override], [virtual]

Stops all operations.

Reimplemented from CreateCollection.

Member Data Documentation

std::function<void(double processed, double total)> RefreshCollection::signal_file_hashed

If this callback set, it will be called to indicate files hashing progress.

progress - number of items already hashed, total - total number of items to be hashed.

Author

Generated automatically by Doxygen for MLBookProc from the source code.

Version 2.1 MLBookProc