select_purse_merges_above_serial_id.h (4663B)
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_merges_above_serial_id.h 18 * @brief implementation of the select_purse_merges_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_PURSE_MERGES_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_PURSE_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 /** 30 * Function called with details about purse 31 * merges that have been made, with 32 * the goal of auditing the purse merge execution. 33 * 34 * @param cls closure 35 * @param rowid unique serial ID for the deposit in our DB 36 * @param partner_base_url where is the reserve, NULL for this exchange 37 * @param amount total amount expected in the purse 38 * @param balance current balance in the purse (according to the auditor) 39 * @param flags purse flags 40 * @param merge_pub merge capability key 41 * @param reserve_pub reserve the merge affects 42 * @param merge_sig signature affirming the merge 43 * @param purse_pub purse key 44 * @param merge_timestamp when did the merge happen 45 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 46 */ 47 typedef enum GNUNET_GenericReturnValue 48 (*TALER_EXCHANGEDB_PurseMergeCallback)( 49 void *cls, 50 uint64_t rowid, 51 const char *partner_base_url, 52 const struct TALER_Amount *amount, 53 const struct TALER_Amount *balance, 54 enum TALER_WalletAccountMergeFlags flags, 55 const struct TALER_PurseMergePublicKeyP *merge_pub, 56 const struct TALER_ReservePublicKeyP *reserve_pub, 57 const struct TALER_PurseMergeSignatureP *merge_sig, 58 const struct TALER_PurseContractPublicKeyP *purse_pub, 59 struct GNUNET_TIME_Timestamp merge_timestamp); 60 61 62 /* Callback typedefs */ 63 /** 64 * Function called with details about purse 65 * merges that have been made, with 66 * the goal of auditing the purse merge execution. 67 * 68 * @param cls closure 69 * @param rowid unique serial ID for the deposit in our DB 70 * @param partner_base_url where is the reserve, NULL for this exchange 71 * @param amount total amount expected in the purse 72 * @param balance current balance in the purse (according to the auditor) 73 * @param flags purse flags 74 * @param merge_pub merge capability key 75 * @param reserve_pub reserve the merge affects 76 * @param merge_sig signature affirming the merge 77 * @param purse_pub purse key 78 * @param merge_timestamp when did the merge happen 79 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 80 */ 81 typedef enum GNUNET_GenericReturnValue 82 (*TALER_EXCHANGEDB_PurseMergeCallback)( 83 void *cls, 84 uint64_t rowid, 85 const char *partner_base_url, 86 const struct TALER_Amount *amount, 87 const struct TALER_Amount *balance, 88 enum TALER_WalletAccountMergeFlags flags, 89 const struct TALER_PurseMergePublicKeyP *merge_pub, 90 const struct TALER_ReservePublicKeyP *reserve_pub, 91 const struct TALER_PurseMergeSignatureP *merge_sig, 92 const struct TALER_PurseContractPublicKeyP *purse_pub, 93 struct GNUNET_TIME_Timestamp merge_timestamp); 94 95 /** 96 * Select purse merges deposits above @a serial_id in monotonically increasing 97 * order. 98 * 99 * @param pg the database context 100 * @param serial_id highest serial ID to exclude (select strictly larger) 101 * @param cb function to call on each result 102 * @param cb_cls closure for @a cb 103 * @return transaction status code 104 */ 105 enum GNUNET_DB_QueryStatus 106 TALER_TALER_TALER_EXCHANGEDB_select_purse_merges_above_serial_id (struct 107 TALER_EXCHANGEDB_PostgresContext 108 *pg, 109 uint64_t 110 serial_id, 111 TALER_EXCHANGEDB_PurseMergeCallback 112 cb, 113 void *cb_cls); 114 115 #endif