commit 13bd0680674dbf75963ff9894e70b06096d05716
parent a00e3a4c7b20ce2b6c3eca00af4b203743649a8c
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date: Mon, 8 Jan 2024 10:53:51 +0100
[db] some changes
Diffstat:
8 files changed, 50 insertions(+), 68 deletions(-)
diff --git a/src/donau-tools/donau-dbinit.c b/src/donau-tools/donau-dbinit.c
@@ -118,21 +118,21 @@ run (void *cls,
}
// if (clear_shards)
// {
- // if (GNUNET_OK !=
- // plugin->delete_shard_locks (plugin->cls))
- // {
- // fprintf (stderr,
- // "Clearing revolving shards failed!\n");
- // }
- // }
- // if (gc_db)
+ // if (GNUNET_OK !=
+ // plugin->delete_shard_locks (plugin->cls))
// {
- // if (GNUNET_SYSERR == plugin->gc (plugin->cls))
- // {
- // fprintf (stderr,
- // "Garbage collection failed!\n");
- // }
+ // fprintf (stderr,
+ // "Clearing revolving shards failed!\n");
+ // }
// }
+ if (gc_db)
+ {
+ if (GNUNET_SYSERR == plugin->gc (plugin->cls))
+ {
+ fprintf (stderr,
+ "Garbage collection failed!\n");
+ }
+ }
}
DONAUDB_plugin_unload (plugin);
plugin = NULL;
@@ -160,19 +160,19 @@ main (int argc,
"reset",
"reset database (DANGEROUS: all existing data is lost!)",
&reset_db),
- GNUNET_GETOPT_option_flag ('s',
- "shardunlock",
- "unlock all revolving shard locks (use after system crash or shard size change while services are not running)",
- &clear_shards),
- GNUNET_GETOPT_option_uint ('P',
- "partition",
- "NUMBER",
- "Setup a partitioned database where each table which can be partitioned holds NUMBER partitions on a single DB node",
- &num_partitions),
- GNUNET_GETOPT_option_flag ('f',
- "force",
- "Force partitions to be created if there is only one partition",
- &force_create_partitions),
+ // GNUNET_GETOPT_option_flag ('s',
+ // "shardunlock",
+ // "unlock all revolving shard locks (use after system crash or shard size change while services are not running)",
+ // &clear_shards),
+ // GNUNET_GETOPT_option_uint ('P',
+ // "partition",
+ // "NUMBER",
+ // "Setup a partitioned database where each table which can be partitioned holds NUMBER partitions on a single DB node",
+ // &num_partitions),
+ // GNUNET_GETOPT_option_flag ('f',
+ // "force",
+ // "Force partitions to be created if there is only one partition",
+ // &force_create_partitions),
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
@@ -439,6 +439,13 @@ handle_mhd_request (void *cls,
.method = MHD_HTTP_METHOD_GET,
.handler.get = &DH_handler_charities_get
},
+ /* GET charity */
+ {
+ .url = "charity",
+ .method = MHD_HTTP_METHOD_GET,
+ .handler.get = &DH_handler_charity_get,
+ .nargs = 1
+ },
/**
etc
diff --git a/src/donau/donau-httpd_db.c b/src/donau/donau-httpd_db.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017, 2021 Taler Systems SA
+ Copyright (C) 2024 Taler Systems SA
TALER 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
diff --git a/src/donaudb/donaudb-postgres.conf b/src/donaudb/donaudb-postgres.conf
@@ -4,6 +4,3 @@ CONFIG = "postgres:///taler"
# Where are the SQL files to setup our tables?
# Important: this MUST end with a "/"!
SQL_DIR = $DATADIR/sql/donau/
-
-# Number of purses per account by default.
-DEFAULT_PURSE_LIMIT = 1
-\ No newline at end of file
diff --git a/src/donaudb/donaudb.conf b/src/donaudb/donaudb.conf
@@ -3,34 +3,3 @@
# Database-backend independent specification for the donaudb module.
#
[donaudb]
-# Where do we expect to find information about auditors?
-AUDITOR_BASE_DIR = ${TALER_DATA_HOME}/auditors/
-
-# Where do we expect to find information about wire transfer fees
-# for aggregate payments? These are the amounts we charge (subtract)
-# the charity per wire transfer. The directory is expected to
-# contain files "$METHOD.fee" with the cost structure, where
-# $METHOD corresponds to a wire transfer method.
-WIREFEE_BASE_DIR = ${TALER_DATA_HOME}/donau/wirefees/
-
-
-# After how long do we close idle reserves? The donau
-# and the auditor must agree on this value. We currently
-# expect it to be globally defined for the whole system,
-# as there is no way for wallets to query this value. Thus,
-# it is only configurable for testing, and should be treated
-# as constant in production.
-IDLE_RESERVE_EXPIRATION_TIME = 4 weeks
-
-
-# After how long do we forget about reserves? Should be above
-# the legal expiration timeframe of withdrawn coins.
-LEGAL_RESERVE_EXPIRATION_TIME = 7 years
-
-# What is the desired delay between a transaction being ready and the
-# aggregator triggering on it?
-AGGREGATOR_SHIFT = 1 s
-
-# How many concurrent purses may be opened by a reserve
-# if the reserve is paid for a year?
-DEFAULT_PURSE_LIMIT = 1
-\ No newline at end of file
diff --git a/src/donaudb/donaudb_plugin.c b/src/donaudb/donaudb_plugin.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015 Taler Systems SA
+ Copyright (C) 2024 Taler Systems SA
TALER 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
@@ -16,8 +16,7 @@
/**
* @file donaudb/donaudb_plugin.c
* @brief Logic to load database plugin
- * @author Christian Grothoff
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Johannes Casaburi
*/
#include "taler/platform.h"
#include "donaudb_plugin.h"
diff --git a/src/donaudb/plugin_donaudb_postgres.c b/src/donaudb/plugin_donaudb_postgres.c
@@ -118,8 +118,8 @@ DH_PG_internal_setup (struct PostgresClosure *pg)
pg->prep_gen++;
pg->conn = db_conn;
}
- // if (NULL == pg->transaction_name)
- // GNUNET_PQ_reconnect_if_down (pg->conn);
+ if (NULL == pg->transaction_name)
+ GNUNET_PQ_reconnect_if_down (pg->conn);
return GNUNET_OK;
}
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
@@ -285,6 +285,18 @@ struct DONAUDB_Plugin
/**
+ * Function called to perform "garbage collection" on the
+ * database, expiring records we no longer require.
+ *
+ * @param cls closure
+ * @return #GNUNET_OK on success,
+ * #GNUNET_SYSERR on DB errors
+ */
+ enum GNUNET_GenericReturnValue
+ (*gc)(void *cls);
+
+
+ /**
* Register callback to be invoked on events of type @a es.
*
* @param cls database context to use