get_reserves.h (2701B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2024 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 #ifndef AUDITOR_DATABASE_GET_RESERVES_H 17 #define AUDITOR_DATABASE_GET_RESERVES_H 18 19 #include "taler/taler_util.h" 20 #include "taler/taler_json_lib.h" 21 #include "auditordb_lib.h" 22 23 24 struct TALER_AUDITORDB_Reserves 25 { 26 uint64_t row_id; 27 uint64_t auditor_reserves_rowid; 28 struct TALER_ReservePublicKeyP reserve_pub; 29 struct TALER_Amount reserve_balance; 30 struct TALER_Amount reserve_loss; 31 struct TALER_Amount withdraw_fee_balance; 32 struct TALER_Amount close_fee_balance; 33 struct TALER_Amount purse_fee_balance; 34 struct TALER_Amount open_fee_balance; 35 struct TALER_Amount history_fee_balance; 36 struct GNUNET_TIME_Absolute expiration_date; 37 struct TALER_FullPayto origin_account; 38 bool suppressed; 39 40 }; 41 42 #ifndef TALER_AUDITORDB_RESERVES_RESULT_CLOSURE 43 /** 44 * Type of the closure for #TALER_AUDITORDB_ReservesCallback. 45 */ 46 #define TALER_AUDITORDB_RESERVES_RESULT_CLOSURE void 47 #endif 48 typedef enum GNUNET_GenericReturnValue 49 (*TALER_AUDITORDB_ReservesCallback)( 50 TALER_AUDITORDB_RESERVES_RESULT_CLOSURE *cls, 51 uint64_t serial_id, 52 const struct TALER_AUDITORDB_Reserves *dc); 53 54 55 /* Callback typedefs */ 56 typedef enum GNUNET_GenericReturnValue 57 (*TALER_AUDITORDB_ReservesCallback)( 58 TALER_AUDITORDB_RESERVES_RESULT_CLOSURE *cls, 59 uint64_t serial_id, 60 const struct TALER_AUDITORDB_Reserves *dc); 61 62 /** 63 * Get information about reserves from the database. 64 * 65 * @param pg the database context 66 * @param limit number of records to return, negative for descending 67 * @param offset table row to start from, exclusive, direction determined by @a limit 68 * @param cb function to call with results 69 * @param cb_cls closure for @a cb 70 * @return query result status 71 */ 72 enum GNUNET_DB_QueryStatus 73 TALER_AUDITORDB_get_reserves (struct TALER_AUDITORDB_PostgresContext *pg, 74 int64_t limit, 75 uint64_t offset, 76 TALER_AUDITORDB_ReservesCallback cb, 77 TALER_AUDITORDB_RESERVES_RESULT_CLOSURE *cb_cls); 78 79 #endif