summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e05532)
raw | patch | inline | side by side (parent: 9e05532)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 26 May 2009 07:13:52 +0000 (07:13 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 26 May 2009 07:13:52 +0000 (07:13 +0000) |
* 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
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 | [deleted file] | patch | blob | history |
doc/rrdflushcached.pod | [new file with mode: 0644] | patch | blob |
src/librrd.sym.in.in | patch | blob | history | |
src/rrd.h | patch | blob | history | |
src/rrd_flush.c | [deleted file] | patch | blob | history |
src/rrd_flushcached.c | [new file with mode: 0644] | patch | blob |
src/rrd_open.c | patch | blob | history | |
src/rrd_tool.c | patch | blob | history |
diff --git a/doc/rrdflush.pod b/doc/rrdflush.pod
--- a/doc/rrdflush.pod
+++ /dev/null
@@ -1,54 +0,0 @@
-=head1 NAME
-
-rrdflush - Flush the values for a spcific RRD file from memory.
-
-=head1 SYNOPSIS
-
-B<rrdtool> B<flush>
-S<[B<--daemon> I<address>]>
-I<filename> [I<filename> ...]
-
-=head1 DESCRIPTION
-
-The B<flush> function connects to L<rrdcached>, 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
-written to disk.
-
-=over 8
-
-=item I<filename>
-
-The name(s) of the B<RRD> file(s) that are to be written to disk.
-
-=item B<--daemon> I<address>
-
-Address of the L<rrdcached> daemon. If not specified, the
-RRDCACHED_ADDRESS environment variable must be set (see below). For a
-list of accepted formats, see the B<-l> option in the L<rrdcached>
-manual.
-
- rrdtool flush --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd
-
-=back
-
-=head1 ENVIRONMENT VARIABLES
-
-The following environment variables may be used to change the behavior of
-C<rrdtoolE<nbsp>flush>:
-
-=over 4
-
-=item B<RRDCACHED_ADDRESS>
-
-If this environment variable is set it will have the same effect as specifying
-the C<--daemon> option on the command line. If both are present, the command
-line argument takes precedence.
-
-=back
-
-=head1 AUTHOR
-
-Florian Forster E<lt>octoE<nbsp>atE<nbsp>verplant.orgE<gt>
-
diff --git a/doc/rrdflushcached.pod b/doc/rrdflushcached.pod
--- /dev/null
+++ b/doc/rrdflushcached.pod
@@ -0,0 +1,53 @@
+=head1 NAME
+
+rrdflush - Flush the values for a spcific RRD file from memory.
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<flushcached>
+S<[B<--daemon> I<address>]>
+I<filename> [I<filename> ...]
+
+=head1 DESCRIPTION
+
+The B<flushcached> function connects to L<rrdcached>, 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
+written to disk.
+
+=over 8
+
+=item I<filename>
+
+The name(s) of the B<RRD> file(s) that are to be written to disk.
+
+=item B<--daemon> I<address>
+
+Address of the L<rrdcached> daemon. If not specified, the
+RRDCACHED_ADDRESS environment variable must be set (see below). For a
+list of accepted formats, see the B<-l> option in the L<rrdcached>
+manual.
+
+ rrdtool flush --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd
+
+=back
+
+=head1 ENVIRONMENT VARIABLES
+
+The following environment variables may be used to change the behavior of
+C<rrdtoolE<nbsp>flushcached>:
+
+=over 4
+
+=item B<RRDCACHED_ADDRESS>
+
+If this environment variable is set it will have the same effect as specifying
+the C<--daemon> option on the command line. If both are present, the command
+line argument takes precedence.
+
+=back
+
+=head1 AUTHOR
+
+Florian Forster E<lt>octoE<nbsp>atE<nbsp>verplant.orgE<gt>
diff --git a/src/librrd.sym.in.in b/src/librrd.sym.in.in
index f947fe530068eff6d6c00d1cbce482e4684dcc23..71ac3fb424b09c595f88ac55561fa24f6910c5ec 100644 (file)
--- a/src/librrd.sym.in.in
+++ b/src/librrd.sym.in.in
rrd_add_strdup
rrd_clear_error
rrd_close
-rrd_cmd_flush
rrd_create
rrd_create_r
rrd_dontneed
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 0227ed4a00c2426facc4f2493d833d6b28ad869f..412e20abe592823aa868730569964ce06b28d46c 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
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);
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_flush.c
--- a/src/rrd_flush.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * RRDTool - src/rrd_flush.c
- * Copyright (C) 2008 Florian octo Forster
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; only version 2 of the License is applicable.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors:
- * Florian octo Forster <octo at verplant.org>
- **/
-
-#include "rrd_tool.h"
-#include "rrd_client.h"
-
-int rrd_cmd_flush (int argc, char **argv)
-{
- char *opt_daemon = NULL;
- int status;
- int i;
-
- /* initialize getopt */
- optind = 0;
- opterr = 0;
-
- while (42)
- {
- int opt;
- static struct option long_options[] =
- {
- {"daemon", required_argument, 0, 'd'},
- {0, 0, 0, 0}
- };
-
- opt = getopt_long(argc, argv, "d:", long_options, NULL);
-
- if (opt == -1)
- break;
-
- switch (opt)
- {
- case 'd':
- if (opt_daemon != NULL)
- free (opt_daemon);
- opt_daemon = strdup (optarg);
- if (opt_daemon == NULL)
- {
- rrd_set_error ("strdup failed.");
- return (-1);
- }
- break;
-
- default:
- rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file>",
- argv[0]);
- return (-1);
- }
- } /* while (42) */
-
- if ((argc - optind) < 1)
- {
- rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file> [<file> ...]", argv[0]);
- return (-1);
- }
-
- /* try to connect to rrdcached */
- status = rrdc_connect(opt_daemon);
- if (opt_daemon) free(opt_daemon);
- if (status != 0) return status;
-
- if (! rrdc_is_connected(opt_daemon))
- {
- rrd_set_error ("Daemon address unknown. Please use the \"--daemon\" "
- "option to set an address on the command line or set the "
- "\"%s\" environment variable.",
- ENV_RRDCACHED_ADDRESS);
- return (-1);
- }
-
- status = 0;
- for (int i = optind; i < argc; i++)
- {
- status = rrdc_flush(argv[i]);
- if (status)
- {
- char *error;
- int remaining;
-
- error = strdup(rrd_get_error());
- remaining = argc - optind - 1;
-
- rrd_set_error("Flushing of file \"%s\" failed: %s. Skipping "
- "remaining %i file%s.", argv[i],
- ((! error) || (*error == '\0')) ? "unknown error" : error,
- remaining, (remaining == 1) ? "" : "s");
- free(error);
- break;
- }
- }
-
- return ((status == 0) ? 0 : -1);
-} /* int rrd_flush */
-
-/*
- * vim: set sw=4 sts=4 et fdm=marker :
- */
diff --git a/src/rrd_flushcached.c b/src/rrd_flushcached.c
--- /dev/null
+++ b/src/rrd_flushcached.c
@@ -0,0 +1,115 @@
+/**
+ * RRDTool - src/rrd_flushcached.c
+ * Copyright (C) 2008 Florian octo Forster
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; only version 2 of the License is applicable.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Florian octo Forster <octo at verplant.org>
+ **/
+
+#include "rrd_tool.h"
+#include "rrd_client.h"
+
+int rrd_flushcached (int argc, char **argv)
+{
+ char *opt_daemon = NULL;
+ int status;
+ int i;
+
+ /* initialize getopt */
+ optind = 0;
+ opterr = 0;
+
+ while (42)
+ {
+ int opt;
+ static struct option long_options[] =
+ {
+ {"daemon", required_argument, 0, 'd'},
+ {0, 0, 0, 0}
+ };
+
+ opt = getopt_long(argc, argv, "d:", long_options, NULL);
+
+ if (opt == -1)
+ break;
+
+ switch (opt)
+ {
+ case 'd':
+ if (opt_daemon != NULL)
+ free (opt_daemon);
+ opt_daemon = strdup (optarg);
+ if (opt_daemon == NULL)
+ {
+ rrd_set_error ("strdup failed.");
+ return (-1);
+ }
+ break;
+
+ default:
+ rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file>",
+ argv[0]);
+ return (-1);
+ }
+ } /* while (42) */
+
+ if ((argc - optind) < 1)
+ {
+ rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file> [<file> ...]", argv[0]);
+ return (-1);
+ }
+
+ /* try to connect to rrdcached */
+ status = rrdc_connect(opt_daemon);
+ if (opt_daemon) free(opt_daemon);
+ if (status != 0) return status;
+
+ if (! rrdc_is_connected(opt_daemon))
+ {
+ rrd_set_error ("Daemon address unknown. Please use the \"--daemon\" "
+ "option to set an address on the command line or set the "
+ "\"%s\" environment variable.",
+ ENV_RRDCACHED_ADDRESS);
+ return (-1);
+ }
+
+ status = 0;
+ for (int i = optind; i < argc; i++)
+ {
+ status = rrdc_flush(argv[i]);
+ if (status)
+ {
+ char *error;
+ int remaining;
+
+ error = strdup(rrd_get_error());
+ remaining = argc - optind - 1;
+
+ rrd_set_error("Flushing of file \"%s\" failed: %s. Skipping "
+ "remaining %i file%s.", argv[i],
+ ((! error) || (*error == '\0')) ? "unknown error" : error,
+ remaining, (remaining == 1) ? "" : "s");
+ free(error);
+ break;
+ }
+ }
+
+ return ((status == 0) ? 0 : -1);
+} /* int rrd_flush */
+
+/*
+ * vim: set sw=4 sts=4 et fdm=marker :
+ */
diff --git a/src/rrd_open.c b/src/rrd_open.c
index 062de236b0b41c77674dd8fabc202e48e8482c50..59526d8b4c3ae3c49582afbd6da2ee440e500123 100644 (file)
--- a/src/rrd_open.c
+++ b/src/rrd_open.c
}
+/* 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 6ca537fa852d9cc23cd8d1b9b18eadf6ba973c49..8f233268f3fe46d5cb5b1387f5868d81cc6af829 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
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");
"\t\t[-s|--start start] [-e|--end end]\n"
"\t\t[--daemon <address>]\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 <address>]\n\n");
/* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
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;
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"))
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);
} 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]);
}