exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

select_purse_requests_above_serial_id.h (4859B)


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