]> source.dussan.org Git - rspamd.git/commitdiff
Runtime for backends now accepts task object.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Feb 2015 13:36:58 +0000 (13:36 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Feb 2015 13:36:58 +0000 (13:36 +0000)
src/libstat/backends/backends.h
src/libstat/backends/mmaped_file.c
src/libstat/backends/redis.c
src/libstat/stat_process.c

index e87a452d61b0f38f5d4a5b4074bab257a3b8fc4f..b6cc49f9e9845229d95500507fefee6858966d82 100644 (file)
@@ -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,
index 2eaf6c638e75829a7f4168b9b1ceeaf5e7674cfd..5bb38c521566875bc21dbc64829159d7d43d4395 100644 (file)
@@ -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;
index 8f91d4396fab42091981e3f5d2ccde48bf6ccd75..9ace23f70cc1bfe474a19fdeba793203288cb79e 100644 (file)
@@ -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);
index f5a4b939839658c722ac367b2d2b68d8bd070ccd..164aaee85cdaa155277d5b199ff12c52bb030c3f 100644 (file)
@@ -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,