select_purse_deposits_above_serial_id.h (4639B)
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 select_purse_deposits_above_serial_id.h 18 * @brief implementation of the select_purse_deposits_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_PURSE_DEPOSITS_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_PURSE_DEPOSITS_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 purse deposits that have been made, with 31 * the goal of auditing the deposit's execution. 32 * 33 * @param cls closure 34 * @param rowid unique serial ID for the deposit in our DB 35 * @param deposit deposit details 36 * @param reserve_pub which reserve is the purse merged into, NULL if unknown 37 * @param flags purse flags 38 * @param auditor_balance purse balance (according to the 39 * auditor during auditing) 40 * @param purse_total target amount the purse should reach 41 * @param denom_pub denomination public key of @a coin_pub 42 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 43 */ 44 #ifndef TALER_EXCHANGEDB_PURSE_DEPOSIT_RESULT_CLOSURE 45 /** 46 * Type of the closure for #TALER_EXCHANGEDB_PurseDepositCallback. 47 */ 48 #define TALER_EXCHANGEDB_PURSE_DEPOSIT_RESULT_CLOSURE void 49 #endif 50 typedef enum GNUNET_GenericReturnValue 51 (*TALER_EXCHANGEDB_PurseDepositCallback)( 52 TALER_EXCHANGEDB_PURSE_DEPOSIT_RESULT_CLOSURE *cls, 53 uint64_t rowid, 54 const struct TALER_EXCHANGEDB_PurseDeposit *deposit, 55 const struct TALER_ReservePublicKeyP *reserve_pub, 56 enum TALER_WalletAccountMergeFlags flags, 57 const struct TALER_Amount *auditor_balance, 58 const struct TALER_Amount *purse_total, 59 const struct TALER_DenominationPublicKey *denom_pub); 60 61 62 /* Callback typedefs */ 63 /** 64 * Function called with details about purse deposits that have been made, with 65 * the goal of auditing the deposit's execution. 66 * 67 * @param cls closure 68 * @param rowid unique serial ID for the deposit in our DB 69 * @param deposit deposit details 70 * @param reserve_pub which reserve is the purse merged into, NULL if unknown 71 * @param flags purse flags 72 * @param auditor_balance purse balance (according to the 73 * auditor during auditing) 74 * @param purse_total target amount the purse should reach 75 * @param denom_pub denomination public key of @a coin_pub 76 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 77 */ 78 typedef enum GNUNET_GenericReturnValue 79 (*TALER_EXCHANGEDB_PurseDepositCallback)( 80 TALER_EXCHANGEDB_PURSE_DEPOSIT_RESULT_CLOSURE *cls, 81 uint64_t rowid, 82 const struct TALER_EXCHANGEDB_PurseDeposit *deposit, 83 const struct TALER_ReservePublicKeyP *reserve_pub, 84 enum TALER_WalletAccountMergeFlags flags, 85 const struct TALER_Amount *auditor_balance, 86 const struct TALER_Amount *purse_total, 87 const struct TALER_DenominationPublicKey *denom_pub); 88 89 /** 90 * Select deposits 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_TALER_EXCHANGEDB_select_purse_deposits_above_serial_id (struct 101 TALER_EXCHANGEDB_PostgresContext 102 * 103 pg, 104 uint64_t serial_id 105 , 106 TALER_EXCHANGEDB_PurseDepositCallback 107 cb, 108 TALER_EXCHANGEDB_PURSE_DEPOSIT_RESULT_CLOSURE 109 *cb_cls); 110 111 112 #endif