diff options
Diffstat (limited to 'src/libstat/backends')
-rw-r--r-- | src/libstat/backends/backends.h | 3 | ||||
-rw-r--r-- | src/libstat/backends/mmaped_file.c | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/libstat/backends/backends.h b/src/libstat/backends/backends.h index d174756df..a3042e8a4 100644 --- a/src/libstat/backends/backends.h +++ b/src/libstat/backends/backends.h @@ -48,6 +48,7 @@ struct rspamd_stat_backend { gboolean (*learn_token)(struct token_node_s *tok, struct rspamd_token_result *res, gpointer ctx); gulong (*total_learns)(struct rspamd_statfile_runtime *runtime, gpointer ctx); + gulong (*inc_learns)(struct rspamd_statfile_runtime *runtime, gpointer ctx); gpointer ctx; }; @@ -62,5 +63,7 @@ gboolean rspamd_mmaped_file_learn_token (struct token_node_s *tok, gpointer ctx); gulong rspamd_mmaped_file_total_learns (struct rspamd_statfile_runtime *runtime, gpointer ctx); +gulong rspamd_mmaped_file_inc_learns (struct rspamd_statfile_runtime *runtime, + gpointer ctx); #endif /* BACKENDS_H_ */ diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c index 8965353a1..e85db248b 100644 --- a/src/libstat/backends/mmaped_file.c +++ b/src/libstat/backends/mmaped_file.c @@ -956,3 +956,19 @@ rspamd_mmaped_file_total_learns (struct rspamd_statfile_runtime *runtime, return rev; } + +gulong +rspamd_mmaped_file_inc_learns (struct rspamd_statfile_runtime *runtime, + gpointer ctx) +{ + rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime; + guint64 rev = 0; + time_t t; + + if (mf != NULL) { + rspamd_mmaped_file_inc_revision (mf); + rspamd_mmaped_file_get_revision (mf, &rev, &t); + } + + return rev; +} |