get_unfinished_close_requests.h (3102B)
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 get_unfinished_close_requests.h 18 * @brief implementation of the get_unfinished_close_requests function 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_GET_UNFINISHED_CLOSE_REQUESTS_H 22 #define EXCHANGE_DATABASE_GET_UNFINISHED_CLOSE_REQUESTS_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /* Callback typedefs */ 30 /** 31 * Function called with details about expired reserves. 32 * 33 * @param cls closure 34 * @param reserve_pub public key of the reserve 35 * @param left amount left in the reserve 36 * @param account_details information about the reserve's bank account, in payto://-format 37 * @param expiration_date when did the reserve expire 38 * @param close_request_row row that caused the reserve 39 * to be closed, 0 if it expired without request 40 * @return #GNUNET_OK on success, 41 * #GNUNET_NO to retry 42 * #GNUNET_SYSERR on hard failures (exit) 43 */ 44 #ifndef TALER_EXCHANGEDB_RESERVE_EXPIRED_RESULT_CLOSURE 45 /** 46 * Type of the closure for #TALER_EXCHANGEDB_ReserveExpiredCallback. 47 */ 48 #define TALER_EXCHANGEDB_RESERVE_EXPIRED_RESULT_CLOSURE void 49 #endif 50 typedef enum GNUNET_GenericReturnValue 51 (*TALER_EXCHANGEDB_ReserveExpiredCallback)( 52 TALER_EXCHANGEDB_RESERVE_EXPIRED_RESULT_CLOSURE *cls, 53 const struct TALER_ReservePublicKeyP *reserve_pub, 54 const struct TALER_Amount *left, 55 const struct TALER_FullPayto account_details, 56 struct GNUNET_TIME_Timestamp expiration_date, 57 uint64_t close_request_row); 58 59 /** 60 * Obtain information about force-closed reserves 61 * where the close was not yet done (and their remaining 62 * balances). Updates the returned reserve's close 63 * status to "done". 64 * 65 * @param pg the database context 66 * @param rec function to call on expired reserves 67 * @param rec_cls closure for @a rec 68 * @return transaction status 69 */ 70 enum GNUNET_DB_QueryStatus 71 TALER_EXCHANGEDB_get_unfinished_close_requests (struct 72 TALER_EXCHANGEDB_PostgresContext 73 *pg 74 , 75 TALER_EXCHANGEDB_ReserveExpiredCallback 76 rec, 77 TALER_EXCHANGEDB_RESERVE_EXPIRED_RESULT_CLOSURE 78 *rec_cls); 79 80 #endif