diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-11-15 20:55:52 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-11-15 20:55:52 +0300 |
commit | eb81ea9c640d58c665bfd447e2d6f8990833530a (patch) | |
tree | d5c8d08c39fe201000a5df8e251831d1537e443a /src/kvstorage_config.c | |
parent | e31d2fac565ae6f32cb5283eb55392344364b453 (diff) | |
download | rspamd-eb81ea9c640d58c665bfd447e2d6f8990833530a.tar.gz rspamd-eb81ea9c640d58c665bfd447e2d6f8990833530a.zip |
* Add initial skeleton of file based backend
Diffstat (limited to 'src/kvstorage_config.c')
-rw-r--r-- | src/kvstorage_config.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/kvstorage_config.c b/src/kvstorage_config.c index 8097078a4..218d26953 100644 --- a/src/kvstorage_config.c +++ b/src/kvstorage_config.c @@ -30,6 +30,9 @@ #ifdef WITH_SQLITE #include "kvstorage_sqlite.h" #endif +#include "kvstorage_file.h" + +#define FILE_STORAGE_LEVELS 3 /* Global hash of storages indexed by id */ @@ -106,6 +109,9 @@ kvstorage_init_callback (const gpointer key, const gpointer value, gpointer unus case KVSTORAGE_TYPE_BACKEND_MAX: backend = NULL; break; + case KVSTORAGE_TYPE_BACKEND_FILE: + backend = rspamd_kv_file_new (kconf->backend.filename, kconf->backend.sync_ops, FILE_STORAGE_LEVELS); + break; #ifdef WITH_DB case KVSTORAGE_TYPE_BACKEND_BDB: backend = rspamd_kv_bdb_new (kconf->backend.filename, kconf->backend.sync_ops); @@ -383,6 +389,9 @@ void kvstorage_xml_text (GMarkupParseContext *context, if (g_ascii_strncasecmp (text, "null", MIN (text_len, sizeof ("null") - 1)) == 0) { kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_NULL; } + else if (g_ascii_strncasecmp (text, "file", MIN (text_len, sizeof ("file") - 1)) == 0) { + kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_FILE; + } #ifdef WITH_DB else if (g_ascii_strncasecmp (text, "bdb", MIN (text_len, sizeof ("bdb") - 1)) == 0) { kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_BDB; |