2015-06-09 17:35:33 +02:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
|
|
|
Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
|
|
|
|
|
|
|
|
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/>
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file mintdb/perf_taler_mintdb_interpreter.h
|
2015-07-01 14:11:54 +02:00
|
|
|
* @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.
|
|
|
|
* To do so, create a #PERF_TALER_MINTDB_Cmd array and fill it with the commands
|
|
|
|
* 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
|
|
|
|
* to initialize your own command array.
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
|
|
|
|
2015-06-09 13:03:37 +02:00
|
|
|
#ifndef __PERF_TALER_MINTDB_INTERPRETER_H__
|
|
|
|
#define __PERF_TALER_MINTDB_INTERPRETER_H__
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
2015-06-12 11:14:32 +02:00
|
|
|
#include "taler_mintdb_plugin.h"
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
|
|
|
|
#define PERF_TALER_MINTDB_NB_DENOMINATION_INIT 10
|
|
|
|
#define PERF_TALER_MINTDB_NB_DENOMINATION_SAVE 10
|
|
|
|
|
|
|
|
#define PERF_TALER_MINTDB_NB_RESERVE_INIT 100
|
|
|
|
#define PERF_TALER_MINTDB_NB_RESERVE_SAVE 10
|
|
|
|
|
|
|
|
#define PERF_TALER_MINTDB_NB_DEPOSIT_INIT 100
|
|
|
|
#define PERF_TALER_MINTDB_NB_DEPOSIT_SAVE 10
|
|
|
|
|
|
|
|
#define PERF_TALER_MINTDB_NB_WITHDRAW_INIT 100
|
|
|
|
#define PERF_TALER_MINTDB_NB_WITHDRAW_SAVE 10
|
|
|
|
|
|
|
|
|
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
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_END(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_END, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-12 15:28:49 +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
|
2015-06-12 15:28:49 +02:00
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_DEBUG(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_DEBUG, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE \
|
2015-06-12 15:28:49 +02:00
|
|
|
}
|
2015-06-26 15:32:20 +02:00
|
|
|
|
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
|
2015-07-01 14:11:54 +02:00
|
|
|
* @param _iter the number of iterations of the loop
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_LOOP(_label, _iter) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_LOOP , \
|
|
|
|
.label = _label , \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE , \
|
2015-06-11 15:55:46 +02:00
|
|
|
.details.loop = { \
|
|
|
|
.max_iterations = _iter , \
|
2015-06-24 10:55:57 +02:00
|
|
|
.curr_iteration = 0 } \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +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
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_END_LOOP(_label, _label_loop) \
|
|
|
|
{\
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_END_LOOP , \
|
|
|
|
.label = _label , \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE , \
|
2015-06-11 15:55:46 +02:00
|
|
|
.details.end_loop.label_loop = _label_loop \
|
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-01 14:11:54 +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
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_TIME(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_TIME, \
|
|
|
|
.label = _label, \
|
2015-07-01 14:11:54 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Commits the duration between @a _label_start and @a _label_stop
|
2015-07-01 14:11:54 +02:00
|
|
|
* to Gauger with @a _description explaining what was measured.
|
|
|
|
*
|
2015-07-06 15:54:48 +02:00
|
|
|
* @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
|
2015-07-01 14:11:54 +02:00
|
|
|
* @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
|
2015-07-06 15:54:48 +02:00
|
|
|
* @param _divide number of measurments in the interval
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-20 14:38:50 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, _category, _description, _unit, _divide) \
|
2015-06-11 15:55:46 +02:00
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_GAUGER, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-06-11 15:55:46 +02:00
|
|
|
.details.gauger = { \
|
|
|
|
.label_start = _label_start, \
|
2015-06-24 10:55:57 +02:00
|
|
|
.label_stop = _label_stop, \
|
2015-07-20 14:38:50 +02:00
|
|
|
.category = _category, \
|
2015-06-24 10:55:57 +02:00
|
|
|
.description = _description, \
|
2015-07-06 14:58:20 +02:00
|
|
|
.unit = _unit, \
|
2015-06-24 10:55:57 +02:00
|
|
|
.divide = _divide, \
|
2015-06-11 15:55:46 +02:00
|
|
|
} \
|
|
|
|
}
|
2015-06-09 13:03:37 +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
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_START_TRANSACTION, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-01 14:11:54 +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
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_COMMIT_TRANSACTION, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Abort the current transaction
|
|
|
|
*
|
|
|
|
* @param _label the label of the command
|
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_ABORT_TRANSACTION(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_ABORT_TRANSACTION, \
|
|
|
|
.label = _label,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves randomly selected items from @a _label_save
|
|
|
|
* Saved items can latter be access using #PERF_TALER_MINTDB_CMD_LOAD_ARRAY
|
|
|
|
*
|
|
|
|
* @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
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-06-30 18:18:31 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY(_label, _label_loop, _label_save, _nb_saved) \
|
2015-06-22 14:46:19 +02:00
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_SAVE_ARRAY, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-06-22 14:46:19 +02:00
|
|
|
.details.save_array = { \
|
|
|
|
.label_loop = _label_loop, \
|
|
|
|
.label_save = _label_save, \
|
|
|
|
.nb_saved = _nb_saved, \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Loads data from a #PERF_TALER_MINTDB_CMD_SAVE_ARRAY to allow other
|
|
|
|
* commands to access it
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
* @param _label_save the label of the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY providing data
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY(_label, _label_loop, _label_save) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_LOAD_ARRAY, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-06-22 14:46:19 +02:00
|
|
|
.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-06-30 09:23:04 +02:00
|
|
|
* Inserts informations about a denomination key in the database
|
2015-07-17 16:23:12 +02:00
|
|
|
* Exposes a #PERF_TALER_MINTDB_DENOMINATION_INFO to be used by other commands
|
2015-07-07 11:59:55 +02:00
|
|
|
* @exposed #PERF_TALER_MINTDB_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
|
|
|
*/
|
2015-06-30 09:23:04 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION(_label) \
|
2015-06-11 15:55:46 +02:00
|
|
|
{ \
|
2015-06-30 09:23:04 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION, \
|
2015-06-11 15:55:46 +02:00
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_DENOMINATION_INFO, \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
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
|
|
|
*/
|
2015-07-07 11:59:55 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_DENOMINATION(_label, _label_denom) \
|
2015-06-11 15:55:46 +02:00
|
|
|
{ \
|
2015-06-30 09:23:04 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_DENOMINATION, \
|
2015-06-11 15:55:46 +02:00
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-07-07 11:59:55 +02:00
|
|
|
.details.get_denomination.label_denom = _label_denom, \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-17 16:23:12 +02:00
|
|
|
* Creates a new reserve in the database containing 1000 Euros
|
|
|
|
* Exposes a #PERF_TALER_MINTDB_RESERVE
|
2015-07-01 18:14:28 +02:00
|
|
|
*
|
2015-07-07 11:59:55 +02:00
|
|
|
* @exposed #PERF_TALER_MINTDB_RESERVE
|
|
|
|
*
|
2015-07-01 18:14:28 +02:00
|
|
|
* @param _label the name of this command
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE(_label) \
|
2015-06-11 15:55:46 +02:00
|
|
|
{ \
|
2015-06-26 15:32:20 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_INSERT_RESERVE, \
|
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_RESERVE \
|
2015-06-22 14:46:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-07-07 11:59:55 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE(_label, _label_reserve) \
|
2015-06-22 14:46:19 +02:00
|
|
|
{ \
|
2015-06-26 15:32:20 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_RESERVE, \
|
2015-06-11 15:55:46 +02:00
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_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
|
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY(_label, _label_reserve) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY, \
|
|
|
|
.label = _label, \
|
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
.details.get_reserve_history.label_reserve = _label_reserve \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-06-30 09:23:04 +02:00
|
|
|
* Insert a deposit into the database
|
2015-07-01 18:14:28 +02:00
|
|
|
*
|
2015-07-07 11:59:55 +02:00
|
|
|
* @exposes #PERF_TALER_MINTDB_DEPOSIT
|
|
|
|
*
|
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_coin the coin used to pay
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-15 18:06:50 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_coin) \
|
2015-06-11 15:55:46 +02:00
|
|
|
{ \
|
2015-06-30 09:23:04 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,\
|
2015-06-22 14:46:19 +02:00
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_DEPOSIT, \
|
2015-07-15 18:06:50 +02:00
|
|
|
.details.insert_deposit.label_coin = _label_coin, \
|
2015-06-30 09:23:04 +02:00
|
|
|
}
|
2015-06-22 14:46:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-30 09:23:04 +02:00
|
|
|
* Check if a deposit is in the database
|
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_deposit the deposit to use
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-06-30 09:23:04 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
|
2015-06-22 14:46:19 +02:00
|
|
|
{ \
|
2015-06-30 09:23:04 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_DEPOSIT, \
|
2015-06-11 15:55:46 +02:00
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-07-07 11:59:55 +02:00
|
|
|
.details.get_deposit.label_deposit = _label_deposit \
|
2015-06-11 15:55:46 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-30 09:23:04 +02:00
|
|
|
|
2015-07-23 16:10:49 +02:00
|
|
|
/**
|
|
|
|
* Access the transactioj history of a coin
|
|
|
|
*
|
|
|
|
* @param _label the label of the command
|
|
|
|
* @param _label_coin the coin which history is checked
|
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION(_label, _label_coin) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION, \
|
|
|
|
.label = _label, \
|
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
.details.get_coin_trancaction.label_coin = _label_coin \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
/**
|
2015-06-30 09:23:04 +02:00
|
|
|
* Inserts informations about a withdrawal in the database
|
2015-07-01 18:14:28 +02:00
|
|
|
*
|
2015-07-15 17:46:49 +02:00
|
|
|
* @exposes #PERF_TALER_MINTDB_COIN
|
2015-07-07 11:59:55 +02:00
|
|
|
*
|
2015-07-01 18:14:28 +02:00
|
|
|
* @param _label the label of this command
|
2015-06-30 09:23:04 +02:00
|
|
|
* @param _label_dki denomination key used to sign the coin
|
|
|
|
* @param _label_reserve reserve used to emmit the coin
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-06-30 09:23:04 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label, _label_dki, _label_reserve) \
|
2015-06-22 14:46:19 +02:00
|
|
|
{ \
|
2015-06-30 09:23:04 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW, \
|
2015-06-22 14:46:19 +02:00
|
|
|
.label = _label, \
|
2015-07-15 17:46:49 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_COIN, \
|
2015-06-30 09:23:04 +02:00
|
|
|
.details.insert_withdraw = {\
|
|
|
|
.label_dki = _label_dki, \
|
|
|
|
.label_reserve = _label_reserve, \
|
|
|
|
} \
|
2015-06-22 14:46:19 +02:00
|
|
|
}
|
|
|
|
|
2015-06-30 09:23:04 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
/**
|
2015-07-01 14:11:54 +02:00
|
|
|
* Polls the database about informations regarding a specific withdrawal
|
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_coin the coin to check
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-07-07 11:59:55 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_WITHDRAW(_label, _label_coin) \
|
2015-06-22 14:46:19 +02:00
|
|
|
{ \
|
2015-06-30 09:23:04 +02:00
|
|
|
.command = PERF_TALER_MINTDB_CMD_GET_WITHDRAW, \
|
2015-06-22 14:46:19 +02:00
|
|
|
.label = _label, \
|
2015-07-01 10:14:51 +02:00
|
|
|
.exposed.type = PERF_TALER_MINTDB_NONE, \
|
2015-07-07 11:59:55 +02:00
|
|
|
.details.get_withdraw.label_coin = _label_coin, \
|
2015-06-22 14:46:19 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
|
|
|
|
2015-07-07 11:59:55 +02:00
|
|
|
/**
|
2015-07-17 16:23:12 +02:00
|
|
|
* The /withdraw/sign api call
|
|
|
|
*
|
|
|
|
* Exposes #PERF_TALER_MINTDB_COIN
|
2015-07-07 11:59:55 +02:00
|
|
|
*
|
|
|
|
* @param _label the label of this command
|
|
|
|
* @param _label_dki the denomination of the created coin
|
2015-07-17 16:23:12 +02:00
|
|
|
* @param _label_reserve the reserve used to provide currency
|
2015-07-07 11:59:55 +02:00
|
|
|
*/
|
2015-07-17 16:23:12 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN(_label, _label_dki, _label_reserve) \
|
2015-07-23 16:10:49 +02:00
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY(_label "reserve_history", \
|
|
|
|
_label_reserve), \
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label "insert withdraw", \
|
|
|
|
_label_dki, \
|
|
|
|
_label_reserve),
|
2015-07-07 11:59:55 +02:00
|
|
|
|
|
|
|
|
2015-07-23 16:10:49 +02:00
|
|
|
/**
|
|
|
|
* The /deposit api call
|
|
|
|
*
|
|
|
|
* @param _label the label of the command
|
|
|
|
* @param _label_coin the coin used for the deposit
|
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_deposit(_label, _label_coin) \
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \
|
|
|
|
_label_coin), \
|
|
|
|
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "deposit", \
|
|
|
|
_label_coin),
|
|
|
|
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* The type of data stored in #PERF_TALER_MINTDB_Memory
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-01 14:11:54 +02:00
|
|
|
enum PERF_TALER_MINTDB_Type
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
PERF_TALER_MINTDB_NONE,
|
|
|
|
PERF_TALER_MINTDB_TIME,
|
2015-06-12 15:28:49 +02:00
|
|
|
PERF_TALER_MINTDB_DEPOSIT,
|
2015-07-15 17:46:49 +02:00
|
|
|
PERF_TALER_MINTDB_COIN,
|
2015-06-17 15:15:10 +02:00
|
|
|
PERF_TALER_MINTDB_RESERVE,
|
|
|
|
PERF_TALER_MINTDB_DENOMINATION_INFO,
|
2015-07-17 16:23:12 +02:00
|
|
|
PERF_TALER_MINTDB_REFRESH_HASH
|
2015-06-09 13:03:37 +02:00
|
|
|
};
|
|
|
|
|
2015-06-10 14:59:14 +02:00
|
|
|
|
2015-06-09 13:03:37 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Structure used to handle several data type
|
2015-07-01 10:14:51 +02:00
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_Data
|
|
|
|
{
|
|
|
|
enum PERF_TALER_MINTDB_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
|
|
|
*/
|
|
|
|
union PERF_TALER_MINTDB_Memory
|
|
|
|
{
|
|
|
|
/** #PERF_TALER_MINTDB_TIME */
|
2015-07-17 16:23:12 +02:00
|
|
|
struct GNUNET_TIME_Absolute *time;
|
2015-07-01 18:14:28 +02:00
|
|
|
/** #PERF_TALER_MINTDB_DEPOSIT */
|
|
|
|
struct TALER_MINTDB_Deposit *deposit;
|
2015-07-15 17:46:49 +02:00
|
|
|
/** #PERF_TALER_MINTDB_COIN */
|
|
|
|
struct PERF_TALER_MINTDB_Coin *coin;
|
2015-07-01 18:14:28 +02:00
|
|
|
/** #PERF_TALER_MINTDB_RESERVE */
|
2015-07-15 16:28:12 +02:00
|
|
|
struct PERF_TALER_MINTDB_Reserve *reserve;
|
2015-07-01 18:14:28 +02:00
|
|
|
/** #PERF_TALER_MINTDB_DENOMINATION_INFO */
|
|
|
|
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
|
2015-07-17 16:23:12 +02:00
|
|
|
/** #PERF_TALER_MINTDB_REFRESH_HASH */
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
enum PERF_TALER_MINTDB_CMD_Name
|
|
|
|
{
|
2015-07-01 14:11:54 +02:00
|
|
|
/**
|
|
|
|
* All comand chain must hace this as their last command
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_END,
|
2015-07-01 14:11:54 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints it's label
|
|
|
|
*/
|
2015-06-12 15:28:49 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_DEBUG,
|
2015-06-17 15:15:10 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Define the start of al command chain loop
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_LOOP,
|
2015-07-01 14:11:54 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Define the end of a command chain loop
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_END_LOOP,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Save the time at which the command was executed
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_TIME,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Upload performance to Gauger
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GAUGER,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Start a new session
|
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_NEW_SESSION,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Start a database transaction
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_START_TRANSACTION,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* End a database transaction
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_COMMIT_TRANSACTION,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
2015-07-06 11:10:47 +02:00
|
|
|
* Abort a transaction started with #PERF_TALER_MINTDB_CMD_START_TRANSACTION
|
2015-07-01 18:14:28 +02:00
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_ABORT_TRANSACTION,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Saves random deposits from a loop
|
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_SAVE_ARRAY,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
2015-07-06 11:10:47 +02:00
|
|
|
* Load items saved earlier in a #PERF_TALER_MINTDB_CMD_SAVE_ARRAY
|
|
|
|
* The items are loaded in a random order, but all of them will be loaded
|
2015-07-01 18:14:28 +02:00
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_LOAD_ARRAY,
|
2015-07-01 14:11:54 +02:00
|
|
|
|
2015-07-06 11:10:47 +02:00
|
|
|
/**
|
|
|
|
* Loads a random item from a #PERF_TALER_MINTDB_CMD_SAVE_ARRAY
|
|
|
|
* A random item is loaded each time the command is run
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_LOAD_RANDOM,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Insert a deposit into the database
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Check if a deposit is in the database
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_DEPOSIT,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Insert currency in a reserve / Create a reserve
|
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_RESERVE,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Get Informations about a reserve
|
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_RESERVE,
|
|
|
|
|
2015-07-07 11:59:55 +02:00
|
|
|
/**
|
|
|
|
* Get the history of a reserve
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Insert informations about a withdrawal in the database
|
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Pulls informations about a withdrawal from the database
|
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_WITHDRAW,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Insert informations about a denomination key in the database
|
|
|
|
*/
|
2015-06-22 14:46:19 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION,
|
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Polls the database for informations about a specific denomination key
|
|
|
|
*/
|
2015-06-24 10:55:57 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_DENOMINATION,
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-15 11:43:31 +02:00
|
|
|
* Get the list of all transactions the coin has been in
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-15 11:43:31 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a refresh session
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_CREATE_REFRESH_SESSION,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a refresh session informations
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert a refresh melt
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get informations about a refresh melt operation
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert a melt refresh order
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_REFRESH_ORDER,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get informations about a refresh order
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_REFRESH_ORDER,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert refresh commit coin
|
|
|
|
*/
|
2015-07-23 16:10:49 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_COIN,
|
2015-07-15 11:43:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get refresh commit coin
|
|
|
|
*/
|
2015-07-23 16:10:49 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_COIN,
|
2015-07-15 11:43:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert refresh commit link
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_LINK,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get refresh commit link
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_LINK,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get information avout the melt commit
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_MELT_COMMITMENT,
|
|
|
|
|
|
|
|
/**
|
2015-07-23 16:10:49 +02:00
|
|
|
* Insert a new coin into the database after a melt operation
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_REFRESH_OUT,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the link data list of a coin
|
|
|
|
*/
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_LINK_DATA_LIST,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the shared secret and the transfere public key
|
2015-07-15 11:43:31 +02:00
|
|
|
*/
|
2015-07-23 16:10:49 +02:00
|
|
|
PERF_TALER_MINTDB_CMD_GET_TRANSFER
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
};
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-10 14:59:14 +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
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
union PERF_TALER_MINTDB_CMD_Details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_LOOP command
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_loopDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Maximum number of iteration in the loop
|
|
|
|
*/
|
|
|
|
const unsigned int max_iterations;
|
|
|
|
/**
|
|
|
|
* The current iteration of the loop
|
|
|
|
*/
|
|
|
|
unsigned int curr_iteration;
|
|
|
|
} loop;
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-24 10:55:57 +02:00
|
|
|
|
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data requiered by the #PERF_TALER_MINTDB_CMD_END_LOOP command
|
2015-06-24 10:55:57 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_endLoopDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Label of the loop closed by the command
|
|
|
|
*/
|
|
|
|
const char *label_loop;
|
|
|
|
} end_loop;
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-10 14:59:14 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Details about the #PERF_TALER_MINTDB_CMD_GAUGER command
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-06 11:10:47 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_gaugerDetails
|
2015-07-01 18:14:28 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Label of the starting timestamp
|
|
|
|
*/
|
|
|
|
const char *label_start;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Label of the ending timestamp
|
|
|
|
*/
|
|
|
|
const char *label_stop;
|
|
|
|
|
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 13:03:37 +02:00
|
|
|
|
2015-06-10 14:59:14 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Contains extra data requiered by the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY command
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_saveArrayDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Number of items to save
|
|
|
|
*/
|
|
|
|
unsigned int nb_saved;
|
|
|
|
/**
|
|
|
|
* Number of items already saved
|
|
|
|
*/
|
|
|
|
unsigned int index;
|
|
|
|
/**
|
|
|
|
* Label of the loop it is attached to
|
|
|
|
*/
|
|
|
|
const char *label_loop;
|
|
|
|
/**
|
|
|
|
* Label of the command exposing the item
|
|
|
|
*/
|
|
|
|
const char *label_save;
|
|
|
|
/**
|
|
|
|
* Array of data saved
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_Data *data_saved;
|
|
|
|
} save_array;
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-07-01 14:11:54 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data required for the #PERF_TALER_MINTDB_CMD_LOAD_ARRAY command
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_loadArrayDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The loop in which the command is located
|
|
|
|
*/
|
|
|
|
const char *label_loop;
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-07-01 18:14:28 +02:00
|
|
|
/**
|
|
|
|
* Label of the command where the items were saved
|
|
|
|
*/
|
|
|
|
const char *label_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-06-26 15:32:20 +02:00
|
|
|
|
|
|
|
|
2015-07-06 11:10:47 +02:00
|
|
|
/**
|
|
|
|
* Contains data for the #PERF_TALER_MINTDB_CMD_LOAD_RANDOM command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_loadRandomDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY the items will be extracted from
|
|
|
|
*/
|
|
|
|
const char *label_save;
|
|
|
|
} load_random;
|
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Data used by the #PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT command
|
2015-06-11 15:55:46 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_insertDepositDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Label of the source where the reserve used to create the coin is
|
|
|
|
*/
|
2015-07-15 18:06:50 +02:00
|
|
|
const char *label_coin;
|
2015-07-01 18:14:28 +02:00
|
|
|
} insert_deposit;
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_DEPOSIT command
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_getDepositDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the source of the deposit to check
|
|
|
|
*/
|
2015-07-07 11:59:55 +02:00
|
|
|
const char *label_deposit;
|
2015-07-01 18:14:28 +02:00
|
|
|
} get_deposit;
|
2015-06-22 14:46:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_RESERVE command
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_getReserveDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the source of the reserve to check
|
|
|
|
*/
|
2015-07-07 11:59:55 +02:00
|
|
|
const char *label_reserve;
|
2015-07-01 18:14:28 +02:00
|
|
|
} get_reserve;
|
2015-06-22 14:46:19 +02:00
|
|
|
|
2015-06-24 10:55:57 +02:00
|
|
|
|
2015-07-07 11:59:55 +02:00
|
|
|
/**
|
|
|
|
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_RESERVE command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getReserveHistoryDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the source of the reserve to check
|
|
|
|
*/
|
|
|
|
const char *label_reserve;
|
|
|
|
} get_reserve_history;
|
|
|
|
|
|
|
|
|
2015-06-26 15:32:20 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data requiered by the #PERF_TALER_MINTDB_CMD_GET_DENOMINATION command
|
2015-06-26 15:32:20 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_getDenominationDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the source of the denomination to check
|
|
|
|
*/
|
2015-07-07 11:59:55 +02:00
|
|
|
const char *label_denom;
|
2015-07-01 18:14:28 +02:00
|
|
|
} get_denomination;
|
2015-06-26 15:32:20 +02:00
|
|
|
|
|
|
|
|
2015-06-24 10:55:57 +02:00
|
|
|
/**
|
2015-07-01 18:14:28 +02:00
|
|
|
* Extra data related to the #PERF_TALER_MINTDB_CMD_GET_WITHDRAW command
|
2015-06-24 10:55:57 +02:00
|
|
|
*/
|
2015-07-01 18:14:28 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_insertWithdrawDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* label of the denomination key used to sign the coin
|
|
|
|
*/
|
|
|
|
const char *label_dki;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* label of the reserve the money to mint the coin comes from
|
|
|
|
*/
|
|
|
|
const char *label_reserve;
|
|
|
|
} insert_withdraw;
|
2015-07-06 11:10:47 +02:00
|
|
|
|
|
|
|
/**
|
2015-07-17 16:23:12 +02:00
|
|
|
* data requiered for the #PERF_TALER_MINTDB_CMD_GET_WITHDRAW
|
2015-07-06 11:10:47 +02:00
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getWithdraw
|
|
|
|
{
|
|
|
|
/**
|
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-06 11:10:47 +02:00
|
|
|
} get_withdraw;
|
2015-07-17 16:23:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getCoinTransactionDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The coin which history is checked
|
|
|
|
*/
|
|
|
|
const char *label_coin;
|
|
|
|
} get_coin_transaction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getRefreshSessionDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* label of the source of the hash of the session
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} get_refresh_session;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_REFRESH_MELT command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insertRefreshMeltDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the hash of the refresh session
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The label of the coin to melt
|
|
|
|
*/
|
|
|
|
const char *label_coin;
|
|
|
|
} insert_refresh_melt;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_REFRESH_MELT command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getRefreshMeltDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the hash of the session
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} get_refresh_melt;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_REFRESH_ORDER command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insertRefreshOrderDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
2015-07-23 16:10:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The new coin denomination
|
|
|
|
*/
|
|
|
|
const char *label_denom;
|
2015-07-17 16:23:12 +02:00
|
|
|
} insert_refresh_order;
|
2015-07-23 16:10:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_REFRESH_ORDER command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getRefreshOrderDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
|
|
|
|
} get_refresh_order;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_COIN command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insertRefreshCommitCoinDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} insert_refresh_commit_coin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_REFRESH_COMMIT_LINK command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insertRefreshCommitLinkDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
|
|
|
|
} insert_refresh_commit_link;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered by the #PERF_TALER_MINTDB_CMD_GET_REFRESH_COMMIT_LINK command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTB_CMD_getRefreshCommitLinkDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} get_refresh_commit_link;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_MELT_COMMITMENT command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getMeltCommitmentDaetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} get_melt_commitment;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered by the #PERF_TALER_MINTDB_CMD_INSERT_REFRESH_OUT command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insertRefreshOutDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} insert_refresh_out;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered by the #PERF_TALER_MINTDB_CMD_GET_LINK_DATA_LIST command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getLinkDataListDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} get_link_datat_list;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data requiered by the #PERF_TALER_MINTDB_CMD_GET_TRANSFER command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_getTransferDetails
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The refresh session hash
|
|
|
|
*/
|
|
|
|
const char *label_hash;
|
|
|
|
} get_transfer;
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
};
|
2015-06-09 13:03:37 +02:00
|
|
|
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Command to be interpreted.
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_Cmd
|
|
|
|
{
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* Type of the command
|
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
enum PERF_TALER_MINTDB_CMD_Name command;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Label to refer to the command
|
|
|
|
*/
|
|
|
|
const char *label;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Command specific data
|
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
union PERF_TALER_MINTDB_CMD_Details details;
|
2015-06-09 17:35:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Data easily accessible
|
|
|
|
*/
|
2015-07-01 10:14:51 +02:00
|
|
|
struct PERF_TALER_MINTDB_Data exposed;
|
2015-06-09 13:03:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
* if #NULL the standard initialization is used
|
|
|
|
* @param benchmark the commands for the benchmark
|
|
|
|
* @return GNUNET_OK upon success; GNUNET_SYSERR upon failure
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
|
|
|
|
const char *configuration_file,
|
|
|
|
struct PERF_TALER_MINTDB_Cmd *init,
|
|
|
|
struct PERF_TALER_MINTDB_Cmd *benchmark);
|
|
|
|
|
|
|
|
|
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
|
|
|
*/
|
2015-06-09 13:03:37 +02:00
|
|
|
int
|
2015-06-09 17:35:33 +02:00
|
|
|
PERF_TALER_MINTDB_interpret(
|
2015-06-11 15:55:46 +02:00
|
|
|
struct TALER_MINTDB_Plugin *db_plugin,
|
|
|
|
struct PERF_TALER_MINTDB_Cmd cmd[]);
|
2015-06-09 13:03:37 +02:00
|
|
|
|
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
|
|
|
|
PERF_TALER_MINTDB_check (const struct PERF_TALER_MINTDB_Cmd *cmd);
|
|
|
|
|
2015-06-09 13:03:37 +02:00
|
|
|
#endif
|