select_early_aggregations.h (2558B)
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 typedef enum GNUNET_GenericReturnValue 69 (*TALER_AUDITORDB_EarlyAggregationsCallback)( 70 void *cls, 71 const struct TALER_AUDITORDB_EarlyAggregation *ea); 72 73 74 /** 75 * Returns all aggregations that were found that were done 76 * too early. 77 * 78 * @param pg the database context 79 * @param limit number of rows to return, negative to iterate backwards 80 * @param offset starting offset, exclusive 81 * @param return_suppressed true to also return suppressed events 82 * @param cb function to call with results 83 * @param cb_cls closure for @a cb 84 * @return transaction status 85 */ 86 enum GNUNET_DB_QueryStatus 87 TALER_AUDITORDB_select_early_aggregations ( 88 struct TALER_AUDITORDB_PostgresContext *pg, 89 int64_t limit, 90 uint64_t offset, 91 bool return_suppressed, 92 TALER_AUDITORDB_EarlyAggregationsCallback cb, 93 void *cb_cls); 94 95 96 #endif