aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-06-23 14:50:56 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-29 12:18:43 +0200
commitdadb6cad8050f216cccd6a36aa5fa98d7541f38f (patch)
tree377291cda139084598b29e5091ebf46fc353506e /src/exchangedb
parent9ead926380cf6a87e22bc19172f723ba4948866e (diff)
work on more GET handlers
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/Makefile.am1
-rw-r--r--src/exchangedb/pg_select_aml_statistics.c38
-rw-r--r--src/exchangedb/pg_select_aml_statistics.h47
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c3
4 files changed, 89 insertions, 0 deletions
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index cc73674a3..ff995508b 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -158,6 +158,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
pg_ensure_coin_known.h pg_ensure_coin_known.c \
pg_get_known_coin.h pg_get_known_coin.c \
pg_get_signature_for_known_coin.h pg_get_signature_for_known_coin.c \
+ pg_select_aml_statistics.h pg_select_aml_statistics.c \
pg_get_coin_denomination.h pg_get_coin_denomination.c \
pg_select_aml_decisions.h pg_select_aml_decisions.c \
pg_have_deposit2.h pg_have_deposit2.c \
diff --git a/src/exchangedb/pg_select_aml_statistics.c b/src/exchangedb/pg_select_aml_statistics.c
new file mode 100644
index 000000000..b12324358
--- /dev/null
+++ b/src/exchangedb/pg_select_aml_statistics.c
@@ -0,0 +1,38 @@
+/*
+ This file is part of TALER
+ 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
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_select_aml_statistics.c
+ * @brief Implementation of the select_aml_statistics function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "taler_error_codes.h"
+#include "taler_dbevents.h"
+#include "taler_pq_lib.h"
+#include "pg_select_aml_statistics.h"
+#include "pg_helper.h"
+
+
+enum GNUNET_DB_QueryStatus
+TEH_PG_select_aml_statistics (
+ void *cls,
+ const char *name,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
+ uint64_t *cnt)
+{
+ // FIXME!
+}
diff --git a/src/exchangedb/pg_select_aml_statistics.h b/src/exchangedb/pg_select_aml_statistics.h
new file mode 100644
index 000000000..24ee56685
--- /dev/null
+++ b/src/exchangedb/pg_select_aml_statistics.h
@@ -0,0 +1,47 @@
+/*
+ This file is part of TALER
+ 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
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file exchangedb/pg_select_aml_statistics.h
+ * @brief implementation of the select_aml_statistics function for Postgres
+ * @author Christian Grothoff
+ */
+#ifndef PG_SELECT_AML_STATISTICS_H
+#define PG_SELECT_AML_STATISTICS_H
+
+#include "taler_util.h"
+#include "taler_json_lib.h"
+#include "taler_exchangedb_plugin.h"
+
+/**
+ * Obtain the AML statistics for a given key and
+ * timeframe.
+ *
+ * @param cls closure
+ * @param name name of the statistic
+ * @param start_date start of time range
+ * @param end_date end of time range
+ * @param[out] cnt number of events in this time range
+ * @return database transaction status, 0 if no threshold was set
+ */
+enum GNUNET_DB_QueryStatus
+TEH_PG_select_aml_statistics (
+ void *cls,
+ const char *name,
+ struct GNUNET_TIME_Timestamp start_date,
+ struct GNUNET_TIME_Timestamp end_date,
+ uint64_t *cnt);
+
+#endif
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index fe4dbd27b..e65f2ef3f 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -67,6 +67,7 @@
#include "pg_insert_purse_request.h"
#include "pg_iterate_active_signkeys.h"
#include "pg_preflight.h"
+#include "pg_select_aml_statistics.h"
#include "pg_commit.h"
#include "pg_drop_tables.h"
#include "pg_get_kyc_rules.h"
@@ -733,6 +734,8 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
= &TEH_PG_insert_signkey_revocation;
plugin->select_aml_attributes
= &TEH_PG_select_aml_attributes;
+ plugin->select_aml_statistics
+ = &TEH_PG_select_aml_statistics;
plugin->lookup_signkey_revocation
= &TEH_PG_lookup_signkey_revocation;
plugin->lookup_denomination_key