diff options
author | Cedric Zwahlen <cedric.zwahlen@students.bfh.ch> | 2024-04-05 02:03:24 +0200 |
---|---|---|
committer | Cedric Zwahlen <cedric.zwahlen@students.bfh.ch> | 2024-04-19 20:47:31 +0200 |
commit | e96b1e7ae3ff7d6b44e4fb6a30d81f689afb4320 (patch) | |
tree | 35776ec5e8ec44066a3baeadb5bc18df15443cfa | |
parent | b657e22d470f53dd9a876bc8580a0f38b91fb9b8 (diff) | |
download | exchange-e96b1e7ae3ff7d6b44e4fb6a30d81f689afb4320.tar.gz exchange-e96b1e7ae3ff7d6b44e4fb6a30d81f689afb4320.tar.bz2 exchange-e96b1e7ae3ff7d6b44e4fb6a30d81f689afb4320.zip |
Fix and Improve CRUD files (still in progress)
45 files changed, 575 insertions, 165 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am index 1ef3f2b9e..ec95946a9 100644 --- a/src/auditor/Makefile.am +++ b/src/auditor/Makefile.am @@ -174,6 +174,33 @@ taler_auditor_httpd_SOURCES = \ taler-auditor-httpd_amount-arithmetic-inconsistency-put.c taler-auditor-httpd_amount-arithmetic-inconsistency-put.h \ taler-auditor-httpd_coin-inconsistency-put.c taler-auditor-httpd_coin-inconsistency-put.h \ taler-auditor-httpd_row-inconsistency-put.c taler-auditor-httpd_row-inconsistency-put.h \ + taler-auditor-httpd_emergency-put.c taler-auditor-httpd_emergency-put.h \ + taler-auditor-httpd_emergency-get.c taler-auditor-httpd_emergency-get.h \ + taler-auditor-httpd_emergency-del.c taler-auditor-httpd_emergency-del.h \ + taler-auditor-httpd_emergency-by-count-put.c taler-auditor-httpd_emergency-by-count-put.h \ + taler-auditor-httpd_emergency-by-count-get.c taler-auditor-httpd_emergency-by-count-get.h \ + taler-auditor-httpd_emergency-by-count-del.c taler-auditor-httpd_emergency-by-count-del.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h \ + taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.c taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-put.c taler-auditor-httpd_purse-not-closed-inconsistencies-put.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-get.c taler-auditor-httpd_purse-not-closed-inconsistencies-get.h \ + taler-auditor-httpd_purse-not-closed-inconsistencies-del.c taler-auditor-httpd_purse-not-closed-inconsistencies-del.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h \ + taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.c taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.h \ + taler-auditor-httpd_bad-sig-losses-put.c taler-auditor-httpd_bad-sig-losses-put.h \ + taler-auditor-httpd_bad-sig-losses-get.c taler-auditor-httpd_bad-sig-losses-get.h \ + taler-auditor-httpd_bad-sig-losses-del.c taler-auditor-httpd_bad-sig-losses-del.h \ + taler-auditor-httpd_auditor-closure-lags-put.c taler-auditor-httpd_auditor-closure-lags-put.h \ + taler-auditor-httpd_auditor-closure-lags-get.c taler-auditor-httpd_auditor-closure-lags-get.h \ + taler-auditor-httpd_auditor-closure-lags-del.c taler-auditor-httpd_auditor-closure-lags-del.h \ + taler-auditor-httpd_progress-put.c taler-auditor-httpd_progress-put.h \ + taler-auditor-httpd_progress-get.c taler-auditor-httpd_progress-get.h \ + taler-auditor-httpd_progress-del.c taler-auditor-httpd_progress-del.h \ + taler-auditor-httpd_refreshes-hanging-put.c taler-auditor-httpd_refreshes-hanging-put.h \ + taler-auditor-httpd_refreshes-hanging-get.c taler-auditor-httpd_refreshes-hanging-get.h \ + taler-auditor-httpd_refreshes-hanging-del.c taler-auditor-httpd_refreshes-hanging-del.h \ taler-auditor-httpd_mhd.c taler-auditor-httpd_mhd.h taler_auditor_httpd_LDADD = \ $(LIBGCRYPT_LIBS) \ diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index 0544c755d..a7315094d 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -42,6 +42,46 @@ #include "taler-auditor-httpd_row-inconsistency-get.h" #include "taler-auditor-httpd_row-inconsistency-put.h" #include "taler-auditor-httpd_row-inconsistency-del.h" + +#include "taler-auditor-httpd_emergency-get.h" +#include "taler-auditor-httpd_emergency-put.h" +#include "taler-auditor-httpd_emergency-del.h" + +#include "taler-auditor-httpd_emergency-by-count-get.h" +#include "taler-auditor-httpd_emergency-by-count-put.h" +#include "taler-auditor-httpd_emergency-by-count-del.h" + +#include \ + "taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.h" +#include \ + "taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.h" +#include \ + "taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-del.h" + +#include "taler-auditor-httpd_purse-not-closed-inconsistencies-get.h" +#include "taler-auditor-httpd_purse-not-closed-inconsistencies-put.h" +#include "taler-auditor-httpd_purse-not-closed-inconsistencies-del.h" + +#include "taler-auditor-httpd_reserve-balance-insufficient-inconsistency-get.h" +#include "taler-auditor-httpd_reserve-balance-insufficient-inconsistency-put.h" +#include "taler-auditor-httpd_reserve-balance-insufficient-inconsistency-del.h" + +#include "taler-auditor-httpd_bad-sig-losses-get.h" +#include "taler-auditor-httpd_bad-sig-losses-put.h" +#include "taler-auditor-httpd_bad-sig-losses-del.h" + +#include "taler-auditor-httpd_closure-lags-get.h" +#include "taler-auditor-httpd_closure-lags-put.h" +#include "taler-auditor-httpd_closure-lags-del.h" + +#include "taler-auditor-httpd_progress-get.h" +#include "taler-auditor-httpd_progress-put.h" +#include "taler-auditor-httpd_progress-del.h" + +#include "taler-auditor-httpd_refreshes-hanging-get.h" +#include "taler-auditor-httpd_refreshes-hanging-put.h" +#include "taler-auditor-httpd_refreshes-hanging-del.h" + #include "taler-auditor-httpd_mhd.h" #include "taler-auditor-httpd.h" diff --git a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c index 9b67ec6ea..79bb80f12 100644 --- a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-get.c @@ -49,10 +49,9 @@ process_denomination_key_validity_withdraw_inconsistency (void *cls, // TODO: fill in - TALER_JSON_pack_amount ("amount", &dc->amount), - GNUNET_JSON_pack_int64 ("deadline", dc->deadline), - GNUNET_JSON_pack_string ("wtid", dc->wtid), - GNUNET_JSON_pack_string ("account", dc->account) + GNUNET_JSON_pack_int64 ("execution_date", &dc->execution_date), + GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub), + GNUNET_JSON_pack_data_auto ("execution_date", &dc->denompub_h) ); GNUNET_break (0 == diff --git a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c index 2fb367722..275147d46 100644 --- a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c +++ b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-put.c @@ -92,10 +92,9 @@ TAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_PUT_handler ( // TODO: fill in - TALER_JSON_spec_amount ("amount", &dc->amount), - GNUNET_JSON_spec_int64 ("deadline", dc->deadline), - GNUNET_JSON_spec_string ("wtid", dc->wtid), - GNUNET_JSON_spec_string ("account", dc->account), + GNUNET_JSON_spec_int64 ("execution_date", &dc.execution_date), + GNUNET_JSON_spec_fixed_auto ("reserve_pub", &dc.reserve_pub), + GNUNET_JSON_spec_fixed_auto ("execution_date", &dc.denompub_h), GNUNET_JSON_spec_end () }; diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-get.c b/src/auditor/taler-auditor-httpd_emergency-by-count-get.c index 7961aafff..2ae783aad 100644 --- a/src/auditor/taler-auditor-httpd_emergency-by-count-get.c +++ b/src/auditor/taler-auditor-httpd_emergency-by-count-get.c @@ -51,13 +51,13 @@ process_emergency_by_count (void *cls, // GNUNET_JSON_pack_... ("", &dc->), // TALER_JSON_pack_... ("", &dc->), - GNUNET_JSON_pack_data_auto ("denompub_h", *dc->denompub_h), + GNUNET_JSON_pack_data_auto ("denompub_h", &dc->denompub_h), - GNUNET_JSON_pack_int64 ("num_issued", &dc->num_issued), - GNUNET_JSON_pack_int64 ("num_known", &dc->num_known), + GNUNET_JSON_pack_int64 ("num_issued", dc->num_issued), + GNUNET_JSON_pack_int64 ("num_known", dc->num_known), TALER_JSON_pack_amount ("risk", &dc->risk), - GNUNET_JSON_pack_int64 ("start", &dc->start), - GNUNET_JSON_pack_int64 ("deposit_end",&dc->deposit_end), + GNUNET_JSON_pack_int64 ("start", dc->start), + GNUNET_JSON_pack_int64 ("deposit_end",dc->deposit_end), TALER_JSON_pack_amount ("value", &dc->value) ); diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-put.c b/src/auditor/taler-auditor-httpd_emergency-by-count-put.c index e7a8ed125..de553f996 100644 --- a/src/auditor/taler-auditor-httpd_emergency-by-count-put.c +++ b/src/auditor/taler-auditor-httpd_emergency-by-count-put.c @@ -83,19 +83,19 @@ TAH_EMERGENCY_BY_COUNT_PUT_handler ( const char *const args[]) { - struct TALER_AUDITORDB_EmergencyByCount dc; + struct TALER_AUDITORDB_EmergenciesByCount dc; struct GNUNET_JSON_Specification spec[] = { // TODO: fill in - GNUNET_JSON_spec_int64 ("num_issued", dc->num_issued), - GNUNET_JSON_spec_int64 ("num_known", dc->num_known), - TALER_JSON_spec_amount ("risk", dc->risk), - GNUNET_JSON_spec_int64 ("start", dc->start), - GNUNET_JSON_spec_int64 ("deposit_end",dc->deposit_end), - TALER_JSON_spec_amount ("value", dc->value), + GNUNET_JSON_spec_int64 ("num_issued", &dc.num_issued), + GNUNET_JSON_spec_int64 ("num_known", &dc.num_known), + TALER_JSON_spec_amount ("risk", TAH_currency, &dc.risk), + GNUNET_JSON_spec_int64 ("start", &dc.start), + GNUNET_JSON_spec_int64 ("deposit_end",&dc.deposit_end), + TALER_JSON_spec_amount ("value", TAH_currency, &dc.value), GNUNET_JSON_spec_end () diff --git a/src/auditor/taler-auditor-httpd_emergency-get.c b/src/auditor/taler-auditor-httpd_emergency-get.c index 63ffca758..c9fd03673 100644 --- a/src/auditor/taler-auditor-httpd_emergency-get.c +++ b/src/auditor/taler-auditor-httpd_emergency-get.c @@ -51,13 +51,13 @@ process_emergency (void *cls, // GNUNET_JSON_pack_... ("", &dc->), // TALER_JSON_pack_... ("", &dc->), - GNUNET_JSON_pack_data_auto ("denompub_h", *dc->denompub_h), + GNUNET_JSON_pack_data_auto ("denompub_h", &dc->denompub_h), TALER_JSON_pack_amount ("denom_risk", &dc->denom_risk), TALER_JSON_pack_amount ("denom_loss", &dc->denom_loss), - GNUNET_JSON_pack_int64 ("deposit_start", &dc->deposit_start), - GNUNET_JSON_pack_int64 ("deposit_end", &dc->deposit_end), + GNUNET_JSON_pack_int64 ("deposit_start", dc->deposit_start), + GNUNET_JSON_pack_int64 ("deposit_end", dc->deposit_end), TALER_JSON_pack_amount ("value", &dc->value) ); @@ -155,7 +155,7 @@ TAH_EMERGENCY_handler_get (struct TAH_RequestHandler *rh, TAH_plugin->cls, row_id, return_suppressed, - &add_emergency, + &process_emergency, ja); if (0 > qs) diff --git a/src/auditor/taler-auditor-httpd_emergency-put.c b/src/auditor/taler-auditor-httpd_emergency-put.c index b5ffb218b..95b365ef7 100644 --- a/src/auditor/taler-auditor-httpd_emergency-put.c +++ b/src/auditor/taler-auditor-httpd_emergency-put.c @@ -90,15 +90,15 @@ TAH_EMERGENCY_PUT_handler ( // TODO: fill in - GNUNET_JSON_spec_fixed_auto ("denompub_h", dc->denompub_h), + GNUNET_JSON_spec_fixed_auto ("denompub_h", &dc.denompub_h), - TALER_JSON_spec_amount ("denom_risk", &dc->denom_risk), - TALER_JSON_spec_amount ("denom_loss", &dc->denom_loss), + TALER_JSON_spec_amount ("denom_risk",TAH_currency, &dc.denom_risk), + TALER_JSON_spec_amount ("denom_loss", TAH_currency,&dc.denom_loss), - GNUNET_JSON_spec_int64 ("deposit_start", dc->deposit_start), - GNUNET_JSON_spec_int64 ("deposit_end", dc->deposit_end), + GNUNET_JSON_spec_int64 ("deposit_start", &dc.deposit_start), + GNUNET_JSON_spec_int64 ("deposit_end", &dc.deposit_end), - TALER_JSON_spec_amount ("value", &dc->value), + TALER_JSON_spec_amount ("value", TAH_currency,&dc.value), GNUNET_JSON_spec_end () diff --git a/src/auditordb/Makefile.am b/src/auditordb/Makefile.am index abf884b66..d70e71834 100644 --- a/src/auditordb/Makefile.am +++ b/src/auditordb/Makefile.am @@ -100,7 +100,33 @@ libtaler_plugin_auditordb_postgres_la_SOURCES = \ pg_insert_row_inconsistency.c pg_insert_row_inconsistency.h \ pg_del_amount_arithmetic_inconsistency.c pg_del_amount_arithmetic_inconsistency.h \ pg_del_coin_inconsistency.c pg_del_coin_inconsistency.h \ - pg_del_row_inconsistency.c pg_del_row_inconsistency.h + pg_del_row_inconsistency.c pg_del_row_inconsistency.h \ + pg_del_emergency.c pg_del_emergency.h \ + pg_insert_emergency.c pg_insert_emergency.h \ + pg_get_emergency.c pg_get_emergency.h \ + pg_del_emergency_by_count.c pg_del_emergency_by_count.h \ + pg_insert_emergency_by_count.c pg_insert_emergency_by_count.h \ + pg_get_emergency_by_count.c pg_get_emergency_by_count.h \ + pg_del_denomination_key_validity_withdraw_inconsistency.c pg_del_denomination_key_validity_withdraw_inconsistency.h \ + pg_insert_denomination_key_validity_withdraw_inconsistency.c pg_insert_denomination_key_validity_withdraw_inconsistency.h \ + pg_get_denomination_key_validity_withdraw_inconsistency.c pg_get_denomination_key_validity_withdraw_inconsistency.h \ + pg_del_purse_not_closed_inconsistencies.c pg_del_purse_not_closed_inconsistencies.h \ + pg_insert_purse_not_closed_inconsistencies.c pg_insert_purse_not_closed_inconsistencies.h \ + pg_get_purse_not_closed_inconsistencies.c pg_get_purse_not_closed_inconsistencies.h \ + pg_del_reserve_balance_insufficient_inconsistency.c pg_del_reserve_balance_insufficient_inconsistency.h \ +pg_insert_reserve_balance_insufficient_inconsistency.c pg_insert_reserve_balance_insufficient_inconsistency.h \ +pg_get_reserve_balance_insufficient_inconsistency.c pg_get_reserve_balance_insufficient_inconsistency.h \ +pg_del_bad_sig_losses.c pg_del_bad_sig_losses.h \ +pg_insert_bad_sig_losses.c pg_insert_bad_sig_losses.h \ +pg_get_bad_sig_losses.c pg_get_bad_sig_losses.h \ +pg_del_auditor_closure_lags.c pg_del_auditor_closure_lags.h \ +pg_insert_auditor_closure_lags.c pg_insert_auditor_closure_lags.h \ +pg_get_auditor_closure_lags.c pg_get_auditor_closure_lags.h \ +pg_del_auditor_progress.c pg_del_auditor_progress.h \ +pg_get_auditor_progress.c pg_get_auditor_progress.h \ +pg_del_refreshes_hanging.c pg_del_refreshes_hanging.h \ +pg_insert_refreshes_hanging.c pg_insert_refreshes_hanging.h \ +pg_get_refreshes_hanging.c pg_get_refreshes_hanging.h libtaler_plugin_auditordb_postgres_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) libtaler_plugin_auditordb_postgres_la_LIBADD = \ diff --git a/src/auditordb/pg_del_emergency.c b/src/auditordb/pg_del_emergency.c new file mode 100644 index 000000000..8160dc582 --- /dev/null +++ b/src/auditordb/pg_del_emergency.c @@ -0,0 +1,41 @@ +/* + This file is part of TALER + Copyright (C) 2022 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/> + */ + +#include "pg_del_emergency.h" + +#include "taler_pq_lib.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_del_emergency ( + void *cls, + uint64_t row_id) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&row_id), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "auditor_delete_emergency", + "DELETE" + " FROM auditor_emergency" + " WHERE row_id=$1;"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "auditor_delete_emergency", + params); +}
\ No newline at end of file diff --git a/src/auditordb/pg_del_emergency.h b/src/auditordb/pg_del_emergency.h new file mode 100644 index 000000000..a99d09c93 --- /dev/null +++ b/src/auditordb/pg_del_emergency.h @@ -0,0 +1,35 @@ +/* + This file is part of TALER + Copyright (C) 2022 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/> + */ + +#ifndef SRC_PG_DEL_EMERGENCY_H +#define SRC_PG_DEL_EMERGENCY_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +/** + * Delete a row from the denom key validity withdraw inconsistency table. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param row_id row to delete + * @return query transaction status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_del_emergency ( + void *cls, + uint64_t row_id); + +#endif // SRC_PG_DEL_EMERGENCY_H diff --git a/src/auditordb/pg_del_emergency_by_count.c b/src/auditordb/pg_del_emergency_by_count.c index da1c55e06..418a157b5 100644 --- a/src/auditordb/pg_del_emergency_by_count.c +++ b/src/auditordb/pg_del_emergency_by_count.c @@ -7,6 +7,7 @@ #include "taler_pq_lib.h" #include "pg_helper.h" + enum GNUNET_DB_QueryStatus TAH_PG_del_emergency_by_count ( void *cls, diff --git a/src/auditordb/pg_del_fee_time_inconsistency.c b/src/auditordb/pg_del_fee_time_inconsistency.c index b00fb5f0c..7697e09f9 100644 --- a/src/auditordb/pg_del_fee_time_inconsistency.c +++ b/src/auditordb/pg_del_fee_time_inconsistency.c @@ -2,11 +2,13 @@ // Created by parallels on 27/03/24. // + #include "pg_del_fee_time_inconsistency.h" #include "taler_pq_lib.h" #include "pg_helper.h" + enum GNUNET_DB_QueryStatus TAH_PG_del_fee_time_inconsistency ( void *cls, diff --git a/src/auditordb/pg_del_purse_not_closed_inconsistencies.c b/src/auditordb/pg_del_purse_not_closed_inconsistencies.c index 51c2a6eb6..0bc9477dc 100644 --- a/src/auditordb/pg_del_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_del_purse_not_closed_inconsistencies.c @@ -7,6 +7,7 @@ #include "taler_pq_lib.h" #include "pg_helper.h" + enum GNUNET_DB_QueryStatus TAH_PG_del_purse_not_closed_inconsistencies ( void *cls, diff --git a/src/auditordb/pg_del_purse_not_closed_inconsistencies.h b/src/auditordb/pg_del_purse_not_closed_inconsistencies.h index 596b995ef..417dfd05a 100644 --- a/src/auditordb/pg_del_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_del_purse_not_closed_inconsistencies.h @@ -16,7 +16,7 @@ * @return query transaction status */ enum GNUNET_DB_QueryStatus -TAH_PG_del_purse_not_closed_inconsistency ( +TAH_PG_del_purse_not_closed_inconsistencies ( void *cls, uint64_t row_id); diff --git a/src/auditordb/pg_get_auditor_closure_lags.c b/src/auditordb/pg_get_auditor_closure_lags.c index de59e377b..a1291fc51 100644 --- a/src/auditordb/pg_get_auditor_closure_lags.c +++ b/src/auditordb/pg_get_auditor_closure_lags.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_auditor_closure_lags.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,8 @@ #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_get_auditor_closure_lags.h" + struct ClosureLagsContext { @@ -18,7 +18,7 @@ struct ClosureLagsContext /** * Function to call for each closure lag . */ - struct TALER_AUDITORDB_ClosureLagsCallback cb; + TALER_AUDITORDB_ClosureLagsCallback cb; /** * Closure for @e cb @@ -51,7 +51,7 @@ closure_lags_cb (void *cls, PGresult *result, unsigned int num_results) { - struct ClosureLagsContextContext *dcc = cls; + struct ClosureLagsContext *dcc = cls; struct PostgresClosure *pg = dcc->pg; for (unsigned int i = 0; i < num_results; i++) @@ -62,18 +62,10 @@ closure_lags_cb (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), -// -// GNUNET_PQ_result_spec_auto_from_type ("operation", &dc.operation), -// TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount), -// -// GNUNET_PQ_result_spec_bool ("profitable", &dc.profitable), - GNUNET_PQ_result_spec_int64 ("deadline", &dc.deadline), - GNUNET_PQ_result_spec_int64 ("wtid", &dc.wtid), - - GNUNET_PQ_result_spec_string ("account", *dc.account), + GNUNET_PQ_result_spec_string ("account", &dc.account), GNUNET_PQ_result_spec_end }; @@ -106,7 +98,7 @@ TAH_PG_get_closure_lags ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_ClosureLagsCallback cb, + TALER_AUDITORDB_ClosureLagsCallback cb, void *cb_cls) { @@ -116,6 +108,7 @@ TAH_PG_get_closure_lags ( GNUNET_PQ_query_param_bool (return_suppressed), GNUNET_PQ_query_param_end }; + struct ClosureLagsContext dcc = { .cb = cb, .cb_cls = cb_cls, diff --git a/src/auditordb/pg_get_auditor_closure_lags.h b/src/auditordb/pg_get_auditor_closure_lags.h index 06d8ba517..2497760ed 100644 --- a/src/auditordb/pg_get_auditor_closure_lags.h +++ b/src/auditordb/pg_get_auditor_closure_lags.h @@ -7,6 +7,7 @@ #include "taler_util.h" +#include "taler_json_lib.h" #include "taler_auditordb_plugin.h" /** @@ -25,7 +26,7 @@ TAH_PG_get_auditor_closure_lags ( void *cls, uint64_t start_id, bool return_suppressed, - TALER_AUDITORDB_AuditorClosureLagsCallback cb, + TALER_AUDITORDB_ClosureLagsCallback cb, void *cb_cls); #endif // SRC_PG_GET_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_get_bad_sig_losses.c b/src/auditordb/pg_get_bad_sig_losses.c index f729c44f4..e2f94dbc2 100644 --- a/src/auditordb/pg_get_bad_sig_losses.c +++ b/src/auditordb/pg_get_bad_sig_losses.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_bad_sig_losses.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,8 @@ #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_get_bad_sig_losses.h" + struct BadSigLossesContext { @@ -18,7 +18,7 @@ struct BadSigLossesContext /** * Function to call for each bad sig loss. */ - struct TALER_AUDITORDB_BadSigLossesCallback cb; + TALER_AUDITORDB_BadSigLossesCallback cb; /** * Closure for @e cb @@ -64,7 +64,7 @@ bad_sig_losses_cb (void *cls, GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), GNUNET_PQ_result_spec_string ("operation", &dc.operation), - TALER_PQ_RESULT_SPEC_AMOUNT ("loss", &dc.amount), + TALER_PQ_RESULT_SPEC_AMOUNT ("loss", &dc.loss), GNUNET_PQ_result_spec_auto_from_type ("operation_specific_pub", &dc.operation_specific_pub), @@ -100,7 +100,7 @@ TAH_PG_get_bad_sig_losses ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_BadSigLossesCallback cb, + TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_bad_sig_losses.h b/src/auditordb/pg_get_bad_sig_losses.h index a17197f1a..878663cff 100644 --- a/src/auditordb/pg_get_bad_sig_losses.h +++ b/src/auditordb/pg_get_bad_sig_losses.h @@ -6,6 +6,7 @@ #define SRC_PG_GET_BAD_SIG_LOSSES_H #include "taler_util.h" +#include "taler_json_lib.h" #include "taler_auditordb_plugin.h" /** @@ -24,7 +25,7 @@ TAH_PG_get_bad_sig_losses ( void *cls, uint64_t start_id, bool return_suppressed, - struct TALER_AUDITORDB_BadSigLossesCallback cb, + TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls); #endif // SRC_PG_GET_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c index 32188d64a..685e71381 100644 --- a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_denomination_key_validity_withdraw_inconsistency.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,8 @@ #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_get_denomination_key_validity_withdraw_inconsistency.h" + /** * Closure for #denomination_key_validity_withdraw_inconsistency_cb(). */ @@ -20,8 +20,7 @@ struct DenominationKeyValidityWithdrawInconsistencyContext /** * Function to call for each denomination key validity... */ - struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistencyCallback - cb; + TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistencyCallback cb; /** * Closure for @e cb @@ -55,7 +54,6 @@ denomination_key_validity_withdraw_inconsistency_cb (void *cls, unsigned int num_results) { struct DenominationKeyValidityWithdrawInconsistencyContext *dcc = cls; - struct PostgresClosure *pg = dcc->pg; for (unsigned int i = 0; i < num_results; i++) { @@ -66,11 +64,9 @@ denomination_key_validity_withdraw_inconsistency_cb (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_string ("operation", &dc.operation), - TALER_PQ_RESULT_SPEC_AMOUNT ("loss", &dc.amount), - - GNUNET_PQ_result_spec_auto_from_type ("operation_specific_pub", - &dc.operation_specific_pub), + GNUNET_PQ_result_spec_int64 ("execution_date", &dc.execution_date), + GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &dc.reserve_pub), + GNUNET_PQ_result_spec_auto_from_type ("denompub_h", &dc.denompub_h), GNUNET_PQ_result_spec_end }; @@ -103,7 +99,7 @@ TAH_PG_get_denomination_key_validity_withdraw_inconsistency ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistencyCallback + TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistencyCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_deposit_confirmations.c b/src/auditordb/pg_get_deposit_confirmations.c index cd9d0cb56..0601056d9 100644 --- a/src/auditordb/pg_get_deposit_confirmations.c +++ b/src/auditordb/pg_get_deposit_confirmations.c @@ -75,7 +75,7 @@ deposit_confirmation_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { uint64_t serial_id; - struct TALER_AUDITORDB_DepositConfirmation dc = { 0}; + struct TALER_AUDITORDB_DepositConfirmation dc = { 0 }; struct TALER_CoinSpendPublicKeyP *coin_pubs = NULL; struct TALER_CoinSpendSignatureP *coin_sigs = NULL; size_t num_pubs = 0; @@ -83,14 +83,14 @@ deposit_confirmation_cb (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("deposit_confirmation_serial_id", &serial_id), - /* -GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", - &dc.h_contract_terms), -GNUNET_PQ_result_spec_auto_from_type ("h_policy", - &dc.h_policy), -GNUNET_PQ_result_spec_auto_from_type ("h_wire", - &dc.h_wire), - */ + + GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", + &dc.h_contract_terms), + GNUNET_PQ_result_spec_auto_from_type ("h_policy", + &dc.h_policy), + GNUNET_PQ_result_spec_auto_from_type ("h_wire", + &dc.h_wire), + GNUNET_PQ_result_spec_timestamp ("exchange_timestamp", &dc.exchange_timestamp), GNUNET_PQ_result_spec_timestamp ("refund_deadline", @@ -99,24 +99,24 @@ GNUNET_PQ_result_spec_auto_from_type ("h_wire", &dc.wire_deadline), TALER_PQ_RESULT_SPEC_AMOUNT ("total_without_fee", &dc.total_without_fee), - /* -GNUNET_PQ_result_spec_auto_array_from_type (pg->conn, - "coin_pubs", - &num_pubs, - coin_pubs), -GNUNET_PQ_result_spec_auto_array_from_type (pg->conn, - "coin_sigs", - &num_sigs, - coin_sigs), -GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", - &dc.merchant), -GNUNET_PQ_result_spec_auto_from_type ("exchange_sig", - &dc.exchange_sig), -GNUNET_PQ_result_spec_auto_from_type ("exchange_pub", - &dc.exchange_pub), -GNUNET_PQ_result_spec_auto_from_type ("master_sig", - &dc.master_sig), - */ + + GNUNET_PQ_result_spec_auto_array_from_type (pg->conn, + "coin_pubs", + &num_pubs, + coin_pubs), + GNUNET_PQ_result_spec_auto_array_from_type (pg->conn, + "coin_sigs", + &num_sigs, + coin_sigs), + GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", + &dc.merchant), + GNUNET_PQ_result_spec_auto_from_type ("exchange_sig", + &dc.exchange_sig), + GNUNET_PQ_result_spec_auto_from_type ("exchange_pub", + &dc.exchange_pub), + GNUNET_PQ_result_spec_auto_from_type ("master_sig", + &dc.master_sig), + GNUNET_PQ_result_spec_end }; enum GNUNET_GenericReturnValue rval; diff --git a/src/auditordb/pg_get_emergency.c b/src/auditordb/pg_get_emergency.c index c9ef404de..7e44aade1 100644 --- a/src/auditordb/pg_get_emergency.c +++ b/src/auditordb/pg_get_emergency.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_emergency.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,8 @@ #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_get_emergency.h" + /** * Closure for #emergency_cb(). */ @@ -20,7 +20,7 @@ struct EmergencyContext /** * Function to call for each deposit confirmation. */ - struct TALER_AUDITORDB_EmergencyCallback cb; + TALER_AUDITORDB_EmergencyCallback cb; /** * Closure for @e cb @@ -68,7 +68,7 @@ emergency_cb (void *cls, TALER_PQ_RESULT_SPEC_AMOUNT ("denom_risk", &dc.denom_risk), TALER_PQ_RESULT_SPEC_AMOUNT ("denom_loss", &dc.denom_loss), GNUNET_PQ_result_spec_int64 ("deposit_start", &dc.deposit_start), - GNUNET_PQ_result_spec_int64 ("deposit_end", &deposit_end), + GNUNET_PQ_result_spec_int64 ("deposit_end", &dc.deposit_end), TALER_PQ_RESULT_SPEC_AMOUNT ("value", &dc.value), GNUNET_PQ_result_spec_end }; @@ -101,7 +101,7 @@ TAH_PG_get_emergency ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_EmergencyCallback cb, + TALER_AUDITORDB_EmergencyCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_emergency_by_count.c b/src/auditordb/pg_get_emergency_by_count.c index 46f6d696c..56d83e16e 100644 --- a/src/auditordb/pg_get_emergency_by_count.c +++ b/src/auditordb/pg_get_emergency_by_count.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_emergency_by_count.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,16 +9,18 @@ #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_get_emergency_by_count.h" + /** * Closure for #emergency_cb(). */ -struct EmergencybyCountContext +struct EmergencyByCountContext { /** * Function to call for each deposit confirmation. */ - struct TALER_AUDITORDB_EmergencyByCountCallback cb; + TALER_AUDITORDB_EmergenciesByCountCallback cb; /** * Closure for @e cb @@ -60,17 +60,17 @@ emergency_by_count_cb (void *cls, { uint64_t serial_id; - struct TALER_AUDITORDB_EmergencyByCount dc; + struct TALER_AUDITORDB_EmergenciesByCount dc; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), GNUNET_PQ_result_spec_auto_from_type ("denompub_h", &dc.denompub_h), - GNUNET_PQ_result_spec_uint64 ("num_issued", &dc.num_issued), - GNUNET_PQ_result_spec_uint64 ("num_known", &dc.num_known), - TALER_PQ_RESULT_SPEC_AMOUNT ("risk", &dc.risk), - GNUNET_PQ_result_spec_uint64 ("start", &dc.start), - GNUNET_PQ_result_spec_int64 ("deposit_end", &deposit_end), + GNUNET_PQ_result_spec_int64 ("num_issued", &dc.num_issued), + GNUNET_PQ_result_spec_int64 ("num_known", &dc.num_known), + TALER_PQ_RESULT_SPEC_AMOUNT ("risk", &dc.risk), + GNUNET_PQ_result_spec_int64 ("start", &dc.start), + GNUNET_PQ_result_spec_int64 ("deposit_end", &dc.deposit_end), TALER_PQ_RESULT_SPEC_AMOUNT ("value", &dc.value), GNUNET_PQ_result_spec_end @@ -104,7 +104,7 @@ TAH_PG_get_emergency_by_count ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_EmergencyByCountCallback cb, + TALER_AUDITORDB_EmergenciesByCountCallback cb, void *cb_cls) { @@ -114,7 +114,7 @@ TAH_PG_get_emergency_by_count ( GNUNET_PQ_query_param_bool (return_suppressed), GNUNET_PQ_query_param_end }; - struct EmergencybyCountContext dcc = { + struct EmergencyByCountContext dcc = { .cb = cb, .cb_cls = cb_cls, .pg = pg diff --git a/src/auditordb/pg_get_emergency_by_count.h b/src/auditordb/pg_get_emergency_by_count.h index 9e54dbfb3..99944afa3 100644 --- a/src/auditordb/pg_get_emergency_by_count.h +++ b/src/auditordb/pg_get_emergency_by_count.h @@ -24,7 +24,7 @@ TAH_PG_get_emergency_by_count ( void *cls, uint64_t start_id, bool return_suppressed, - struct TALER_AUDITORDB_EmergenciesByCountCallback cb, + TALER_AUDITORDB_EmergenciesByCountCallback cb, void *cb_cls); #endif // SRC_PG_GET_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_get_fee_time_inconsistency.c b/src/auditordb/pg_get_fee_time_inconsistency.c index da01010dd..c24a4e54c 100644 --- a/src/auditordb/pg_get_fee_time_inconsistency.c +++ b/src/auditordb/pg_get_fee_time_inconsistency.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_fee_time_inconsistency.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,8 @@ #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_get_fee_time_inconsistency.h" + /** * Closure for #feetimeinconsistency_cb(). */ @@ -20,7 +20,7 @@ struct FeeTimeInconsistencyContext /** * Function to call for each fee time inconsistency */ - struct TALER_AUDITORDB_FeeTimeInconsistencyCallback cb; + TALER_AUDITORDB_FeeTimeInconsistencyCallback cb; /** * Closure for @e cb @@ -101,7 +101,7 @@ TAH_PG_get_fee_time_inconsistency ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_FeeTimeInconsistencyCallback cb, + TALER_AUDITORDB_FeeTimeInconsistencyCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_fee_time_inconsistency.h b/src/auditordb/pg_get_fee_time_inconsistency.h index d1a09ab56..6d182432e 100644 --- a/src/auditordb/pg_get_fee_time_inconsistency.h +++ b/src/auditordb/pg_get_fee_time_inconsistency.h @@ -24,7 +24,7 @@ TAH_PG_get_fee_time_inconsistency ( void *cls, uint64_t start_id, bool return_suppressed, - struct TALER_AUDITORDB_FeeTimeInconsistencyCallback cb, + TALER_AUDITORDB_FeeTimeInconsistencyCallback cb, void *cb_cls); #endif // SRC_PG_GET_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_purse_not_closed_inconsistencies.c b/src/auditordb/pg_get_purse_not_closed_inconsistencies.c index 7cc3d6cae..4ba51e0a3 100644 --- a/src/auditordb/pg_get_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_get_purse_not_closed_inconsistencies.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_purse_not_closed_inconsistencies.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,10 @@ #include "taler_pq_lib.h" #include "pg_helper.h" + +#include "pg_get_purse_not_closed_inconsistencies.h" + + /** * Closure for #purse_not_closed_inconsistencies_cb(). */ @@ -20,7 +22,7 @@ struct PurseNotClosedInconsistenciesContext /** * Function to call for each purse not closed_inconsistencies. */ - struct TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb; + TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb; /** * Closure for @e cb @@ -100,7 +102,7 @@ TAH_PG_get_purse_not_closed_inconsistencies ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb, + TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_purse_not_closed_inconsistencies.h b/src/auditordb/pg_get_purse_not_closed_inconsistencies.h index 5fe996bcd..188180485 100644 --- a/src/auditordb/pg_get_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_get_purse_not_closed_inconsistencies.h @@ -24,7 +24,7 @@ TAH_PG_get_purse_not_closed_inconsistencies ( void *cls, uint64_t start_id, bool return_suppressed, - struct TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb, + TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb, void *cb_cls); #endif // SRC_PG_GET_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_get_refreshes_hanging.c b/src/auditordb/pg_get_refreshes_hanging.c index 37deac8c8..5c88966f4 100644 --- a/src/auditordb/pg_get_refreshes_hanging.c +++ b/src/auditordb/pg_get_refreshes_hanging.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_refreshes_hanging.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,9 @@ #include "taler_pq_lib.h" #include "pg_helper.h" + +#include "pg_get_refreshes_hanging.h" + /** * Closure for #refreshes_hanging_cb(). */ @@ -20,7 +21,7 @@ struct RefreshesHangingContext /** * Function to call for each RefreshesHanging. */ - struct TALER_AUDITORDB_RefreshesHangingCallback cb; + TALER_AUDITORDB_RefreshesHangingCallback cb; /** * Closure for @e cb @@ -65,9 +66,8 @@ refreshes_hanging_cb (void *cls, struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - GNUNET_PQ_result_spec_auto_from_type ("purse_pub", &dc.purse_pub), TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &dc.amount), - GNUNET_PQ_result_spec_int64 ("expiration_date", &dc.expiration_date), + GNUNET_PQ_result_spec_auto_from_type ("purse_pub", &dc.coin_pub), GNUNET_PQ_result_spec_end }; @@ -100,7 +100,7 @@ TAH_PG_get_refreshes_hanging ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_RefreshesHangingCallback cb, + TALER_AUDITORDB_RefreshesHangingCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_refreshes_hanging.h b/src/auditordb/pg_get_refreshes_hanging.h index d284bb0c1..2dd72ed8d 100644 --- a/src/auditordb/pg_get_refreshes_hanging.h +++ b/src/auditordb/pg_get_refreshes_hanging.h @@ -24,7 +24,7 @@ TAH_PG_get_refreshes_hanging ( void *cls, uint64_t start_id, bool return_suppressed, - struct TALER_AUDITORDB_RefreshesHangingCallback cb, + TALER_AUDITORDB_RefreshesHangingCallback cb, void *cb_cls); #endif // SRC_PG_GET_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c index 43f9145e5..688b855d3 100644 --- a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c +++ b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c @@ -2,8 +2,6 @@ // Created by parallels on 27/03/24. // -#include "pg_get_reserve_balance_insufficient_inconsistency.h" - #include "platform.h" #include "taler_error_codes.h" @@ -11,6 +9,9 @@ #include "taler_pq_lib.h" #include "pg_helper.h" + +#include "pg_get_reserve_balance_insufficient_inconsistency.h" + /** * Closure for #reserve_balance_insufficient_inconsistency_cb(). */ @@ -20,7 +21,7 @@ struct ReserveBalanceInsufficientInconsistencyContext /** * Function to call for each ReserveBalanceInsufficientInconsistency. */ - struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb; + TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb; /** * Closure for @e cb @@ -98,11 +99,11 @@ reserve_balance_insufficient_inconsistency_cb (void *cls, enum GNUNET_DB_QueryStatus -TAH_PG_get_emergency ( +TAH_PG_get_reserve_balance_insufficient_inconsistency ( void *cls, uint64_t start_id, bool return_suppressed, // maybe not needed - struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb, + TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb, void *cb_cls) { diff --git a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h index 2c1307617..892e75cee 100644 --- a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h @@ -24,7 +24,7 @@ TAH_PG_get_reserve_balance_insufficient_inconsistency ( void *cls, uint64_t start_id, bool return_suppressed, - struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb, + TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb, void *cb_cls); #endif // SRC_PG_GET_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_row_inconsistency.c b/src/auditordb/pg_get_row_inconsistency.c index a595e16fc..922880da8 100644 --- a/src/auditordb/pg_get_row_inconsistency.c +++ b/src/auditordb/pg_get_row_inconsistency.c @@ -53,7 +53,6 @@ row_inconsistency_cb (void *cls, unsigned int num_results) { struct RowInconsistencyContext *dcc = cls; - struct PostgresClosure *pg = dcc->pg; for (unsigned int i = 0; i < num_results; i++) { @@ -86,7 +85,6 @@ row_inconsistency_cb (void *cls, dcc->qs = i + 1; - printf ("checkpoint pg_2: %s, %s\n", dc.row_table, dc.diagnostic); rval = dcc->cb (dcc->cb_cls, serial_id, @@ -106,7 +104,6 @@ TAH_PG_get_row_inconsistency ( TALER_AUDITORDB_RowInconsistencyCallback cb, void *cb_cls) { - printf ("checkpoint pg_0\n"); struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -121,7 +118,6 @@ TAH_PG_get_row_inconsistency ( }; enum GNUNET_DB_QueryStatus qs; - printf ("checkpoint pg_1\n"); PREPARE (pg, "auditor_row_inconsistency_select", @@ -138,7 +134,6 @@ TAH_PG_get_row_inconsistency ( &row_inconsistency_cb, &dcc); - printf ("checkpoint pg_5\n"); if (qs > 0) return dcc.qs; diff --git a/src/auditordb/pg_insert_auditor_closure_lags.c b/src/auditordb/pg_insert_auditor_closure_lags.c index 3b19693e4..4c2ad3a07 100644 --- a/src/auditordb/pg_insert_auditor_closure_lags.c +++ b/src/auditordb/pg_insert_auditor_closure_lags.c @@ -15,14 +15,14 @@ */ -#include "pg_insert_closure_lags.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_auditor_closure_lags.h" + enum GNUNET_DB_QueryStatus -TAH_PG_insert_closure_lags ( +TAH_PG_insert_auditor_closure_lags ( void *cls, const struct TALER_AUDITORDB_ClosureLags *dc) { diff --git a/src/auditordb/pg_insert_bad_sig_losses.c b/src/auditordb/pg_insert_bad_sig_losses.c index 2a1bcf79f..75cc98d37 100644 --- a/src/auditordb/pg_insert_bad_sig_losses.c +++ b/src/auditordb/pg_insert_bad_sig_losses.c @@ -14,12 +14,13 @@ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -#include "pg_insert_bad_sig_losses.h" #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_bad_sig_losses.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_bad_sig_losses ( void *cls, diff --git a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c index 8d6356dd7..bbf978d06 100644 --- a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.c @@ -15,12 +15,12 @@ */ -#include "pg_insert_denomination_key_validity_withdraw_inconsistency.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_denomination_key_validity_withdraw_inconsistency.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_denomination_key_validity_withdraw_inconsistency ( void *cls, diff --git a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h index dfa3ecaf4..a8a5e57e4 100644 --- a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h @@ -17,7 +17,7 @@ * @return query result status */ enum GNUNET_DB_QueryStatus -TAH_PG_insert_denomination_key_validity_withdrew_inconsistency ( +TAH_PG_insert_denomination_key_validity_withdraw_inconsistency ( void *cls, const struct TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency *dc); diff --git a/src/auditordb/pg_insert_emergency.c b/src/auditordb/pg_insert_emergency.c index 0287006f6..64ed9b8f6 100644 --- a/src/auditordb/pg_insert_emergency.c +++ b/src/auditordb/pg_insert_emergency.c @@ -15,12 +15,12 @@ */ -#include "pg_insert_emergency.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_emergency.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_emergency ( void *cls, @@ -32,9 +32,9 @@ TAH_PG_insert_emergency ( GNUNET_PQ_query_param_auto_from_type (&dc->denompub_h), TALER_PQ_query_param_amount (pg->conn, &dc->denom_risk), TALER_PQ_query_param_amount (pg->conn, &dc->denom_loss), - GNUNET_PQ_query_param_int64 (dc->deposit_start), - GNUNET_PQ_query_param_int64 (dc->deposit_end), - TALER_PQ_query_param_amount (pg->conn,dc->value), + GNUNET_PQ_query_param_int64 (&dc->deposit_start), + GNUNET_PQ_query_param_int64 (&dc->deposit_end), + TALER_PQ_query_param_amount (pg->conn,&dc->value), GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_emergency_by_count.c b/src/auditordb/pg_insert_emergency_by_count.c index 16c6c5f14..6900a3e2e 100644 --- a/src/auditordb/pg_insert_emergency_by_count.c +++ b/src/auditordb/pg_insert_emergency_by_count.c @@ -15,12 +15,13 @@ */ -#include "pg_insert_emergency_by_count.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" + +#include "pg_insert_emergency_by_count.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_emergency_by_count ( void *cls, diff --git a/src/auditordb/pg_insert_fee_time_inconsistency.c b/src/auditordb/pg_insert_fee_time_inconsistency.c index 0a44b53f7..bd3f25515 100644 --- a/src/auditordb/pg_insert_fee_time_inconsistency.c +++ b/src/auditordb/pg_insert_fee_time_inconsistency.c @@ -15,12 +15,12 @@ */ -#include "pg_insert_fee_time_inconsistency.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_fee_time_inconsistency.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_fee_time_inconsistency ( void *cls, diff --git a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c index 39e779eb9..9a82edb98 100644 --- a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.c @@ -15,12 +15,12 @@ */ -#include "pg_insert_purse_not_closed_inconsistencies.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_purse_not_closed_inconsistencies.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_purse_not_closed_inconsistencies ( void *cls, diff --git a/src/auditordb/pg_insert_refreshes_hanging.c b/src/auditordb/pg_insert_refreshes_hanging.c index 169f5ae00..6dfc4988a 100644 --- a/src/auditordb/pg_insert_refreshes_hanging.c +++ b/src/auditordb/pg_insert_refreshes_hanging.c @@ -15,12 +15,12 @@ */ -#include "pg_insert_refreshes_hanging.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_refreshes_hanging.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_refreshes_hanging ( void *cls, diff --git a/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.c b/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.c index 93a647a7d..d50da9fde 100644 --- a/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.c +++ b/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.c @@ -15,12 +15,12 @@ */ -#include "pg_insert_reserve_balance_insufficient_inconsistency.h" - #include "platform.h" #include "taler_pq_lib.h" #include "pg_helper.h" +#include "pg_insert_reserve_balance_insufficient_inconsistency.h" + enum GNUNET_DB_QueryStatus TAH_PG_insert_reserve_balance_insufficient_inconsistency ( void *cls, diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index ca7a6822c..9c2f8765a 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -70,6 +70,45 @@ #include "pg_insert_row_inconsistency.h" #include "pg_insert_amount_arithmetic_inconsistency.h" +#include "pg_get_auditor_closure_lags.h" +#include "pg_del_auditor_closure_lags.h" +#include "pg_insert_auditor_closure_lags.h" + +#include "pg_get_emergency_by_count.h" +#include "pg_del_emergency_by_count.h" +#include "pg_insert_emergency_by_count.h" + +#include "pg_get_emergency.h" +#include "pg_del_emergency.h" +#include "pg_insert_emergency.h" + +#include "pg_get_auditor_progress.h" +#include "pg_del_auditor_progress.h" +#include "pg_insert_auditor_progress.h" + +#include "pg_get_bad_sig_losses.h" +#include "pg_del_bad_sig_losses.h" +#include "pg_insert_bad_sig_losses.h" + +#include "pg_get_denomination_key_validity_withdraw_inconsistency.h" +#include "pg_del_denomination_key_validity_withdraw_inconsistency.h" +#include "pg_insert_denomination_key_validity_withdraw_inconsistency.h" + +#include "pg_get_fee_time_inconsistency.h" +#include "pg_del_fee_time_inconsistency.h" +#include "pg_insert_fee_time_inconsistency.h" + +#include "pg_get_purse_not_closed_inconsistencies.h" +#include "pg_del_purse_not_closed_inconsistencies.h" +#include "pg_insert_purse_not_closed_inconsistencies.h" + +#include "pg_get_refreshes_hanging.h" +#include "pg_del_refreshes_hanging.h" +#include "pg_insert_refreshes_hanging.h" + +#include "pg_get_reserve_balance_insufficient_inconsistency.h" +#include "pg_del_reserve_balance_insufficient_inconsistency.h" +#include "pg_insert_reserve_balance_insufficient_inconsistency.h" #define LOG(kind,...) GNUNET_log_from (kind, "taler-auditordb-postgres", \ __VA_ARGS__) @@ -570,6 +609,51 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->select_historic_reserve_revenue = &TAH_PG_select_historic_reserve_revenue; + + plugin->delete_emergency = &TAH_PG_del_emergency; + plugin->insert_emergency = &TAH_PG_insert_emergency; + plugin->get_emergency = &TAH_PG_get_emergency; + + plugin->delete_emergency_by_count = &TAH_PG_del_emergency_by_count; + plugin->insert_emergency_by_count = &TAH_PG_insert_emergency_by_count; + plugin->get_emergency_by_count = &TAH_PG_get_emergency_by_count; + + plugin->delete_denomination_key_validity_withdraw_inconsistency = + &TAH_PG_del_denomination_key_validity_withdraw_inconsistency; + plugin->insert_denomination_key_validity_withdraw_inconsistency = + &TAH_PG_insert_denomination_key_validity_withdraw_inconsistency; + plugin->get_denomination_key_validity_withdraw_inconsistency = + &TAH_PG_get_denomination_key_validity_withdraw_inconsistency; + + plugin->delete_purse_not_closed_inconsistencies = + &TAH_PG_del_purse_not_closed_inconsistencies; + plugin->insert_purse_not_closed_inconsistencies = + &TAH_PG_insert_purse_not_closed_inconsistencies; + plugin->get_purse_not_closed_inconsistencies = + &TAH_PG_get_purse_not_closed_inconsistencies; + + plugin->delete_reserve_balance_insufficient_inconsistency = + &TAH_PG_del_reserve_balance_insufficient_inconsistency; + plugin->insert_reserve_balance_insufficient_inconsistency = + &TAH_PG_insert_reserve_balance_insufficient_inconsistency; + plugin->get_reserve_balance_insufficient_inconsistency = + &TAH_PG_get_reserve_balance_insufficient_inconsistency; + + plugin->delete_bad_sig_losses = &TAH_PG_del_bad_sig_losses; + plugin->insert_bad_sig_losses = &TAH_PG_insert_bad_sig_losses; + plugin->get_bad_sig_losses = &TAH_PG_get_bad_sig_losses; + + plugin->delete_auditor_closure_lags = &TAH_PG_del_auditor_closure_lags; + plugin->insert_auditor_closure_lags = &TAH_PG_insert_auditor_closure_lags; + plugin->get_auditor_closure_lags = &TAH_PG_get_auditor_closure_lags; + + plugin->delete_progress = &TAH_PG_del_progress; + + plugin->delete_refreshes_hanging = &TAH_PG_del_refreshes_hanging; + plugin->insert_refreshes_hanging = &TAH_PG_insert_refreshes_hanging; + plugin->get_refreshes_hanging = &TAH_PG_get_refreshes_hanging; + + return plugin; } diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index 036af8e01..e6d431c05 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -1023,6 +1023,77 @@ struct TALER_AUDITORDB_Plugin TALER_AUDITORDB_RowInconsistencyCallback cb, void *cb_cls); + enum GNUNET_DB_QueryStatus + (*get_emergency)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_EmergencyCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_emergency_by_count)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_EmergenciesByCountCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_denomination_key_validity_withdraw_inconsistency)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistencyCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_purse_not_closed_inconsistencies)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_PurseNotClosedInconsistenciesCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_reserve_balance_insufficient_inconsistency)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_ReserveBalanceInsufficientInconsistencyCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_bad_sig_losses)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_BadSigLossesCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_auditor_closure_lags)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_ClosureLagsCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_progress)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_EmergencyCallback cb, + void *cb_cls); + + enum GNUNET_DB_QueryStatus + (*get_refreshes_hanging)( + void *cls, + uint64_t start_id, + bool return_suppressed, + TALER_AUDITORDB_RefreshesHangingCallback cb, + void *cb_cls); /** * Delete information about a deposit confirmation from the database. @@ -1046,13 +1117,59 @@ struct TALER_AUDITORDB_Plugin void *cls, uint64_t row_id); + enum GNUNET_DB_QueryStatus + (*delete_emergency)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_emergency_by_count)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_denomination_key_validity_withdraw_inconsistency)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_purse_not_closed_inconsistencies)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_reserve_balance_insufficient_inconsistency)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_bad_sig_losses)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_auditor_closure_lags)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_progress)( + void *cls, + uint64_t row_id); + + enum GNUNET_DB_QueryStatus + (*delete_refreshes_hanging)( + void *cls, + uint64_t row_id); + + /** - * Insert information about a deposit confirmation into the database. - * - * @param cls the @e cls of this struct with the plugin-specific state - * @param dc deposit confirmation information to store - * @return query result status - */ +* Insert information about a deposit confirmation into the database. +* +* @param cls the @e cls of this struct with the plugin-specific state +* @param dc deposit confirmation information to store +* @return query result status +*/ enum GNUNET_DB_QueryStatus (*insert_amount_arithmetic_inconsistency)( void *cls, @@ -1068,6 +1185,53 @@ struct TALER_AUDITORDB_Plugin void *cls, const struct TALER_AUDITORDB_RowInconsistency *dc); + enum GNUNET_DB_QueryStatus + (*insert_emergency)( + void *cls, + const struct TALER_AUDITORDB_Emergency *dc); + + enum GNUNET_DB_QueryStatus + (*insert_emergency_by_count)( + void *cls, + const struct TALER_AUDITORDB_EmergenciesByCount *dc); + + enum GNUNET_DB_QueryStatus + (*insert_denomination_key_validity_withdraw_inconsistency)( + void *cls, + const struct + TALER_AUDITORDB_DenominationKeyValidityWithdrawInconsistency *dc); + + enum GNUNET_DB_QueryStatus + (*insert_purse_not_closed_inconsistencies)( + void *cls, + const struct TALER_AUDITORDB_PurseNotClosedInconsistencies *dc); + + enum GNUNET_DB_QueryStatus + (*insert_reserve_balance_insufficient_inconsistency)( + void *cls, + const struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency *dc); + + enum GNUNET_DB_QueryStatus + (*insert_bad_sig_losses)( + void *cls, + const struct TALER_AUDITORDB_BadSigLosses *dc); + + enum GNUNET_DB_QueryStatus + (*insert_auditor_closure_lags)( + void *cls, + const struct TALER_AUDITORDB_ClosureLags *dc); + + + enum GNUNET_DB_QueryStatus + (*insert_progress)( + void *cls, + const struct TALER_AUDITORDB_Progress *dc); + + enum GNUNET_DB_QueryStatus + (*insert_refreshes_hanging)( + void *cls, + const struct TALER_AUDITORDB_RefreshesHanging *dc); + /** * Insert information about a reserve. There must not be an * existing record for the reserve. |