1 : #ifndef EPT_DEBTAGS_DEBTAGSINDEXER_H
2 : #define EPT_DEBTAGS_DEBTAGSINDEXER_H
3 :
4 : #include <ept/debtags/maint/sourcedir.h>
5 : #include <string>
6 :
7 : namespace ept {
8 : namespace debtags {
9 :
10 : class Vocabulary;
11 :
12 : struct DebtagsIndexer
13 10 : {
14 : Vocabulary& voc;
15 :
16 : SourceDir mainSource;
17 : SourceDir userSource;
18 : time_t ts_main_src;
19 : time_t ts_user_src;
20 : time_t ts_main_tag;
21 : time_t ts_main_idx;
22 : time_t ts_user_tag;
23 : time_t ts_user_idx;
24 :
25 34 : time_t sourceTimestamp() const
26 : {
27 34 : time_t res = ts_main_src;
28 34 : if (ts_user_src > res) res = ts_user_src;
29 34 : return res;
30 : }
31 : bool needsRebuild() const;
32 : bool rebuild(const std::string& tagfname, const std::string& idxfname);
33 : bool rebuildIfNeeded();
34 : bool getUpToDateTagdb(std::string& tagfname, std::string& idxfname);
35 :
36 : bool userIndexIsRedundant() const;
37 : bool deleteRedundantUserIndex();
38 :
39 : void rescan();
40 :
41 : DebtagsIndexer(Vocabulary& voc);
42 :
43 : static bool obtainWorkingDebtags(Vocabulary& voc, std::string& tagfname, std::string& idxfname);
44 : };
45 :
46 :
47 : }
48 : }
49 :
50 : // vim:set ts=4 sw=4:
51 : #endif
|