exchange

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

select_reserve_open_above_serial_id.h (4161B)


      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_reserve_open_above_serial_id.h
     18  * @brief implementation of the select_reserve_open_above_serial_id function
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_RESERVE_OPEN_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_RESERVE_OPEN_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 about reserve opening operations.
     31  *
     32  * @param cls closure
     33  * @param rowid row identifier used to uniquely identify the reserve closing operation
     34  * @param reserve_payment how much to pay from the
     35  *        reserve's own balance for opening the reserve
     36  * @param request_timestamp when was the request created
     37  * @param reserve_expiration desired expiration time for the reserve
     38  * @param purse_limit minimum number of purses the client
     39  *       wants to have concurrently open for this reserve
     40  * @param reserve_pub public key of the reserve
     41  * @param reserve_sig signature affirming the operation
     42  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     43  */
     44 typedef enum GNUNET_GenericReturnValue
     45 (*TALER_EXCHANGEDB_ReserveOpenCallback)(
     46   void *cls,
     47   uint64_t rowid,
     48   const struct TALER_Amount *reserve_payment,
     49   struct GNUNET_TIME_Timestamp request_timestamp,
     50   struct GNUNET_TIME_Timestamp reserve_expiration,
     51   uint32_t purse_limit,
     52   const struct TALER_ReservePublicKeyP *reserve_pub,
     53   const struct TALER_ReserveSignatureP *reserve_sig);
     54 
     55 
     56 /* Callback typedefs */
     57 /**
     58  * Function called about reserve opening operations.
     59  *
     60  * @param cls closure
     61  * @param rowid row identifier used to uniquely identify the reserve closing operation
     62  * @param reserve_payment how much to pay from the
     63  *        reserve's own balance for opening the reserve
     64  * @param request_timestamp when was the request created
     65  * @param reserve_expiration desired expiration time for the reserve
     66  * @param purse_limit minimum number of purses the client
     67  *       wants to have concurrently open for this reserve
     68  * @param reserve_pub public key of the reserve
     69  * @param reserve_sig signature affirming the operation
     70  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     71  */
     72 typedef enum GNUNET_GenericReturnValue
     73 (*TALER_EXCHANGEDB_ReserveOpenCallback)(
     74   void *cls,
     75   uint64_t rowid,
     76   const struct TALER_Amount *reserve_payment,
     77   struct GNUNET_TIME_Timestamp request_timestamp,
     78   struct GNUNET_TIME_Timestamp reserve_expiration,
     79   uint32_t purse_limit,
     80   const struct TALER_ReservePublicKeyP *reserve_pub,
     81   const struct TALER_ReserveSignatureP *reserve_sig);
     82 
     83 /**
     84  * Function called to select reserve open operations, ordered by serial ID
     85  * (monotonically increasing).
     86  *
     87  * @param pg the database context
     88  * @param serial_id lowest serial ID to include (select larger or equal)
     89  * @param cb function to call for ONE unfinished item
     90  * @param cb_cls closure for @a cb
     91  * @return transaction status code
     92  */
     93 enum GNUNET_DB_QueryStatus
     94 TALER_EXCHANGEDB_select_reserve_open_above_serial_id (struct
     95                                                       TALER_EXCHANGEDB_PostgresContext
     96                                                       *pg,
     97                                                       uint64_t serial_id,
     98                                                       TALER_EXCHANGEDB_ReserveOpenCallback
     99                                                       cb,
    100                                                       void *cb_cls);
    101 
    102 
    103 #endif