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