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
|
|
|
|
* @brief Library for performance analysis of taler database
|
|
|
|
* @author Nicolas Fournier
|
|
|
|
*/
|
|
|
|
|
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-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Marks the end of the command chain
|
|
|
|
* @param _label
|
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_END(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_END, \
|
|
|
|
.label = _label, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE \
|
|
|
|
}
|
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-06-12 15:28:49 +02:00
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_DEBUG(_label) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_DEBUG, \
|
|
|
|
.label = _label, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE \
|
|
|
|
}
|
2015-06-26 15:32:20 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* The begining of a loop
|
|
|
|
* @param _label the name of the loop
|
|
|
|
* @param _iter the number of iteration of the loop
|
|
|
|
*/
|
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 , \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE , \
|
|
|
|
.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-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 , \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE , \
|
|
|
|
.details.end_loop.label_loop = _label_loop \
|
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Saves the time of execution to use for logging with gauger
|
|
|
|
*/
|
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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
}
|
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
|
|
|
|
* to Gauger with @a _description explaining
|
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
|
|
|
|
* @param _divide number of measurments in the interval
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-24 10:55:57 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GAUGER(_label, _label_start, _label_stop, _description, _divide) \
|
2015-06-11 15:55:46 +02:00
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_GAUGER, \
|
|
|
|
.label = _label, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
.details.gauger = { \
|
|
|
|
.label_start = _label_start, \
|
2015-06-24 10:55:57 +02:00
|
|
|
.label_stop = _label_stop, \
|
|
|
|
.description = _description, \
|
|
|
|
.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-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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Commits a database connection
|
|
|
|
*/
|
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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
/**
|
|
|
|
* Extracts @a _nb_saved items of type @a _save_type
|
|
|
|
* from the command @a _label_save during the loop @a _label_loop
|
|
|
|
*/
|
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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
|
|
|
.details.save_array = { \
|
|
|
|
.label_loop = _label_loop, \
|
|
|
|
.label_save = _label_save, \
|
|
|
|
.nb_saved = _nb_saved, \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads @a _nb_saved previously sampled data of type @a _saved_type
|
|
|
|
* from @a _label_save during the loop @a _label_loop
|
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY(_label, _label_loop, _label_save) \
|
|
|
|
{ \
|
|
|
|
.command = PERF_TALER_MINTDB_CMD_LOAD_ARRAY, \
|
|
|
|
.label = _label, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_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-06-30 09:23:04 +02:00
|
|
|
* Inserts informations about a denomination key in the database
|
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-06-30 09:23:04 +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-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-30 09:23:04 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_DENOMINATION(_label, _label_source) \
|
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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
2015-06-30 09:23:04 +02:00
|
|
|
.details.get_denomination.label_source = _label_source, \
|
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-22 14:46:19 +02:00
|
|
|
* Creates a new reserve in the database
|
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-06-22 14:46:19 +02:00
|
|
|
.exposed_type = PERF_TALER_MINTDB_RESERVE \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Polls the database for a secific reserve's details
|
|
|
|
* @param _label_source Source for the reserve to poll
|
|
|
|
*/
|
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE(_label, _label_source) \
|
|
|
|
{ \
|
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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
2015-06-22 14:46:19 +02:00
|
|
|
.details.get_reserve.label_source = _label_source \
|
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
|
|
|
|
* @param _label_dki source to use for the denomination key
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-30 09:23:04 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_dki) \
|
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-06-30 09:23:04 +02:00
|
|
|
.exposed_type = PERF_TALER_MINTDB_DEPOSIT, \
|
|
|
|
.details.insert_deposit.label_dki = _label_dki, \
|
|
|
|
}
|
2015-06-22 14:46:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-30 09:23:04 +02:00
|
|
|
* Check if a deposit is in the database
|
|
|
|
* @param _label_deposit Label of 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-06-12 15:28:49 +02:00
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
2015-06-30 09:23:04 +02:00
|
|
|
.details.get_deposit.label_source = _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-06-22 14:46:19 +02:00
|
|
|
/**
|
2015-06-30 09:23:04 +02:00
|
|
|
* Inserts informations about a withdrawal in the database
|
|
|
|
* @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-06-30 09:23:04 +02:00
|
|
|
.exposed_type = PERF_TALER_MINTDB_BLINDCOIN, \
|
|
|
|
.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-06-30 09:23:04 +02:00
|
|
|
* Polls the database about informations regarding a secific withdrawal
|
2015-06-22 14:46:19 +02:00
|
|
|
*/
|
2015-06-30 09:23:04 +02:00
|
|
|
#define PERF_TALER_MINTDB_INIT_CMD_GET_WITHDRAW(_label, _label_source) \
|
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, \
|
|
|
|
.exposed_type = PERF_TALER_MINTDB_NONE, \
|
2015-06-30 09:23:04 +02:00
|
|
|
.details.get_withdraw.label_source = _label_source, \
|
2015-06-22 14:46:19 +02:00
|
|
|
}
|
2015-06-09 13:03:37 +02:00
|
|
|
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* The type of data stored
|
2015-06-11 15:55:46 +02:00
|
|
|
* in a PERF_TALER_MINTDB_Type
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
|
|
|
enum PERF_TALER_MINTDB_Type
|
|
|
|
{
|
|
|
|
PERF_TALER_MINTDB_NONE,
|
|
|
|
PERF_TALER_MINTDB_TIME,
|
2015-06-12 15:28:49 +02:00
|
|
|
PERF_TALER_MINTDB_DEPOSIT,
|
2015-06-17 15:15:10 +02:00
|
|
|
PERF_TALER_MINTDB_BLINDCOIN,
|
|
|
|
PERF_TALER_MINTDB_RESERVE,
|
|
|
|
PERF_TALER_MINTDB_DENOMINATION_INFO,
|
|
|
|
PERF_TALER_MINTDB_COIN_INFO,
|
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-06-09 17:35:33 +02:00
|
|
|
* Storage for a variety of data type
|
2015-06-09 13:03:37 +02:00
|
|
|
*/
|
2015-06-09 17:35:33 +02:00
|
|
|
union PERF_TALER_MINTDB_Data
|
|
|
|
{
|
|
|
|
struct timespec time;
|
2015-06-22 14:46:19 +02:00
|
|
|
struct TALER_MINTDB_Deposit *deposit;
|
2015-06-17 15:15:10 +02:00
|
|
|
struct TALER_MINTDB_CollectableBlindcoin *blindcoin;
|
|
|
|
struct TALER_MINTDB_Reserve *reserve;
|
|
|
|
struct TALER_MINTDB_DenominationKeyIssueInformation *dki;
|
|
|
|
struct TALER_CoinPublicInfo *cpi;
|
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
|
|
|
/**
|
|
|
|
* Name of the command
|
|
|
|
*/
|
|
|
|
enum PERF_TALER_MINTDB_CMD_Name
|
|
|
|
{
|
|
|
|
// All comand chain must hace this as their last command
|
|
|
|
PERF_TALER_MINTDB_CMD_END,
|
2015-06-17 15:15:10 +02:00
|
|
|
|
2015-06-12 15:28:49 +02:00
|
|
|
// Prints it's label
|
|
|
|
PERF_TALER_MINTDB_CMD_DEBUG,
|
2015-06-17 15:15:10 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Define the start of al command chain loop
|
|
|
|
PERF_TALER_MINTDB_CMD_LOOP,
|
2015-06-17 15:15:10 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Define the end of a command chain loop
|
|
|
|
PERF_TALER_MINTDB_CMD_END_LOOP,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Save the time at which the command was executed
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_TIME,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Upload performance to Gauger
|
|
|
|
PERF_TALER_MINTDB_CMD_GAUGER,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
// Start a new session
|
|
|
|
PERF_TALER_MINTDB_CMD_NEW_SESSION,
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Start a database transaction
|
|
|
|
PERF_TALER_MINTDB_CMD_START_TRANSACTION,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// End a database transaction
|
|
|
|
PERF_TALER_MINTDB_CMD_COMMIT_TRANSACTION,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
// Abort a transaction
|
|
|
|
PERF_TALER_MINTDB_CMD_ABORT_TRANSACTION,
|
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
// Saves random deposits from a loop
|
|
|
|
PERF_TALER_MINTDB_CMD_SAVE_ARRAY,
|
|
|
|
|
|
|
|
// Load deposits saved earlier
|
|
|
|
PERF_TALER_MINTDB_CMD_LOAD_ARRAY,
|
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Insert a deposit into the database
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
// Check if a deposit is in the database
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_DEPOSIT,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
// Insert currency in a reserve / Create a reserve
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_RESERVE,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
// Get Informations about a reserve
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_RESERVE,
|
|
|
|
|
|
|
|
// Insert informations about a withdrawal in the database
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW,
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
// Pulls informations about a withdrawal from the database
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_WITHDRAW,
|
|
|
|
|
|
|
|
// Insert informations about a denomination key in the database
|
|
|
|
PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION,
|
|
|
|
|
2015-06-24 10:55:57 +02:00
|
|
|
// Polls the database for informations about a specific denomination key
|
|
|
|
PERF_TALER_MINTDB_CMD_GET_DENOMINATION,
|
|
|
|
|
|
|
|
// Refresh a coin
|
|
|
|
PERF_TALER_MINTDB_CMD_REFRESH_COIN,
|
2015-06-22 14:46:19 +02:00
|
|
|
};
|
2015-06-09 13:03:37 +02:00
|
|
|
|
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* Extra data requiered for the LOOP command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_loop_details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
// Maximum number of iteration in the loop
|
|
|
|
const unsigned int max_iterations;
|
2015-06-24 14:42:03 +02:00
|
|
|
unsigned int curr_iteration;
|
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-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* Extra data requiered by the LOOP_END command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_loop_end_details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Label of the loop closed by the command
|
|
|
|
*/
|
|
|
|
const char *label_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
|
|
|
/**
|
|
|
|
* Details about the GAUGER command
|
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_gauger_details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Label of the starting timestamp
|
|
|
|
*/
|
|
|
|
const char *label_start;
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Label of the ending timestamp
|
|
|
|
*/
|
|
|
|
const char *label_stop;
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Description of the metric, used in GAUGER
|
|
|
|
*/
|
|
|
|
const char *description;
|
2015-06-24 10:55:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constant the result needs to be divided by
|
|
|
|
* to get the result per unit
|
|
|
|
*/
|
|
|
|
float divide;
|
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-06-11 15:55:46 +02:00
|
|
|
* Contains extra data requiered by the SAVE_ARRAY command
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
2015-06-11 15:55:46 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_save_array_details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
/**
|
|
|
|
* Type of data saved
|
|
|
|
*/
|
2015-06-10 14:59:14 +02:00
|
|
|
enum PERF_TALER_MINTDB_Type type_saved;
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Array of data saved
|
|
|
|
*/
|
|
|
|
union PERF_TALER_MINTDB_Data *data_saved;
|
|
|
|
};
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-10 14:59:14 +02:00
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* Extra data required for the LOAD_ARRAY command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_load_array_details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
|
|
|
/**
|
2015-06-11 15:55:46 +02:00
|
|
|
* The loop in which the command is located
|
2015-06-09 17:35:33 +02:00
|
|
|
*/
|
|
|
|
const char *label_loop;
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* Label of the command where the items were saved
|
|
|
|
*/
|
2015-06-10 14:59:14 +02:00
|
|
|
const char *label_save;
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-09 17:35:33 +02:00
|
|
|
/**
|
|
|
|
* A permutation array used to randomize the order the items are loaded in
|
|
|
|
*/
|
|
|
|
unsigned int *permutation; // A permutation array to randomize the order the deposits are loaded in
|
|
|
|
};
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-26 15:32:20 +02:00
|
|
|
/**
|
|
|
|
* Data used by the command insert_deposit
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insert_deposit_details
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Label of the source where the reserve used to create the coin is
|
|
|
|
*/
|
|
|
|
const char *label_dki;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* Extra data requiered for the GET_DEPOSIT command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_get_deposit_details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* The label of the source of the deposit to check
|
|
|
|
*/
|
|
|
|
const char *label_source;
|
2015-06-09 17:35:33 +02:00
|
|
|
};
|
2015-06-09 13:03:37 +02:00
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
|
2015-06-22 14:46:19 +02:00
|
|
|
/**
|
|
|
|
* Extra data requiered for the GET_DEPOSIT command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_get_reserve_details
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the source of the reserve to check
|
|
|
|
*/
|
|
|
|
const char *label_source;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct PERF_TALER_MINTDB_CMD_get_denomination_details
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the source of the denomination to check
|
|
|
|
*/
|
|
|
|
const char *label_source;
|
|
|
|
};
|
|
|
|
|
2015-06-24 10:55:57 +02:00
|
|
|
|
2015-06-26 15:32:20 +02:00
|
|
|
/**
|
|
|
|
* Extra data related to the get withdraw command
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_insert_withdraw_details
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
};
|
|
|
|
|
2015-06-24 10:55:57 +02:00
|
|
|
/**
|
|
|
|
* Extra data requiered for refreshing coins
|
|
|
|
*/
|
|
|
|
struct PERF_TALER_MINTDB_CMD_refresh_coin_details
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The label of the coin to refresh
|
|
|
|
*/
|
|
|
|
const char *label_source;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-11 15:55:46 +02:00
|
|
|
/**
|
|
|
|
* Contains extra data required for any command
|
|
|
|
*/
|
|
|
|
union PERF_TALER_MINTDB_CMD_Details
|
2015-06-09 17:35:33 +02:00
|
|
|
{
|
2015-06-11 15:55:46 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_loop_details loop;
|
|
|
|
struct PERF_TALER_MINTDB_CMD_loop_end_details end_loop;
|
|
|
|
struct PERF_TALER_MINTDB_CMD_gauger_details gauger;
|
|
|
|
struct PERF_TALER_MINTDB_CMD_save_array_details save_array;
|
|
|
|
struct PERF_TALER_MINTDB_CMD_load_array_details load_array;
|
2015-06-26 15:32:20 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_insert_deposit_details insert_deposit;
|
2015-06-11 15:55:46 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_get_deposit_details get_deposit;
|
2015-06-22 14:46:19 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_get_reserve_details get_reserve;
|
|
|
|
struct PERF_TALER_MINTDB_CMD_get_denomination_details get_denomination;
|
2015-06-24 10:55:57 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_refresh_coin_details refresh;
|
2015-06-26 15:32:20 +02:00
|
|
|
struct PERF_TALER_MINTDB_CMD_insert_withdraw_details insert_withdraw;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Type of the data exposed
|
|
|
|
*/
|
|
|
|
enum PERF_TALER_MINTDB_Type exposed_type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data easily accessible
|
|
|
|
*/
|
|
|
|
union PERF_TALER_MINTDB_Data exposed;
|
2015-06-09 13:03:37 +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-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
|
|
|
|
|
|
|
#endif
|