From ba0146b8789d33afee9c3644ad7dade5b99ae1ba Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 31 May 2016 09:16:09 +0200 Subject: add -g option to taler-exchange-dbinit --- doc/taler-exchange-dbinit.1 | 5 ++++- src/exchange-tools/taler-exchange-dbinit.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/taler-exchange-dbinit.1 b/doc/taler-exchange-dbinit.1 index 92bf83b09..a1559959f 100644 --- a/doc/taler-exchange-dbinit.1 +++ b/doc/taler-exchange-dbinit.1 @@ -1,4 +1,4 @@ -.TH TALER\-EXCHANGE\-DBINIT 1 "Apr 22, 2015" "GNU Taler" +.TH TALER\-EXCHANGE\-DBINIT 1 "May 31, 2016" "GNU Taler" .SH NAME taler\-exchange\-dbinit \- Initialize Taler exchange database. @@ -19,6 +19,9 @@ Use the configuration and other resources for the exchange to operate from DIRNA .IP "\-h, \-\-help" Print short help on options. .B +.IP "\-g, \-\-gc" +Garbage collect database. Deletes all unnecessary data in the database. +.B .IP "\-r, \-\-reset" Drop tables. Dangerous, will delete all existing data in the database before creating the tables. .B diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c index 16d76e4d0..cf768f4ca 100644 --- a/src/exchange-tools/taler-exchange-dbinit.c +++ b/src/exchange-tools/taler-exchange-dbinit.c @@ -33,6 +33,11 @@ static int global_ret; */ static int reset_db; +/** + * -g option: garbage collect DB reset + */ +static int gc_db; + /** * Main function that will be run. * @@ -68,6 +73,12 @@ run (void *cls, global_ret = 1; return; } + if (gc_db) + { + if (GNUNET_SYSERR == plugin->gc (plugin->cls)) + fprintf (stderr, + "Garbage collection failed!\n"); + } TALER_EXCHANGEDB_plugin_unload (plugin); } @@ -88,6 +99,9 @@ main (int argc, {'r', "reset", NULL, "reset database (DANGEROUS: all existing data is lost!)", 0, &GNUNET_GETOPT_set_one, &reset_db}, + {'g', "gc", NULL, + "garbage collect database", 0, + &GNUNET_GETOPT_set_one, &gc_db}, GNUNET_GETOPT_OPTION_END }; -- cgit v1.2.3