Code

rrdtool plugin: Added a flush callback.
authorSebastian Harl <sh@tokkee.org>
Tue, 26 Feb 2008 17:15:28 +0000 (18:15 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 27 Feb 2008 07:21:13 +0000 (08:21 +0100)
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/rrdtool.c

index 3bb5a9e7ede71ed45b87f09fa3dd2424a305b850..4e34d6ad0aac1bbb93a5c537d58f07e7a559a49c 100644 (file)
@@ -947,6 +947,17 @@ static int rrd_write (const data_set_t *ds, const value_list_t *vl)
        return (status);
 } /* int rrd_write */
 
+static int rrd_flush (const int timeout)
+{
+       if (cache == NULL)
+               return (0);
+
+       pthread_mutex_lock (&cache_lock);
+       rrd_cache_flush (timeout);
+       pthread_mutex_unlock (&cache_lock);
+       return (0);
+} /* int rrd_flush */
+
 static int rrd_config (const char *key, const char *value)
 {
        if (strcasecmp ("CacheTimeout", key) == 0)
@@ -1152,5 +1163,6 @@ void module_register (void)
                        config_keys, config_keys_num);
        plugin_register_init ("rrdtool", rrd_init);
        plugin_register_write ("rrdtool", rrd_write);
+       plugin_register_flush ("rrdtool", rrd_flush);
        plugin_register_shutdown ("rrdtool", rrd_shutdown);
 }