select_purse_requests_above_serial_id.h (4479B)
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 select_purse_requests_above_serial_id.h 18 * @brief implementation of the select_purse_requests_above_serial_id function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_SELECT_PURSE_REQUESTS_ABOVE_SERIAL_ID_H 22 #define EXCHANGE_DATABASE_SELECT_PURSE_REQUESTS_ABOVE_SERIAL_ID_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 purse requests. 31 * 32 * @param cls closure 33 * @param rowid purse request table row of the purse 34 * @param purse_pub public key of the purse 35 * @param merge_pub public key representing the merge capability 36 * @param purse_creation when was the purse created? 37 * @param purse_expiration when would an unmerged purse expire 38 * @param h_contract_terms contract associated with the purse 39 * @param age_limit the age limit for deposits into the purse 40 * @param target_amount amount to be put into the purse 41 * @param purse_sig signature of the purse over the initialization data 42 * @return #GNUNET_OK to continue to iterate 43 */ 44 typedef enum GNUNET_GenericReturnValue 45 (*TALER_EXCHANGEDB_PurseRequestCallback)( 46 void *cls, 47 uint64_t rowid, 48 const struct TALER_PurseContractPublicKeyP *purse_pub, 49 const struct TALER_PurseMergePublicKeyP *merge_pub, 50 struct GNUNET_TIME_Timestamp purse_creation, 51 struct GNUNET_TIME_Timestamp purse_expiration, 52 const struct TALER_PrivateContractHashP *h_contract_terms, 53 uint32_t age_limit, 54 const struct TALER_Amount *target_amount, 55 const struct TALER_PurseContractSignatureP *purse_sig); 56 57 58 /* Callback typedefs */ 59 /** 60 * Function called on purse requests. 61 * 62 * @param cls closure 63 * @param rowid purse request table row of the purse 64 * @param purse_pub public key of the purse 65 * @param merge_pub public key representing the merge capability 66 * @param purse_creation when was the purse created? 67 * @param purse_expiration when would an unmerged purse expire 68 * @param h_contract_terms contract associated with the purse 69 * @param age_limit the age limit for deposits into the purse 70 * @param target_amount amount to be put into the purse 71 * @param purse_sig signature of the purse over the initialization data 72 * @return #GNUNET_OK to continue to iterate 73 */ 74 typedef enum GNUNET_GenericReturnValue 75 (*TALER_EXCHANGEDB_PurseRequestCallback)( 76 void *cls, 77 uint64_t rowid, 78 const struct TALER_PurseContractPublicKeyP *purse_pub, 79 const struct TALER_PurseMergePublicKeyP *merge_pub, 80 struct GNUNET_TIME_Timestamp purse_creation, 81 struct GNUNET_TIME_Timestamp purse_expiration, 82 const struct TALER_PrivateContractHashP *h_contract_terms, 83 uint32_t age_limit, 84 const struct TALER_Amount *target_amount, 85 const struct TALER_PurseContractSignatureP *purse_sig); 86 87 /** 88 * Select purse requestss deposits above @a serial_id in monotonically increasing 89 * order. 90 * 91 * @param pg the database context 92 * @param serial_id highest serial ID to exclude (select strictly larger) 93 * @param cb function to call on each result 94 * @param cb_cls closure for @a cb 95 * @return transaction status code 96 */ 97 enum GNUNET_DB_QueryStatus 98 TALER_TALER_EXCHANGEDB_select_purse_requests_above_serial_id (struct 99 TALER_EXCHANGEDB_PostgresContext 100 * 101 pg, 102 uint64_t serial_id 103 , 104 TALER_EXCHANGEDB_PurseRequestCallback 105 cb, 106 void *cb_cls); 107 108 109 #endif