Perform query classifier initialization implicitly

The setting up and the initialization of the query classifier has
now been separated. The gateway explicitly sets up the query
classifier (i.e. chooses which one to use and what arguments to
provide), but the actual initialization is performed as part of
the general module initialization.
This commit is contained in:
Johan Wikman
2017-01-05 19:24:58 +02:00
parent 530c0e9617
commit 8fc5bdc2f1
13 changed files with 116 additions and 96 deletions

View File

@ -38,7 +38,7 @@ static const char default_qc_name[] = "qc_sqlite";
static QUERY_CLASSIFIER* classifier;
bool qc_init(const char* plugin_name, const char* plugin_args)
bool qc_setup(const char* plugin_name, const char* plugin_args)
{
QC_TRACE();
ss_dassert(!classifier);
@ -56,21 +56,30 @@ bool qc_init(const char* plugin_name, const char* plugin_args)
{
success = classifier->qc_setup(plugin_args);
if (success)
if (!success)
{
success = classifier->qc_init();
qc_unload(classifier);
classifier = NULL;
}
}
return success;
}
void qc_end(void)
bool qc_process_init(void)
{
QC_TRACE();
ss_dassert(classifier);
classifier->qc_end();
return classifier->qc_process_init() == 0;
}
void qc_process_end(void)
{
QC_TRACE();
ss_dassert(classifier);
classifier->qc_process_end();
classifier = NULL;
}
@ -101,7 +110,7 @@ bool qc_thread_init(void)
QC_TRACE();
ss_dassert(classifier);
return classifier->qc_thread_init();
return classifier->qc_thread_init() == 0;
}
void qc_thread_end(void)