diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-08-20 20:24:56 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-08-20 20:24:56 +0200 |
commit | 04d1b5f57f81838bb96f0c532709c49c5389a212 (patch) | |
tree | efc3ebe2c53c9c201b90c972e0d637a2f5c98b9d | |
parent | 7faa13dc25d469fccd54cc5632cbffc740028de0 (diff) |
DCE in auditordb
50 files changed, 64 insertions, 2139 deletions
diff --git a/contrib/wallet-core b/contrib/wallet-core -Subproject 4c59144f6e2a9b5748de42fa108a3a164cacc4e +Subproject 5934e007f637bd9834a811e67c0a030d7a59f2c diff --git a/src/auditordb/0002-auditor_exchange_signkeys.sql b/src/auditordb/0002-auditor_exchange_signkeys.sql index 289b60ed9..25aa13cad 100644 --- a/src/auditordb/0002-auditor_exchange_signkeys.sql +++ b/src/auditordb/0002-auditor_exchange_signkeys.sql @@ -20,8 +20,7 @@ CREATE TABLE auditor_exchange_signkeys ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64) ,ep_valid_from BIGINT NOT NULL ,ep_expire_sign BIGINT NOT NULL - ,ep_expire_legal BIGINT NOT NULL, - suppressed BOOLEAN NOT NULL DEFAULT FALSE + ,ep_expire_legal BIGINT NOT NULL ); COMMENT ON TABLE auditor_exchange_signkeys IS 'list of the online signing keys of exchanges we are auditing'; diff --git a/src/auditordb/Makefile.am b/src/auditordb/Makefile.am index 919d4b94b..36c6917a8 100644 --- a/src/auditordb/Makefile.am +++ b/src/auditordb/Makefile.am @@ -86,7 +86,6 @@ libtaler_plugin_auditordb_postgres_la_SOURCES = \ pg_select_purse_expired.c pg_select_purse_expired.h \ pg_update_generic_suppressed.c pg_update_generic_suppressed.h \ pg_update_auditor_progress.c pg_update_auditor_progress.h \ - pg_update_balance.c pg_update_balance.h \ pg_update_denomination_balance.c pg_update_denomination_balance.h \ pg_update_purse_info.c pg_update_purse_info.h \ pg_update_reserve_info.c pg_update_reserve_info.h \ @@ -130,7 +129,6 @@ pg_update_row_inconsistency.c pg_update_row_inconsistency.h \ pg_update_purse_not_closed_inconsistencies.c pg_update_purse_not_closed_inconsistencies.h \ pg_update_reserve_balance_insufficient_inconsistency.c pg_update_reserve_balance_insufficient_inconsistency.h \ pg_update_coin_inconsistency.c pg_update_coin_inconsistency.h \ -pg_update_progress.c pg_update_progress.h \ pg_update_denomination_key_validity_withdraw_inconsistency.c pg_update_denomination_key_validity_withdraw_inconsistency.h \ pg_update_refreshes_hanging.c pg_update_refreshes_hanging.h \ pg_update_emergency.c pg_update_emergency.h \ @@ -151,31 +149,17 @@ pg_get_misattribution_in_inconsistency.c pg_get_misattribution_in_inconsistency. pg_del_misattribution_in_inconsistency.c pg_del_misattribution_in_inconsistency.h \ pg_insert_misattribution_in_inconsistency.c pg_insert_misattribution_in_inconsistency.h \ pg_update_misattribution_in_inconsistency.c pg_update_misattribution_in_inconsistency.h \ +pg_update_balance.c pg_update_balance.h \ pg_get_reserves.c pg_get_reserves.h \ pg_del_reserves.c pg_del_reserves.h \ -pg_insert_reserves.c pg_insert_reserves.h \ -pg_update_reserves.c pg_update_reserves.h \ pg_get_purses.c pg_get_purses.h \ pg_del_purses.c pg_del_purses.h \ -pg_insert_purses.c pg_insert_purses.h \ -pg_update_purses.c pg_update_purses.h \ -pg_get_historic_denomination_revenue.c pg_get_historic_denomination_revenue.h \ -pg_del_historic_denomination_revenue.c pg_del_historic_denomination_revenue.h \ pg_insert_historic_denom_revenue.c pg_insert_historic_denom_revenue.h \ -pg_insert_historic_denomination_revenue.c pg_insert_historic_denomination_revenue.h \ -pg_update_historic_denomination_revenue.c pg_update_historic_denomination_revenue.h \ pg_get_denomination_pending.c pg_get_denomination_pending.h \ pg_del_denomination_pending.c pg_del_denomination_pending.h \ pg_insert_denomination_pending.c pg_insert_denomination_pending.h \ pg_update_denomination_pending.c pg_update_denomination_pending.h \ -pg_get_historic_reserve_summary.c pg_get_historic_reserve_summary.h \ -pg_del_historic_reserve_summary.c pg_del_historic_reserve_summary.h \ -pg_insert_historic_reserve_summary.c pg_insert_historic_reserve_summary.h \ -pg_update_historic_reserve_summary.c pg_update_historic_reserve_summary.h \ pg_get_exchange_signkeys.c pg_get_exchange_signkeys.h \ -pg_del_exchange_signkeys.c pg_del_exchange_signkeys.h \ -pg_insert_exchange_signkeys.c pg_insert_exchange_signkeys.h \ -pg_update_exchange_signkeys.c pg_update_exchange_signkeys.h \ pg_get_wire_format_inconsistency.c pg_get_wire_format_inconsistency.h \ pg_del_wire_format_inconsistency.c pg_del_wire_format_inconsistency.h \ pg_insert_wire_format_inconsistency.c pg_insert_wire_format_inconsistency.h \ @@ -198,11 +182,10 @@ pg_del_fee_time_inconsistency.c pg_del_fee_time_inconsistency.h \ pg_insert_fee_time_inconsistency.c pg_insert_fee_time_inconsistency.h \ pg_update_fee_time_inconsistency.c pg_update_fee_time_inconsistency.h \ pg_get_balances.c pg_get_balances.h \ -pg_del_balances.c pg_del_balances.h \ -pg_insert_balances.c pg_insert_balances.h \ +pg_insert_exchange_signkey.c pg_insert_exchange_signkey.h \ pg_update_deposit_confirmations.c pg_update_deposit_confirmations.h \ -pg_update_amount_arithmetic_inconsistency.c pg_update_amount_arithmetic_inconsistency.h \ -pg_update_balances.c pg_update_balances.h +pg_update_amount_arithmetic_inconsistency.c pg_update_amount_arithmetic_inconsistency.h + libtaler_plugin_auditordb_postgres_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) libtaler_plugin_auditordb_postgres_la_LIBADD = \ diff --git a/src/auditordb/auditordb_plugin.c b/src/auditordb/auditordb_plugin.c index d84158deb..635247aa3 100644 --- a/src/auditordb/auditordb_plugin.c +++ b/src/auditordb/auditordb_plugin.c @@ -24,23 +24,6 @@ #include <ltdl.h> -const char * -TALER_AUDITORDB_get_table_name (enum TALER_AUDITORDB_SuppressableTables table) -{ - const char *tables[] = { - "auditor_amount_arithmetic_inconsistency", - }; - - if ( (table < 0) || - (table >= TALER_AUDITORDB_SUPPRESSABLE_TABLES_MAX)) - { - GNUNET_break (0); - return NULL; - } - return tables[table]; -} - - struct TALER_AUDITORDB_Plugin * TALER_AUDITORDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg) { diff --git a/src/auditordb/pg_del_balances.c b/src/auditordb/pg_del_balances.c deleted file mode 100644 index 9cdf9e2ea..000000000 --- a/src/auditordb/pg_del_balances.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - 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/> - */ - - -#include "pg_del_balances.h" - -#include "taler_pq_lib.h" -#include "pg_helper.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_del_balances ( - 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_balances", - "DELETE" - " FROM auditor_balances" - " WHERE row_id=$1;"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_delete_balances", - params); -} diff --git a/src/auditordb/pg_del_balances.h b/src/auditordb/pg_del_balances.h deleted file mode 100644 index 03baebebc..000000000 --- a/src/auditordb/pg_del_balances.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_DEL_BALANCES_H -#define SRC_PG_DEL_BALANCES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -/** - * Delete a row from the bad sig losses 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_balances ( - void *cls, - uint64_t row_id); - -#endif // SRC_PG_DEL_BALANCES_H diff --git a/src/auditordb/pg_del_exchange_signkeys.c b/src/auditordb/pg_del_exchange_signkeys.c deleted file mode 100644 index 168221e2d..000000000 --- a/src/auditordb/pg_del_exchange_signkeys.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - 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/> - */ - - -#include "pg_del_exchange_signkeys.h" - -#include "taler_pq_lib.h" -#include "pg_helper.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_del_exchange_signkeys ( - 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_exchange_signkeys", - "DELETE" - " FROM auditor_exchange_signkeys" - " WHERE row_id=$1;"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_delete_exchange_signkeys", - params); -} diff --git a/src/auditordb/pg_del_exchange_signkeys.h b/src/auditordb/pg_del_exchange_signkeys.h deleted file mode 100644 index 100e11450..000000000 --- a/src/auditordb/pg_del_exchange_signkeys.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_DEL_EXCHANGE_SIGNKEYS_H -#define SRC_PG_DEL_EXCHANGE_SIGNKEYS_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -/** - * Delete a row from the bad sig losses 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_exchange_signkeys ( - void *cls, - uint64_t row_id); - -#endif // SRC_PG_DEL_EXCHANGE_SIGNKEYS_H diff --git a/src/auditordb/pg_del_historic_denomination_revenue.c b/src/auditordb/pg_del_historic_denomination_revenue.c deleted file mode 100644 index 72f6c7be8..000000000 --- a/src/auditordb/pg_del_historic_denomination_revenue.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - 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/> - */ - - -#include "pg_del_historic_denomination_revenue.h" - -#include "taler_pq_lib.h" -#include "pg_helper.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_del_historic_denomination_revenue ( - 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_historic_denomination_revenue", - "DELETE" - " FROM auditor_historic_denomination_revenue" - " WHERE row_id=$1;"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_delete_historic_denomination_revenue", - params); -} diff --git a/src/auditordb/pg_del_historic_denomination_revenue.h b/src/auditordb/pg_del_historic_denomination_revenue.h deleted file mode 100644 index 12668b743..000000000 --- a/src/auditordb/pg_del_historic_denomination_revenue.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_DEL_HISTORIC_DENOMINATION_REVENUE_H -#define SRC_PG_DEL_HISTORIC_DENOMINATION_REVENUE_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -/** - * Delete a row from the bad sig losses 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_historic_denomination_revenue ( - void *cls, - uint64_t row_id); - -#endif // SRC_PG_DEL_HISTORIC_DENOMINATION_REVENUE_H diff --git a/src/auditordb/pg_del_historic_reserve_summary.c b/src/auditordb/pg_del_historic_reserve_summary.c deleted file mode 100644 index e82b0dafd..000000000 --- a/src/auditordb/pg_del_historic_reserve_summary.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - 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/> - */ - - -#include "pg_del_historic_reserve_summary.h" - -#include "taler_pq_lib.h" -#include "pg_helper.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_del_historic_reserve_summary ( - 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_historic_reserve_summary", - "DELETE" - " FROM auditor_historic_reserve_summary" - " WHERE row_id=$1;"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_delete_historic_reserve_summary", - params); -} diff --git a/src/auditordb/pg_del_historic_reserve_summary.h b/src/auditordb/pg_del_historic_reserve_summary.h deleted file mode 100644 index c1675d668..000000000 --- a/src/auditordb/pg_del_historic_reserve_summary.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_DEL_HISTORIC_RESERVE_SUMMARY_H -#define SRC_PG_DEL_HISTORIC_RESERVE_SUMMARY_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -/** - * Delete a row from the bad sig losses 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_historic_reserve_summary ( - void *cls, - uint64_t row_id); - -#endif // SRC_PG_DEL_HISTORIC_RESERVE_SUMMARY_H diff --git a/src/auditordb/pg_get_historic_denomination_revenue.c b/src/auditordb/pg_get_historic_denomination_revenue.c deleted file mode 100644 index 0e84c573e..000000000 --- a/src/auditordb/pg_get_historic_denomination_revenue.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_get_historic_denomination_revenue.h" - - -struct HistoricDenominationRevenueContext -{ - - /** - * Function to call for each bad sig loss. - */ - TALER_AUDITORDB_HistoricDenominationRevenueCallback cb; - - /** - * Closure for @e cb - */ - void *cb_cls; - - /** - * Plugin context. - */ - struct PostgresClosure *pg; - - /** - * Query status to return. - */ - enum GNUNET_DB_QueryStatus qs; -}; - - -/** - * Helper function for #TAH_PG_get_historic_denomination_revenue(). - * To be called with the results of a SELECT statement - * that has returned @a num_results results. - * - * @param cls closure of type `struct HistoricDenominationRevenueContext *` - * @param result the postgres result - * @param num_results the number of results in @a result - */ -static void -historic_denomination_revenue_cb (void *cls, - PGresult *result, - unsigned int num_results) -{ - struct HistoricDenominationRevenueContext *dcc = cls; - struct PostgresClosure *pg = dcc->pg; - - for (unsigned int i = 0; i < num_results; i++) - { - uint64_t serial_id; - - struct TALER_AUDITORDB_HistoricDenominationRevenue dc; - - struct GNUNET_PQ_ResultSpec rs[] = { - - GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - - GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", - &dc.denom_pub_hash), - GNUNET_PQ_result_spec_absolute_time ("revenue_timestamp", - &dc.revenue_timestamp), - TALER_PQ_RESULT_SPEC_AMOUNT ("revenue_balance", &dc.revenue_balance), - TALER_PQ_RESULT_SPEC_AMOUNT ("loss_balance", &dc.loss_balance), - - - GNUNET_PQ_result_spec_end - }; - enum GNUNET_GenericReturnValue rval; - - if (GNUNET_OK != - GNUNET_PQ_extract_result (result, - rs, - i)) - { - GNUNET_break (0); - dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; - return; - } - - dcc->qs = i + 1; - - rval = dcc->cb (dcc->cb_cls, - serial_id, - &dc); - GNUNET_PQ_cleanup_result (rs); - if (GNUNET_OK != rval) - break; - } -} - - -enum GNUNET_DB_QueryStatus -TAH_PG_get_historic_denomination_revenue ( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, // maybe not needed - TALER_AUDITORDB_HistoricDenominationRevenueCallback cb, - void *cb_cls) -{ - - uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); - - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&offset), - GNUNET_PQ_query_param_uint64 (&plimit), - GNUNET_PQ_query_param_end - }; - struct HistoricDenominationRevenueContext dcc = { - .cb = cb, - .cb_cls = cb_cls, - .pg = pg - }; - enum GNUNET_DB_QueryStatus qs; - - PREPARE (pg, - "auditor_historic_denomination_revenue_get_desc", - "SELECT" - " row_id," - " denom_pub_hash," - " revenue_timestamp," - " revenue_balance," - " loss_balance" - " FROM auditor_historic_denomination_revenue" - " WHERE (row_id < $1)" - " ORDER BY row_id DESC" - " LIMIT $3" - ); - PREPARE (pg, - "auditor_historic_denomination_revenue_get_asc", - "SELECT" - " row_id," - " denom_pub_hash," - " revenue_timestamp," - " revenue_balance," - " loss_balance" - " FROM auditor_historic_denomination_revenue" - " WHERE (row_id > $1)" - " ORDER BY row_id ASC" - " LIMIT $3" - ); - qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - (limit > 0) - ? - "auditor_historic_denomination_revenue_get_asc" - : - "auditor_historic_denomination_revenue_get_desc", - params, - &historic_denomination_revenue_cb, - &dcc); - - if (qs > 0) - return dcc.qs; - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); - return qs; -} diff --git a/src/auditordb/pg_get_historic_denomination_revenue.h b/src/auditordb/pg_get_historic_denomination_revenue.h deleted file mode 100644 index 01e2820ea..000000000 --- a/src/auditordb/pg_get_historic_denomination_revenue.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_GET_HISTORIC_DENOMINATION_REVENUE_H -#define SRC_PG_GET_HISTORIC_DENOMINATION_REVENUE_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "taler_auditordb_plugin.h" - -/** - * Get information about historic-denomination-revenue from the database. - * - * @param cls the @e cls of this struct with the plugin-specific state - * @param limit number of records to return, negative for descending - * @param offset table row to start from, exclusive, direction determined by @a limit - * @param return_suppressed should suppressed rows be returned anyway? - * @param cb function to call with results - * @param cb_cls closure for @a cb - * @return query result status - */ -enum GNUNET_DB_QueryStatus -TAH_PG_get_historic_denomination_revenue ( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, - TALER_AUDITORDB_HistoricDenominationRevenueCallback cb, - void *cb_cls); - -#endif diff --git a/src/auditordb/pg_get_historic_reserve_summary.c b/src/auditordb/pg_get_historic_reserve_summary.c deleted file mode 100644 index 684a78559..000000000 --- a/src/auditordb/pg_get_historic_reserve_summary.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_error_codes.h" -#include "taler_dbevents.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_get_historic_reserve_summary.h" - - -struct HistoricReserveSummaryContext -{ - - /** - * Function to call for each bad sig loss. - */ - TALER_AUDITORDB_HistoricReserveSummaryCallback cb; - - /** - * Closure for @e cb - */ - void *cb_cls; - - /** - * Plugin context. - */ - struct PostgresClosure *pg; - - /** - * Query status to return. - */ - enum GNUNET_DB_QueryStatus qs; -}; - - -/** - * Helper function for #TAH_PG_get_historic_reserve_summary(). - * To be called with the results of a SELECT statement - * that has returned @a num_results results. - * - * @param cls closure of type `struct HistoricReserveSummaryContext *` - * @param result the postgres result - * @param num_results the number of results in @a result - */ -static void -historic_reserve_summary_cb (void *cls, - PGresult *result, - unsigned int num_results) -{ - struct HistoricReserveSummaryContext *dcc = cls; - struct PostgresClosure *pg = dcc->pg; - - for (unsigned int i = 0; i < num_results; i++) - { - uint64_t serial_id; - - struct TALER_AUDITORDB_HistoricReserveSummary dc; - - struct GNUNET_PQ_ResultSpec rs[] = { - - GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), - - GNUNET_PQ_result_spec_absolute_time ("start_date", &dc.start_date), - GNUNET_PQ_result_spec_absolute_time ("end_date", &dc.end_date), - TALER_PQ_RESULT_SPEC_AMOUNT ("reserve_profits", &dc.reserve_profits), - - - GNUNET_PQ_result_spec_end - }; - enum GNUNET_GenericReturnValue rval; - - if (GNUNET_OK != - GNUNET_PQ_extract_result (result, - rs, - i)) - { - GNUNET_break (0); - dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; - return; - } - - dcc->qs = i + 1; - - rval = dcc->cb (dcc->cb_cls, - serial_id, - &dc); - GNUNET_PQ_cleanup_result (rs); - if (GNUNET_OK != rval) - break; - } -} - - -enum GNUNET_DB_QueryStatus -TAH_PG_get_historic_reserve_summary ( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, // maybe not needed - TALER_AUDITORDB_HistoricReserveSummaryCallback cb, - void *cb_cls) -{ - - uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); - - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&offset), - GNUNET_PQ_query_param_bool (return_suppressed), - GNUNET_PQ_query_param_uint64 (&plimit), - GNUNET_PQ_query_param_end - }; - struct HistoricReserveSummaryContext dcc = { - .cb = cb, - .cb_cls = cb_cls, - .pg = pg - }; - enum GNUNET_DB_QueryStatus qs; - - PREPARE (pg, - "auditor_historic_reserve_summary_get_desc", - "SELECT" - " row_id," - " start_date," - " end_date," - " reserve_profits" - " FROM auditor_historic_reserve_summary" - " WHERE (row_id < $1)" - " ORDER BY row_id DESC" - " LIMIT $3" - ); - PREPARE (pg, - "auditor_historic_reserve_summary_get_asc", - "SELECT" - " row_id," - " start_date," - " end_date," - " reserve_profits" - " FROM auditor_historic_reserve_summary" - " WHERE (row_id > $1)" - " ORDER BY row_id ASC" - " LIMIT $3" - ); - qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, - (limit > 0) - ? - "auditor_historic_reserve_summary_get_asc" - : - "auditor_historic_reserve_summary_get_desc", - params, - &historic_reserve_summary_cb, - &dcc); - - if (qs > 0) - return dcc.qs; - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); - return qs; -} diff --git a/src/auditordb/pg_get_historic_reserve_summary.h b/src/auditordb/pg_get_historic_reserve_summary.h deleted file mode 100644 index 70b5dd59e..000000000 --- a/src/auditordb/pg_get_historic_reserve_summary.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_GET_HISTORIC_RESERVE_SUMMARY_H -#define SRC_PG_GET_HISTORIC_RESERVE_SUMMARY_H - -#include "taler_util.h" -#include "taler_json_lib.h" -#include "taler_auditordb_plugin.h" - -/** - * Get information about historic-reserve-summary from the database. - * - * @param cls the @e cls of this struct with the plugin-specific state - * @param limit number of records to return, negative for descending - * @param offset table row to start from, exclusive, direction determined by @a limit - * @param return_suppressed should suppressed rows be returned anyway? - * @param cb function to call with results - * @param cb_cls closure for @a cb - * @return query result status - */ -enum GNUNET_DB_QueryStatus -TAH_PG_get_historic_reserve_summary ( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, - TALER_AUDITORDB_HistoricReserveSummaryCallback cb, - void *cb_cls); - -#endif diff --git a/src/auditordb/pg_helper.h b/src/auditordb/pg_helper.h index 54ccd5978..3c22dd424 100644 --- a/src/auditordb/pg_helper.h +++ b/src/auditordb/pg_helper.h @@ -25,6 +25,11 @@ #include "taler_auditordb_plugin.h" +// FIXME: comment +const char * +TAH_PG_get_table_name (enum TALER_AUDITORDB_SuppressableTables table); + + /** * Type of the "cls" argument given to each of the functions in * our API. @@ -71,37 +76,37 @@ struct PostgresClosure * @param sql actual SQL text */ #define PREPARE(pg,name,sql) \ - do { \ - static struct { \ - unsigned long long cnt; \ - struct PostgresClosure *pg; \ - } preps[2]; /* 2 ctrs for taler-auditor-sync*/ \ - unsigned int off = 0; \ + do { \ + static struct { \ + unsigned long long cnt; \ + struct PostgresClosure *pg; \ + } preps[2]; /* 2 ctrs for taler-auditor-sync*/ \ + unsigned int off = 0; \ \ - while ( (NULL != preps[off].pg) && \ - (pg != preps[off].pg) && \ - (off < sizeof(preps) / sizeof(*preps)) ) \ - off++; \ - GNUNET_assert (off < \ - sizeof(preps) / sizeof(*preps)); \ - if (preps[off].cnt < pg->prep_gen) \ - { \ - struct GNUNET_PQ_PreparedStatement ps[] = { \ - GNUNET_PQ_make_prepare (name, sql), \ - GNUNET_PQ_PREPARED_STATEMENT_END \ - }; \ + while ( (NULL != preps[off].pg) && \ + (pg != preps[off].pg) && \ + (off < sizeof(preps) / sizeof(*preps)) ) \ + off++; \ + GNUNET_assert (off < \ + sizeof(preps) / sizeof(*preps)); \ + if (preps[off].cnt < pg->prep_gen) \ + { \ + struct GNUNET_PQ_PreparedStatement ps[] = { \ + GNUNET_PQ_make_prepare (name, sql), \ + GNUNET_PQ_PREPARED_STATEMENT_END \ + }; \ \ - if (GNUNET_OK != \ - GNUNET_PQ_prepare_statements (pg->conn, \ - ps)) \ - { \ - GNUNET_break (0); \ - return GNUNET_DB_STATUS_HARD_ERROR; \ - } \ - preps[off].pg = pg; \ - preps[off].cnt = pg->prep_gen; \ - } \ - } while (0) + if (GNUNET_OK != \ + GNUNET_PQ_prepare_statements (pg->conn, \ + ps)) \ + { \ + GNUNET_break (0); \ + return GNUNET_DB_STATUS_HARD_ERROR; \ + } \ + preps[off].pg = pg; \ + preps[off].cnt = pg->prep_gen; \ + } \ + } while (0) /** @@ -113,7 +118,7 @@ struct PostgresClosure */ #define TALER_PQ_RESULT_SPEC_AMOUNT(field, \ amountp) TALER_PQ_result_spec_amount ( \ - field,pg->currency,amountp) + field,pg->currency,amountp) #endif diff --git a/src/auditordb/pg_insert_balances.c b/src/auditordb/pg_insert_balances.c deleted file mode 100644 index d6d4f35ce..000000000 --- a/src/auditordb/pg_insert_balances.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_insert_balances.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_insert_balances ( - void *cls, - const struct TALER_AUDITORDB_Balances *dc) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - - GNUNET_PQ_query_param_string (dc->balance_key), - TALER_PQ_query_param_amount (pg->conn, &dc->balance_value), - - - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "auditor_balances_insert", - "INSERT INTO auditor_balances " - "( balance_key," - " balance_value" - ") VALUES ($1,$2);" - ); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_balances_insert", - params); -} diff --git a/src/auditordb/pg_insert_balances.h b/src/auditordb/pg_insert_balances.h deleted file mode 100644 index 19d2bc046..000000000 --- a/src/auditordb/pg_insert_balances.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_INSERT_BALANCES_H -#define SRC_PG_INSERT_BALANCES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - - -/** - * Insert information about a bad sig loss 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 -TAH_PG_insert_balances ( - void *cls, - const struct TALER_AUDITORDB_Balances *dc); - -#endif // SRC_PG_INSERT_BALANCES_H diff --git a/src/auditordb/pg_insert_exchange_signkey.c b/src/auditordb/pg_insert_exchange_signkey.c index 264b2b592..c31456737 100644 --- a/src/auditordb/pg_insert_exchange_signkey.c +++ b/src/auditordb/pg_insert_exchange_signkey.c @@ -49,13 +49,7 @@ TAH_PG_insert_exchange_signkey ( ",ep_end" ",exchange_pub" ",master_sig" - ") VALUES ($1,$2,$3,$4,$5)" - " ON CONFLICT (exchange_pub) DO UPDATE" - " SET ep_start = exclude.ep_start," - " ep_expire = exclude.ep_expire," - " ep_end = exclude.ep_end," - " master_sig = exclude.master_sig," - " suppressed = false;" + ") VALUES ($1,$2,$3,$4,$5);" ); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "auditor_insert_exchange_signkey", diff --git a/src/auditordb/pg_insert_exchange_signkey.h b/src/auditordb/pg_insert_exchange_signkey.h index 6d92a95a3..dfe45bf50 100644 --- a/src/auditordb/pg_insert_exchange_signkey.h +++ b/src/auditordb/pg_insert_exchange_signkey.h @@ -18,15 +18,13 @@ * @brief implementation of the insert_exchange_signkey function * @author Christian Grothoff */ - -/* #ifndef PG_INSERT_EXCHANGE_SIGNKEY_H #define PG_INSERT_EXCHANGE_SIGNKEY_H #include "taler_util.h" #include "taler_json_lib.h" #include "taler_auditordb_plugin.h" -*/ + /** * Insert information about a signing key of the exchange. * @@ -34,12 +32,9 @@ * @param sk signing key information to store * @return query result status */ -/* enum GNUNET_DB_QueryStatus TAH_PG_insert_exchange_signkey ( void *cls, const struct TALER_AUDITORDB_ExchangeSigningKey *sk); - #endif -*/
\ No newline at end of file diff --git a/src/auditordb/pg_insert_exchange_signkeys.c b/src/auditordb/pg_insert_exchange_signkeys.c deleted file mode 100644 index 892f8bc3a..000000000 --- a/src/auditordb/pg_insert_exchange_signkeys.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_insert_exchange_signkeys.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_insert_exchange_signkeys ( - void *cls, - const struct TALER_AUDITORDB_ExchangeSignkeys *dc) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - - GNUNET_PQ_query_param_auto_from_type (&dc->exchange_pub), - GNUNET_PQ_query_param_auto_from_type (&dc->master_sig), - GNUNET_PQ_query_param_absolute_time (&dc->ep_valid_from), - GNUNET_PQ_query_param_absolute_time (&dc->ep_expire_sign), - GNUNET_PQ_query_param_absolute_time (&dc->ep_expire_legal), - - - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "auditor_exchange_signkeys_insert", - "INSERT INTO auditor_exchange_signkeys " - "( exchange_pub," - " master_sig," - " ep_valid_from," - " ep_expire_sign," - " ep_expire_legal" - ") VALUES ($1,$2,$3,$4,$5);" - ); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_exchange_signkeys_insert", - params); -} diff --git a/src/auditordb/pg_insert_exchange_signkeys.h b/src/auditordb/pg_insert_exchange_signkeys.h deleted file mode 100644 index 584c83ce2..000000000 --- a/src/auditordb/pg_insert_exchange_signkeys.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_INSERT_EXCHANGE_SIGNKEYS_H -#define SRC_PG_INSERT_EXCHANGE_SIGNKEYS_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - - -/** - * Insert information about a bad sig loss 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 -TAH_PG_insert_exchange_signkeys ( - void *cls, - const struct TALER_AUDITORDB_ExchangeSignkeys *dc); - -#endif // SRC_PG_INSERT_EXCHANGE_SIGNKEYS_H diff --git a/src/auditordb/pg_insert_historic_denomination_revenue.c b/src/auditordb/pg_insert_historic_denomination_revenue.c deleted file mode 100644 index 3067e6ea9..000000000 --- a/src/auditordb/pg_insert_historic_denomination_revenue.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_insert_historic_denomination_revenue.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_insert_historic_denomination_revenue ( - void *cls, - const struct TALER_AUDITORDB_HistoricDenominationRevenue *dc) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - - GNUNET_PQ_query_param_auto_from_type (&dc->denom_pub_hash), - GNUNET_PQ_query_param_absolute_time (&dc->revenue_timestamp), - TALER_PQ_query_param_amount (pg->conn, &dc->revenue_balance), - TALER_PQ_query_param_amount (pg->conn, &dc->loss_balance), - - - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "auditor_historic_denomination_revenue_insert", - "INSERT INTO auditor_historic_denomination_revenue " - "( denom_pub_hash," - " revenue_timestamp," - " revenue_balance," - " loss_balance" - ") VALUES ($1,$2,$3,$4)" - " ON CONFLICT (denom_pub_hash) DO UPDATE" - " SET revenue_timestamp = excluded.revenue_timestamp," - " revenue_balance = excluded.revenue_balance," - " loss_balance = excluded.loss_balance," - " suppresssed = false;" - ); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_historic_denomination_revenue_insert", - params); -} diff --git a/src/auditordb/pg_insert_historic_denomination_revenue.h b/src/auditordb/pg_insert_historic_denomination_revenue.h deleted file mode 100644 index bc81f5a9b..000000000 --- a/src/auditordb/pg_insert_historic_denomination_revenue.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_INSERT_HISTORIC_DENOMINATION_REVENUE_H -#define SRC_PG_INSERT_HISTORIC_DENOMINATION_REVENUE_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - - -/** - * Insert information about a bad sig loss 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 -TAH_PG_insert_historic_denomination_revenue ( - void *cls, - const struct TALER_AUDITORDB_HistoricDenominationRevenue *dc); - -#endif // SRC_PG_INSERT_HISTORIC_DENOMINATION_REVENUE_H diff --git a/src/auditordb/pg_insert_historic_reserve_summary.c b/src/auditordb/pg_insert_historic_reserve_summary.c deleted file mode 100644 index 1f49ae0d2..000000000 --- a/src/auditordb/pg_insert_historic_reserve_summary.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_insert_historic_reserve_summary.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_insert_historic_reserve_summary ( - void *cls, - const struct TALER_AUDITORDB_HistoricReserveSummary *dc) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - - GNUNET_PQ_query_param_absolute_time (&dc->start_date), - GNUNET_PQ_query_param_absolute_time (&dc->end_date), - TALER_PQ_query_param_amount (pg->conn, &dc->reserve_profits), - - - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "auditor_historic_reserve_summary_insert", - "INSERT INTO auditor_historic_reserve_summary " - "( start_date," - " end_date," - " reserve_profits" - ") VALUES ($1,$2,$3);" - ); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_historic_reserve_summary_insert", - params); -} diff --git a/src/auditordb/pg_insert_historic_reserve_summary.h b/src/auditordb/pg_insert_historic_reserve_summary.h deleted file mode 100644 index c10c2989f..000000000 --- a/src/auditordb/pg_insert_historic_reserve_summary.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_INSERT_HISTORIC_RESERVE_SUMMARY_H -#define SRC_PG_INSERT_HISTORIC_RESERVE_SUMMARY_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - - -/** - * Insert information about a bad sig loss 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 -TAH_PG_insert_historic_reserve_summary ( - void *cls, - const struct TALER_AUDITORDB_HistoricReserveSummary *dc); - -#endif // SRC_PG_INSERT_HISTORIC_RESERVE_SUMMARY_H diff --git a/src/auditordb/pg_insert_purses.c b/src/auditordb/pg_insert_purses.c deleted file mode 100644 index b751a6caf..000000000 --- a/src/auditordb/pg_insert_purses.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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/> - */ -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" -#include "pg_insert_purses.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_insert_purses ( - void *cls, - const struct TALER_AUDITORDB_Purses *dc) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&dc->auditor_purses_rowid), - GNUNET_PQ_query_param_auto_from_type (&dc->purse_pub), - TALER_PQ_query_param_amount (pg->conn, &dc->balance), - TALER_PQ_query_param_amount (pg->conn, &dc->target), - GNUNET_PQ_query_param_absolute_time (&dc->expiration_date), - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "auditor_purses_insert", - "INSERT INTO auditor_purses " - "( auditor_purses_rowid," - " purse_pub," - " balance," - " target," - " expiration_date" - ") VALUES ($1,$2,$3,$4,$5);" - ); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_purses_insert", - params); -} diff --git a/src/auditordb/pg_insert_purses.h b/src/auditordb/pg_insert_purses.h deleted file mode 100644 index 14f5e838f..000000000 --- a/src/auditordb/pg_insert_purses.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_INSERT_PURSES_H -#define SRC_PG_INSERT_PURSES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - - -/** - * Insert information about a bad sig loss 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 -TAH_PG_insert_purses ( - void *cls, - const struct TALER_AUDITORDB_Purses *dc); - -#endif // SRC_PG_INSERT_PURSES_H diff --git a/src/auditordb/pg_insert_reserves.c b/src/auditordb/pg_insert_reserves.c deleted file mode 100644 index cda4df72a..000000000 --- a/src/auditordb/pg_insert_reserves.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_insert_reserves.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_insert_reserves ( - void *cls, - const struct TALER_AUDITORDB_Reserves *dc) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - - GNUNET_PQ_query_param_auto_from_type (&dc->reserve_pub), - TALER_PQ_query_param_amount (pg->conn, &dc->reserve_balance), - TALER_PQ_query_param_amount (pg->conn, &dc->reserve_loss), - TALER_PQ_query_param_amount (pg->conn, &dc->withdraw_fee_balance), - TALER_PQ_query_param_amount (pg->conn, &dc->close_fee_balance), - TALER_PQ_query_param_amount (pg->conn, &dc->purse_fee_balance), - TALER_PQ_query_param_amount (pg->conn, &dc->open_fee_balance), - TALER_PQ_query_param_amount (pg->conn, &dc->history_fee_balance), - GNUNET_PQ_query_param_absolute_time (&dc->expiration_date), - GNUNET_PQ_query_param_string (dc->origin_account), - - - GNUNET_PQ_query_param_end - }; - - PREPARE (pg, - "auditor_reserves_insert", - "INSERT INTO auditor_reserves " - " ( reserve_pub," - " reserve_balance," - " reserve_loss," - " withdraw_fee_balance," - " close_fee_balance," - " purse_fee_balance," - " open_fee_balance," - " history_fee_balance," - " expiration_date," - " origin_account" - ") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10);" - ); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "auditor_reserves_insert", - params); -} diff --git a/src/auditordb/pg_insert_reserves.h b/src/auditordb/pg_insert_reserves.h deleted file mode 100644 index feeca07d1..000000000 --- a/src/auditordb/pg_insert_reserves.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_INSERT_RESERVES_H -#define SRC_PG_INSERT_RESERVES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - - -/** - * Insert information about a bad sig loss 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 -TAH_PG_insert_reserves ( - void *cls, - const struct TALER_AUDITORDB_Reserves *dc); - -#endif // SRC_PG_INSERT_RESERVES_H diff --git a/src/auditordb/pg_update_balances.c b/src/auditordb/pg_update_balances.c deleted file mode 100644 index 110184ed0..000000000 --- a/src/auditordb/pg_update_balances.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_balances.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_balances ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_balances", - "UPDATE auditor_balances SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_balances", - params); -} diff --git a/src/auditordb/pg_update_balances.h b/src/auditordb/pg_update_balances.h deleted file mode 100644 index 4253897e5..000000000 --- a/src/auditordb/pg_update_balances.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_BALANCES_H -#define SRC_PG_UPDATE_BALANCES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_balances ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_BALANCES_H diff --git a/src/auditordb/pg_update_exchange_signkeys.c b/src/auditordb/pg_update_exchange_signkeys.c deleted file mode 100644 index d0b91f8f9..000000000 --- a/src/auditordb/pg_update_exchange_signkeys.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_exchange_signkeys.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_exchange_signkeys ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_exchange_signkeys", - "UPDATE auditor_exchange_signkeys SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_exchange_signkeys", - params); -} diff --git a/src/auditordb/pg_update_exchange_signkeys.h b/src/auditordb/pg_update_exchange_signkeys.h deleted file mode 100644 index 266c383c1..000000000 --- a/src/auditordb/pg_update_exchange_signkeys.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_EXCHANGE_SIGNKEYS_H -#define SRC_PG_UPDATE_EXCHANGE_SIGNKEYS_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_exchange_signkeys ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_EXCHANGE_SIGNKEYS_H diff --git a/src/auditordb/pg_update_generic_suppressed.c b/src/auditordb/pg_update_generic_suppressed.c index b44f6025c..ef58d855c 100644 --- a/src/auditordb/pg_update_generic_suppressed.c +++ b/src/auditordb/pg_update_generic_suppressed.c @@ -52,7 +52,7 @@ TAH_PG_update_generic_suppressed ( TALER_AUDITORDB_SUPPRESSABLE_TABLES_MAX]; struct Preparations *prep = &preps[table]; - const char *table_name = TALER_AUDITORDB_get_table_name (table); + const char *table_name = TAH_PG_get_table_name (table); char statement_name[256]; GNUNET_snprintf (statement_name, diff --git a/src/auditordb/pg_update_historic_denomination_revenue.c b/src/auditordb/pg_update_historic_denomination_revenue.c deleted file mode 100644 index 376fa744e..000000000 --- a/src/auditordb/pg_update_historic_denomination_revenue.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_historic_denomination_revenue.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_historic_denomination_revenue ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_historic_denomination_revenue", - "UPDATE auditor_historic_denomination_revenue SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_historic_denomination_revenue", - params); -} diff --git a/src/auditordb/pg_update_historic_denomination_revenue.h b/src/auditordb/pg_update_historic_denomination_revenue.h deleted file mode 100644 index c2e27f709..000000000 --- a/src/auditordb/pg_update_historic_denomination_revenue.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_HISTORIC_DENOMINATION_REVENUE_H -#define SRC_PG_UPDATE_HISTORIC_DENOMINATION_REVENUE_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_historic_denomination_revenue ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_HISTORIC_DENOMINATION_REVENUE_H diff --git a/src/auditordb/pg_update_historic_reserve_summary.c b/src/auditordb/pg_update_historic_reserve_summary.c deleted file mode 100644 index f3eeff102..000000000 --- a/src/auditordb/pg_update_historic_reserve_summary.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_historic_reserve_summary.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_historic_reserve_summary ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_historic_reserve_summary", - "UPDATE auditor_historic_reserve_summary SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_historic_reserve_summary", - params); -} diff --git a/src/auditordb/pg_update_historic_reserve_summary.h b/src/auditordb/pg_update_historic_reserve_summary.h deleted file mode 100644 index 8267666a0..000000000 --- a/src/auditordb/pg_update_historic_reserve_summary.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_HISTORIC_RESERVE_SUMMARY_H -#define SRC_PG_UPDATE_HISTORIC_RESERVE_SUMMARY_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_historic_reserve_summary ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_HISTORIC_RESERVE_SUMMARY_H diff --git a/src/auditordb/pg_update_progress.c b/src/auditordb/pg_update_progress.c deleted file mode 100644 index 75786c536..000000000 --- a/src/auditordb/pg_update_progress.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_progress.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_progress ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_progress", - "UPDATE auditor_progress SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_progress", - params); -} diff --git a/src/auditordb/pg_update_progress.h b/src/auditordb/pg_update_progress.h deleted file mode 100644 index 3f5abedf1..000000000 --- a/src/auditordb/pg_update_progress.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_PROGRESS_H -#define SRC_PG_UPDATE_PROGRESS_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_progress ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_PROGRESS_H diff --git a/src/auditordb/pg_update_purses.c b/src/auditordb/pg_update_purses.c deleted file mode 100644 index f0147e0c4..000000000 --- a/src/auditordb/pg_update_purses.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_purses.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_purses ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_purses", - "UPDATE auditor_purses SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_purses", - params); -} diff --git a/src/auditordb/pg_update_purses.h b/src/auditordb/pg_update_purses.h deleted file mode 100644 index 22820fcb5..000000000 --- a/src/auditordb/pg_update_purses.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_PURSES_H -#define SRC_PG_UPDATE_PURSES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_purses ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_PURSES_H diff --git a/src/auditordb/pg_update_reserves.c b/src/auditordb/pg_update_reserves.c deleted file mode 100644 index 7a6d7d6aa..000000000 --- a/src/auditordb/pg_update_reserves.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - 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/> - */ - - -#include "platform.h" -#include "taler_pq_lib.h" -#include "pg_helper.h" - -#include "pg_update_reserves.h" - -/* -Update a given resource – for now this only means suppressing -*/ -enum GNUNET_DB_QueryStatus -TAH_PG_update_reserves ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_uint64 (&gu->row_id), - GNUNET_PQ_query_param_bool (gu->suppressed), - GNUNET_PQ_query_param_end - }; - - - PREPARE (pg, - "update_reserves", - "UPDATE auditor_reserves SET" - " suppressed=$2" - " WHERE row_id=$1"); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "update_reserves", - params); -} diff --git a/src/auditordb/pg_update_reserves.h b/src/auditordb/pg_update_reserves.h deleted file mode 100644 index 567037b78..000000000 --- a/src/auditordb/pg_update_reserves.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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/> - */ - - -#ifndef SRC_PG_UPDATE_RESERVES_H -#define SRC_PG_UPDATE_RESERVES_H - -#include "taler_util.h" -#include "taler_auditordb_plugin.h" - -enum GNUNET_DB_QueryStatus -TAH_PG_update_reserves ( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *dc); - -#endif // SRC_PG_UPDATE_RESERVES_H diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index e4c952eca..0d24b7872 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -52,7 +52,6 @@ #include "pg_select_purse_expired.h" #include "pg_update_generic_suppressed.h" #include "pg_update_auditor_progress.h" -#include "pg_update_balance.h" #include "pg_update_denomination_balance.h" #include "pg_update_purse_info.h" #include "pg_update_reserve_info.h" @@ -65,13 +64,14 @@ #include "pg_update_purse_not_closed_inconsistencies.h" #include "pg_update_reserve_balance_insufficient_inconsistency.h" #include "pg_update_coin_inconsistency.h" -#include "pg_update_progress.h" #include "pg_update_denomination_key_validity_withdraw_inconsistency.h" #include "pg_update_refreshes_hanging.h" #include "pg_update_emergency.h" #include "pg_update_closure_lags.h" #include "pg_update_row_minor_inconsistencies.h" +#include "pg_update_balance.h" + #include "pg_del_amount_arithmetic_inconsistency.h" #include "pg_del_coin_inconsistency.h" #include "pg_del_row_inconsistency.h" @@ -142,33 +142,16 @@ #include "pg_get_reserves.h" #include "pg_del_reserves.h" -#include "pg_insert_reserves.h" -#include "pg_update_reserves.h" #include "pg_get_purses.h" #include "pg_del_purses.h" -#include "pg_insert_purses.h" -#include "pg_update_purses.h" - -#include "pg_get_historic_denomination_revenue.h" -#include "pg_del_historic_denomination_revenue.h" -#include "pg_insert_historic_denomination_revenue.h" -#include "pg_update_historic_denomination_revenue.h" #include "pg_get_denomination_pending.h" #include "pg_del_denomination_pending.h" #include "pg_insert_denomination_pending.h" #include "pg_update_denomination_pending.h" -#include "pg_get_historic_reserve_summary.h" -#include "pg_del_historic_reserve_summary.h" -#include "pg_insert_historic_reserve_summary.h" -#include "pg_update_historic_reserve_summary.h" - #include "pg_get_exchange_signkeys.h" -#include "pg_del_exchange_signkeys.h" -#include "pg_insert_exchange_signkeys.h" -#include "pg_update_exchange_signkeys.h" #include "pg_get_wire_format_inconsistency.h" #include "pg_del_wire_format_inconsistency.h" @@ -190,11 +173,6 @@ #include "pg_insert_row_minor_inconsistencies.h" #include "pg_update_row_minor_inconsistencies.h" -#include "pg_get_balances.h" -#include "pg_del_balances.h" -#include "pg_insert_balances.h" -#include "pg_update_balances.h" - #include "pg_update_amount_arithmetic_inconsistency.h" #include "pg_update_deposit_confirmations.h" @@ -619,12 +597,6 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->update_auditor_progress = &TAH_PG_update_auditor_progress; - plugin->update_balance - = &TAH_PG_update_balance; -/* - plugin->insert_exchange_signkey - = &TAH_PG_insert_exchange_signkey; - */ plugin->insert_deposit_confirmation = &TAH_PG_insert_deposit_confirmation; plugin->get_deposit_confirmations @@ -759,7 +731,6 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->update_reserve_balance_insufficient_inconsistency = &TAH_PG_update_reserve_balance_insufficient_inconsistency; plugin->update_coin_inconsistency = &TAH_PG_update_coin_inconsistency; - plugin->update_progress = &TAH_PG_update_progress; plugin->update_denomination_key_validity_withdraw_inconsistency = &TAH_PG_update_denomination_key_validity_withdraw_inconsistency; plugin->update_refreshes_hanging = &TAH_PG_update_refreshes_hanging; @@ -805,49 +776,18 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->update_misattribution_in_inconsistency = &TAH_PG_update_misattribution_in_inconsistency; - plugin->delete_reserves = &TAH_PG_del_reserves; - plugin->insert_reserves = &TAH_PG_insert_reserves; plugin->get_reserves = &TAH_PG_get_reserves; - plugin->update_reserves = &TAH_PG_update_reserves; - plugin->delete_purses = &TAH_PG_del_purses; - plugin->insert_purses = &TAH_PG_insert_purses; plugin->get_purses = &TAH_PG_get_purses; - plugin->update_purses = &TAH_PG_update_purses; - - - plugin->delete_historic_denomination_revenue = - &TAH_PG_del_historic_denomination_revenue; - plugin->insert_historic_denomination_revenue = - &TAH_PG_insert_historic_denomination_revenue; - plugin->get_historic_denomination_revenue = - &TAH_PG_get_historic_denomination_revenue; - plugin->update_historic_denomination_revenue = - &TAH_PG_update_historic_denomination_revenue; - plugin->delete_denomination_pending = &TAH_PG_del_denomination_pending; plugin->insert_denomination_pending = &TAH_PG_insert_denomination_pending; plugin->get_denomination_pending = &TAH_PG_get_denomination_pending; plugin->update_denomination_pending = &TAH_PG_update_denomination_pending; - - plugin->delete_historic_reserve_summary = - &TAH_PG_del_historic_reserve_summary; - plugin->insert_historic_reserve_summary = - &TAH_PG_insert_historic_reserve_summary; - plugin->get_historic_reserve_summary = &TAH_PG_get_historic_reserve_summary; - plugin->update_historic_reserve_summary = - &TAH_PG_update_historic_reserve_summary; - - - plugin->delete_exchange_signkeys = &TAH_PG_del_exchange_signkeys; - plugin->insert_exchange_signkeys = &TAH_PG_insert_exchange_signkeys; plugin->get_exchange_signkeys = &TAH_PG_get_exchange_signkeys; - plugin->update_exchange_signkeys = &TAH_PG_update_exchange_signkeys; - plugin->delete_wire_format_inconsistency = &TAH_PG_del_wire_format_inconsistency; @@ -887,14 +827,16 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->get_fee_time_inconsistency = &TAH_PG_get_fee_time_inconsistency; plugin->update_fee_time_inconsistency = &TAH_PG_update_fee_time_inconsistency; - plugin->delete_balances = &TAH_PG_del_balances; - plugin->insert_balances = &TAH_PG_insert_balances; - plugin->get_balances = &TAH_PG_get_balances; - plugin->update_balances = &TAH_PG_update_balances; + plugin->update_balance + = &TAH_PG_update_balance; + + plugin->insert_exchange_signkey + = &TAH_PG_insert_exchange_signkey; - plugin->update_deposit_confirmations = &TAH_PG_update_deposit_confirmations; - plugin->update_amount_arithmetic_inconsistency = - &TAH_PG_update_amount_arithmetic_inconsistency; + plugin->update_deposit_confirmations + = &TAH_PG_update_deposit_confirmations; + plugin->update_amount_arithmetic_inconsistency + = &TAH_PG_update_amount_arithmetic_inconsistency; return plugin; } diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index 5184722f0..b72e95ab1 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c @@ -21,7 +21,6 @@ */ #include "platform.h" #include <gnunet/gnunet_db_lib.h> -#include "taler_auditordb_lib.h" #include "taler_auditordb_plugin.h" /** @@ -33,23 +32,24 @@ * Report line of error if @a cond is true, and jump to label "drop". */ #define FAILIF(cond) \ - do { \ - if (! (cond)) { break;} \ - GNUNET_break (0); \ - goto drop; \ - } while (0) + do { \ + if (! (cond)) { break;} \ + GNUNET_break (0); \ + goto drop; \ + } while (0) /** * Initializes @a ptr with random data. */ #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (*ptr)) + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* \ + ptr)) /** * Initializes @a ptr with zeros. */ #define ZR_BLK(ptr) \ - memset (ptr, 0, sizeof (*ptr)) + memset (ptr, 0, sizeof (*ptr)) /** @@ -132,7 +132,8 @@ select_historic_denom_revenue_result ( &rloss))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "select_historic_denom_revenue_result: result does not match\n"); + "select_historic_denom_revenue_result: result does not match\n") + ; GNUNET_break (0); return GNUNET_SYSERR; } diff --git a/src/include/taler_auditordb_lib.h b/src/include/taler_auditordb_lib.h index a05f59fc7..552788719 100644 --- a/src/include/taler_auditordb_lib.h +++ b/src/include/taler_auditordb_lib.h @@ -37,10 +37,6 @@ enum TALER_AUDITORDB_SuppressableTables }; -// FIXME: comment -const char * -TALER_AUDITORDB_get_table_name (enum TALER_AUDITORDB_SuppressableTables table); - /** * Initialize the plugin. * diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index f33113122..203802e97 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -1579,13 +1579,6 @@ struct TALER_AUDITORDB_Plugin void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus - (*update_progress)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus (*update_denomination_key_validity_withdraw_inconsistency)( void *cls, @@ -1747,19 +1740,6 @@ struct TALER_AUDITORDB_Plugin void *cls, uint64_t row_id); - - enum GNUNET_DB_QueryStatus - (*insert_reserves)( - void *cls, - const struct TALER_AUDITORDB_Reserves *dc); - - - enum GNUNET_DB_QueryStatus - (*update_reserves)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus (*get_purses)( void *cls, @@ -1775,47 +1755,6 @@ struct TALER_AUDITORDB_Plugin void *cls, uint64_t row_id); - - enum GNUNET_DB_QueryStatus - (*insert_purses)( - void *cls, - const struct TALER_AUDITORDB_Purses *dc); - - - enum GNUNET_DB_QueryStatus - (*update_purses)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - - enum GNUNET_DB_QueryStatus - (*get_historic_denomination_revenue)( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, - TALER_AUDITORDB_HistoricDenominationRevenueCallback cb, - void *cb_cls); - - - enum GNUNET_DB_QueryStatus - (*delete_historic_denomination_revenue)( - void *cls, - uint64_t row_id); - - - enum GNUNET_DB_QueryStatus - (*insert_historic_denomination_revenue)( - void *cls, - const struct TALER_AUDITORDB_HistoricDenominationRevenue *dc); - - - enum GNUNET_DB_QueryStatus - (*update_historic_denomination_revenue)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus (*get_denomination_pending)( void *cls, @@ -1825,53 +1764,21 @@ struct TALER_AUDITORDB_Plugin TALER_AUDITORDB_DenominationPendingCallback cb, void *cb_cls); - enum GNUNET_DB_QueryStatus (*delete_denomination_pending)( void *cls, uint64_t row_id); - enum GNUNET_DB_QueryStatus (*insert_denomination_pending)( void *cls, const struct TALER_AUDITORDB_DenominationPending *dc); - enum GNUNET_DB_QueryStatus (*update_denomination_pending)( void *cls, const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus - (*get_historic_reserve_summary)( - void *cls, - int64_t limit, - uint64_t offset, - bool return_suppressed, - TALER_AUDITORDB_HistoricReserveSummaryCallback cb, - void *cb_cls); - - - enum GNUNET_DB_QueryStatus - (*delete_historic_reserve_summary)( - void *cls, - uint64_t row_id); - - - enum GNUNET_DB_QueryStatus - (*insert_historic_reserve_summary)( - void *cls, - const struct TALER_AUDITORDB_HistoricReserveSummary *dc); - - - enum GNUNET_DB_QueryStatus - (*update_historic_reserve_summary)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus (*get_exchange_signkeys)( void *cls, @@ -1881,25 +1788,6 @@ struct TALER_AUDITORDB_Plugin TALER_AUDITORDB_ExchangeSignkeysCallback cb, void *cb_cls); - - enum GNUNET_DB_QueryStatus - (*delete_exchange_signkeys)( - void *cls, - uint64_t row_id); - - - enum GNUNET_DB_QueryStatus - (*insert_exchange_signkeys)( - void *cls, - const struct TALER_AUDITORDB_ExchangeSignkeys *dc); - - - enum GNUNET_DB_QueryStatus - (*update_exchange_signkeys)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - enum GNUNET_DB_QueryStatus (*get_wire_format_inconsistency)( void *cls, @@ -2049,25 +1937,6 @@ struct TALER_AUDITORDB_Plugin TALER_AUDITORDB_BalancesCallback cb, void *cb_cls); - - enum GNUNET_DB_QueryStatus - (*delete_balances)( - void *cls, - uint64_t row_id); - - - enum GNUNET_DB_QueryStatus - (*insert_balances)( - void *cls, - const struct TALER_AUDITORDB_Balances *dc); - - - enum GNUNET_DB_QueryStatus - (*update_balances)( - void *cls, - const struct TALER_AUDITORDB_Generic_Update *gu); - - /** * Insert information about a reserve. There must not be an * existing record for the reserve. |