MLBookProc 2.1
Loading...
Searching...
No Matches
RefreshCollection.h
1/*
2 * Copyright (C) 2026 Yury Bobylev <bobilev_yury@mail.ru>
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation, version 3.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#ifndef REFRESHCOLLECTION_H
17#define REFRESHCOLLECTION_H
18
19#include <BaseKeeper.h>
20#include <CreateCollection.h>
21#include <memory>
22
29{
30public:
36 RefreshCollection(const std::shared_ptr<MLBookProc> &mlbp,
37 const int &threads_num = int(1));
38
39 virtual ~RefreshCollection();
40
53 void
54 refreshCollection(const std::filesystem::path &base_path,
55 const bool &fast_refresh = bool(true));
56
64 void
65 addFilesAndDirs(const std::filesystem::path &base_path,
66 const std::vector<std::filesystem::path> &files_and_dirs);
67
71 void
72 stopAll() override;
73
81 std::function<void(double processed, double total)> signal_file_hashed;
82
83private:
84 bool
85 elementRemove(const UDBElement &el, const bool &fast_refresh);
86
87 void
88 compareVectors(std::vector<UDBElement> *new_v,
89 const std::vector<UDBElement> *old_v);
90
91 BaseKeeper *base_keeper;
92
93 double l_processed = 0.0;
94
95 bool cancel_local = false;
96};
97
98#endif // REFRESHCOLLECTION_H
The BaseKeeper class.
Definition BaseKeeper.h:34
CreateCollection(const std::shared_ptr< MLBookProc > &mlbp, const int &threads_num=int(1))
CreateCollection constructor.
std::atomic< double > processed
Definition CreateCollection.h:366
double total
Definition CreateCollection.h:373
std::shared_ptr< MLBookProc > mlbp
Definition CreateCollection.h:298
std::function< void(double processed, double total)> signal_file_hashed
Definition RefreshCollection.h:81
RefreshCollection(const std::shared_ptr< MLBookProc > &mlbp, const int &threads_num=int(1))
RefreshCollection constructor.
void addFilesAndDirs(const std::filesystem::path &base_path, const std::vector< std::filesystem::path > &files_and_dirs)
void stopAll() override
void refreshCollection(const std::filesystem::path &base_path, const bool &fast_refresh=bool(true))