select_account_merges_above_serial_id.h (3773B)
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_account_merges_above_serial_id.h 18 * @brief implementation of the select_account_merges_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_ACCOUNT_MERGES_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_ACCOUNT_MERGES_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 * Function called with details about 30 * account merge requests that have been made, with 31 * the goal of auditing the account merge execution. 32 * 33 * @param cls closure 34 * @param rowid unique serial ID for the deposit in our DB 35 * @param reserve_pub reserve affected by the merge 36 * @param purse_pub purse being merged 37 * @param h_contract_terms hash over contract of the purse 38 * @param purse_expiration when would the purse expire 39 * @param amount total amount in the purse 40 * @param min_age minimum age of all coins deposited into the purse 41 * @param flags how was the purse created 42 * @param purse_fee if a purse fee was paid, how high is it 43 * @param merge_timestamp when was the merge approved 44 * @param reserve_sig signature by reserve approving the merge 45 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 46 */ 47 #ifndef TALER_EXCHANGEDB_ACCOUNT_MERGE_RESULT_CLOSURE 48 /** 49 * Type of the closure for #TALER_EXCHANGEDB_AccountMergeCallback. 50 */ 51 #define TALER_EXCHANGEDB_ACCOUNT_MERGE_RESULT_CLOSURE void 52 #endif 53 typedef enum GNUNET_GenericReturnValue 54 (*TALER_EXCHANGEDB_AccountMergeCallback)( 55 TALER_EXCHANGEDB_ACCOUNT_MERGE_RESULT_CLOSURE *cls, 56 uint64_t rowid, 57 const struct TALER_ReservePublicKeyP *reserve_pub, 58 const struct TALER_PurseContractPublicKeyP *purse_pub, 59 const struct TALER_PrivateContractHashP *h_contract_terms, 60 struct GNUNET_TIME_Timestamp purse_expiration, 61 const struct TALER_Amount *amount, 62 uint32_t min_age, 63 enum TALER_WalletAccountMergeFlags flags, 64 const struct TALER_Amount *purse_fee, 65 struct GNUNET_TIME_Timestamp merge_timestamp, 66 const struct TALER_ReserveSignatureP *reserve_sig); 67 68 /** 69 * Select account merges above @a serial_id in monotonically increasing 70 * order. 71 * 72 * @param pg the database context 73 * @param serial_id highest serial ID to exclude (select strictly larger) 74 * @param cb function to call on each result 75 * @param cb_cls closure for @a cb 76 * @return transaction status code 77 */ 78 enum GNUNET_DB_QueryStatus 79 TALER_EXCHANGEDB_select_account_merges_above_serial_id (struct 80 TALER_EXCHANGEDB_PostgresContext 81 * 82 pg, 83 uint64_t serial_id, 84 TALER_EXCHANGEDB_AccountMergeCallback 85 cb, 86 TALER_EXCHANGEDB_ACCOUNT_MERGE_RESULT_CLOSURE 87 *cb_cls); 88 89 #endif