exchange

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

select_purse_decisions_above_serial_id.h (3829B)


      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_purse_decisions_above_serial_id.h
     18  * @brief implementation of the select_purse_decisions_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_PURSE_DECISIONS_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_PURSE_DECISIONS_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 purse decisions that have been made, with
     31  * the goal of auditing the purse's execution.
     32  *
     33  * @param cls closure
     34  * @param rowid unique serial ID for the deposit in our DB
     35  * @param purse_pub public key of the purse
     36  * @param reserve_pub public key of the target reserve, NULL if not known / refunded
     37  * @param purse_value what is the (target) value of the purse
     38  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     39  */
     40 typedef enum GNUNET_GenericReturnValue
     41 (*TALER_EXCHANGEDB_PurseDecisionCallback)(
     42   void *cls,
     43   uint64_t rowid,
     44   const struct TALER_PurseContractPublicKeyP *purse_pub,
     45   const struct TALER_ReservePublicKeyP *reserve_pub,
     46   const struct TALER_Amount *purse_value);
     47 
     48 
     49 /* Callback typedefs */
     50 /**
     51  * Function called with details about purse decisions that have been made, with
     52  * the goal of auditing the purse's execution.
     53  *
     54  * @param cls closure
     55  * @param rowid unique serial ID for the deposit in our DB
     56  * @param purse_pub public key of the purse
     57  * @param reserve_pub public key of the target reserve, NULL if not known / refunded
     58  * @param purse_value what is the (target) value of the purse
     59  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     60  */
     61 typedef enum GNUNET_GenericReturnValue
     62 (*TALER_EXCHANGEDB_PurseDecisionCallback)(
     63   void *cls,
     64   uint64_t rowid,
     65   const struct TALER_PurseContractPublicKeyP *purse_pub,
     66   const struct TALER_ReservePublicKeyP *reserve_pub,
     67   const struct TALER_Amount *purse_value);
     68 
     69 /**
     70  * Select purse decisions above @a serial_id in monotonically increasing
     71  * order.
     72  *
     73  * @param pg the database context
     74  * @param serial_id highest serial ID to exclude (select strictly larger)
     75  * @param refunded which refund status to select for
     76  * @param cb function to call on each result
     77  * @param cb_cls closure for @a cb
     78  * @return transaction status code
     79  */
     80 enum GNUNET_DB_QueryStatus
     81 TALER_TALER_EXCHANGEDB_select_purse_decisions_above_serial_id (struct
     82                                                                TALER_EXCHANGEDB_PostgresContext
     83                                                                *
     84                                                                pg,
     85                                                                uint64_t
     86                                                                serial_id,
     87                                                                bool refunded,
     88                                                                TALER_EXCHANGEDB_PurseDecisionCallback
     89                                                                cb,
     90                                                                void *cb_cls);
     91 
     92 #endif