select_early_aggregations.h (2855B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2025 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/auditor-database/select_early_aggregations.h 18 * @brief implementation of the select_early_aggregations function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef AUDITOR_DATABASE_SELECT_EARLY_AGGREGATIONS_H 22 #define AUDITOR_DATABASE_SELECT_EARLY_AGGREGATIONS_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "auditordb_lib.h" 27 28 29 /** 30 * Information about an early aggregation event. 31 */ 32 struct TALER_AUDITORDB_EarlyAggregation 33 { 34 /** 35 * Row of the event in the auditor database. 36 */ 37 uint64_t row_id; 38 39 /** 40 * Row of the batch deposit in the exchange database. 41 */ 42 uint64_t batch_deposit_serial_id; 43 44 /** 45 * FIXME 46 */ 47 uint64_t tracking_serial_id; 48 49 /** 50 * Total amount involved. 51 */ 52 struct TALER_Amount total; 53 54 /** 55 * True if this report was previously suppressed. 56 */ 57 bool suppressed; 58 }; 59 60 61 /** 62 * Function to call with information about early aggregations. 63 * 64 * @param cls closure 65 * @param ea event data 66 * @return #GNUNET_OK to continue to iterate 67 */ 68 #ifndef TALER_AUDITORDB_EARLY_AGGREGATIONS_RESULT_CLOSURE 69 /** 70 * Type of the closure for #TALER_AUDITORDB_EarlyAggregationsCallback. 71 */ 72 #define TALER_AUDITORDB_EARLY_AGGREGATIONS_RESULT_CLOSURE void 73 #endif 74 typedef enum GNUNET_GenericReturnValue 75 (*TALER_AUDITORDB_EarlyAggregationsCallback)( 76 TALER_AUDITORDB_EARLY_AGGREGATIONS_RESULT_CLOSURE *cls, 77 const struct TALER_AUDITORDB_EarlyAggregation *ea); 78 79 80 /** 81 * Returns all aggregations that were found that were done 82 * too early. 83 * 84 * @param pg the database context 85 * @param limit number of rows to return, negative to iterate backwards 86 * @param offset starting offset, exclusive 87 * @param return_suppressed true to also return suppressed events 88 * @param cb function to call with results 89 * @param cb_cls closure for @a cb 90 * @return transaction status 91 */ 92 enum GNUNET_DB_QueryStatus 93 TALER_AUDITORDB_select_early_aggregations ( 94 struct TALER_AUDITORDB_PostgresContext *pg, 95 int64_t limit, 96 uint64_t offset, 97 bool return_suppressed, 98 TALER_AUDITORDB_EarlyAggregationsCallback cb, 99 TALER_AUDITORDB_EARLY_AGGREGATIONS_RESULT_CLOSURE *cb_cls); 100 101 102 #endif