aboutsummaryrefslogtreecommitdiffstats
path: root/src/kvstorage_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-11-02 17:49:09 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-11-02 17:49:09 +0300
commitf678526b2089826fba0299c88b9258bc48f748c4 (patch)
treeb74c641d73e660bb9a6147335a646a468cb54d06 /src/kvstorage_config.c
parentb50b716c78c39249e15b92132e2ee9d75639be17 (diff)
downloadrspamd-f678526b2089826fba0299c88b9258bc48f748c4.tar.gz
rspamd-f678526b2089826fba0299c88b9258bc48f748c4.zip
* Implement sqlite3 backend for kvstorage.
Diffstat (limited to 'src/kvstorage_config.c')
-rw-r--r--src/kvstorage_config.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/kvstorage_config.c b/src/kvstorage_config.c
index 0dbad5380..57a23d6ab 100644
--- a/src/kvstorage_config.c
+++ b/src/kvstorage_config.c
@@ -27,6 +27,9 @@
#ifdef WITH_DB
#include "kvstorage_bdb.h"
#endif
+#ifdef WITH_SQLITE
+#include "kvstorage_sqlite.h"
+#endif
#define LRU_QUEUES 32
@@ -93,6 +96,7 @@ kvstorage_init_callback (const gpointer key, const gpointer value, gpointer unus
switch (kconf->backend.type) {
case KVSTORAGE_TYPE_BACKEND_NULL:
+ case KVSTORAGE_TYPE_BACKEND_MAX:
backend = NULL;
break;
#ifdef WITH_DB
@@ -100,6 +104,11 @@ kvstorage_init_callback (const gpointer key, const gpointer value, gpointer unus
backend = rspamd_kv_bdb_new (kconf->backend.filename, kconf->backend.sync_ops);
break;
#endif
+#ifdef WITH_SQLITE
+ case KVSTORAGE_TYPE_BACKEND_SQLITE:
+ backend = rspamd_kv_sqlite_new (kconf->backend.filename, kconf->backend.sync_ops);
+ break;
+#endif
}
switch (kconf->expire.type) {
@@ -367,6 +376,11 @@ void kvstorage_xml_text (GMarkupParseContext *context,
kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_BDB;
}
#endif
+#ifdef WITH_SQLITE
+ else if (g_ascii_strncasecmp (text, "sqlite", MIN (text_len, sizeof ("sqlite") - 1)) == 0) {
+ kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_SQLITE;
+ }
+#endif
else {
if (*error == NULL) {
*error = g_error_new (xml_error_quark (), XML_EXTRA_ELEMENT, "invalid backend type: %*s", (int)text_len, text);