select_recoup_refresh_above_serial_id.h (5122B)
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_recoup_refresh_above_serial_id.h 18 * @brief implementation of the select_recoup_refresh_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_RECOUP_REFRESH_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_RECOUP_REFRESH_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 about recoups on refreshed coins the exchange has to 31 * perform. 32 * 33 * @param cls closure 34 * @param rowid row identifier used to uniquely identify the recoup operation 35 * @param timestamp when did we receive the recoup request 36 * @param amount how much should be added back to the old coin 37 * @param old_coin_pub original coin that was refreshed to create @a coin 38 * @param old_denom_pub_hash hash of public key of @a old_coin_pub 39 * @param coin public information about the fresh coin 40 * @param denom_pub denomination key of @a coin 41 * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP 42 * @param coin_blind blinding factor used to blind the coin 43 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 44 */ 45 #ifndef TALER_EXCHANGEDB_RECOUP_REFRESH_RESULT_CLOSURE 46 /** 47 * Type of the closure for #TALER_EXCHANGEDB_RecoupRefreshCallback. 48 */ 49 #define TALER_EXCHANGEDB_RECOUP_REFRESH_RESULT_CLOSURE void 50 #endif 51 typedef enum GNUNET_GenericReturnValue 52 (*TALER_EXCHANGEDB_RecoupRefreshCallback)( 53 TALER_EXCHANGEDB_RECOUP_REFRESH_RESULT_CLOSURE *cls, 54 uint64_t rowid, 55 struct GNUNET_TIME_Timestamp timestamp, 56 const struct TALER_Amount *amount, 57 const struct TALER_CoinSpendPublicKeyP *old_coin_pub, 58 const struct TALER_DenominationHashP *old_denom_pub_hash, 59 const struct TALER_CoinPublicInfo *coin, 60 const struct TALER_DenominationPublicKey *denom_pub, 61 const struct TALER_CoinSpendSignatureP *coin_sig, 62 const union GNUNET_CRYPTO_BlindingSecretP *coin_blind); 63 64 65 /* Callback typedefs */ 66 /** 67 * Function called about recoups on refreshed coins the exchange has to 68 * perform. 69 * 70 * @param cls closure 71 * @param rowid row identifier used to uniquely identify the recoup operation 72 * @param timestamp when did we receive the recoup request 73 * @param amount how much should be added back to the old coin 74 * @param old_coin_pub original coin that was refreshed to create @a coin 75 * @param old_denom_pub_hash hash of public key of @a old_coin_pub 76 * @param coin public information about the fresh coin 77 * @param denom_pub denomination key of @a coin 78 * @param coin_sig signature with @e coin_pub of type #TALER_SIGNATURE_WALLET_COIN_RECOUP 79 * @param coin_blind blinding factor used to blind the coin 80 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 81 */ 82 typedef enum GNUNET_GenericReturnValue 83 (*TALER_EXCHANGEDB_RecoupRefreshCallback)( 84 TALER_EXCHANGEDB_RECOUP_REFRESH_RESULT_CLOSURE *cls, 85 uint64_t rowid, 86 struct GNUNET_TIME_Timestamp timestamp, 87 const struct TALER_Amount *amount, 88 const struct TALER_CoinSpendPublicKeyP *old_coin_pub, 89 const struct TALER_DenominationHashP *old_denom_pub_hash, 90 const struct TALER_CoinPublicInfo *coin, 91 const struct TALER_DenominationPublicKey *denom_pub, 92 const struct TALER_CoinSpendSignatureP *coin_sig, 93 const union GNUNET_CRYPTO_BlindingSecretP *coin_blind); 94 95 /** 96 * Function called to select recoup requests the exchange received for 97 * refreshed coins, ordered by serial ID (monotonically increasing). 98 * 99 * @param pg the database context 100 * @param serial_id lowest serial ID to include (select larger or equal) 101 * @param cb function to call for ONE unfinished item 102 * @param cb_cls closure for @a cb 103 * @return transaction status code 104 */ 105 enum GNUNET_DB_QueryStatus 106 TALER_EXCHANGEDB_select_recoup_refresh_above_serial_id (struct 107 TALER_EXCHANGEDB_PostgresContext 108 * 109 pg, 110 uint64_t serial_id, 111 TALER_EXCHANGEDB_RecoupRefreshCallback 112 cb, 113 TALER_EXCHANGEDB_RECOUP_REFRESH_RESULT_CLOSURE 114 *cb_cls); 115 116 #endif