select_withdrawals_above_serial_id.h (5648B)
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_withdrawals_above_serial_id.h 18 * @brief implementation of the select_withdrawals_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_WITHDRAWALS_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_WITHDRAWALS_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 withdraw operations. 31 * 32 * @param cls closure 33 * @param rowid unique serial ID for the refresh session in our DB 34 * @param num_denom_serials number of elements in @e denom_serials array 35 * @param denom_serials array with length @e num_denom_serials of serial ID's of denominations in our DB 36 * @param selected_h hash over the gamma-selected planchets 37 * @param h_planchets running hash over all hashes of blinded planchets in the original withdraw request 38 * @param blinding_seed the blinding seed for CS denominations that was provided during withdraw; might be NULL 39 * @param age_proof_required true if the withdraw request required an age proof. 40 * @param max_age if @e age_proof_required is true, the maximum age that was set on the coins. 41 * @param noreveal_index if @e age_proof_required is true, the index that was returned by the exchange for the reveal phase. 42 * @param reserve_pub public key of the reserve 43 * @param reserve_sig signature over the withdraw operation 44 * @param execution_date when did the wallet withdraw the coin 45 * @param amount_with_fee amount that was withdrawn 46 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 47 */ 48 typedef enum GNUNET_GenericReturnValue 49 (*TALER_EXCHANGEDB_WithdrawCallback)( 50 void *cls, 51 uint64_t rowid, 52 size_t num_denom_serials, 53 const uint64_t *denom_serials, 54 const struct TALER_HashBlindedPlanchetsP *selected_h, 55 const struct TALER_HashBlindedPlanchetsP *h_planchets, 56 const struct TALER_BlindingMasterSeedP *blinding_seed, 57 bool age_proof_required, 58 uint8_t max_age, 59 uint8_t noreveal_index, 60 const struct TALER_ReservePublicKeyP *reserve_pub, 61 const struct TALER_ReserveSignatureP *reserve_sig, 62 struct GNUNET_TIME_Timestamp execution_date, 63 const struct TALER_Amount *amount_with_fee); 64 65 66 /* Callback typedefs */ 67 /** 68 * Function called with details about withdraw operations. 69 * 70 * @param cls closure 71 * @param rowid unique serial ID for the refresh session in our DB 72 * @param num_denom_serials number of elements in @e denom_serials array 73 * @param denom_serials array with length @e num_denom_serials of serial ID's of denominations in our DB 74 * @param selected_h hash over the gamma-selected planchets 75 * @param h_planchets running hash over all hashes of blinded planchets in the original withdraw request 76 * @param blinding_seed the blinding seed for CS denominations that was provided during withdraw; might be NULL 77 * @param age_proof_required true if the withdraw request required an age proof. 78 * @param max_age if @e age_proof_required is true, the maximum age that was set on the coins. 79 * @param noreveal_index if @e age_proof_required is true, the index that was returned by the exchange for the reveal phase. 80 * @param reserve_pub public key of the reserve 81 * @param reserve_sig signature over the withdraw operation 82 * @param execution_date when did the wallet withdraw the coin 83 * @param amount_with_fee amount that was withdrawn 84 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 85 */ 86 typedef enum GNUNET_GenericReturnValue 87 (*TALER_EXCHANGEDB_WithdrawCallback)( 88 void *cls, 89 uint64_t rowid, 90 size_t num_denom_serials, 91 const uint64_t *denom_serials, 92 const struct TALER_HashBlindedPlanchetsP *selected_h, 93 const struct TALER_HashBlindedPlanchetsP *h_planchets, 94 const struct TALER_BlindingMasterSeedP *blinding_seed, 95 bool age_proof_required, 96 uint8_t max_age, 97 uint8_t noreveal_index, 98 const struct TALER_ReservePublicKeyP *reserve_pub, 99 const struct TALER_ReserveSignatureP *reserve_sig, 100 struct GNUNET_TIME_Timestamp execution_date, 101 const struct TALER_Amount *amount_with_fee); 102 103 /** 104 * Select withdraw operations from reserves_out above @a serial_id 105 * in monotonically increasing order. 106 * 107 * @param pg the database context 108 * @param serial_id highest serial ID to exclude (select strictly larger) 109 * @param cb function to call on each result 110 * @param cb_cls closure for @a cb 111 * @return transaction status code 112 */ 113 enum GNUNET_DB_QueryStatus 114 TALER_EXCHANGEDB_select_withdrawals_above_serial_id (struct 115 TALER_EXCHANGEDB_PostgresContext 116 *pg, 117 uint64_t serial_id, 118 TALER_EXCHANGEDB_WithdrawCallback 119 cb, 120 void *cb_cls); 121 122 #endif