select_purse_deposits_above_serial_id.h (4259B)
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 typedef enum GNUNET_GenericReturnValue 45 (*TALER_EXCHANGEDB_PurseDepositCallback)( 46 void *cls, 47 uint64_t rowid, 48 const struct TALER_EXCHANGEDB_PurseDeposit *deposit, 49 const struct TALER_ReservePublicKeyP *reserve_pub, 50 enum TALER_WalletAccountMergeFlags flags, 51 const struct TALER_Amount *auditor_balance, 52 const struct TALER_Amount *purse_total, 53 const struct TALER_DenominationPublicKey *denom_pub); 54 55 56 /* Callback typedefs */ 57 /** 58 * Function called with details about purse deposits that have been made, with 59 * the goal of auditing the deposit's execution. 60 * 61 * @param cls closure 62 * @param rowid unique serial ID for the deposit in our DB 63 * @param deposit deposit details 64 * @param reserve_pub which reserve is the purse merged into, NULL if unknown 65 * @param flags purse flags 66 * @param auditor_balance purse balance (according to the 67 * auditor during auditing) 68 * @param purse_total target amount the purse should reach 69 * @param denom_pub denomination public key of @a coin_pub 70 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 71 */ 72 typedef enum GNUNET_GenericReturnValue 73 (*TALER_EXCHANGEDB_PurseDepositCallback)( 74 void *cls, 75 uint64_t rowid, 76 const struct TALER_EXCHANGEDB_PurseDeposit *deposit, 77 const struct TALER_ReservePublicKeyP *reserve_pub, 78 enum TALER_WalletAccountMergeFlags flags, 79 const struct TALER_Amount *auditor_balance, 80 const struct TALER_Amount *purse_total, 81 const struct TALER_DenominationPublicKey *denom_pub); 82 83 /** 84 * Select deposits above @a serial_id in monotonically increasing 85 * order. 86 * 87 * @param pg the database context 88 * @param serial_id highest serial ID to exclude (select strictly larger) 89 * @param cb function to call on each result 90 * @param cb_cls closure for @a cb 91 * @return transaction status code 92 */ 93 enum GNUNET_DB_QueryStatus 94 TALER_TALER_EXCHANGEDB_select_purse_deposits_above_serial_id (struct 95 TALER_EXCHANGEDB_PostgresContext 96 * 97 pg, 98 uint64_t serial_id 99 , 100 TALER_EXCHANGEDB_PurseDepositCallback 101 cb, 102 void *cb_cls); 103 104 105 #endif