diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-11-02 12:25:42 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-11-02 12:25:42 +0100 |
commit | 34f46382f0c0afc0babf5b7cbdfd83869b620c33 (patch) | |
tree | 2be6eba40af40419464134f3c97e61dfd4fa45d5 /src | |
parent | 821c87ccbddbb7b0d0896f350de0a671f210ae40 (diff) | |
download | exchange-34f46382f0c0afc0babf5b7cbdfd83869b620c33.tar.xz |
skeleton logic for new auditordb functions
Diffstat (limited to 'src')
-rw-r--r-- | src/auditordb/pg_delete_purse_info.c | 34 | ||||
-rw-r--r-- | src/auditordb/pg_delete_purse_info.h | 44 | ||||
-rw-r--r-- | src/auditordb/pg_get_purse_info.c | 37 | ||||
-rw-r--r-- | src/auditordb/pg_get_purse_info.h | 49 | ||||
-rw-r--r-- | src/auditordb/pg_get_purse_summary.c | 33 | ||||
-rw-r--r-- | src/auditordb/pg_get_purse_summary.h | 43 | ||||
-rw-r--r-- | src/auditordb/pg_insert_purse_info.c | 36 | ||||
-rw-r--r-- | src/auditordb/pg_insert_purse_info.h | 47 | ||||
-rw-r--r-- | src/auditordb/pg_insert_purse_summary.c | 34 | ||||
-rw-r--r-- | src/auditordb/pg_insert_purse_summary.h | 45 | ||||
-rw-r--r-- | src/auditordb/pg_select_purse_expired.c | 35 | ||||
-rw-r--r-- | src/auditordb/pg_select_purse_expired.h | 45 | ||||
-rwxr-xr-x | src/auditordb/pg_template.sh | 6 | ||||
-rw-r--r-- | src/auditordb/pg_update_purse_info.c | 36 | ||||
-rw-r--r-- | src/auditordb/pg_update_purse_info.h | 47 | ||||
-rw-r--r-- | src/auditordb/pg_update_purse_summary.c | 35 | ||||
-rw-r--r-- | src/auditordb/pg_update_purse_summary.h | 45 | ||||
-rw-r--r-- | src/auditordb/plugin_auditordb_postgres.c | 16 | ||||
-rw-r--r-- | src/include/taler_auditordb_plugin.h | 16 |
19 files changed, 664 insertions, 19 deletions
diff --git a/src/auditordb/pg_delete_purse_info.c b/src/auditordb/pg_delete_purse_info.c new file mode 100644 index 000000000..2b22218be --- /dev/null +++ b/src/auditordb/pg_delete_purse_info.c @@ -0,0 +1,34 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_delete_purse_info.c + * @brief Implementation of the delete_purse_info function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_delete_purse_info.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_delete_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub) +{ +} diff --git a/src/auditordb/pg_delete_purse_info.h b/src/auditordb/pg_delete_purse_info.h new file mode 100644 index 000000000..88b59fde2 --- /dev/null +++ b/src/auditordb/pg_delete_purse_info.h @@ -0,0 +1,44 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_delete_purse_info.h + * @brief implementation of the delete_purse_info function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_DELETE_PURSE_INFO_H +#define PG_DELETE_PURSE_INFO_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Delete information about a purse. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param purse_pub public key of the reserve + * @param master_pub master public key of the exchange + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_delete_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub); + + +#endif diff --git a/src/auditordb/pg_get_purse_info.c b/src/auditordb/pg_get_purse_info.c new file mode 100644 index 000000000..4c469978a --- /dev/null +++ b/src/auditordb/pg_get_purse_info.c @@ -0,0 +1,37 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_get_purse_info.c + * @brief Implementation of the get_purse_info function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_get_purse_info.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_get_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub, + uint64_t *rowid, + struct TALER_Amount *balance, + struct GNUNET_TIME_Timestamp *expiration_date) +{ +} diff --git a/src/auditordb/pg_get_purse_info.h b/src/auditordb/pg_get_purse_info.h new file mode 100644 index 000000000..2b2e77415 --- /dev/null +++ b/src/auditordb/pg_get_purse_info.h @@ -0,0 +1,49 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_get_purse_info.h + * @brief implementation of the get_purse_info function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_GET_PURSE_INFO_H +#define PG_GET_PURSE_INFO_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Get information about a purse. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param purse_pub public key of the purse + * @param master_pub master public key of the exchange + * @param[out] rowid which row did we get the information from + * @param[out] balance set to balance of the purse + * @param[out] expiration_date expiration date of the purse + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_get_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub, + uint64_t *rowid, + struct TALER_Amount *balance, + struct GNUNET_TIME_Timestamp *expiration_date); + +#endif diff --git a/src/auditordb/pg_get_purse_summary.c b/src/auditordb/pg_get_purse_summary.c new file mode 100644 index 000000000..5a5e087dd --- /dev/null +++ b/src/auditordb/pg_get_purse_summary.c @@ -0,0 +1,33 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_get_purse_summary.c + * @brief Implementation of the get_purse_summary function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_get_purse_summary.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_get_purse_summary (void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + struct TALER_AUDITORDB_PurseBalance *sum) +{ +} diff --git a/src/auditordb/pg_get_purse_summary.h b/src/auditordb/pg_get_purse_summary.h new file mode 100644 index 000000000..e3c5d92f7 --- /dev/null +++ b/src/auditordb/pg_get_purse_summary.h @@ -0,0 +1,43 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_get_purse_summary.h + * @brief implementation of the get_purse_summary function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_GET_PURSE_SUMMARY_H +#define PG_GET_PURSE_SUMMARY_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Get summary information about all purses. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param master_pub master public key of the exchange + * @param[out] sum purse balances summary to initialize + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_get_purse_summary (void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + struct TALER_AUDITORDB_PurseBalance *sum); + + +#endif diff --git a/src/auditordb/pg_insert_purse_info.c b/src/auditordb/pg_insert_purse_info.c new file mode 100644 index 000000000..bec57c851 --- /dev/null +++ b/src/auditordb/pg_insert_purse_info.c @@ -0,0 +1,36 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_insert_purse_info.c + * @brief Implementation of the insert_purse_info function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_insert_purse_info.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_insert_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_Amount *balance, + struct GNUNET_TIME_Timestamp expiration_date) +{ +} diff --git a/src/auditordb/pg_insert_purse_info.h b/src/auditordb/pg_insert_purse_info.h new file mode 100644 index 000000000..67ac3dba1 --- /dev/null +++ b/src/auditordb/pg_insert_purse_info.h @@ -0,0 +1,47 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_insert_purse_info.h + * @brief implementation of the insert_purse_info function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_INSERT_PURSE_INFO_H +#define PG_INSERT_PURSE_INFO_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + +/** + * Insert information about a purse. There must not be an + * existing record for the purse. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param purse_pub public key of the purse + * @param master_pub master public key of the exchange + * @param balance balance of the purse + * @param expiration_date expiration date of the purse + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_insert_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_Amount *balance, + struct GNUNET_TIME_Timestamp expiration_date); + +#endif diff --git a/src/auditordb/pg_insert_purse_summary.c b/src/auditordb/pg_insert_purse_summary.c new file mode 100644 index 000000000..6a1a5b950 --- /dev/null +++ b/src/auditordb/pg_insert_purse_summary.c @@ -0,0 +1,34 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_insert_purse_summary.c + * @brief Implementation of the insert_purse_summary function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_insert_purse_summary.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_insert_purse_summary ( + void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_AUDITORDB_PurseBalance *sum) +{ +} diff --git a/src/auditordb/pg_insert_purse_summary.h b/src/auditordb/pg_insert_purse_summary.h new file mode 100644 index 000000000..37e1843d7 --- /dev/null +++ b/src/auditordb/pg_insert_purse_summary.h @@ -0,0 +1,45 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_insert_purse_summary.h + * @brief implementation of the insert_purse_summary function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_INSERT_PURSE_SUMMARY_H +#define PG_INSERT_PURSE_SUMMARY_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Insert information about all purses. There must not be an + * existing record for the @a master_pub. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param master_pub master public key of the exchange + * @param sum purse balance summary to store + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_insert_purse_summary ( + void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_AUDITORDB_PurseBalance *sum); + + +#endif diff --git a/src/auditordb/pg_select_purse_expired.c b/src/auditordb/pg_select_purse_expired.c new file mode 100644 index 000000000..7a9ba915d --- /dev/null +++ b/src/auditordb/pg_select_purse_expired.c @@ -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/> + */ +/** + * @file auditordb/pg_select_purse_expired.c + * @brief Implementation of the select_purse_expired function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_select_purse_expired.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_select_purse_expired ( + void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + TALER_AUDITORDB_ExpiredPurseCallback cb, + void *cb_cls) +{ +} diff --git a/src/auditordb/pg_select_purse_expired.h b/src/auditordb/pg_select_purse_expired.h new file mode 100644 index 000000000..9f501408a --- /dev/null +++ b/src/auditordb/pg_select_purse_expired.h @@ -0,0 +1,45 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_select_purse_expired.h + * @brief implementation of the select_purse_expired function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_SELECT_PURSE_EXPIRED_H +#define PG_SELECT_PURSE_EXPIRED_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Get information about expired purses. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param master_pub master public key of the exchange + * @param cb function to call on expired purses + * @param cb_cls closure for @a cb + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_select_purse_expired ( + void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + TALER_AUDITORDB_ExpiredPurseCallback cb, + void *cb_cls); + +#endif diff --git a/src/auditordb/pg_template.sh b/src/auditordb/pg_template.sh index 73bd7e989..c0937dcd3 100755 --- a/src/auditordb/pg_template.sh +++ b/src/auditordb/pg_template.sh @@ -10,12 +10,12 @@ do then cat pg_template.c | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.c cat pg_template.h | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.h - echo " plugin->$n\n = &TEH_PG_$n;" >> tmpl.c + echo " plugin->$n\n = &TAH_PG_$n;" >> tmpl.c echo "#include \"pg_$n.h\"" >> tmpl.inc echo " pg_$n.h pg_$n.c \\" >> tmpl.am fi done echo "Add lines from tmpl.am to Makefile.am" -echo "Add lines from tmpl.inc to plugin_exchangedb_postgres.c at the beginning" -echo "Add lines from tmpl.c to plugin_exchangedb_postgres.c at the end" +echo "Add lines from tmpl.inc to plugin_auditordb_postgres.c at the beginning" +echo "Add lines from tmpl.c to plugin_auditordb_postgres.c at the end" diff --git a/src/auditordb/pg_update_purse_info.c b/src/auditordb/pg_update_purse_info.c new file mode 100644 index 000000000..0af0c913a --- /dev/null +++ b/src/auditordb/pg_update_purse_info.c @@ -0,0 +1,36 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_update_purse_info.c + * @brief Implementation of the update_purse_info function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_update_purse_info.h" +#include "pg_helper.h" + + +enum GNUNET_DB_QueryStatus +TAH_PG_update_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_Amount *balance) +{ +} diff --git a/src/auditordb/pg_update_purse_info.h b/src/auditordb/pg_update_purse_info.h new file mode 100644 index 000000000..0b1f71d31 --- /dev/null +++ b/src/auditordb/pg_update_purse_info.h @@ -0,0 +1,47 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_update_purse_info.h + * @brief implementation of the update_purse_info function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_UPDATE_PURSE_INFO_H +#define PG_UPDATE_PURSE_INFO_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Update information about a purse. Destructively updates an + * existing record, which must already exist. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param purse_pub public key of the purse + * @param master_pub master public key of the exchange + * @param balance new balance for the purse + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_update_purse_info ( + void *cls, + const struct TALER_PurseContractPublicKeyP *purse_pub, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_Amount *balance); + + +#endif diff --git a/src/auditordb/pg_update_purse_summary.c b/src/auditordb/pg_update_purse_summary.c new file mode 100644 index 000000000..b03f0f4fd --- /dev/null +++ b/src/auditordb/pg_update_purse_summary.c @@ -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/> + */ +/** + * @file auditordb/pg_update_purse_summary.c + * @brief Implementation of the update_purse_summary function for Postgres + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_update_purse_summary.h" +#include "pg_helper.h" + + +enum GNUNET_DB_QueryStatus +TAH_PG_update_purse_summary ( + void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_AUDITORDB_PurseBalance *sum) +{ +} diff --git a/src/auditordb/pg_update_purse_summary.h b/src/auditordb/pg_update_purse_summary.h new file mode 100644 index 000000000..b613f7c0d --- /dev/null +++ b/src/auditordb/pg_update_purse_summary.h @@ -0,0 +1,45 @@ +/* + 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/> + */ +/** + * @file auditordb/pg_update_purse_summary.h + * @brief implementation of the update_purse_summary function for Postgres + * @author Christian Grothoff + */ +#ifndef PG_UPDATE_PURSE_SUMMARY_H +#define PG_UPDATE_PURSE_SUMMARY_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + + +/** + * Update information about all purses. Destructively updates an + * existing record, which must already exist. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param master_pub master public key of the exchange + * @param sum purse balances summary to store + * @return transaction status code + */ +enum GNUNET_DB_QueryStatus +TAH_PG_update_purse_summary ( + void *cls, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_AUDITORDB_PurseBalance *sum); + + +#endif diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 64c7b5033..5ed01e5d2 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -517,23 +517,23 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->insert_predicted_result = &TAH_PG_insert_predicted_result; plugin->get_purse_info - = &TEH_PG_get_purse_info; + = &TAH_PG_get_purse_info; plugin->delete_purse_info - = &TEH_PG_delete_purse_info; + = &TAH_PG_delete_purse_info; plugin->update_purse_info - = &TEH_PG_update_purse_info; + = &TAH_PG_update_purse_info; plugin->insert_purse_info - = &TEH_PG_insert_purse_info; + = &TAH_PG_insert_purse_info; plugin->get_purse_summary - = &TEH_PG_get_purse_summary; + = &TAH_PG_get_purse_summary; plugin->select_purse_expired - = &TEH_PG_select_purse_expired; + = &TAH_PG_select_purse_expired; plugin->insert_purse_summary - = &TEH_PG_insert_purse_summary; + = &TAH_PG_insert_purse_summary; plugin->update_purse_summary - = &TEH_PG_update_purse_summary; + = &TAH_PG_update_purse_summary; return plugin; } diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index 709a956cb..9f46004c1 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -1381,14 +1381,14 @@ struct TALER_AUDITORDB_Plugin /** - * Insert information about all purses. There must not be an - * existing record for the @a master_pub. - * - * @param cls the @e cls of this struct with the plugin-specific state - * @param master_pub master public key of the exchange - * @param sum purse balance summary to store - * @return transaction status code - */ + * Insert information about all purses. There must not be an + * existing record for the @a master_pub. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param master_pub master public key of the exchange + * @param sum purse balance summary to store + * @return transaction status code + */ enum GNUNET_DB_QueryStatus (*insert_purse_summary)( void *cls, |