add -g option to taler-exchange-dbinit

This commit is contained in:
Christian Grothoff 2016-05-31 09:16:09 +02:00
parent 94e1679955
commit ba0146b878
2 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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
};