summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/taler-exchange-dbinit.15
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c14
2 files changed, 18 insertions, 1 deletions
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
@@ -34,6 +34,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.
*
* @param cls closure
@@ -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
};