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