summaryrefslogtreecommitdiffstats
path: root/src/libstat/learn_cache
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 16:57:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-13 16:57:06 +0000
commitfdff2c694ba91d9e96300b1020d577cfbe8fbd3b (patch)
tree63a14ec56555cbd708410dbb1855577374107550 /src/libstat/learn_cache
parentf086958b4b6b71952bb47e422aebaaa00c3143ea (diff)
downloadrspamd-fdff2c694ba91d9e96300b1020d577cfbe8fbd3b.tar.gz
rspamd-fdff2c694ba91d9e96300b1020d577cfbe8fbd3b.zip
Configure learn caches.
Diffstat (limited to 'src/libstat/learn_cache')
-rw-r--r--src/libstat/learn_cache/learn_cache.h15
-rw-r--r--src/libstat/learn_cache/sqlite3_cache.c4
2 files changed, 11 insertions, 8 deletions
diff --git a/src/libstat/learn_cache/learn_cache.h b/src/libstat/learn_cache/learn_cache.h
index bd01d1be1..51b2a9dbd 100644
--- a/src/libstat/learn_cache/learn_cache.h
+++ b/src/libstat/learn_cache/learn_cache.h
@@ -28,11 +28,7 @@
#include "config.h"
#include "ucl.h"
-typedef enum rspamd_learn_cache_result {
- RSPAMD_LEARN_OK = 0,
- RSPAMD_LEARN_UNLEARN,
- RSPAMD_LEARN_INGORE
-} rspamd_learn_t;
+#define RSPAMD_DEFAULT_CACHE "sqlite3"
struct rspamd_task;
struct rspamd_stat_ctx;
@@ -41,9 +37,16 @@ struct rspamd_config;
struct rspamd_stat_cache {
const char *name;
gpointer (*init)(struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg);
- rspamd_learn_t (*process)(struct rspamd_task *task, gboolean is_spam,
+ gint (*process)(struct rspamd_task *task,
+ gboolean is_spam,
gpointer ctx);
gpointer ctx;
};
+gpointer rspamd_stat_cache_sqlite3_init(struct rspamd_stat_ctx *ctx,
+ struct rspamd_config *cfg);
+gint rspamd_stat_cache_sqlite3_process (
+ struct rspamd_task *task,
+ gboolean is_spam, gpointer c);
+
#endif /* LEARN_CACHE_H_ */
diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c
index ef6f005b3..0bde829f7 100644
--- a/src/libstat/learn_cache/sqlite3_cache.c
+++ b/src/libstat/learn_cache/sqlite3_cache.c
@@ -167,8 +167,8 @@ rspamd_stat_cache_sqlite3_check (const guchar *h, gsize len, gboolean is_spam,
return ret;
}
-rspamd_learn_t
-rspamd_stat_cache_sqlite3_process(struct rspamd_task *task,
+gint
+rspamd_stat_cache_sqlite3_process (struct rspamd_task *task,
gboolean is_spam, gpointer c)
{
struct rspamd_stat_sqlite3_ctx *ctx = (struct rspamd_stat_sqlite3_ctx *)c;