exchange

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

select_coin_deposits_above_serial_id.h (3956B)


      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 src/include/exchange-database/select_coin_deposits_above_serial_id.h
     18  * @brief implementation of the select_coin_deposits_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_COIN_DEPOSITS_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_COIN_DEPOSITS_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 with details about deposits that have been made,
     31  * with the goal of auditing the deposit's execution.
     32  *
     33  * @param cls closure
     34  * @param rowid unique serial ID for the deposit in our DB
     35  * @param exchange_timestamp when did the deposit happen
     36  * @param deposit deposit details
     37  * @param denom_pub denomination public key of @a coin_pub
     38  * @param done flag set if the deposit was already executed (or not)
     39  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     40  */
     41 #ifndef TALER_EXCHANGEDB_DEPOSIT_RESULT_CLOSURE
     42 /**
     43  * Type of the closure for #TALER_EXCHANGEDB_DepositCallback.
     44  */
     45 #define TALER_EXCHANGEDB_DEPOSIT_RESULT_CLOSURE void
     46 #endif
     47 typedef enum GNUNET_GenericReturnValue
     48 (*TALER_EXCHANGEDB_DepositCallback)(
     49   TALER_EXCHANGEDB_DEPOSIT_RESULT_CLOSURE *cls,
     50   uint64_t rowid,
     51   struct GNUNET_TIME_Timestamp exchange_timestamp,
     52   const struct TALER_EXCHANGEDB_Deposit *deposit,
     53   const struct TALER_DenominationPublicKey *denom_pub,
     54   bool done);
     55 
     56 
     57 /* Callback typedefs */
     58 /**
     59  * Function called with details about deposits that have been made,
     60  * with the goal of auditing the deposit's execution.
     61  *
     62  * @param cls closure
     63  * @param rowid unique serial ID for the deposit in our DB
     64  * @param exchange_timestamp when did the deposit happen
     65  * @param deposit deposit details
     66  * @param denom_pub denomination public key of @a coin_pub
     67  * @param done flag set if the deposit was already executed (or not)
     68  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     69  */
     70 typedef enum GNUNET_GenericReturnValue
     71 (*TALER_EXCHANGEDB_DepositCallback)(
     72   TALER_EXCHANGEDB_DEPOSIT_RESULT_CLOSURE *cls,
     73   uint64_t rowid,
     74   struct GNUNET_TIME_Timestamp exchange_timestamp,
     75   const struct TALER_EXCHANGEDB_Deposit *deposit,
     76   const struct TALER_DenominationPublicKey *denom_pub,
     77   bool done);
     78 
     79 /**
     80  * Select deposits above @a serial_id in monotonically increasing
     81  * order.
     82  *
     83  * @param pg the database context
     84  * @param serial_id highest serial ID to exclude (select strictly larger)
     85  * @param cb function to call on each result
     86  * @param cb_cls closure for @a cb
     87  * @return transaction status code
     88  */
     89 enum GNUNET_DB_QueryStatus
     90 TALER_EXCHANGEDB_select_coin_deposits_above_serial_id (struct
     91                                                        TALER_EXCHANGEDB_PostgresContext
     92                                                        *pg
     93                                                        ,
     94                                                        uint64_t serial_id,
     95                                                        TALER_EXCHANGEDB_DepositCallback
     96                                                        cb,
     97                                                        TALER_EXCHANGEDB_DEPOSIT_RESULT_CLOSURE
     98                                                        *cb_cls);
     99 
    100 #endif