exchange/src/exchangedb/perf_taler_exchangedb_interpreter.h

1245 lines
32 KiB
C
Raw Normal View History

2015-06-09 17:35:33 +02:00
/*
This file is part of TALER
2016-01-19 14:39:00 +01:00
Copyright (C) 2014, 2015 GNUnet e.V.
2015-06-09 17:35:33 +02:00
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/
/**
2016-03-01 15:35:04 +01:00
* @file exchangedb/perf_taler_exchangedb_interpreter.h
* @brief Library for performance analysis of the Taler database
2015-06-09 17:35:33 +02:00
* @author Nicolas Fournier
2015-07-07 11:59:55 +02:00
*
* This library contains functions and macro alowing Taler performance analysis
* to be written with ease.
2016-03-01 15:35:04 +01:00
* To do so, create a #PERF_TALER_EXCHANGEDB_Cmd array and fill it with the commands
2015-07-07 11:59:55 +02:00
* to execute in chronological order. Some command have an exposed variable wich
* can be reused in other commands.
* Macros are available to make the use much easier so feel free to use them
2015-07-07 11:59:55 +02:00
* to initialize your own command array.
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#ifndef __PERF_TALER_EXCHANGEDB_INTERPRETER_H__
#define __PERF_TALER_EXCHANGEDB_INTERPRETER_H__
#include <sys/time.h>
2016-03-01 15:35:04 +01:00
#include "taler_exchangedb_plugin.h"
2015-07-01 18:14:28 +02:00
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_NB_DENOMINATION_INIT 10
#define PERF_TALER_EXCHANGEDB_NB_DENOMINATION_SAVE 10
2015-07-01 18:14:28 +02:00
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_NB_RESERVE_INIT 100
#define PERF_TALER_EXCHANGEDB_NB_RESERVE_SAVE 10
2015-07-01 18:14:28 +02:00
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_NB_DEPOSIT_INIT 100
#define PERF_TALER_EXCHANGEDB_NB_DEPOSIT_SAVE 10
2015-07-01 18:14:28 +02:00
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_NB_WITHDRAW_INIT 100
#define PERF_TALER_EXCHANGEDB_NB_WITHDRAW_SAVE 10
2015-07-01 18:14:28 +02:00
2015-06-09 17:35:33 +02:00
/**
* Marks the end of the command chain
2015-07-01 18:14:28 +02:00
*
* @param _label The label of the command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_END(_label) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_END, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE \
2015-06-11 15:55:46 +02:00
}
/**
2015-06-30 09:23:04 +02:00
* Prints @ _label to stdout
*
2015-07-01 18:14:28 +02:00
* @param _label The label of the command,
* will be logged each time the command runs
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_DEBUG(_label) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_DEBUG, \
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE \
}
2015-06-09 17:35:33 +02:00
/**
* The begining of a loop
*
2015-07-01 18:14:28 +02:00
* @param _label the label of the loop
* @param _iter the number of iterations of the loop
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_LOOP(_label, _iter) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_LOOP , \
2015-06-11 15:55:46 +02:00
.label = _label , \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE , \
2015-06-11 15:55:46 +02:00
.details.loop = { \
.max_iterations = _iter , \
.curr_iteration = 0 } \
2015-06-11 15:55:46 +02:00
}
2015-06-09 17:35:33 +02:00
/**
* Marks the end of the loop @_label_loop
*
2015-07-01 18:14:28 +02:00
* @param _label the label of the command
* @param _label_loop the label of the loop closed by this command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_END_LOOP(_label, _label_loop) \
2015-06-11 15:55:46 +02:00
{\
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_END_LOOP , \
2015-06-11 15:55:46 +02:00
.label = _label , \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE , \
2015-06-11 15:55:46 +02:00
.details.end_loop.label_loop = _label_loop \
}
2015-06-09 17:35:33 +02:00
/**
* Saves the time of execution to use for logging with Gauger
2015-07-01 18:14:28 +02:00
*
* @param _label the label of the command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_TIME(_label) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_TIME, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_TIME \
2015-06-11 15:55:46 +02:00
}
2015-06-09 17:35:33 +02:00
/**
* Commits the duration between @a _label_start and @a _label_stop
* to Gauger with @a _description explaining what was measured.
*
* @param _label the label of this command
2015-06-30 09:23:04 +02:00
* @param _label_start label of the start of the measurment
* @param _label_stop label of the end of the measurment
* @param _description description of the measure displayed in Gauger
2015-07-06 11:10:47 +02:00
* @param _unit the unit of the data measured, typicly something/sec
* @param _divide number of measurments in the interval
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, _category, _description, _unit, _divide) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GAUGER, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-06-11 15:55:46 +02:00
.details.gauger = { \
.label_start = _label_start, \
.label_stop = _label_stop, \
2015-07-20 14:38:50 +02:00
.category = _category, \
.description = _description, \
2015-07-06 14:58:20 +02:00
.unit = _unit, \
.divide = _divide, \
2015-06-11 15:55:46 +02:00
} \
}
2015-06-09 17:35:33 +02:00
/**
* Initiate a database transaction
*
2015-07-01 18:14:28 +02:00
* @param _label the label of the command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_START_TRANSACTION(_label) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-06-11 15:55:46 +02:00
}
2015-06-09 17:35:33 +02:00
/**
* Commits a database transaction
*
2015-07-01 18:14:28 +02:00
* @param _label the label of the command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_COMMIT_TRANSACTION(_label) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-06-11 15:55:46 +02:00
}
/**
2015-07-01 18:14:28 +02:00
* Abort the current transaction
*
* @param _label the label of the command
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_ABORT_TRANSACTION(_label) \
2015-07-01 18:14:28 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION, \
2015-07-01 18:14:28 +02:00
.label = _label,
/**
* Saves randomly selected items from @a _label_save
2016-03-01 15:35:04 +01:00
* Saved items can latter be access using #PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY
*
2015-07-01 18:14:28 +02:00
* @param _label the label of the command, used by other commands to reference it
* @param _label_loop the label of the loop the array iterates over
* @param _label_save the label of the command which outout is saved by this command
2015-07-17 16:23:12 +02:00
* @param _nb_saved the total number of items to be saved
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_SAVE_ARRAY(_label, _label_loop, _label_save, _nb_saved) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY, \
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
.details.save_array = { \
.label_loop = _label_loop, \
.label_save = _label_save, \
.nb_saved = _nb_saved, \
} \
}
/**
2016-03-01 15:35:04 +01:00
* Loads data from a #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY to allow other
2015-07-01 18:14:28 +02:00
* commands to access it
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command, referenced by commands to access it's outpout
* @param _label_loop the label of the loop to iterate over
2016-03-01 15:35:04 +01:00
* @param _label_save the label of the #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY providing data
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_LOAD_ARRAY(_label, _label_loop, _label_save) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY, \
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
.details.load_array = { \
.label_loop = _label_loop, \
.label_save = _label_save \
} \
}
2015-06-30 09:23:04 +02:00
2015-06-09 17:35:33 +02:00
/**
2015-08-10 15:11:02 +02:00
* Create a denomination key to use
2016-03-01 15:35:04 +01:00
* Exposes a #PERF_TALER_EXCHANGEDB_DENOMINATION_INFO to be used by other commands
* @exposed #PERF_TALER_EXCHANGEDB_DENOMINATION_INFO
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DENOMINATION(_label) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_DENOMINATION_INFO, \
2015-06-11 15:55:46 +02:00
}
2015-08-10 15:11:02 +02:00
/**
* Inserts informations about a denomination key in the database
*
* @param _label the label of this command
* @param _label_denom the label of the denomination to insert
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DENOMINATION(_label, _label_denom) \
2015-08-10 15:11:02 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION, \
2015-08-10 15:11:02 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.insert_denomination.label_denom = _label_denom, \
}
2015-06-09 17:35:33 +02:00
/**
2015-06-30 09:23:04 +02:00
* Polls the database about informations regarding a specific denomination key
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command
2015-07-17 16:23:12 +02:00
* @param _label_denom the label of the command providing information about the denomination key
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DENOMINATION(_label, _label_denom) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.get_denomination.label_denom = _label_denom \
2015-06-11 15:55:46 +02:00
}
2015-06-09 17:35:33 +02:00
/**
2015-08-10 15:11:02 +02:00
* Create a reserve to be used later
2016-03-01 15:35:04 +01:00
* Exposes a #PERF_TALER_EXCHANGEDB_RESERVE
*
2015-08-10 15:11:02 +02:00
* @param _label the label of the command
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_RESERVE(_label) \
2015-08-10 15:11:02 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE, \
2015-08-10 15:11:02 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_RESERVE \
2015-08-10 15:11:02 +02:00
}
/**
* Insert a new reserve in the database containing 1000 Euros
*
2015-07-01 18:14:28 +02:00
* @param _label the name of this command
2015-08-10 15:11:02 +02:00
* @param _label_reserve the label of the reserve to insert
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_RESERVE(_label, _label_reserve) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE, \
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.insert_reserve.label_reserve = _label_reserve \
}
/**
* Polls the database for a secific reserve's details
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command
2015-07-17 16:23:12 +02:00
* @param _label_reserve the reserve to poll
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE(_label, _label_reserve) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-07-07 11:59:55 +02:00
.details.get_reserve.label_reserve = _label_reserve \
}
/**
* Polls the database for the history of a reserve
*
* @param _label the label of the command
* @param _label_reserve the reserve to examine
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY(_label, _label_reserve) \
2015-07-07 11:59:55 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY, \
2015-07-07 11:59:55 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-07-07 11:59:55 +02:00
.details.get_reserve_history.label_reserve = _label_reserve \
2015-06-11 15:55:46 +02:00
}
2015-06-09 17:35:33 +02:00
/**
2015-08-10 15:11:02 +02:00
* Creates a coin to be used later
2015-07-07 11:59:55 +02:00
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command
2015-08-10 15:11:02 +02:00
* @param _label_dki denomination key used to sign the coin
* @param _label_reserve reserve used to emmit the coin
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW(_label, _label_dki, _label_reserve) \
2015-06-11 15:55:46 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW, \
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_COIN, \
2015-08-10 15:11:02 +02:00
.details.create_withdraw = {\
.label_dki = _label_dki, \
.label_reserve = _label_reserve, \
} \
2015-06-30 09:23:04 +02:00
}
/**
2015-08-10 15:11:02 +02:00
* Inserts informations about a withdrawal in the database
*
2016-03-01 15:35:04 +01:00
* @exposes #PERF_TALER_EXCHANGEDB_COIN
2015-07-01 18:14:28 +02:00
*
* @param _label the label of this command
2015-08-10 15:11:02 +02:00
* @param _label_coin the coin to insert
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW(_label, _label_coin) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW, \
2015-06-11 15:55:46 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.insert_withdraw.label_coin = _label_coin\
2015-06-11 15:55:46 +02:00
}
2015-06-30 09:23:04 +02:00
2015-07-23 16:10:49 +02:00
/**
2015-08-10 15:11:02 +02:00
* Polls the database about informations regarding a specific withdrawal
2015-07-23 16:10:49 +02:00
*
2015-08-10 15:11:02 +02:00
* @param _label the label of this command
* @param _label_coin the coin to check
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_WITHDRAW(_label, _label_coin) \
2015-07-23 16:10:49 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW, \
2015-07-23 16:10:49 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.get_withdraw.label_coin = _label_coin, \
2015-07-23 16:10:49 +02:00
}
2015-08-03 10:26:52 +02:00
/**
2015-09-19 22:08:49 +02:00
* The /reserve/withdraw api call
2015-08-10 15:11:02 +02:00
*
2016-03-01 15:35:04 +01:00
* Exposes #PERF_TALER_EXCHANGEDB_COIN
2015-08-10 15:11:02 +02:00
*
* @param _label the label of this command
* @param _label_dki the denomination of the created coin
* @param _label_reserve the reserve used to provide currency
2015-08-03 10:26:52 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_WITHDRAW_SIGN(_label, _label_dki, _label_reserve) \
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_WITHDRAW (_label "withdraw", \
2015-08-10 15:11:02 +02:00
_label_dki, \
_label_reserve), \
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DENOMINATION(_label "withdraw info", \
2015-08-25 18:28:54 +02:00
_label_dki), \
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_RESERVE_HISTORY(_label "reserve_history", \
2015-08-10 15:11:02 +02:00
_label_reserve), \
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_WITHDRAW(_label "insert withdraw", \
2015-08-10 15:11:02 +02:00
_label "withdraw")
2015-08-03 10:26:52 +02:00
/**
2015-08-10 15:11:02 +02:00
* Create a deposit for use later
2016-03-01 15:35:04 +01:00
* @exposes #PERF_TALER_EXCHANGEDB_DEPOSIT
2015-07-07 11:59:55 +02:00
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command
2015-08-10 15:11:02 +02:00
* @param _label_coin the coin used to pay
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DEPOSIT(_label, _label_coin) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT, \
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_DEPOSIT, \
2015-08-10 15:11:02 +02:00
.details.create_deposit.label_coin = _label_coin, \
}
/**
2015-08-10 15:11:02 +02:00
* Insert a deposit into the database
*
2015-07-01 18:14:28 +02:00
* @param _label the label of this command
2015-08-10 15:11:02 +02:00
* @param _label_deposit the deposit inseerted
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_deposit) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT,\
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.insert_deposit.label_deposit = _label_deposit, \
}
2015-07-07 11:59:55 +02:00
/**
2015-08-10 15:11:02 +02:00
* Check if a deposit is in the database
2015-07-07 11:59:55 +02:00
*
* @param _label the label of this command
2015-08-10 15:11:02 +02:00
* @param _label_deposit the deposit to use
2015-07-07 11:59:55 +02:00
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
2015-08-10 15:11:02 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT, \
2015-08-10 15:11:02 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.get_deposit.label_deposit = _label_deposit \
}
2015-08-10 15:11:02 +02:00
/**
* Access the transaction history of a coin
*
* @param _label the label of the command
* @param _label_coin the coin which history is checked
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_COIN_TRANSACTION(_label, _label_coin) \
2015-08-10 15:11:02 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION, \
2015-08-10 15:11:02 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE, \
2015-08-10 15:11:02 +02:00
.details.get_coin_transaction.label_coin = _label_coin \
}
2015-07-07 11:59:55 +02:00
2015-07-23 16:10:49 +02:00
/**
* The /deposit api call
*
2015-07-23 16:10:49 +02:00
* @param _label the label of the command
* @param _label_coin the coin used for the deposit
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_DEPOSIT(_label, _label_coin) \
PERF_TALER_EXCHANGEDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \
2015-07-23 16:10:49 +02:00
_label_coin), \
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_DEPOSIT (_label "deposit", \
2015-08-10 15:11:02 +02:00
_label_coin), \
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_INIT_CMD_INSERT_DEPOSIT (_label "insert", \
2015-08-10 15:11:02 +02:00
_label "deposit")
2015-08-10 18:12:27 +02:00
/**
* Insert informations about a refresh session
* melts one coin into another
*
* @param _label the label of the command
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_CREATE_REFRESH_SESSION(_label) \
2015-08-10 18:12:27 +02:00
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION, \
2015-08-10 18:12:27 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_REFRESH_HASH \
2015-08-10 18:12:27 +02:00
}
/**
* Get informations about a refresh session
2016-05-02 01:30:13 +02:00
*
2015-08-10 18:12:27 +02:00
* @param _label the label of the command
* @param _label_hash the label of the hash to search
*/
2016-03-01 15:35:04 +01:00
#define PERF_TALER_EXCHANGEDB_INIT_CMD_GET_REFRESH_SESSION(_label, \
2015-08-10 18:12:27 +02:00
_label_hash) \
{ \
2016-03-01 15:35:04 +01:00
.command = PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION, \
2015-08-10 18:12:27 +02:00
.label = _label, \
2016-03-01 15:35:04 +01:00
.exposed.type = PERF_TALER_EXCHANGEDB_NONE \
2015-08-10 18:12:27 +02:00
}
2015-07-23 16:10:49 +02:00
2015-06-09 17:35:33 +02:00
/**
2016-03-01 15:35:04 +01:00
* The type of data stored in #PERF_TALER_EXCHANGEDB_Memory
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
enum PERF_TALER_EXCHANGEDB_Type
2015-06-09 17:35:33 +02:00
{
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_NONE,
PERF_TALER_EXCHANGEDB_TIME,
PERF_TALER_EXCHANGEDB_DENOMINATION_INFO,
PERF_TALER_EXCHANGEDB_RESERVE,
PERF_TALER_EXCHANGEDB_COIN,
PERF_TALER_EXCHANGEDB_DEPOSIT,
PERF_TALER_EXCHANGEDB_REFRESH_HASH
};
/**
2015-07-01 18:14:28 +02:00
* Structure used to handle several data type
2015-07-01 10:14:51 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_Data
2015-07-01 10:14:51 +02:00
{
2016-03-01 15:35:04 +01:00
enum PERF_TALER_EXCHANGEDB_Type type;
2015-07-01 18:14:28 +02:00
/**
* Storage for a variety of data type
2015-07-06 11:10:47 +02:00
* The data saved should match #type
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
union PERF_TALER_EXCHANGEDB_Memory
2015-07-01 18:14:28 +02:00
{
2016-03-01 15:35:04 +01:00
/** #PERF_TALER_EXCHANGEDB_TIME */
2015-07-17 16:23:12 +02:00
struct GNUNET_TIME_Absolute *time;
2016-03-01 15:35:04 +01:00
/** #PERF_TALER_EXCHANGEDB_DEPOSIT */
struct TALER_EXCHANGEDB_Deposit *deposit;
/** #PERF_TALER_EXCHANGEDB_COIN */
struct PERF_TALER_EXCHANGEDB_Coin *coin;
/** #PERF_TALER_EXCHANGEDB_RESERVE */
struct PERF_TALER_EXCHANGEDB_Reserve *reserve;
/** #PERF_TALER_EXCHANGEDB_DENOMINATION_INFO */
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki;
/** #PERF_TALER_EXCHANGEDB_REFRESH_HASH */
2015-08-10 18:12:27 +02:00
struct GNUNET_HashCode *session_hash;
2015-07-01 18:14:28 +02:00
} data;
2015-07-01 10:14:51 +02:00
};
2015-06-09 17:35:33 +02:00
/**
* Name of the command
*/
2016-03-01 15:35:04 +01:00
enum PERF_TALER_EXCHANGEDB_CMD_Name
2015-06-09 17:35:33 +02:00
{
/**
* All comand chain must hace this as their last command
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_END,
/**
* Prints it's label
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_DEBUG,
/**
2015-07-01 18:14:28 +02:00
* Define the start of al command chain loop
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_LOOP,
2015-07-01 18:14:28 +02:00
/**
* Define the end of a command chain loop
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_END_LOOP,
2015-07-01 18:14:28 +02:00
/**
* Save the time at which the command was executed
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_TIME,
2015-07-01 18:14:28 +02:00
/**
* Upload performance to Gauger
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GAUGER,
2015-07-01 18:14:28 +02:00
/**
* Start a new session
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_NEW_SESSION,
2015-06-11 15:55:46 +02:00
2015-07-01 18:14:28 +02:00
/**
* Start a database transaction
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION,
2015-07-01 18:14:28 +02:00
/**
* End a database transaction
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_COMMIT_TRANSACTION,
2015-07-01 18:14:28 +02:00
/**
2016-03-01 15:35:04 +01:00
* Abort a transaction started with #PERF_TALER_EXCHANGEDB_CMD_START_TRANSACTION
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_ABORT_TRANSACTION,
2015-06-11 15:55:46 +02:00
2015-07-01 18:14:28 +02:00
/**
* Saves random deposits from a loop
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY,
2015-07-01 18:14:28 +02:00
/**
2016-03-01 15:35:04 +01:00
* Load items saved earlier in a #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY
2015-07-06 11:10:47 +02:00
* The items are loaded in a random order, but all of them will be loaded
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY,
2015-07-06 11:10:47 +02:00
/**
2016-03-01 15:35:04 +01:00
* Loads a random item from a #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY
2015-07-06 11:10:47 +02:00
* A random item is loaded each time the command is run
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_LOAD_RANDOM,
2015-07-06 11:10:47 +02:00
2015-07-01 18:14:28 +02:00
/**
2015-08-10 15:11:02 +02:00
* Create a denomination to be used later
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_CREATE_DENOMINATION,
2015-07-01 18:14:28 +02:00
/**
2015-08-10 15:11:02 +02:00
* Insert informations about a denomination key in the database
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION,
2015-08-10 15:11:02 +02:00
/**
* Polls the database for informations about a specific denomination key
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION,
2015-08-10 15:11:02 +02:00
/**
* Create a reserve to be used later
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_CREATE_RESERVE,
2015-07-01 18:14:28 +02:00
/**
* Insert currency in a reserve / Create a reserve
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE,
2015-07-01 18:14:28 +02:00
/**
* Get Informations about a reserve
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE,
2015-07-07 11:59:55 +02:00
/**
* Get the history of a reserve
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY,
2015-07-07 11:59:55 +02:00
2015-08-10 15:11:02 +02:00
/**
* Create a withdrawal to be used later
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW,
2015-08-10 15:11:02 +02:00
2015-07-01 18:14:28 +02:00
/**
* Insert informations about a withdrawal in the database
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW,
2015-07-01 18:14:28 +02:00
/**
* Pulls informations about a withdrawal from the database
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW,
2015-07-01 18:14:28 +02:00
/**
2015-08-10 15:11:02 +02:00
* Get the list of all transactions the coin has been in
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION,
2015-07-01 18:14:28 +02:00
/**
2015-08-10 15:11:02 +02:00
* Create a deposit to be used later
2015-07-01 18:14:28 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT,
2015-06-09 17:35:33 +02:00
/**
2015-08-10 15:11:02 +02:00
* Insert a deposit into the database
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT,
2015-08-10 15:11:02 +02:00
/**
* Check if a deposit is in the database
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT,
2015-07-15 11:43:31 +02:00
/**
* Create a refresh session
2015-07-27 15:56:01 +02:00
* The number of melted coins is 1,
2016-03-01 15:35:04 +01:00
* The number of exchangeed coins is 1
2015-07-15 11:43:31 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_CREATE_REFRESH_SESSION,
2015-07-15 11:43:31 +02:00
/**
* Get a refresh session informations
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION,
2015-07-15 11:43:31 +02:00
/**
* Insert a melt refresh order
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_ORDER,
2015-07-15 11:43:31 +02:00
/**
* Get informations about a refresh order
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_ORDER,
2015-07-15 11:43:31 +02:00
/**
* Insert refresh commit coin
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_COMMIT_COIN,
2015-07-15 11:43:31 +02:00
/**
* Get refresh commit coin
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_COMMIT_COIN,
2015-07-15 11:43:31 +02:00
/**
* Insert refresh commit link
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_COMMIT_LINK,
2015-07-15 11:43:31 +02:00
/**
* Get refresh commit link
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_COMMIT_LINK,
2015-07-15 11:43:31 +02:00
/**
* Get information avout the melt commit
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_MELT_COMMITMENT,
2015-07-15 11:43:31 +02:00
/**
2015-07-23 16:10:49 +02:00
* Insert a new coin into the database after a melt operation
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_OUT,
2015-07-23 16:10:49 +02:00
/**
* Get the link data list of a coin
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_LINK_DATA_LIST,
2015-07-23 16:10:49 +02:00
/**
* Get the shared secret and the transfere public key
2015-07-15 11:43:31 +02:00
*/
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_CMD_GET_TRANSFER
2015-07-23 16:10:49 +02:00
2015-06-09 17:35:33 +02:00
};
2015-06-09 17:35:33 +02:00
/**
2015-07-01 18:14:28 +02:00
* Contains extra data required for any command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
union PERF_TALER_EXCHANGEDB_CMD_Details
2015-06-09 17:35:33 +02:00
{
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered for the #PERF_TALER_EXCHANGEDB_CMD_LOOP command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_loopDetails
2015-07-01 18:14:28 +02:00
{
/**
* Maximum number of iteration in the loop
2015-07-01 18:14:28 +02:00
*/
const unsigned int max_iterations;
2015-07-28 14:07:12 +02:00
2015-07-01 18:14:28 +02:00
/**
* The current iteration of the loop
*/
unsigned int curr_iteration;
} loop;
2015-06-11 15:55:46 +02:00
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered by the #PERF_TALER_EXCHANGEDB_CMD_END_LOOP command
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_endLoopDetails
2015-07-01 18:14:28 +02:00
{
/**
* Label of the loop closed by the command
*/
const char *label_loop;
2015-07-28 14:07:12 +02:00
unsigned int index_loop;
2015-07-01 18:14:28 +02:00
} end_loop;
2015-06-09 17:35:33 +02:00
/**
2016-03-01 15:35:04 +01:00
* Details about the #PERF_TALER_EXCHANGEDB_CMD_GAUGER command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_gaugerDetails
2015-07-01 18:14:28 +02:00
{
/**
* Label of the starting timestamp
*/
const char *label_start;
2015-07-28 14:07:12 +02:00
unsigned int index_start;
2015-07-01 18:14:28 +02:00
/**
* Label of the ending timestamp
*/
const char *label_stop;
2015-07-28 14:07:12 +02:00
unsigned int index_stop;
2015-07-01 18:14:28 +02:00
2015-07-20 14:38:50 +02:00
/**
* The category of the measurment
*/
const char *category;
2015-07-01 18:14:28 +02:00
/**
* Description of the metric, used in Gauger
*/
const char *description;
2015-07-06 11:10:47 +02:00
/**
* The name of the metric beeing used
*/
const char *unit;
2015-07-01 18:14:28 +02:00
/**
* Constant the result needs to be divided by
* to get the result per unit
*/
float divide;
} gauger;
2015-06-09 17:35:33 +02:00
/**
2016-03-01 15:35:04 +01:00
* Contains extra data requiered by the #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_saveArrayDetails
2015-07-01 18:14:28 +02:00
{
/**
* Number of items to save
*/
unsigned int nb_saved;
2015-07-28 14:07:12 +02:00
2015-07-01 18:14:28 +02:00
/**
* Number of items already saved
*/
unsigned int index;
2015-07-01 18:14:28 +02:00
/**
* Label of the loop it is attached to
*/
const char *label_loop;
2015-07-28 14:07:12 +02:00
unsigned int index_loop;
2015-07-01 18:14:28 +02:00
/**
* Label of the command exposing the item
*/
const char *label_save;
2015-07-28 14:07:12 +02:00
unsigned int index_save;
2015-07-01 18:14:28 +02:00
/**
* Array of data saved
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_Data *data_saved;
/**
* Type of the data that will be stored in @a data_saved, for
* 'static' type checking.
*/
2016-03-01 15:35:04 +01:00
enum PERF_TALER_EXCHANGEDB_Type type_saved;
2015-07-01 18:14:28 +02:00
} save_array;
2015-06-11 15:55:46 +02:00
2015-06-09 17:35:33 +02:00
/**
2016-03-01 15:35:04 +01:00
* Extra data required for the #PERF_TALER_EXCHANGEDB_CMD_LOAD_ARRAY command
2015-06-09 17:35:33 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_loadArrayDetails
2015-07-01 18:14:28 +02:00
{
/**
* The loop in which the command is located
*/
const char *label_loop;
2015-07-28 14:07:12 +02:00
unsigned int index_loop;
2015-07-01 18:14:28 +02:00
/**
* Label of the command where the items were saved
*/
const char *label_save;
2015-07-28 14:07:12 +02:00
unsigned int index_save;
2015-06-11 15:55:46 +02:00
2015-07-01 18:14:28 +02:00
/**
* A permutation array used to randomize the order the items are loaded in
*/
unsigned int *permutation;
} load_array;
2015-07-06 11:10:47 +02:00
/**
2016-03-01 15:35:04 +01:00
* Contains data for the #PERF_TALER_EXCHANGEDB_CMD_LOAD_RANDOM command
2015-07-06 11:10:47 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_loadRandomDetails
2015-07-06 11:10:47 +02:00
{
/**
2016-03-01 15:35:04 +01:00
* The label of the #PERF_TALER_EXCHANGEDB_CMD_SAVE_ARRAY the items will be extracted from
2015-07-06 11:10:47 +02:00
*/
const char *label_save;
2015-07-28 14:07:12 +02:00
unsigned int index_save;
2015-07-06 11:10:47 +02:00
} load_random;
2015-06-11 15:55:46 +02:00
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered by the #PERF_TALER_EXCHANGEDB_CMD_INSERT_DENOMINATION command
2015-06-11 15:55:46 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertDenominationDetails
2015-07-01 18:14:28 +02:00
{
/**
2015-08-10 15:11:02 +02:00
* The label of the source of the denomination to insert
2015-07-01 18:14:28 +02:00
*/
2015-08-10 15:11:02 +02:00
const char *label_denom;
unsigned int index_denom;
2016-05-02 01:30:13 +02:00
} insert_denomination;
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered by the #PERF_TALER_EXCHANGEDB_CMD_GET_DENOMINATION command
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getDenominationDetails
2015-07-01 18:14:28 +02:00
{
/**
2015-08-10 15:11:02 +02:00
* The label of the source of the denomination to check
2015-07-01 18:14:28 +02:00
*/
2015-08-10 15:11:02 +02:00
const char *label_denom;
unsigned int index_denom;
} get_denomination;
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered for the #PERF_TALER_EXCHANGEDB_CMD_INSERT_RESERVE command
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertReserveDetails
2015-07-01 18:14:28 +02:00
{
/**
2015-08-10 15:11:02 +02:00
* The label of the source of the reserve to insert
2015-07-01 18:14:28 +02:00
*/
2015-07-07 11:59:55 +02:00
const char *label_reserve;
2015-07-28 14:07:12 +02:00
unsigned int index_reserve;
2015-08-10 15:11:02 +02:00
} insert_reserve;
2015-07-07 11:59:55 +02:00
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE command
2015-07-07 11:59:55 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getReserveDetails
2015-07-07 11:59:55 +02:00
{
/**
* The label of the source of the reserve to check
*/
const char *label_reserve;
2015-07-28 14:07:12 +02:00
unsigned int index_reserve;
2015-08-10 15:11:02 +02:00
} get_reserve;
2015-07-07 11:59:55 +02:00
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_RESERVE_HISTORY command
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getReserveHistoryDetails
2015-07-01 18:14:28 +02:00
{
/**
2015-08-10 15:11:02 +02:00
* The label of the source of the reserve to check
2015-07-01 18:14:28 +02:00
*/
2015-08-10 15:11:02 +02:00
const char *label_reserve;
unsigned int index_reserve;
} get_reserve_history;
/**
2016-03-01 15:35:04 +01:00
* Extra data related to the #PERF_TALER_EXCHANGEDB_CMD_CREATE_WITHDRAW command
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_createWithdrawDetails
2015-07-01 18:14:28 +02:00
{
/**
* label of the denomination key used to sign the coin
*/
const char *label_dki;
2015-07-28 14:07:12 +02:00
unsigned int index_dki;
2015-07-01 18:14:28 +02:00
/**
2016-03-01 15:35:04 +01:00
* label of the reserve the money to exchange the coin comes from
2015-07-01 18:14:28 +02:00
*/
const char *label_reserve;
2015-07-28 14:07:12 +02:00
unsigned int index_reserve;
2015-08-10 15:11:02 +02:00
} create_withdraw;
/**
2016-03-01 15:35:04 +01:00
* data requiered for the #PERF_TALER_EXCHANGEDB_CMD_INSERT_WITHDRAW
2015-08-10 15:11:02 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertWithdrawDetails
2015-08-10 15:11:02 +02:00
{
/**
* label of the source for the coin information
*/
const char *label_coin;
unsigned int index_coin;
2015-07-01 18:14:28 +02:00
} insert_withdraw;
2015-07-06 11:10:47 +02:00
/**
2016-03-01 15:35:04 +01:00
* data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_WITHDRAW
2015-07-06 11:10:47 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getWithdraw
2015-07-06 11:10:47 +02:00
{
/**
2015-07-07 11:59:55 +02:00
* label of the source for the coin information
2015-07-06 11:10:47 +02:00
*/
2015-07-07 11:59:55 +02:00
const char *label_coin;
2015-07-28 14:07:12 +02:00
unsigned int index_coin;
2015-07-06 11:10:47 +02:00
} get_withdraw;
2015-07-17 16:23:12 +02:00
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_COIN_TRANSACTION command
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getCoinTransactionDetails
2015-07-17 16:23:12 +02:00
{
/**
* The coin which history is checked
*/
const char *label_coin;
2015-07-28 14:07:12 +02:00
unsigned int index_coin;
2015-07-17 16:23:12 +02:00
} get_coin_transaction;
/**
2016-03-01 15:35:04 +01:00
* Data used by the #PERF_TALER_EXCHANGEDB_CMD_CREATE_DEPOSIT command
2015-08-10 15:11:02 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_createDepositDetails
2015-08-10 15:11:02 +02:00
{
/**
* Label of the source where the reserve used to create the coin is
*/
const char *label_coin;
unsigned int index_coin;
} create_deposit;
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered for the #PERF_TALER_EXCHANGEDB_CMD_INSERT_DEPOSIT command
2015-08-10 15:11:02 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertDepositDetails
2015-08-10 15:11:02 +02:00
{
/**
* The label of the source of the deposit to check
*/
const char *label_deposit;
unsigned int index_deposit;
} insert_deposit;
/**
2016-03-01 15:35:04 +01:00
* Extra data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_DEPOSIT command
2015-08-10 15:11:02 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getDepositDetails
2015-08-10 15:11:02 +02:00
{
/**
* The label of the source of the deposit to check
*/
const char *label_deposit;
unsigned int index_deposit;
} get_deposit;
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_SESSION command
2015-07-17 16:23:12 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getRefreshSessionDetails
2015-07-17 16:23:12 +02:00
{
/**
* label of the source of the hash of the session
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-17 16:23:12 +02:00
} get_refresh_session;
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_ORDER command
2015-07-17 16:23:12 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertRefreshOrderDetails
2015-07-17 16:23:12 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
/**
* The new coin denomination
*/
const char *label_denom;
2015-07-28 14:07:12 +02:00
unsigned int index_denom;
2015-07-17 16:23:12 +02:00
} insert_refresh_order;
2015-07-23 16:10:49 +02:00
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_ORDER command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getRefreshOrderDetails
2015-07-23 16:10:49 +02:00
{
/**
* The session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
} get_refresh_order;
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_COMMIT_COIN command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertRefreshCommitCoinDetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-27 15:56:01 +02:00
2015-07-23 16:10:49 +02:00
} insert_refresh_commit_coin;
2015-08-17 10:56:56 +02:00
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_COMMIT_COIN command
2015-08-17 10:56:56 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getRefreshCommitCoinDetails
2015-08-17 10:56:56 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
unsigned int index_hash;
} get_refresh_commit_coin;
2015-07-23 16:10:49 +02:00
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_COMMIT_LINK command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertRefreshCommitLinkDetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
} insert_refresh_commit_link;
/**
2016-03-01 15:35:04 +01:00
* Data requiered by the #PERF_TALER_EXCHANGEDB_CMD_GET_REFRESH_COMMIT_LINK command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getRefreshCommitLinkDetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
} get_refresh_commit_link;
/**
2016-03-01 15:35:04 +01:00
* Data requiered for the #PERF_TALER_EXCHANGEDB_CMD_GET_MELT_COMMITMENT command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getMeltCommitmentDaetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
} get_melt_commitment;
/**
2016-03-01 15:35:04 +01:00
* Data requiered by the #PERF_TALER_EXCHANGEDB_CMD_INSERT_REFRESH_OUT command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_insertRefreshOutDetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
} insert_refresh_out;
/**
2016-03-01 15:35:04 +01:00
* Data requiered by the #PERF_TALER_EXCHANGEDB_CMD_GET_LINK_DATA_LIST command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getLinkDataListDetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-08-17 10:56:56 +02:00
} get_link_data_list;
2015-07-23 16:10:49 +02:00
/**
2016-03-01 15:35:04 +01:00
* Data requiered by the #PERF_TALER_EXCHANGEDB_CMD_GET_TRANSFER command
2015-07-23 16:10:49 +02:00
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_CMD_getTransferDetails
2015-07-23 16:10:49 +02:00
{
/**
* The refresh session hash
*/
const char *label_hash;
2015-07-28 14:07:12 +02:00
unsigned int index_hash;
2015-07-23 16:10:49 +02:00
} get_transfer;
2015-06-09 17:35:33 +02:00
};
2015-06-09 17:35:33 +02:00
/**
* Command to be interpreted.
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_Cmd
2015-06-09 17:35:33 +02:00
{
2015-06-11 15:55:46 +02:00
/**
* Type of the command
*/
2016-03-01 15:35:04 +01:00
enum PERF_TALER_EXCHANGEDB_CMD_Name command;
2015-06-09 17:35:33 +02:00
/**
* Label to refer to the command
*/
const char *label;
/**
* Command specific data
*/
2016-03-01 15:35:04 +01:00
union PERF_TALER_EXCHANGEDB_CMD_Details details;
2015-06-09 17:35:33 +02:00
/**
* Data easily accessible
*/
2016-03-01 15:35:04 +01:00
struct PERF_TALER_EXCHANGEDB_Data exposed;
};
2015-07-01 18:14:28 +02:00
/**
2015-07-23 16:10:49 +02:00
* Run a benchmark
2015-07-01 18:14:28 +02:00
*
* @param benchmark_name the name of the benchmark, displayed in the logs
* @param configuration_file path to the taler configuration file to use
* @param init the commands to use for the database initialisation,
2015-07-01 18:14:28 +02:00
* if #NULL the standard initialization is used
* @param benchmark the commands for the benchmark
2016-05-02 01:30:13 +02:00
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure,
* #GNUNET_NO if we failed to init the database
2015-07-01 18:14:28 +02:00
*/
int
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_run_benchmark (const char *benchmark_name,
2016-05-02 01:30:13 +02:00
const char *configuration_file,
struct PERF_TALER_EXCHANGEDB_Cmd *init,
struct PERF_TALER_EXCHANGEDB_Cmd *benchmark);
2015-07-01 18:14:28 +02:00
2015-06-12 11:14:32 +02:00
/**
* Runs the command array @a cmd
* using @a db_plugin to connect to the database
*
2015-07-01 18:14:28 +02:00
* @param db_plugin the connection to the database
* @param cmd the commands to run
2015-06-12 11:14:32 +02:00
*/
int
2016-05-02 01:30:13 +02:00
PERF_TALER_EXCHANGEDB_interpret(struct TALER_EXCHANGEDB_Plugin *db_plugin,
struct PERF_TALER_EXCHANGEDB_Cmd cmd[]);
2015-07-06 11:10:47 +02:00
/**
* Check if the given command array is syntaxicly correct
* This will check if the label are corrects but will not check if
* they are pointing to an apropriate command.
*
* @param cmd the command array to check
* @return #GNUNET_OK is @a cmd is correct; #GNUNET_SYSERR if it is'nt
*/
int
2016-03-01 15:35:04 +01:00
PERF_TALER_EXCHANGEDB_check (const struct PERF_TALER_EXCHANGEDB_Cmd *cmd);
2015-07-06 11:10:47 +02:00
#endif