select_refreshes_above_serial_id.h (4492B)
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/taler/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 "taler/taler_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 typedef enum GNUNET_GenericReturnValue 46 (*TALER_EXCHANGEDB_RefreshesCallback)( 47 void *cls, 48 uint64_t rowid, 49 const struct TALER_DenominationPublicKey *old_denom_pub, 50 const struct TALER_CoinSpendPublicKeyP *coin_pub, 51 const struct TALER_CoinSpendSignatureP *coin_sig, 52 const struct TALER_AgeCommitmentHashP *h_age_commitment, 53 const struct TALER_Amount *amount_with_fee, 54 size_t num_nds, 55 uint64_t new_denom_serials[static num_nds], 56 const struct TALER_RefreshCommitmentP *rc); 57 58 59 /* Callback typedefs */ 60 /** 61 * Function called with details about coins that were melted, 62 * with the goal of auditing the refresh's execution. 63 * 64 * @param cls closure 65 * @param rowid unique serial ID for the refresh session in our DB 66 * @param old_denom_pub denomination public key of @a coin_pub 67 * @param coin_pub public key of the coin 68 * @param coin_sig signature from the coin 69 * @param h_age_commitment hash of the age commitment for the coin 70 * @param amount_with_fee amount that was deposited including fee 71 * @param num_nds length of the @a new_denom_serials array 72 * @param new_denom_serials array of denomination serials of fresh coins 73 * @param rc what the refresh commitment 74 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 75 */ 76 typedef enum GNUNET_GenericReturnValue 77 (*TALER_EXCHANGEDB_RefreshesCallback)( 78 void *cls, 79 uint64_t rowid, 80 const struct TALER_DenominationPublicKey *old_denom_pub, 81 const struct TALER_CoinSpendPublicKeyP *coin_pub, 82 const struct TALER_CoinSpendSignatureP *coin_sig, 83 const struct TALER_AgeCommitmentHashP *h_age_commitment, 84 const struct TALER_Amount *amount_with_fee, 85 size_t num_nds, 86 uint64_t new_denom_serials[static num_nds], 87 const struct TALER_RefreshCommitmentP *rc); 88 89 /** 90 * Select refresh sessions above @a serial_id in monotonically increasing 91 * order. 92 * 93 * @param pg the database context 94 * @param serial_id highest serial ID to exclude (select strictly larger) 95 * @param cb function to call on each result 96 * @param cb_cls closure for @a cb 97 * @return transaction status code 98 */ 99 enum GNUNET_DB_QueryStatus 100 TALER_EXCHANGEDB_select_refreshes_above_serial_id (struct 101 TALER_EXCHANGEDB_PostgresContext 102 * 103 pg, 104 uint64_t serial_id, 105 TALER_EXCHANGEDB_RefreshesCallback 106 cb, 107 void *cb_cls); 108 109 #endif