From cd6581d4edf9cd9c73f023eb9b1f5529959bf816 Mon Sep 17 00:00:00 2001 From: oetiker Date: Tue, 26 May 2009 07:13:52 +0000 Subject: [PATCH] resolve the "flush inconsistency": * rrd_flush (a leftover from when rrdtool was using stream based io) is turned into a no-op but still exported to preserve library compatibility. * rrd_cmd_flush (the implementation of "rrdtool flush") is renamed to rrd_flushcached along with its command line invocation which is now rrdtool flushcached --tobi git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1812 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/{rrdflush.pod => rrdflushcached.pod} | 7 +++---- src/librrd.sym.in.in | 3 ++- src/rrd.h | 5 ++++- src/{rrd_flush.c => rrd_flushcached.c} | 4 ++-- src/rrd_open.c | 7 +++++++ src/rrd_tool.c | 22 +++++++++++----------- 6 files changed, 29 insertions(+), 19 deletions(-) rename doc/{rrdflush.pod => rrdflushcached.pod} (90%) rename src/{rrd_flush.c => rrd_flushcached.c} (97%) diff --git a/doc/rrdflush.pod b/doc/rrdflushcached.pod similarity index 90% rename from doc/rrdflush.pod rename to doc/rrdflushcached.pod index 5dbc60a..3c14201 100644 --- a/doc/rrdflush.pod +++ b/doc/rrdflushcached.pod @@ -4,13 +4,13 @@ rrdflush - Flush the values for a spcific RRD file from memory. =head1 SYNOPSIS -B B +B B S<[B<--daemon> I
]> I [I ...] =head1 DESCRIPTION -The B function connects to L, the RRD caching daemon, +The B function connects to L, the RRD caching daemon, and issues a "flush" command for the given files. The daemon will put the files to the head of the update queue so they are written "soon". The status will be returned only after the files' pending updates have been @@ -36,7 +36,7 @@ manual. =head1 ENVIRONMENT VARIABLES The following environment variables may be used to change the behavior of -Cflush>: +Cflushcached>: =over 4 @@ -51,4 +51,3 @@ line argument takes precedence. =head1 AUTHOR Florian Forster EoctoEatEverplant.orgE - diff --git a/src/librrd.sym.in.in b/src/librrd.sym.in.in index f947fe5..71ac3fb 100644 --- a/src/librrd.sym.in.in +++ b/src/librrd.sym.in.in @@ -2,7 +2,6 @@ rrd_add_ptr rrd_add_strdup rrd_clear_error rrd_close -rrd_cmd_flush rrd_create rrd_create_r rrd_dontneed @@ -10,8 +9,10 @@ rrd_dump rrd_dump_r rrd_fetch rrd_fetch_r +rrd_flushcached rrd_first rrd_first_r +rrd_flush rrd_free rrd_free_context rrd_free_ptrs diff --git a/src/rrd.h b/src/rrd.h index 0227ed4..412e20a 100644 --- a/src/rrd.h +++ b/src/rrd.h @@ -208,7 +208,7 @@ extern "C" { unsigned long *, char ***, rrd_value_t **); - int rrd_cmd_flush (int argc, char **argv); + int rrd_flushcached (int argc, char **argv); void rrd_freemem( void *mem); @@ -382,6 +382,9 @@ int rrd_proc_start_end( const void *buf, size_t count) RRD_DEPRECATED; + void rrd_flush( + rrd_file_t *rrd_file) + RRD_DEPRECATED; off_t rrd_seek( rrd_file_t *rrd_file, off_t off, diff --git a/src/rrd_flush.c b/src/rrd_flushcached.c similarity index 97% rename from src/rrd_flush.c rename to src/rrd_flushcached.c index 1f72e80..fb9345b 100644 --- a/src/rrd_flush.c +++ b/src/rrd_flushcached.c @@ -1,5 +1,5 @@ /** - * RRDTool - src/rrd_flush.c + * RRDTool - src/rrd_flushcached.c * Copyright (C) 2008 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ #include "rrd_tool.h" #include "rrd_client.h" -int rrd_cmd_flush (int argc, char **argv) +int rrd_flushcached (int argc, char **argv) { char *opt_daemon = NULL; int status; diff --git a/src/rrd_open.c b/src/rrd_open.c index 062de23..59526d8 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -675,6 +675,13 @@ ssize_t rrd_write( } +/* this is a leftover from the old days, it serves no purpose + and is therefore turned into a no-op */ +void rrd_flush( + rrd_file_t *rrd_file __attribute__((unused))) +{ +} + /* Initialize RRD header. */ void rrd_init( diff --git a/src/rrd_tool.c b/src/rrd_tool.c index 6ca537f..8f23326 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -57,7 +57,7 @@ void PrintUsage( N_ ("Valid commands: create, update, updatev, graph, graphv, dump, restore,\n" "\t\tlast, lastupdate, first, info, fetch, tune,\n" - "\t\tresize, xport, flush\n\n"); + "\t\tresize, xport, flushcached\n\n"); const char *help_listremote = N_("Valid remote commands: quit, ls, cd, mkdir, pwd\n\n"); @@ -119,9 +119,9 @@ void PrintUsage( "\t\t[-s|--start start] [-e|--end end]\n" "\t\t[--daemon
]\n\n"); - const char *help_flush = - N_("* flush - flush cached data out to an RRD file\n\n" - "\trrdtool flush filename.rrd\n" + const char *help_flushcached = + N_("* flushcached - flush cached data out to an RRD file\n\n" + "\trrdtool flushcached filename.rrd\n" "\t\t[--daemon
]\n\n"); /* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/ @@ -229,7 +229,7 @@ void PrintUsage( C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_GRAPHV, C_TUNE, C_RESIZE, C_XPORT, C_QUIT, C_LS, C_CD, C_MKDIR, C_PWD, - C_UPDATEV, C_FLUSH + C_UPDATEV, C_FLUSHCACHED }; int help_cmd = C_NONE; @@ -254,8 +254,8 @@ void PrintUsage( help_cmd = C_UPDATEV; else if (!strcmp(cmd, "fetch")) help_cmd = C_FETCH; - else if (!strcmp(cmd, "flush")) - help_cmd = C_FLUSH; + else if (!strcmp(cmd, "flushcached")) + help_cmd = C_FLUSHCACHED; else if (!strcmp(cmd, "graph")) help_cmd = C_GRAPH; else if (!strcmp(cmd, "graphv")) @@ -316,8 +316,8 @@ void PrintUsage( case C_FETCH: fputs(_(help_fetch), stdout); break; - case C_FLUSH: - fputs(_(help_flush), stdout); + case C_FLUSHCACHED: + fputs(_(help_flushcached), stdout); break; case C_GRAPH: fputs(_(help_graph0), stdout); @@ -813,8 +813,8 @@ int HandleInputLine( } else if (strcmp("tune", argv[1]) == 0) rrd_tune(argc - 1, &argv[1]); - else if (strcmp("flush", argv[1]) == 0) - rrd_cmd_flush(argc - 1, &argv[1]); + else if (strcmp("flushcached", argv[1]) == 0) + rrd_flushcached(argc - 1, &argv[1]); else { rrd_set_error("unknown function '%s'", argv[1]); } -- 2.30.2