indents
This commit is contained in:
parent
3cf7fb3b65
commit
96ba5acd32
@ -1,18 +0,0 @@
|
||||
PROGS = subtreelist mimetype
|
||||
all: $(PROGS)
|
||||
|
||||
SUBTREELIST_OBJS= subtreelist.o
|
||||
subtreelist : $(SUBTREELIST_OBJS)
|
||||
$(CXX) $(ALL_CXXFLAGS) -o subtreelist $(SUBTREELIST_OBJS) \
|
||||
$(LIBRECOLL)
|
||||
subtreelist.o : subtreelist.cpp
|
||||
$(CXX) $(ALL_CXXFLAGS) -DTEST_SUBTREELIST -c subtreelist.cpp
|
||||
|
||||
MIMETYPE_OBJS= trmimetype.o
|
||||
mimetype : $(MIMETYPE_OBJS)
|
||||
$(CXX) $(ALL_CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) $(LIBRECOLL)
|
||||
trmimetype.o : mimetype.cpp
|
||||
$(CXX) $(ALL_CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \
|
||||
mimetype.cpp
|
||||
|
||||
include ../utils/utmkdefs.mk
|
||||
@ -23,7 +23,7 @@
|
||||
// Current status of an indexing operation. This is updated in
|
||||
// $RECOLL_CONFDIR/idxstatus.txt
|
||||
class DbIxStatus {
|
||||
public:
|
||||
public:
|
||||
enum Phase {DBIXS_NONE,
|
||||
DBIXS_FILES, DBIXS_PURGE, DBIXS_STEMDB, DBIXS_CLOSING,
|
||||
DBIXS_MONITOR,
|
||||
|
||||
@ -432,4 +432,3 @@ vector<string> ConfIndexer::getStemmerNames()
|
||||
{
|
||||
return Rcl::Db::getStemmerNames();
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class WebQueueIndexer;
|
||||
/** Callback to say what we're doing. If the update func returns false, we
|
||||
* stop as soon as possible without corrupting state */
|
||||
class DbIxStatusUpdater {
|
||||
public:
|
||||
public:
|
||||
#ifdef IDX_THREADS
|
||||
std::mutex m_mutex;
|
||||
#endif
|
||||
@ -62,7 +62,7 @@ class DbIxStatusUpdater {
|
||||
* database(s).
|
||||
*/
|
||||
class ConfIndexer {
|
||||
public:
|
||||
public:
|
||||
enum runStatus {IndexerOk, IndexerError};
|
||||
ConfIndexer(RclConfig *cnf, DbIxStatusUpdater *updfunc = 0);
|
||||
virtual ~ConfIndexer();
|
||||
@ -113,7 +113,7 @@ class ConfIndexer {
|
||||
|
||||
/** Set in place reset mode */
|
||||
void setInPlaceReset() {m_db.setInPlaceReset();}
|
||||
private:
|
||||
private:
|
||||
RclConfig *m_config;
|
||||
Rcl::Db m_db;
|
||||
FsIndexer *m_fsindexer;
|
||||
|
||||
@ -45,7 +45,7 @@ using std::multimap;
|
||||
* Monitoring event: something changed in the filesystem
|
||||
*/
|
||||
class RclMonEvent {
|
||||
public:
|
||||
public:
|
||||
enum EvType {RCLEVT_NONE= 0, RCLEVT_MODIFY=1, RCLEVT_DELETE=2,
|
||||
RCLEVT_DIRCREATE=3, RCLEVT_ISDIR=0x10};
|
||||
string m_path;
|
||||
@ -76,7 +76,7 @@ enum RclMonitorOption {RCLMON_NONE=0, RCLMON_NOFORK=1, RCLMON_NOX11=2,
|
||||
*/
|
||||
class RclEQData;
|
||||
class RclMonEventQueue {
|
||||
public:
|
||||
public:
|
||||
RclMonEventQueue();
|
||||
~RclMonEventQueue();
|
||||
/** Wait for event or timeout. Returns with the queue locked */
|
||||
@ -94,7 +94,7 @@ class RclMonEventQueue {
|
||||
void setConfig(RclConfig *conf);
|
||||
RclConfig *getConfig();
|
||||
|
||||
private:
|
||||
private:
|
||||
RclEQData *m_data;
|
||||
};
|
||||
|
||||
|
||||
@ -427,80 +427,80 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
|
||||
string thisprog;
|
||||
|
||||
static const char usage [] =
|
||||
"\n"
|
||||
"recollindex [-h] \n"
|
||||
" Print help\n"
|
||||
"recollindex [-z|-Z] [-k]\n"
|
||||
" Index everything according to configuration file\n"
|
||||
" -z : reset database before starting indexing\n"
|
||||
" -Z : in place reset: consider all documents as changed. Can also\n"
|
||||
" be combined with -i or -r but not -m\n"
|
||||
" -k : retry files on which we previously failed\n"
|
||||
"\n"
|
||||
"recollindex [-h] \n"
|
||||
" Print help\n"
|
||||
"recollindex [-z|-Z] [-k]\n"
|
||||
" Index everything according to configuration file\n"
|
||||
" -z : reset database before starting indexing\n"
|
||||
" -Z : in place reset: consider all documents as changed. Can also\n"
|
||||
" be combined with -i or -r but not -m\n"
|
||||
" -k : retry files on which we previously failed\n"
|
||||
#ifdef RCL_MONITOR
|
||||
"recollindex -m [-w <secs>] -x [-D] [-C]\n"
|
||||
" Perform real time indexing. Don't become a daemon if -D is set.\n"
|
||||
" -w sets number of seconds to wait before starting.\n"
|
||||
" -C disables monitoring config for changes/reexecuting.\n"
|
||||
" -n disables initial incremental indexing (!and purge!).\n"
|
||||
"recollindex -m [-w <secs>] -x [-D] [-C]\n"
|
||||
" Perform real time indexing. Don't become a daemon if -D is set.\n"
|
||||
" -w sets number of seconds to wait before starting.\n"
|
||||
" -C disables monitoring config for changes/reexecuting.\n"
|
||||
" -n disables initial incremental indexing (!and purge!).\n"
|
||||
#ifndef DISABLE_X11MON
|
||||
" -x disables exit on end of x11 session\n"
|
||||
" -x disables exit on end of x11 session\n"
|
||||
#endif /* DISABLE_X11MON */
|
||||
#endif /* RCL_MONITOR */
|
||||
"recollindex -e [<filepath [path ...]>]\n"
|
||||
" Purge data for individual files. No stem database updates.\n"
|
||||
" Reads paths on stdin if none is given as argument.\n"
|
||||
"recollindex -i [-f] [-Z] [<filepath [path ...]>]\n"
|
||||
" Index individual files. No database purge or stem database updates\n"
|
||||
" Will read paths on stdin if none is given as argument\n"
|
||||
" -f : ignore skippedPaths and skippedNames while doing this\n"
|
||||
"recollindex -r [-K] [-f] [-Z] [-p pattern] <top> \n"
|
||||
" Recursive partial reindex. \n"
|
||||
" -p : filter file names, multiple instances are allowed, e.g.: \n"
|
||||
" -p *.odt -p *.pdf\n"
|
||||
" -K : skip previously failed files (they are retried by default)\n"
|
||||
"recollindex -l\n"
|
||||
" List available stemming languages\n"
|
||||
"recollindex -s <lang>\n"
|
||||
" Build stem database for additional language <lang>\n"
|
||||
"recollindex -E\n"
|
||||
" Check configuration file for topdirs and other paths existence\n"
|
||||
"recollindex -e [<filepath [path ...]>]\n"
|
||||
" Purge data for individual files. No stem database updates.\n"
|
||||
" Reads paths on stdin if none is given as argument.\n"
|
||||
"recollindex -i [-f] [-Z] [<filepath [path ...]>]\n"
|
||||
" Index individual files. No database purge or stem database updates\n"
|
||||
" Will read paths on stdin if none is given as argument\n"
|
||||
" -f : ignore skippedPaths and skippedNames while doing this\n"
|
||||
"recollindex -r [-K] [-f] [-Z] [-p pattern] <top> \n"
|
||||
" Recursive partial reindex. \n"
|
||||
" -p : filter file names, multiple instances are allowed, e.g.: \n"
|
||||
" -p *.odt -p *.pdf\n"
|
||||
" -K : skip previously failed files (they are retried by default)\n"
|
||||
"recollindex -l\n"
|
||||
" List available stemming languages\n"
|
||||
"recollindex -s <lang>\n"
|
||||
" Build stem database for additional language <lang>\n"
|
||||
"recollindex -E\n"
|
||||
" Check configuration file for topdirs and other paths existence\n"
|
||||
#ifdef FUTURE_IMPROVEMENT
|
||||
"recollindex -W\n"
|
||||
" Process the Web queue\n"
|
||||
"recollindex -W\n"
|
||||
" Process the Web queue\n"
|
||||
#endif
|
||||
#ifdef RCL_USE_ASPELL
|
||||
"recollindex -S\n"
|
||||
" Build aspell spelling dictionary.>\n"
|
||||
"recollindex -S\n"
|
||||
" Build aspell spelling dictionary.>\n"
|
||||
#endif
|
||||
"Common options:\n"
|
||||
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
||||
;
|
||||
"Common options:\n"
|
||||
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
||||
;
|
||||
|
||||
static void Usage()
|
||||
{
|
||||
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
||||
fprintf(fp, "%s: Usage: %s", path_getsimple(thisprog).c_str(), usage);
|
||||
fprintf(fp, "Recoll version: %s\n", Rcl::version_string().c_str());
|
||||
exit((op_flags & OPT_h)==0);
|
||||
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
||||
fprintf(fp, "%s: Usage: %s", path_getsimple(thisprog).c_str(), usage);
|
||||
fprintf(fp, "Recoll version: %s\n", Rcl::version_string().c_str());
|
||||
exit((op_flags & OPT_h)==0);
|
||||
}
|
||||
|
||||
static RclConfig *config;
|
||||
|
||||
static void lockorexit(Pidfile *pidfile, RclConfig *config)
|
||||
{
|
||||
PRETEND_USE(config);
|
||||
pid_t pid;
|
||||
if ((pid = pidfile->open()) != 0) {
|
||||
if (pid > 0) {
|
||||
cerr << "Can't become exclusive indexer: " << pidfile->getreason()
|
||||
<< ". Return (other pid?): " << pid << endl;
|
||||
PRETEND_USE(config);
|
||||
pid_t pid;
|
||||
if ((pid = pidfile->open()) != 0) {
|
||||
if (pid > 0) {
|
||||
cerr << "Can't become exclusive indexer: " << pidfile->getreason()
|
||||
<< ". Return (other pid?): " << pid << endl;
|
||||
#ifndef _WIN32
|
||||
// Have a look at the status file. If the other process is
|
||||
// a monitor we can tell it to start an incremental pass
|
||||
// by touching the configuration file
|
||||
DbIxStatus status;
|
||||
readIdxStatus(config, status);
|
||||
if (status.hasmonitor) {
|
||||
// Have a look at the status file. If the other process is
|
||||
// a monitor we can tell it to start an incremental pass
|
||||
// by touching the configuration file
|
||||
DbIxStatus status;
|
||||
readIdxStatus(config, status);
|
||||
if (status.hasmonitor) {
|
||||
string cmd("touch ");
|
||||
string path = path_cat(config->getConfDir(), "recoll.conf");
|
||||
cmd += path;
|
||||
@ -511,19 +511,19 @@ static void lockorexit(Pidfile *pidfile, RclConfig *config)
|
||||
cerr << "Monitoring indexer process was notified of "
|
||||
"indexing request\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
} else {
|
||||
cerr << "Can't become exclusive indexer: " << pidfile->getreason()
|
||||
<< endl;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
if (pidfile->write_pid() != 0) {
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
if (pidfile->write_pid() != 0) {
|
||||
cerr << "Can't become exclusive indexer: " << pidfile->getreason() <<
|
||||
endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static string reasonsfile;
|
||||
@ -559,7 +559,7 @@ static void flushIdxReasons()
|
||||
static vector<string> argstovector(int argc, wchar_t **argv)
|
||||
#else
|
||||
#define WARGTOSTRING(w) (w)
|
||||
static vector<string> argstovector(int argc, char **argv)
|
||||
static vector<string> argstovector(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
thisprog = path_absolute(WARGTOSTRING(argv[0]));
|
||||
@ -599,7 +599,7 @@ static std::string orig_cwd;
|
||||
#if USE_WMAIN
|
||||
int wmain(int argc, wchar_t *argv[])
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
// The reexec struct is used by the daemon to shed memory after
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef TEST_SUBTREELIST
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <memory>
|
||||
@ -33,7 +32,8 @@ bool subtreelist(RclConfig *config, const string& top,
|
||||
LOGDEB("subtreelist: top: [" << (top) << "]\n" );
|
||||
Rcl::Db rcldb(config);
|
||||
if (!rcldb.open(Rcl::Db::DbRO)) {
|
||||
LOGERR("subtreelist: can't open database in [" << (config->getDbDir()) << "]: " << (rcldb.getReason()) << "\n" );
|
||||
LOGERR("subtreelist: can't open database in [" << config->getDbDir() <<
|
||||
"]: " << rcldb.getReason() << "\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -56,76 +56,3 @@ bool subtreelist(RclConfig *config, const string& top,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#else // TEST
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "subtreelist.h"
|
||||
#include "rclconfig.h"
|
||||
#include "rclinit.h"
|
||||
|
||||
static char *thisprog;
|
||||
static char usage [] =
|
||||
" <path> : list document paths in this tree\n"
|
||||
;
|
||||
static void
|
||||
Usage(void)
|
||||
{
|
||||
cerr << thisprog << ": usage:" << endl << usage;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int op_flags;
|
||||
#define OPT_o 0x2
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
string top;
|
||||
|
||||
thisprog = argv[0];
|
||||
argc--; argv++;
|
||||
|
||||
while (argc > 0 && **argv == '-') {
|
||||
(*argv)++;
|
||||
if (!(**argv))
|
||||
/* Cas du "adb - core" */
|
||||
Usage();
|
||||
while (**argv)
|
||||
switch (*(*argv)++) {
|
||||
default: Usage(); break;
|
||||
}
|
||||
argc--; argv++;
|
||||
}
|
||||
if (argc < 1)
|
||||
Usage();
|
||||
top = *argv++;argc--;
|
||||
string reason;
|
||||
RclConfig *config = recollinit(0, 0, 0, reason, 0);
|
||||
if (!config || !config->ok()) {
|
||||
fprintf(stderr, "Recoll init failed: %s\n", reason.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vector<string> paths;
|
||||
if (!subtreelist(config, top, paths)) {
|
||||
cerr << "subtreelist failed" << endl;
|
||||
exit(1);
|
||||
}
|
||||
for (vector<string>::const_iterator it = paths.begin();
|
||||
it != paths.end(); it++) {
|
||||
cout << *it << endl;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class CirCache;
|
||||
class RclConfig;
|
||||
class WebStore;
|
||||
namespace Rcl {
|
||||
class Db;
|
||||
class Db;
|
||||
}
|
||||
|
||||
class WebQueueIndexer : public FsTreeWalkerCB {
|
||||
|
||||
64
src/testmains/trsubtreelist.cpp
Normal file
64
src/testmains/trsubtreelist.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "subtreelist.h"
|
||||
#include "rclconfig.h"
|
||||
#include "rclinit.h"
|
||||
|
||||
static char *thisprog;
|
||||
static char usage [] = " <path> : list document paths in this tree\n";
|
||||
static void Usage(void)
|
||||
{
|
||||
std::cerr << thisprog << ": usage:" << endl << usage;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int op_flags;
|
||||
#define OPT_o 0x2
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
string top;
|
||||
|
||||
thisprog = argv[0];
|
||||
argc--; argv++;
|
||||
|
||||
while (argc > 0 && **argv == '-') {
|
||||
(*argv)++;
|
||||
if (!(**argv))
|
||||
/* Cas du "adb - core" */
|
||||
Usage();
|
||||
while (**argv)
|
||||
switch (*(*argv)++) {
|
||||
default: Usage(); break;
|
||||
}
|
||||
argc--; argv++;
|
||||
}
|
||||
if (argc < 1)
|
||||
Usage();
|
||||
top = *argv++;argc--;
|
||||
string reason;
|
||||
RclConfig *config = recollinit(0, 0, 0, reason, 0);
|
||||
if (!config || !config->ok()) {
|
||||
fprintf(stderr, "Recoll init failed: %s\n", reason.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vector<string> paths;
|
||||
if (!subtreelist(config, top, paths)) {
|
||||
cerr << "subtreelist failed" << endl;
|
||||
exit(1);
|
||||
}
|
||||
for (vector<string>::const_iterator it = paths.begin();
|
||||
it != paths.end(); it++) {
|
||||
cout << *it << endl;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user