|
a |
|
b/src/index/idxstatus.h |
|
|
1 |
/* Copyright (C) 2017-2018 J.F.Dockes
|
|
|
2 |
* This program is free software; you can redistribute it and/or modify
|
|
|
3 |
* it under the terms of the GNU General Public License as published by
|
|
|
4 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
5 |
* (at your option) any later version.
|
|
|
6 |
*
|
|
|
7 |
* This program is distributed in the hope that it will be useful,
|
|
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
10 |
* GNU General Public License for more details.
|
|
|
11 |
*
|
|
|
12 |
* You should have received a copy of the GNU General Public License
|
|
|
13 |
* along with this program; if not, write to the
|
|
|
14 |
* Free Software Foundation, Inc.,
|
|
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
#ifndef _IDXSTATUS_H_INCLUDED_
|
|
|
19 |
#define _IDXSTATUS_H_INCLUDED_
|
|
|
20 |
|
|
|
21 |
#include <string>
|
|
|
22 |
|
|
|
23 |
// Current status of an indexing operation. This is updated in
|
|
|
24 |
// $RECOLL_CONFDIR/idxstatus.txt
|
|
|
25 |
class DbIxStatus {
|
|
|
26 |
public:
|
|
|
27 |
enum Phase {DBIXS_NONE,
|
|
|
28 |
DBIXS_FILES, DBIXS_PURGE, DBIXS_STEMDB, DBIXS_CLOSING,
|
|
|
29 |
DBIXS_MONITOR,
|
|
|
30 |
DBIXS_DONE};
|
|
|
31 |
Phase phase;
|
|
|
32 |
std::string fn; // Last file processed
|
|
|
33 |
int docsdone; // Documents actually updated
|
|
|
34 |
int filesdone; // Files tested (updated or not)
|
|
|
35 |
int fileerrors; // Failed files (e.g.: missing input handler).
|
|
|
36 |
int dbtotdocs; // Doc count in index at start
|
|
|
37 |
// Total files in index.This is actually difficult to compute from
|
|
|
38 |
// the index so it's preserved from last indexing
|
|
|
39 |
int totfiles;
|
|
|
40 |
// Is this indexer a monitoring one? This is a permanent value
|
|
|
41 |
// telling if option -m was set, not about what we are currently
|
|
|
42 |
// doing
|
|
|
43 |
bool hasmonitor{false};
|
|
|
44 |
|
|
|
45 |
void reset() {
|
|
|
46 |
phase = DBIXS_FILES;
|
|
|
47 |
fn.erase();
|
|
|
48 |
docsdone = filesdone = fileerrors = dbtotdocs = totfiles = 0;
|
|
|
49 |
}
|
|
|
50 |
DbIxStatus() {reset();}
|
|
|
51 |
};
|
|
|
52 |
|
|
|
53 |
class RclConfig;
|
|
|
54 |
extern void readIdxStatus(RclConfig *config, DbIxStatus &status);
|
|
|
55 |
|
|
|
56 |
#endif /* _IDXSTATUS_H_INCLUDED_ */
|