select_aggregations_above_serial.h (3366B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2023 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 src/include/exchange-database/select_aggregations_above_serial.h 18 * @brief implementation of the select_aggregations_above_serial function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_AGGREGATIONS_ABOVE_SERIAL_H 22 #define EXCHANGE_DATABASE_SELECT_AGGREGATIONS_ABOVE_SERIAL_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 on aggregations that were done for 31 * a (batch) deposit. 32 * 33 * @param cls closure 34 * @param amount affected amount 35 * @param tracking_serial_id where in the table are we 36 * @param batch_deposit_serial_id which batch deposit was aggregated 37 */ 38 #ifndef TALER_EXCHANGEDB_AGGREGATION_RESULT_CLOSURE 39 /** 40 * Type of the closure for #TALER_EXCHANGEDB_AggregationCallback. 41 */ 42 #define TALER_EXCHANGEDB_AGGREGATION_RESULT_CLOSURE void 43 #endif 44 typedef void 45 (*TALER_EXCHANGEDB_AggregationCallback)( 46 TALER_EXCHANGEDB_AGGREGATION_RESULT_CLOSURE *cls, 47 const struct TALER_Amount *amount, 48 uint64_t tracking_serial_id, 49 uint64_t batch_deposit_serial_id); 50 51 52 /* Callback typedefs */ 53 /** 54 * Function called on aggregations that were done for 55 * a (batch) deposit. 56 * 57 * @param cls closure 58 * @param amount affected amount 59 * @param tracking_serial_id where in the table are we 60 * @param batch_deposit_serial_id which batch deposit was aggregated 61 */ 62 typedef void 63 (*TALER_EXCHANGEDB_AggregationCallback)( 64 TALER_EXCHANGEDB_AGGREGATION_RESULT_CLOSURE *cls, 65 const struct TALER_Amount *amount, 66 uint64_t tracking_serial_id, 67 uint64_t batch_deposit_serial_id); 68 69 /** 70 * Select all aggregation tracking IDs in the database 71 * above a given @a min_tracking_serial_id. 72 * 73 * @param pg the database context 74 * @param min_tracking_serial_id only return entries strictly above this row (and in order) 75 * @param cb function to call on all such aggregations 76 * @param cb_cls closure for @a cb 77 * @return transaction status code 78 */ 79 enum GNUNET_DB_QueryStatus 80 TALER_EXCHANGEDB_select_aggregations_above_serial (struct 81 TALER_EXCHANGEDB_PostgresContext 82 * 83 pg, 84 uint64_t 85 min_tracking_serial_id, 86 TALER_EXCHANGEDB_AggregationCallback 87 cb, 88 TALER_EXCHANGEDB_AGGREGATION_RESULT_CLOSURE 89 *cb_cls); 90 91 92 #endif