aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/stat_internal.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-09 13:33:04 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-09 13:33:04 +0000
commitaee3e6a68d84f7ed2047e4b9b939492008b7f7af (patch)
tree89b0a5e2dc0b140829d65c4188d5b5711bb599d4 /src/libstat/stat_internal.h
parent6b0f624216ca5c0311a62ae117f56d7cbcb4c840 (diff)
downloadrspamd-aee3e6a68d84f7ed2047e4b9b939492008b7f7af.tar.gz
rspamd-aee3e6a68d84f7ed2047e4b9b939492008b7f7af.zip
Implement async timered events for statistics
Diffstat (limited to 'src/libstat/stat_internal.h')
-rw-r--r--src/libstat/stat_internal.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libstat/stat_internal.h b/src/libstat/stat_internal.h
index 787323fbc..7a3951a0e 100644
--- a/src/libstat/stat_internal.h
+++ b/src/libstat/stat_internal.h
@@ -25,6 +25,7 @@
#include "config.h"
#include "task.h"
+#include "ref.h"
#include "classifiers/classifiers.h"
#include "tokenizers/tokenizers.h"
#include "backends/backends.h"
@@ -65,11 +66,22 @@ typedef struct token_node_s {
gdouble values[];
} rspamd_token_t;
+struct rspamd_stat_async_elt;
+
+typedef void (*rspamd_stat_async_handler)(struct rspamd_stat_async_elt *elt,
+ gpointer ud);
+typedef void (*rspamd_stat_async_cleanup)(struct rspamd_stat_async_elt *elt,
+ gpointer ud);
+
struct rspamd_stat_async_elt {
- void (*handler)(struct rspamd_stat_async_elt *elt, gpointer ud);
- void (*cleanup)(struct rspamd_stat_async_elt *elt, gpointer ud);
- struct event ev;
+ rspamd_stat_async_handler handler;
+ rspamd_stat_async_cleanup cleanup;
+ struct event timer_ev;
+ struct timeval tv;
+ gdouble timeout;
+ gboolean enabled;
gpointer ud;
+ ref_entry_t ref;
};
struct rspamd_stat_ctx {
@@ -106,6 +118,9 @@ struct rspamd_stat_classifier * rspamd_stat_get_classifier (const gchar *name);
struct rspamd_stat_backend * rspamd_stat_get_backend (const gchar *name);
struct rspamd_stat_tokenizer * rspamd_stat_get_tokenizer (const gchar *name);
struct rspamd_stat_cache * rspamd_stat_get_cache (const gchar *name);
+struct rspamd_stat_async_elt* rspamd_stat_ctx_register_async (
+ rspamd_stat_async_handler handler, rspamd_stat_async_cleanup cleanup,
+ gpointer d, gdouble timeout);
static GQuark rspamd_stat_quark (void)
{