From 35dc96ac784586d0c137a43ff90eea7b7b253d7a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 30 Nov 2019 00:43:06 +0100 Subject: implement -g option in sync-dbinit --- src/syncdb/sync-dbinit.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/syncdb/sync-dbinit.c b/src/syncdb/sync-dbinit.c index be78eb8..95aaeb6 100644 --- a/src/syncdb/sync-dbinit.c +++ b/src/syncdb/sync-dbinit.c @@ -34,6 +34,11 @@ static int global_ret; */ static int reset_db; +/** + * -g option: do GC reset + */ +static int gc_db; + /** * Main function that will be run. * @@ -64,6 +69,20 @@ run (void *cls, SYNC_DB_plugin_unload (plugin); plugin = SYNC_DB_plugin_load (cfg); } + if (gc_db) + { + struct GNUNET_TIME_Absolute now; + struct GNUNET_TIME_Absolute ancient; + + now = GNUNET_TIME_absolute_get (); + ancient = GNUNET_TIME_absolute_subtract (now, + GNUNET_TIME_relative_multiply ( + GNUNET_TIME_UNIT_YEARS, + 6)); + plugin->gc (plugin->cls, + now, + ancient); + } SYNC_DB_plugin_unload (plugin); } @@ -85,6 +104,10 @@ main (int argc, "reset", "reset database (DANGEROUS: all existing data is lost!)", &reset_db), + GNUNET_GETOPT_option_flag ('g', + "garbagecollect", + "remove state data from database", + &gc_db), GNUNET_GETOPT_OPTION_END }; -- cgit v1.2.3