separated out the cache access part from beaglequeueindexer. this avoids having to link the pure query programs with indexing code

This commit is contained in:
Jean-Francois Dockes
2010-02-05 12:46:41 +01:00
parent de63a00540
commit b87a23bfca
10 changed files with 146 additions and 76 deletions
+5 -9
View File
@@ -45,7 +45,7 @@ using namespace std;
#include "rclconfig.h"
#include "mh_html.h"
#include "fileudi.h"
#include "beaglequeue.h"
#include "beaglequeuecache.h"
#include "cancelcheck.h"
#ifdef RCL_USE_XATTR
@@ -390,14 +390,10 @@ FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf,
}
init(fn, &st, cnf, td, flags, &idoc.mimetype);
} else if (!backend.compare("BGL")) {
// Retrieve from our webcache (beagle data). There should
// probably be a separate object type for readonly cache
// access (distinct from the one used for indexing).
// Anyway, we're not called in the same thread as indexing ops, and
// even, at worse, this would duplicate the memory used. The beagler
// object is created at the first call of this routine and deleted
// when the program exits.
static BeagleQueueIndexer beagler(cnf);
// Retrieve from our webcache (beagle data). The beagler
// object is created at the first call of this routine and
// deleted when the program exits.
static BeagleQueueCache beagler(cnf);
string data;
Rcl::Doc dotdoc;
map<string,string>::const_iterator it =
+8 -2
View File
@@ -494,6 +494,7 @@ bool MimeHandlerMbox::next_document()
#include <string>
using namespace std;
#include "rclconfig.h"
#include "rclinit.h"
#include "mh_mbox.h"
@@ -508,6 +509,11 @@ Usage(void)
fprintf(stderr, "%s: usage:\n%s", thisprog, usage);
exit(1);
}
static RclConfig *config;
RclConfig *RclConfig::getMainConfig()
{
return config;
}
int main(int argc, char **argv)
{
@@ -530,8 +536,8 @@ int main(int argc, char **argv)
Usage();
string filename = *argv++;argc--;
string reason;
RclConfig *conf = recollinit(RclInitFlags(0), 0, 0, reason, 0);
if (conf == 0) {
config = recollinit(RclInitFlags(0), 0, 0, reason, 0);
if (config == 0) {
cerr << "init failed " << reason << endl;
exit(1);
}