select_reserve_closed_above_serial_id.h (4496B)
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_reserve_closed_above_serial_id.h 18 * @brief implementation of the select_reserve_closed_above_serial_id function 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_RESERVE_CLOSED_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_RESERVE_CLOSED_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 about reserve closing operations 31 * the aggregator triggered. 32 * 33 * @param cls closure 34 * @param rowid row identifier used to uniquely identify the reserve closing operation 35 * @param execution_date when did we execute the close operation 36 * @param amount_with_fee how much did we debit the reserve 37 * @param closing_fee how much did we charge for closing the reserve 38 * @param reserve_pub public key of the reserve 39 * @param receiver_account where did we send the funds, in payto://-format 40 * @param wtid identifier used for the wire transfer 41 * @param close_request_row row with the responsible close 42 * request, 0 if regular expiration triggered close 43 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 44 */ 45 typedef enum GNUNET_GenericReturnValue 46 (*TALER_EXCHANGEDB_ReserveClosedCallback)( 47 void *cls, 48 uint64_t rowid, 49 struct GNUNET_TIME_Timestamp execution_date, 50 const struct TALER_Amount *amount_with_fee, 51 const struct TALER_Amount *closing_fee, 52 const struct TALER_ReservePublicKeyP *reserve_pub, 53 const struct TALER_FullPayto receiver_account, 54 const struct TALER_WireTransferIdentifierRawP *wtid, 55 uint64_t close_request_row); 56 57 58 /* Callback typedefs */ 59 /** 60 * Function called about reserve closing operations 61 * the aggregator triggered. 62 * 63 * @param cls closure 64 * @param rowid row identifier used to uniquely identify the reserve closing operation 65 * @param execution_date when did we execute the close operation 66 * @param amount_with_fee how much did we debit the reserve 67 * @param closing_fee how much did we charge for closing the reserve 68 * @param reserve_pub public key of the reserve 69 * @param receiver_account where did we send the funds, in payto://-format 70 * @param wtid identifier used for the wire transfer 71 * @param close_request_row row with the responsible close 72 * request, 0 if regular expiration triggered close 73 * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop 74 */ 75 typedef enum GNUNET_GenericReturnValue 76 (*TALER_EXCHANGEDB_ReserveClosedCallback)( 77 void *cls, 78 uint64_t rowid, 79 struct GNUNET_TIME_Timestamp execution_date, 80 const struct TALER_Amount *amount_with_fee, 81 const struct TALER_Amount *closing_fee, 82 const struct TALER_ReservePublicKeyP *reserve_pub, 83 const struct TALER_FullPayto receiver_account, 84 const struct TALER_WireTransferIdentifierRawP *wtid, 85 uint64_t close_request_row); 86 87 /** 88 * Function called to select reserve close operations the aggregator 89 * triggered, ordered by serial ID (monotonically increasing). 90 * 91 * @param pg the database context 92 * @param serial_id lowest serial ID to include (select larger or equal) 93 * @param cb function to call for ONE unfinished item 94 * @param cb_cls closure for @a cb 95 * @return transaction status code 96 */ 97 enum GNUNET_DB_QueryStatus 98 TALER_EXCHANGEDB_select_reserve_closed_above_serial_id (struct 99 TALER_EXCHANGEDB_PostgresContext 100 * 101 pg, 102 uint64_t serial_id, 103 TALER_EXCHANGEDB_ReserveClosedCallback 104 cb, 105 void *cb_cls); 106 107 108 #endif