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 (3618B)


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