get_unfinished_close_requests.h (2767B)
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 typedef enum GNUNET_GenericReturnValue 45 (*TALER_EXCHANGEDB_ReserveExpiredCallback)( 46 void *cls, 47 const struct TALER_ReservePublicKeyP *reserve_pub, 48 const struct TALER_Amount *left, 49 const struct TALER_FullPayto account_details, 50 struct GNUNET_TIME_Timestamp expiration_date, 51 uint64_t close_request_row); 52 53 /** 54 * Obtain information about force-closed reserves 55 * where the close was not yet done (and their remaining 56 * balances). Updates the returned reserve's close 57 * status to "done". 58 * 59 * @param pg the database context 60 * @param rec function to call on expired reserves 61 * @param rec_cls closure for @a rec 62 * @return transaction status 63 */ 64 enum GNUNET_DB_QueryStatus 65 TALER_EXCHANGEDB_get_unfinished_close_requests (struct 66 TALER_EXCHANGEDB_PostgresContext 67 *pg 68 , 69 TALER_EXCHANGEDB_ReserveExpiredCallback 70 rec, 71 void *rec_cls); 72 73 #endif