aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-27 13:36:58 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-27 13:36:58 +0000
commit8a20f3344a67762fa0b72fa05f4b777170e78471 (patch)
tree427f58f1b7705bcd5d087bca783c5b2ed1bca11e /src
parent9e3a4c1020a558ae69183ba64317db0dcc320374 (diff)
downloadrspamd-8a20f3344a67762fa0b72fa05f4b777170e78471.tar.gz
rspamd-8a20f3344a67762fa0b72fa05f4b777170e78471.zip
Runtime for backends now accepts task object.
Diffstat (limited to 'src')
-rw-r--r--src/libstat/backends/backends.h10
-rw-r--r--src/libstat/backends/mmaped_file.c4
-rw-r--r--src/libstat/backends/redis.c10
-rw-r--r--src/libstat/stat_process.c2
4 files changed, 19 insertions, 7 deletions
diff --git a/src/libstat/backends/backends.h b/src/libstat/backends/backends.h
index e87a452d6..b6cc49f9e 100644
--- a/src/libstat/backends/backends.h
+++ b/src/libstat/backends/backends.h
@@ -38,11 +38,13 @@ struct rspamd_stat_ctx;
struct rspamd_token_result;
struct rspamd_statfile_runtime;
struct token_node_s;
+struct rspamd_task;
struct rspamd_stat_backend {
const char *name;
gpointer (*init)(struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg);
- gpointer (*runtime)(struct rspamd_statfile_config *stcf, gboolean learn, gpointer ctx);
+ gpointer (*runtime)(struct rspamd_task *task,
+ struct rspamd_statfile_config *stcf, gboolean learn, gpointer ctx);
gboolean (*process_token)(struct token_node_s *tok,
struct rspamd_token_result *res, gpointer ctx);
gboolean (*learn_token)(struct token_node_s *tok,
@@ -56,7 +58,8 @@ struct rspamd_stat_backend {
};
gpointer rspamd_mmaped_file_init (struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg);
-gpointer rspamd_mmaped_file_runtime (struct rspamd_statfile_config *stcf,
+gpointer rspamd_mmaped_file_runtime (struct rspamd_task *task,
+ struct rspamd_statfile_config *stcf,
gboolean learn, gpointer ctx);
gboolean rspamd_mmaped_file_process_token (struct token_node_s *tok,
struct rspamd_token_result *res,
@@ -76,7 +79,8 @@ ucl_object_t * rspamd_mmaped_file_get_stat (struct rspamd_statfile_runtime *runt
gpointer ctx);
gpointer rspamd_redis_init (struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg);
-gpointer rspamd_redis_runtime (struct rspamd_statfile_config *stcf,
+gpointer rspamd_redis_runtime (struct rspamd_task *task,
+ struct rspamd_statfile_config *stcf,
gboolean learn, gpointer ctx);
gboolean rspamd_redis_process_token (struct token_node_s *tok,
struct rspamd_token_result *res,
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c
index 2eaf6c638..5bb38c521 100644
--- a/src/libstat/backends/mmaped_file.c
+++ b/src/libstat/backends/mmaped_file.c
@@ -852,7 +852,9 @@ rspamd_mmaped_file_init (struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg)
}
gpointer
-rspamd_mmaped_file_runtime (struct rspamd_statfile_config *stcf, gboolean learn,
+rspamd_mmaped_file_runtime (struct rspamd_task *task,
+ struct rspamd_statfile_config *stcf,
+ gboolean learn,
gpointer p)
{
rspamd_mmaped_file_ctx *ctx = (rspamd_mmaped_file_ctx *)p;
diff --git a/src/libstat/backends/redis.c b/src/libstat/backends/redis.c
index 8f91d4396..9ace23f70 100644
--- a/src/libstat/backends/redis.c
+++ b/src/libstat/backends/redis.c
@@ -134,8 +134,14 @@ rspamd_redis_init (struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg)
return (gpointer)new;
}
-gpointer rspamd_redis_runtime (struct rspamd_statfile_config *stcf,
- gboolean learn, gpointer ctx);
+gpointer
+rspamd_redis_runtime (struct rspamd_task *task,
+ struct rspamd_statfile_config *stcf,
+ gboolean learn, gpointer ctx)
+{
+
+}
+
gboolean rspamd_redis_process_token (struct token_node_s *tok,
struct rspamd_token_result *res,
gpointer ctx);
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index f5a4b9398..164aaee85 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -213,7 +213,7 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx,
continue;
}
- backend_runtime = bk->runtime (stcf, op != RSPAMD_CLASSIFY_OP,
+ backend_runtime = bk->runtime (task, stcf, op != RSPAMD_CLASSIFY_OP,
bk->ctx);
st_runtime = rspamd_mempool_alloc0 (task->task_pool,