select_refreshes_above_serial_id.h (4820B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2022 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file src/include/exchange-database/select_refreshes_above_serial_id.h 18 * @brief implementation of the select_refreshes_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_REFRESHES_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_REFRESHES_ABOVE_SERIAL_ID_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /** 30 * Function called with details about coins that were melted, 31 * with the goal of auditing the refresh's execution. 32 * 33 * @param cls closure 34 * @param rowid unique serial ID for the refresh session in our DB 35 * @param old_denom_pub denomination public key of @a coin_pub 36 * @param coin_pub public key of the coin 37 * @param coin_sig signature from the coin 38 * @param h_age_commitment hash of the age commitment for the coin 39 * @param amount_with_fee amount that was deposited including fee 40 * @param num_nds length of the @a new_denom_serials array 41 * @param new_denom_serials array of denomination serials of fresh coins 42 * @param rc what the refresh commitment 43 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 44 */ 45 #ifndef TALER_EXCHANGEDB_REFRESHES_RESULT_CLOSURE 46 /** 47 * Type of the closure for #TALER_EXCHANGEDB_RefreshesCallback. 48 */ 49 #define TALER_EXCHANGEDB_REFRESHES_RESULT_CLOSURE void 50 #endif 51 typedef enum GNUNET_GenericReturnValue 52 (*TALER_EXCHANGEDB_RefreshesCallback)( 53 TALER_EXCHANGEDB_REFRESHES_RESULT_CLOSURE *cls, 54 uint64_t rowid, 55 const struct TALER_DenominationPublicKey *old_denom_pub, 56 const struct TALER_CoinSpendPublicKeyP *coin_pub, 57 const struct TALER_CoinSpendSignatureP *coin_sig, 58 const struct TALER_AgeCommitmentHashP *h_age_commitment, 59 const struct TALER_Amount *amount_with_fee, 60 size_t num_nds, 61 uint64_t new_denom_serials[static num_nds], 62 const struct TALER_RefreshCommitmentP *rc); 63 64 65 /* Callback typedefs */ 66 /** 67 * Function called with details about coins that were melted, 68 * with the goal of auditing the refresh's execution. 69 * 70 * @param cls closure 71 * @param rowid unique serial ID for the refresh session in our DB 72 * @param old_denom_pub denomination public key of @a coin_pub 73 * @param coin_pub public key of the coin 74 * @param coin_sig signature from the coin 75 * @param h_age_commitment hash of the age commitment for the coin 76 * @param amount_with_fee amount that was deposited including fee 77 * @param num_nds length of the @a new_denom_serials array 78 * @param new_denom_serials array of denomination serials of fresh coins 79 * @param rc what the refresh commitment 80 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 81 */ 82 typedef enum GNUNET_GenericReturnValue 83 (*TALER_EXCHANGEDB_RefreshesCallback)( 84 TALER_EXCHANGEDB_REFRESHES_RESULT_CLOSURE *cls, 85 uint64_t rowid, 86 const struct TALER_DenominationPublicKey *old_denom_pub, 87 const struct TALER_CoinSpendPublicKeyP *coin_pub, 88 const struct TALER_CoinSpendSignatureP *coin_sig, 89 const struct TALER_AgeCommitmentHashP *h_age_commitment, 90 const struct TALER_Amount *amount_with_fee, 91 size_t num_nds, 92 uint64_t new_denom_serials[static num_nds], 93 const struct TALER_RefreshCommitmentP *rc); 94 95 /** 96 * Select refresh sessions above @a serial_id in monotonically increasing 97 * order. 98 * 99 * @param pg the database context 100 * @param serial_id highest serial ID to exclude (select strictly larger) 101 * @param cb function to call on each result 102 * @param cb_cls closure for @a cb 103 * @return transaction status code 104 */ 105 enum GNUNET_DB_QueryStatus 106 TALER_EXCHANGEDB_select_refreshes_above_serial_id (struct 107 TALER_EXCHANGEDB_PostgresContext 108 * 109 pg, 110 uint64_t serial_id, 111 TALER_EXCHANGEDB_RefreshesCallback 112 cb, 113 TALER_EXCHANGEDB_REFRESHES_RESULT_CLOSURE 114 *cb_cls); 115 116 #endif