Merge branch 'master' of git+ssh://taler.net/var/git/mint

This commit is contained in:
Christian Grothoff 2015-08-10 17:46:15 +02:00
commit d344ff5e6d
4 changed files with 588 additions and 306 deletions

View File

@ -26,7 +26,7 @@
#define NB_DENOMINATION_SAVE 15 #define NB_DENOMINATION_SAVE 15
#define BIGGER 10 #define BIGGER 10
#define BIG 4 #define BIG 10
#define NB_RESERVE_INIT BIGGER #define NB_RESERVE_INIT BIGGER
#define NB_RESERVE_SAVE BIG #define NB_RESERVE_SAVE BIG
@ -53,24 +53,28 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
NB_DENOMINATION_INIT), NB_DENOMINATION_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"), PERF_TALER_MINTDB_INIT_CMD_CREATE_DENOMINATION ("01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - insert",
"01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
"01 - denomination loop", "01 - denomination loop",
"01 - denomination", "01 - denomination",
NB_DENOMINATION_SAVE), NB_DENOMINATION_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("01 - end",
"01 - denomination loop"), "01 - denomination loop"),
// End of initialization // End of initialization
// Reserve initialization // Reserve initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
NB_RESERVE_INIT), NB_RESERVE_INIT),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - reserve"), PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - insert",
"02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
"02 - init reserve loop", "02 - init reserve loop",
"02 - reserve", "02 - reserve",
NB_RESERVE_SAVE), NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("02 - end",
"02 - init reserve loop"), "02 - init reserve loop"),
// End reserve init // End reserve init
// Withdrawal initialization // Withdrawal initialization
@ -83,15 +87,17 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
"03 - init withdraw loop", "03 - init withdraw loop",
"02 - save reserve"), "02 - save reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw", PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW ("03 - withdraw",
"03 - denomination load", "03 - denomination load",
"03 - reserve load"), "03 - reserve load"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - insert",
"03 - withdraw"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - save coin", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - save coin",
"03 - init withdraw loop", "03 - init withdraw loop",
"03 - withdraw", "03 - withdraw",
NB_WITHDRAW_SAVE), NB_WITHDRAW_SAVE),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("03 - end",
"03 - init withdraw loop"), "03 - init withdraw loop"),
//End of withdrawal initialization //End of withdrawal initialization
//Deposit initialization //Deposit initialization
@ -101,8 +107,10 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - coin load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("04 - coin load",
"04 - deposit init loop", "04 - deposit init loop",
"03 - save coin"), "03 - save coin"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - deposit", PERF_TALER_MINTDB_INIT_CMD_CREATE_DEPOSIT ("04 - deposit",
"04 - coin load"), "04 - coin load"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT ("04 - insert",
"04 - deposit"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("04 - deposit array",
"04 - deposit init loop", "04 - deposit init loop",
@ -117,11 +125,13 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - start"),
PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - reserve insert measure", PERF_TALER_MINTDB_INIT_CMD_LOOP ("05 - reserve insert measure",
NB_RESERVE_SAVE), NB_RESERVE_SAVE),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE (""), PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("05 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("05 - insert",
"05 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"05 - reserve insert measure"), "05 - reserve insert measure"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - stop"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("05 - stop"),
PERF_TALER_MINTDB_INIT_CMD_GAUGER ("", PERF_TALER_MINTDB_INIT_CMD_GAUGER ("05 - gauger",
"05 - start", "05 - start",
"05 - stop", "05 - stop",
"POSTGRES", "POSTGRES",
@ -136,7 +146,7 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - reserve", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("06 - reserve",
"06 - reserve load measure", "06 - reserve load measure",
"02 - save reserve"), "02 - save reserve"),
PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE ("", PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE ("06 - get",
"06 - reserve"), "06 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"06 - reserve load measure"), "06 - reserve load measure"),
@ -180,9 +190,11 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - denomination", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("08 - denomination",
"08 - withdraw insert measure", "08 - withdraw insert measure",
"01 - save denomination"), "01 - save denomination"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("", PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW ("08 - withdraw",
"08 - denomination", "08 - denomination",
"08 - reserve"), "08 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("08 - insert",
"08 - withdraw"),
PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("", PERF_TALER_MINTDB_INIT_CMD_END_LOOP ("",
"08 - withdraw insert measure"), "08 - withdraw insert measure"),
PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - stop"), PERF_TALER_MINTDB_INIT_CMD_GET_TIME ("08 - stop"),

View File

@ -385,55 +385,81 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
} }
break; break;
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT: case PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION:
{
int ret;
ret = cmd_find( cmd,
cmd[i].details.insert_deposit.label_coin);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_deposit.label_coin);
return GNUNET_SYSERR;
}
cmd[i].details.insert_deposit.index_coin = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
{ {
int ret; int ret;
ret = cmd_find (cmd, ret = cmd_find (cmd,
cmd[i].details.get_deposit.label_deposit); cmd[i].details.insert_denomination.label_denom);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n", "%d:Undefined reference to %s\n",
i, i,
cmd[i].details.get_deposit.label_deposit); cmd[i].details.insert_denomination.label_denom);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (PERF_TALER_MINTDB_DEPOSIT != cmd[ret].exposed.type) if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n", "%d:Wrong type reference to %s\n",
i, i,
cmd[i].details.get_deposit.label_deposit); cmd[i].details.insert_denomination.label_denom);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
cmd[i].details.get_deposit.index_deposit = ret; cmd[i].details.insert_denomination.index_denom = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_denomination.label_denom);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_denomination.label_denom);
return GNUNET_SYSERR;
}
cmd[i].details.get_denomination.index_denom = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_RESERVE:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.insert_reserve.label_reserve);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_reserve.label_reserve);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_reserve.label_reserve);
return GNUNET_SYSERR;
}
cmd[i].details.insert_reserve.index_reserve = ret;
} }
break; break;
@ -489,29 +515,52 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION: case PERF_TALER_MINTDB_CMD_CREATE_WITHDRAW:
{ {
int ret; int ret;
ret = cmd_find (cmd, ret = cmd_find (cmd,
cmd[i].details.get_denomination.label_denom); cmd[i].details.create_withdraw.label_dki);
if (GNUNET_SYSERR == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, if (GNUNET_SYSERR == ret)
"%d:Undefined reference to %s\n", {
i, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
cmd[i].details.get_denomination.label_denom); "%d:Undefined reference to %s\n",
return GNUNET_SYSERR; i,
cmd[i].details.create_withdraw.label_dki);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.create_withdraw.label_dki);
return GNUNET_SYSERR;
}
} }
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type) cmd[i].details.create_withdraw.index_dki = ret;
ret = cmd_find (cmd,
cmd[i].details.create_withdraw.label_reserve);
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, if (GNUNET_SYSERR == ret)
"%d:Wrong type reference to %s\n", {
i, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
cmd[i].details.get_denomination.label_denom); "%d:Undefined reference to %s\n",
return GNUNET_SYSERR; i,
cmd[i].details.create_withdraw.label_reserve);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.create_withdraw.label_reserve);
return GNUNET_SYSERR;
}
} }
cmd[i].details.get_denomination.index_denom = ret; cmd[i].details.create_withdraw.index_reserve = ret;
} }
break; break;
@ -520,44 +569,24 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
int ret; int ret;
ret = cmd_find (cmd, ret = cmd_find (cmd,
cmd[i].details.insert_withdraw.label_dki); cmd[i].details.insert_withdraw.label_coin);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n", "%d:Undefined reference to %s\n",
i, i,
cmd[i].details.insert_withdraw.label_dki); cmd[i].details.insert_withdraw.label_coin);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (PERF_TALER_MINTDB_DENOMINATION_INFO != cmd[ret].exposed.type) if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n", "%d:Wrong type reference to %s\n",
i, i,
cmd[i].details.insert_withdraw.label_dki); cmd[i].details.insert_withdraw.label_coin);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
cmd[i].details.insert_withdraw.index_dki = ret; cmd[i].details.insert_withdraw.index_coin = ret;
ret = cmd_find (cmd,
cmd[i].details.insert_withdraw.label_reserve);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_RESERVE != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_withdraw.label_reserve);
return GNUNET_SYSERR;
}
cmd[i].details.insert_withdraw.index_reserve = ret;
} }
break; break;
@ -566,7 +595,7 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
int ret; int ret;
ret = cmd_find (cmd, ret = cmd_find (cmd,
cmd[i].details.get_withdraw.label_coin); cmd[i].details.get_withdraw.label_coin);
if (GNUNET_SYSERR == ret) if (GNUNET_SYSERR == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -587,6 +616,110 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_coin_transaction.label_coin);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_coin_transaction.label_coin);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_coin_transaction.label_coin);
return GNUNET_SYSERR;
}
cmd[i].details.get_coin_transaction.index_coin = ret;
}
break;
case PERF_TALER_MINTDB_CMD_CREATE_DEPOSIT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.create_deposit.label_coin);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.create_deposit.label_coin);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_COIN != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.create_deposit.label_coin);
return GNUNET_SYSERR;
}
cmd[i].details.create_deposit.index_coin = ret;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
{
int ret;
ret = cmd_find( cmd,
cmd[i].details.insert_deposit.label_deposit);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.insert_deposit.label_deposit);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DEPOSIT != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.insert_deposit.label_deposit);
return GNUNET_SYSERR;
}
cmd[i].details.insert_deposit.index_deposit = ret;
}
break;
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
{
int ret;
ret = cmd_find (cmd,
cmd[i].details.get_deposit.label_deposit);
if (GNUNET_SYSERR == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Undefined reference to %s\n",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
}
if (PERF_TALER_MINTDB_DEPOSIT != cmd[ret].exposed.type)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%d:Wrong type reference to %s\n",
i,
cmd[i].details.get_deposit.label_deposit);
return GNUNET_SYSERR;
}
cmd[i].details.get_deposit.index_deposit = ret;
}
break;
case PERF_TALER_MINTDB_CMD_END: case PERF_TALER_MINTDB_CMD_END:
case PERF_TALER_MINTDB_CMD_DEBUG: case PERF_TALER_MINTDB_CMD_DEBUG:
case PERF_TALER_MINTDB_CMD_LOOP: case PERF_TALER_MINTDB_CMD_LOOP:
@ -594,8 +727,8 @@ cmd_init (struct PERF_TALER_MINTDB_Cmd cmd[])
case PERF_TALER_MINTDB_CMD_COMMIT_TRANSACTION: case PERF_TALER_MINTDB_CMD_COMMIT_TRANSACTION:
case PERF_TALER_MINTDB_CMD_ABORT_TRANSACTION: case PERF_TALER_MINTDB_CMD_ABORT_TRANSACTION:
case PERF_TALER_MINTDB_CMD_GET_TIME: case PERF_TALER_MINTDB_CMD_GET_TIME:
case PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION: case PERF_TALER_MINTDB_CMD_CREATE_DENOMINATION:
case PERF_TALER_MINTDB_CMD_INSERT_RESERVE: case PERF_TALER_MINTDB_CMD_CREATE_RESERVE:
break; break;
default: default:
@ -873,30 +1006,39 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
interprete_load_random (state); interprete_load_random (state);
break; break;
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT: case PERF_TALER_MINTDB_CMD_CREATE_DEPOSIT:
{ {
int coin_index; int coin_index;
struct TALER_MINTDB_Deposit *deposit; struct TALER_MINTDB_Deposit *deposit;
coin_index = state->cmd[state->i].details.insert_deposit.index_coin; coin_index = state->cmd[state->i].details.create_deposit.index_coin;
deposit = PERF_TALER_MINTDB_deposit_init (state->cmd[coin_index].exposed.data.coin); deposit = PERF_TALER_MINTDB_deposit_init (state->cmd[coin_index].exposed.data.coin);
GNUNET_assert (NULL != deposit); GNUNET_assert (NULL != deposit);
state->cmd[state->i].exposed.data.deposit = deposit;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT:
{
int deposit_index;
struct TALER_MINTDB_Deposit *deposit;
deposit_index = state->cmd[state->i].details.insert_deposit.index_deposit;
deposit = state->cmd[deposit_index].exposed.data.deposit;
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
state->plugin->insert_deposit (state->plugin->cls, state->plugin->insert_deposit (state->plugin->cls,
state->session, state->session,
deposit)); deposit));
state->cmd[state->i].exposed.data.deposit = deposit; state->cmd[state->i].exposed.data.deposit = deposit;
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_DEPOSIT: case PERF_TALER_MINTDB_CMD_GET_DEPOSIT:
{ {
int source_index; unsigned int source_index;
struct PERF_TALER_MINTDB_Data *data; struct PERF_TALER_MINTDB_Data *data;
source_index = cmd_find (state->cmd, source_index = state->cmd[state->i].details.get_deposit.index_deposit;
state->cmd[state->i].details.get_deposit.label_deposit);
GNUNET_assert (GNUNET_SYSERR != source_index);
data = &state->cmd[source_index].exposed; data = &state->cmd[source_index].exposed;
state->plugin->have_deposit (state->plugin->cls, state->plugin->have_deposit (state->plugin->cls,
state->session, state->session,
@ -904,16 +1046,28 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
} }
break; break;
case PERF_TALER_MINTDB_CMD_INSERT_RESERVE: case PERF_TALER_MINTDB_CMD_CREATE_RESERVE:
{ {
struct PERF_TALER_MINTDB_Reserve *reserve; struct PERF_TALER_MINTDB_Reserve *reserve;
json_t *details = NULL;
GNUNET_assert (NULL !=
(details = json_pack ("{s:i}","justification",
GNUNET_CRYPTO_random_u32 (
GNUNET_CRYPTO_QUALITY_WEAK,
UINT32_MAX))));
reserve = PERF_TALER_MINTDB_reserve_init (); reserve = PERF_TALER_MINTDB_reserve_init ();
state->cmd[state->i].exposed.data.reserve = reserve;
}
break;
case PERF_TALER_MINTDB_CMD_INSERT_RESERVE:
{
unsigned int reserve_index;
struct PERF_TALER_MINTDB_Reserve *reserve;
json_t *details = NULL;
reserve_index = state->cmd[state->i].details.insert_reserve.index_reserve;
reserve = state->cmd[reserve_index].exposed.data.reserve;
details = json_pack ("{s:i}","justification",
GNUNET_CRYPTO_random_u32 (
GNUNET_CRYPTO_QUALITY_WEAK,
UINT32_MAX));
GNUNET_assert (NULL != details);
state->plugin->reserves_in_insert ( state->plugin->reserves_in_insert (
state->plugin->cls, state->plugin->cls,
state->session, state->session,
@ -923,134 +1077,139 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
details details
); );
json_decref (details); json_decref (details);
state->cmd[state->i].exposed.data.reserve = reserve;
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_RESERVE: case PERF_TALER_MINTDB_CMD_GET_RESERVE:
{ {
int reserve_index; int reserve_index;
int ret;
struct PERF_TALER_MINTDB_Data *data; struct PERF_TALER_MINTDB_Data *data;
GNUNET_assert (GNUNET_SYSERR !=
(reserve_index = cmd_find (state->cmd,
state->cmd[state->i]
.details.get_reserve.label_reserve)));
reserve_index = state->cmd[state->i].details.get_reserve.index_reserve;
data = &state->cmd[reserve_index].exposed; data = &state->cmd[reserve_index].exposed;
GNUNET_assert (GNUNET_OK == ret = state->plugin->reserve_get (state->plugin->cls,
(state->plugin->reserve_get (state->plugin->cls, state->session,
state->session, &data->data.reserve->reserve);
&data->data.reserve->reserve))); GNUNET_assert (GNUNET_OK == ret);
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY: case PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY:
{ {
int reserve_index; int reserve_index;
struct TALER_MINTDB_ReserveHistory *history; struct TALER_MINTDB_ReserveHistory *history;
struct PERF_TALER_MINTDB_Data *data; struct PERF_TALER_MINTDB_Data *data;
GNUNET_assert (GNUNET_SYSERR != reserve_index = state->cmd[state->i].details.get_reserve_history.index_reserve;
(reserve_index = cmd_find (state->cmd, data = &state->cmd[reserve_index].exposed;
state->cmd[state->i] history = state->plugin->get_reserve_history (state->plugin->cls,
.details.get_reserve_history.label_reserve))); state->session,
data = &state->cmd[reserve_index].exposed; &data->data.reserve->reserve.pub);
GNUNET_assert (NULL != GNUNET_assert (NULL != history);
(history = state->plugin->get_reserve_history (state->plugin->cls, state->plugin->free_reserve_history (state->plugin->cls,
state->session, history);
&data->data.reserve->reserve.pub))); }
state->plugin->free_reserve_history (state->plugin->cls, break;
history);
case PERF_TALER_MINTDB_CMD_CREATE_DENOMINATION:
{
struct TALER_MINTDB_DenominationKeyIssueInformation *dki =
PERF_TALER_MINTDB_denomination_init ();
state->cmd[state->i].exposed.data.dki = dki;
} }
break; break;
case PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION: case PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION:
{ {
struct TALER_MINTDB_DenominationKeyIssueInformation *dki = unsigned int denom_index;
PERF_TALER_MINTDB_denomination_init (); int ret;
struct TALER_MINTDB_DenominationKeyIssueInformation *dki ;
state->plugin->insert_denomination_info (state->plugin->cls, denom_index = state->cmd[state->i].details.insert_denomination.index_denom;
state->session, dki = state->cmd[denom_index].exposed.data.dki;
&dki->denom_pub, ret = state->plugin->insert_denomination_info (state->plugin->cls,
&dki->issue); state->session,
state->cmd[state->i].exposed.data.dki = dki; &dki->denom_pub,
&dki->issue);
GNUNET_assert (GNUNET_SYSERR != ret);
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_DENOMINATION: case PERF_TALER_MINTDB_CMD_GET_DENOMINATION:
{ {
int source_index; unsigned int denom_index;
int ret;
struct PERF_TALER_MINTDB_Data *data; struct PERF_TALER_MINTDB_Data *data;
GNUNET_assert (GNUNET_SYSERR != denom_index = state->cmd[state->i].details.get_denomination.index_denom;
(source_index = cmd_find (state->cmd, data = &state->cmd[denom_index].exposed;
state->cmd[state->i] ret = state->plugin->get_denomination_info (state->plugin->cls,
.details.get_denomination.label_denom))); state->session,
data = &state->cmd[source_index].exposed; &data->data.dki->denom_pub,
state->plugin->get_denomination_info (state->plugin->cls, &data->data.dki->issue);
state->session, GNUNET_assert (GNUNET_SYSERR != ret);
&data->data.dki->denom_pub, }
&data->data.dki->issue); break;
case PERF_TALER_MINTDB_CMD_CREATE_WITHDRAW:
{
int dki_index, reserve_index;
struct PERF_TALER_MINTDB_Coin *coin ;
dki_index = state->cmd[state->i].details.create_withdraw.index_dki;
reserve_index = state->cmd[state->i].details.create_withdraw.index_reserve;
coin = PERF_TALER_MINTDB_coin_init (state->cmd[dki_index].exposed.data.dki,
state->cmd[reserve_index].exposed.data.reserve);
GNUNET_assert (NULL != coin);
state->cmd[state->i].exposed.data.coin = coin;
} }
break; break;
case PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW: case PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW:
{ {
int dki_index, reserve_index; unsigned int coin_index;
int ret;
struct PERF_TALER_MINTDB_Coin *coin ; struct PERF_TALER_MINTDB_Coin *coin ;
GNUNET_assert (GNUNET_SYSERR != coin_index = state->cmd[state->i].details.insert_withdraw.index_coin;
(dki_index = cmd_find ( coin = state->cmd[coin_index].exposed.data.coin;
state->cmd, ret = state->plugin->insert_withdraw_info (state->plugin->cls,
state->cmd[state->i].details.insert_withdraw.label_dki))); state->session,
GNUNET_assert (GNUNET_SYSERR != &coin->blind);
(reserve_index = cmd_find ( GNUNET_assert (GNUNET_SYSERR != ret);
state->cmd,
state->cmd[state->i].details.insert_withdraw.label_reserve)));
GNUNET_assert (NULL !=
(coin =
PERF_TALER_MINTDB_coin_init (
state->cmd[dki_index].exposed.data.dki,
state->cmd[reserve_index].exposed.data.reserve)));
state->plugin->insert_withdraw_info (state->plugin->cls,
state->session,
&coin->blind);
state->cmd[state->i].exposed.data.coin = coin;
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_WITHDRAW: case PERF_TALER_MINTDB_CMD_GET_WITHDRAW:
{ {
int source_index; unsigned int source_index;
int ret;
struct PERF_TALER_MINTDB_Data *data; struct PERF_TALER_MINTDB_Data *data;
GNUNET_assert (GNUNET_SYSERR != source_index = state->cmd[state->i].details.get_denomination.index_denom;
(source_index = cmd_find (state->cmd,
state->cmd[state->i]
.details.get_denomination.label_denom)));
data = &state->cmd[source_index].exposed; data = &state->cmd[source_index].exposed;
state->plugin->get_withdraw_info (state->plugin->cls, ret = state->plugin->get_withdraw_info (state->plugin->cls,
state->session, state->session,
&data->data.coin->blind.h_coin_envelope, &data->data.coin->blind.h_coin_envelope,
&data->data.coin->blind); &data->data.coin->blind);
GNUNET_assert (GNUNET_SYSERR != ret);
} }
break; break;
case PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION: case PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION:
{ {
int coin_index; unsigned int coin_index;
struct PERF_TALER_MINTDB_Coin *coin; struct PERF_TALER_MINTDB_Coin *coin;
struct TALER_MINTDB_TransactionList *transactions; struct TALER_MINTDB_TransactionList *transactions;
coin_index = cmd_find (state->cmd, coin_index = state->cmd[state->i].details.get_coin_transaction.index_coin;
state->cmd[state->i].details.get_coin_transaction.label_coin);
GNUNET_assert (GNUNET_SYSERR != coin_index);
coin = state->cmd[coin_index].exposed.data.coin; coin = state->cmd[coin_index].exposed.data.coin;
transactions = state->plugin->get_coin_transactions (state->plugin->cls, transactions = state->plugin->get_coin_transactions (state->plugin->cls,
state->session, state->session,
&coin->public_info.coin_pub); &coin->public_info.coin_pub);
GNUNET_assert (transactions != NULL);
state->plugin->free_coin_transaction_list (state->plugin->cls, state->plugin->free_coin_transaction_list (state->plugin->cls,
transactions); transactions);
} }
@ -1144,7 +1303,7 @@ interpret (struct PERF_TALER_MINTDB_interpreter_state *state)
state->cmd[state->i].details.insert_refresh_order.label_hash); state->cmd[state->i].details.insert_refresh_order.label_hash);
GNUNET_assert (GNUNET_SYSERR != hash_index); GNUNET_assert (GNUNET_SYSERR != hash_index);
denom_index = cmd_find (state->cmd, denom_index = cmd_find (state->cmd,
state->cmd[state->i].details.insert_refresh_order.label_denom); state->cmd[state->i].details.insert_refresh_order.label_denom);
GNUNET_assert (GNUNET_SYSERR != denom_index); GNUNET_assert (GNUNET_SYSERR != denom_index);
session_hash = state->cmd[hash_index].exposed.data.session_hash; session_hash = state->cmd[hash_index].exposed.data.session_hash;
denom = state->cmd[denom_index].exposed.data.dki; denom = state->cmd[denom_index].exposed.data.dki;
@ -1282,7 +1441,9 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
PERF_TALER_MINTDB_NB_DENOMINATION_INIT), PERF_TALER_MINTDB_NB_DENOMINATION_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"), PERF_TALER_MINTDB_INIT_CMD_CREATE_DENOMINATION ("01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - insert",
"01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
"01 - denomination loop", "01 - denomination loop",
@ -1295,7 +1456,9 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
// Reserve initialization // Reserve initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
PERF_TALER_MINTDB_NB_RESERVE_INIT), PERF_TALER_MINTDB_NB_RESERVE_INIT),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - reserve"), PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - insert",
"02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
"02 - init reserve loop", "02 - init reserve loop",
"02 - reserve", "02 - reserve",
@ -1314,9 +1477,11 @@ PERF_TALER_MINTDB_run_benchmark (const char *benchmark_name,
PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load", PERF_TALER_MINTDB_INIT_CMD_LOAD_ARRAY ("03 - reserve load",
"03 - init withdraw loop", "03 - init withdraw loop",
"02 - save reserve"), "02 - save reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - withdraw", PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW ("03 - withdraw",
"03 - denomination load", "03 - denomination load",
"03 - reserve load"), "03 - reserve load"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW ("03 - insert",
"03 - withdraw"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION (""),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - save coin", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("03 - save coin",
"03 - init withdraw loop", "03 - init withdraw loop",

View File

@ -216,17 +216,31 @@
} }
/** /**
* Inserts informations about a denomination key in the database * Create a denomination key to use
* Exposes a #PERF_TALER_MINTDB_DENOMINATION_INFO to be used by other commands * Exposes a #PERF_TALER_MINTDB_DENOMINATION_INFO to be used by other commands
* @exposed #PERF_TALER_MINTDB_DENOMINATION_INFO * @exposed #PERF_TALER_MINTDB_DENOMINATION_INFO
* *
* @param _label the label of this command * @param _label the label of this command
*/ */
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION(_label) \ #define PERF_TALER_MINTDB_INIT_CMD_CREATE_DENOMINATION(_label) \
{ \
.command = PERF_TALER_MINTDB_CMD_CREATE_DENOMINATION, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_DENOMINATION_INFO, \
}
/**
* 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
*/
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION(_label, _label_denom) \
{ \ { \
.command = PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION, \ .command = PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION, \
.label = _label, \ .label = _label, \
.exposed.type = PERF_TALER_MINTDB_DENOMINATION_INFO, \ .exposed.type = PERF_TALER_MINTDB_NONE, \
.details.insert_denomination.label_denom = _label_denom, \
} }
/** /**
@ -240,24 +254,35 @@
.command = PERF_TALER_MINTDB_CMD_GET_DENOMINATION, \ .command = PERF_TALER_MINTDB_CMD_GET_DENOMINATION, \
.label = _label, \ .label = _label, \
.exposed.type = PERF_TALER_MINTDB_NONE, \ .exposed.type = PERF_TALER_MINTDB_NONE, \
.details.get_denomination.label_denom = _label_denom, \ .details.get_denomination.label_denom = _label_denom \
} }
/** /**
* Creates a new reserve in the database containing 1000 Euros * Create a reserve to be used later
* Exposes a #PERF_TALER_MINTDB_RESERVE * Exposes a #PERF_TALER_MINTDB_RESERVE
* *
* @exposed #PERF_TALER_MINTDB_RESERVE * @param _label the label of the command
*
* @param _label the name of this command
*/ */
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE(_label) \ #define PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE(_label) \
{ \ { \
.command = PERF_TALER_MINTDB_CMD_INSERT_RESERVE, \ .command = PERF_TALER_MINTDB_CMD_CREATE_RESERVE, \
.label = _label, \ .label = _label, \
.exposed.type = PERF_TALER_MINTDB_RESERVE \ .exposed.type = PERF_TALER_MINTDB_RESERVE \
} }
/**
* Insert a new reserve in the database containing 1000 Euros
*
* @param _label the name of this command
* @param _label_reserve the label of the reserve to insert
*/
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE(_label, _label_reserve) \
{ \
.command = PERF_TALER_MINTDB_CMD_INSERT_RESERVE, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_NONE, \
.details.insert_reserve.label_reserve = _label_reserve \
}
/** /**
* Polls the database for a secific reserve's details * Polls the database for a secific reserve's details
@ -273,7 +298,6 @@
.details.get_reserve.label_reserve = _label_reserve \ .details.get_reserve.label_reserve = _label_reserve \
} }
/** /**
* Polls the database for the history of a reserve * Polls the database for the history of a reserve
* *
@ -288,80 +312,38 @@
.details.get_reserve_history.label_reserve = _label_reserve \ .details.get_reserve_history.label_reserve = _label_reserve \
} }
/** /**
* Insert a deposit into the database * Creates a coin to be used later
*
* @exposes #PERF_TALER_MINTDB_DEPOSIT
* *
* @param _label the label of this command * @param _label the label of this command
* @param _label_coin the coin used to pay * @param _label_dki denomination key used to sign the coin
* @param _label_reserve reserve used to emmit the coin
*/ */
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_coin) \ #define PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW(_label, _label_dki, _label_reserve) \
{ \ { \
.command = PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,\ .command = PERF_TALER_MINTDB_CMD_CREATE_WITHDRAW, \
.label = _label, \ .label = _label, \
.exposed.type = PERF_TALER_MINTDB_DEPOSIT, \ .exposed.type = PERF_TALER_MINTDB_COIN, \
.details.insert_deposit.label_coin = _label_coin, \ .details.create_withdraw = {\
.label_dki = _label_dki, \
.label_reserve = _label_reserve, \
} \
} }
/**
* Check if a deposit is in the database
*
* @param _label the label of this command
* @param _label_deposit the deposit to use
*/
#define PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
{ \
.command = PERF_TALER_MINTDB_CMD_GET_DEPOSIT, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_NONE, \
.details.get_deposit.label_deposit = _label_deposit \
}
/**
* 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_transaction.label_coin = _label_coin \
}
/**
* the /deposit API call
*/
#define PERF_TALER_MONTDB_INIT_CMD_DEPOSIT(_label, _label_coin)\
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label ":insert deposit", _label_coin), \
PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT (_label ":get deposit", _label ":insert deposit")
/** /**
* Inserts informations about a withdrawal in the database * Inserts informations about a withdrawal in the database
* *
* @exposes #PERF_TALER_MINTDB_COIN * @exposes #PERF_TALER_MINTDB_COIN
* *
* @param _label the label of this command * @param _label the label of this command
* @param _label_dki denomination key used to sign the coin * @param _label_coin the coin to insert
* @param _label_reserve reserve used to emmit the coin
*/ */
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label, _label_dki, _label_reserve) \ #define PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label, _label_coin) \
{ \ { \
.command = PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW, \ .command = PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW, \
.label = _label, \ .label = _label, \
.exposed.type = PERF_TALER_MINTDB_COIN, \ .exposed.type = PERF_TALER_MINTDB_NONE, \
.details.insert_withdraw = {\ .details.insert_withdraw.label_coin = _label_coin\
.label_dki = _label_dki, \
.label_reserve = _label_reserve, \
} \
} }
@ -390,12 +372,70 @@
* @param _label_reserve the reserve used to provide currency * @param _label_reserve the reserve used to provide currency
*/ */
#define PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN(_label, _label_dki, _label_reserve) \ #define PERF_TALER_MINTDB_INIT_CMD_WITHDRAW_SIGN(_label, _label_dki, _label_reserve) \
PERF_TALER_MINTDB_INIT_CMD_CREATE_WITHDRAW (_label "withdraw", \
_label_dki, \
_label_reserve), \
PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY(_label "reserve_history", \ PERF_TALER_MINTDB_INIT_CMD_GET_RESERVE_HISTORY(_label "reserve_history", \
_label_reserve), \ _label_reserve), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label "insert withdraw", \ PERF_TALER_MINTDB_INIT_CMD_INSERT_WITHDRAW(_label "insert withdraw", \
_label_dki, \ _label "withdraw")
_label_reserve)
/**
* Create a deposit for use later
* @exposes #PERF_TALER_MINTDB_DEPOSIT
*
* @param _label the label of this command
* @param _label_coin the coin used to pay
*/
#define PERF_TALER_MINTDB_INIT_CMD_CREATE_DEPOSIT(_label, _label_coin) \
{ \
.command = PERF_TALER_MINTDB_CMD_CREATE_DEPOSIT, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_DEPOSIT, \
.details.create_deposit.label_coin = _label_coin, \
}
/**
* Insert a deposit into the database
*
* @param _label the label of this command
* @param _label_deposit the deposit inseerted
*/
#define PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT(_label, _label_deposit) \
{ \
.command = PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,\
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_NONE, \
.details.insert_deposit.label_deposit = _label_deposit, \
}
/**
* Check if a deposit is in the database
*
* @param _label the label of this command
* @param _label_deposit the deposit to use
*/
#define PERF_TALER_MINTDB_INIT_CMD_GET_DEPOSIT(_label, _label_deposit) \
{ \
.command = PERF_TALER_MINTDB_CMD_GET_DEPOSIT, \
.label = _label, \
.exposed.type = PERF_TALER_MINTDB_NONE, \
.details.get_deposit.label_deposit = _label_deposit \
}
/**
* Access the transaction 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_transaction.label_coin = _label_coin \
}
/** /**
* The /deposit api call * The /deposit api call
@ -406,8 +446,10 @@
#define PERF_TALER_MINTDB_INIT_CMD_DEPOSIT(_label, _label_coin) \ #define PERF_TALER_MINTDB_INIT_CMD_DEPOSIT(_label, _label_coin) \
PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \ PERF_TALER_MINTDB_INIT_CMD_GET_COIN_TRANSACTION (_label "coin history", \
_label_coin), \ _label_coin), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "deposit", \ PERF_TALER_MINTDB_INIT_CMD_CREATE_DEPOSIT (_label "deposit", \
_label_coin) _label_coin), \
PERF_TALER_MINTDB_INIT_CMD_INSERT_DEPOSIT (_label "insert", \
_label "deposit")
/** /**
@ -417,10 +459,10 @@ enum PERF_TALER_MINTDB_Type
{ {
PERF_TALER_MINTDB_NONE, PERF_TALER_MINTDB_NONE,
PERF_TALER_MINTDB_TIME, PERF_TALER_MINTDB_TIME,
PERF_TALER_MINTDB_DEPOSIT,
PERF_TALER_MINTDB_COIN,
PERF_TALER_MINTDB_RESERVE,
PERF_TALER_MINTDB_DENOMINATION_INFO, PERF_TALER_MINTDB_DENOMINATION_INFO,
PERF_TALER_MINTDB_RESERVE,
PERF_TALER_MINTDB_COIN,
PERF_TALER_MINTDB_DEPOSIT,
PERF_TALER_MINTDB_REFRESH_HASH PERF_TALER_MINTDB_REFRESH_HASH
}; };
@ -527,14 +569,24 @@ enum PERF_TALER_MINTDB_CMD_Name
PERF_TALER_MINTDB_CMD_LOAD_RANDOM, PERF_TALER_MINTDB_CMD_LOAD_RANDOM,
/** /**
* Insert a deposit into the database * Create a denomination to be used later
*/ */
PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT, PERF_TALER_MINTDB_CMD_CREATE_DENOMINATION,
/** /**
* Check if a deposit is in the database * Insert informations about a denomination key in the database
*/ */
PERF_TALER_MINTDB_CMD_GET_DEPOSIT, PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION,
/**
* Polls the database for informations about a specific denomination key
*/
PERF_TALER_MINTDB_CMD_GET_DENOMINATION,
/**
* Create a reserve to be used later
*/
PERF_TALER_MINTDB_CMD_CREATE_RESERVE,
/** /**
* Insert currency in a reserve / Create a reserve * Insert currency in a reserve / Create a reserve
@ -551,6 +603,11 @@ enum PERF_TALER_MINTDB_CMD_Name
*/ */
PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY, PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY,
/**
* Create a withdrawal to be used later
*/
PERF_TALER_MINTDB_CMD_CREATE_WITHDRAW,
/** /**
* Insert informations about a withdrawal in the database * Insert informations about a withdrawal in the database
*/ */
@ -561,21 +618,26 @@ enum PERF_TALER_MINTDB_CMD_Name
*/ */
PERF_TALER_MINTDB_CMD_GET_WITHDRAW, PERF_TALER_MINTDB_CMD_GET_WITHDRAW,
/**
* Insert informations about a denomination key in the database
*/
PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION,
/**
* Polls the database for informations about a specific denomination key
*/
PERF_TALER_MINTDB_CMD_GET_DENOMINATION,
/** /**
* Get the list of all transactions the coin has been in * Get the list of all transactions the coin has been in
*/ */
PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION, PERF_TALER_MINTDB_CMD_GET_COIN_TRANSACTION,
/**
* Create a deposit to be used later
*/
PERF_TALER_MINTDB_CMD_CREATE_DEPOSIT,
/**
* Insert a deposit into the database
*/
PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT,
/**
* Check if a deposit is in the database
*/
PERF_TALER_MINTDB_CMD_GET_DEPOSIT,
/** /**
* Create a refresh session * Create a refresh session
* The number of melted coins is 1, * The number of melted coins is 1,
@ -672,7 +734,6 @@ union PERF_TALER_MINTDB_CMD_Details
unsigned int curr_iteration; unsigned int curr_iteration;
} loop; } loop;
/** /**
* Extra data requiered by the #PERF_TALER_MINTDB_CMD_END_LOOP command * Extra data requiered by the #PERF_TALER_MINTDB_CMD_END_LOOP command
*/ */
@ -685,7 +746,6 @@ union PERF_TALER_MINTDB_CMD_Details
unsigned int index_loop; unsigned int index_loop;
} end_loop; } end_loop;
/** /**
* Details about the #PERF_TALER_MINTDB_CMD_GAUGER command * Details about the #PERF_TALER_MINTDB_CMD_GAUGER command
*/ */
@ -725,7 +785,6 @@ union PERF_TALER_MINTDB_CMD_Details
float divide; float divide;
} gauger; } gauger;
/** /**
* Contains extra data requiered by the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY command * Contains extra data requiered by the #PERF_TALER_MINTDB_CMD_SAVE_ARRAY command
*/ */
@ -766,7 +825,6 @@ union PERF_TALER_MINTDB_CMD_Details
} save_array; } save_array;
/** /**
* Extra data required for the #PERF_TALER_MINTDB_CMD_LOAD_ARRAY command * Extra data required for the #PERF_TALER_MINTDB_CMD_LOAD_ARRAY command
*/ */
@ -790,7 +848,6 @@ union PERF_TALER_MINTDB_CMD_Details
unsigned int *permutation; unsigned int *permutation;
} load_array; } load_array;
/** /**
* Contains data for the #PERF_TALER_MINTDB_CMD_LOAD_RANDOM command * Contains data for the #PERF_TALER_MINTDB_CMD_LOAD_RANDOM command
*/ */
@ -804,30 +861,40 @@ union PERF_TALER_MINTDB_CMD_Details
} load_random; } load_random;
/** /**
* Data used by the #PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT command * Extra data requiered by the #PERF_TALER_MINTDB_CMD_INSERT_DENOMINATION command
*/ */
struct PERF_TALER_MINTDB_CMD_insertDepositDetails struct PERF_TALER_MINTDB_CMD_insertDenominationDetails
{ {
/** /**
* Label of the source where the reserve used to create the coin is * The label of the source of the denomination to insert
*/ */
const char *label_coin; const char *label_denom;
unsigned int index_coin; unsigned int index_denom;
} insert_deposit; } insert_denomination;
/**
* Extra data requiered by the #PERF_TALER_MINTDB_CMD_GET_DENOMINATION command
*/
struct PERF_TALER_MINTDB_CMD_getDenominationDetails
{
/**
* The label of the source of the denomination to check
*/
const char *label_denom;
unsigned int index_denom;
} get_denomination;
/** /**
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_DEPOSIT command * Extra data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_RESERVE command
*/ */
struct PERF_TALER_MINTDB_CMD_getDepositDetails struct PERF_TALER_MINTDB_CMD_insertReserveDetails
{ {
/** /**
* The label of the source of the deposit to check * The label of the source of the reserve to insert
*/ */
const char *label_deposit; const char *label_reserve;
unsigned int index_deposit; unsigned int index_reserve;
} get_deposit; } insert_reserve;
/** /**
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_RESERVE command * Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_RESERVE command
@ -841,9 +908,8 @@ union PERF_TALER_MINTDB_CMD_Details
unsigned int index_reserve; unsigned int index_reserve;
} get_reserve; } get_reserve;
/** /**
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_RESERVE command * Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_RESERVE_HISTORY command
*/ */
struct PERF_TALER_MINTDB_CMD_getReserveHistoryDetails struct PERF_TALER_MINTDB_CMD_getReserveHistoryDetails
{ {
@ -854,24 +920,10 @@ union PERF_TALER_MINTDB_CMD_Details
unsigned int index_reserve; unsigned int index_reserve;
} get_reserve_history; } get_reserve_history;
/** /**
* Extra data requiered by the #PERF_TALER_MINTDB_CMD_GET_DENOMINATION command * Extra data related to the #PERF_TALER_MINTDB_CMD_CREATE_WITHDRAW command
*/ */
struct PERF_TALER_MINTDB_CMD_getDenominationDetails struct PERF_TALER_MINTDB_CMD_createWithdrawDetails
{
/**
* The label of the source of the denomination to check
*/
const char *label_denom;
unsigned int index_denom;
} get_denomination;
/**
* Extra data related to the #PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW command
*/
struct PERF_TALER_MINTDB_CMD_insertWithdrawDetails
{ {
/** /**
* label of the denomination key used to sign the coin * label of the denomination key used to sign the coin
@ -884,6 +936,18 @@ union PERF_TALER_MINTDB_CMD_Details
*/ */
const char *label_reserve; const char *label_reserve;
unsigned int index_reserve; unsigned int index_reserve;
} create_withdraw;
/**
* data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_WITHDRAW
*/
struct PERF_TALER_MINTDB_CMD_insertWithdrawDetails
{
/**
* label of the source for the coin information
*/
const char *label_coin;
unsigned int index_coin;
} insert_withdraw; } insert_withdraw;
/** /**
@ -911,6 +975,42 @@ union PERF_TALER_MINTDB_CMD_Details
} get_coin_transaction; } get_coin_transaction;
/** /**
* Data used by the #PERF_TALER_MINTDB_CMD_CREATE_DEPOSIT command
*/
struct PERF_TALER_MINTDB_CMD_createDepositDetails
{
/**
* Label of the source where the reserve used to create the coin is
*/
const char *label_coin;
unsigned int index_coin;
} create_deposit;
/**
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_INSERT_DEPOSIT command
*/
struct PERF_TALER_MINTDB_CMD_insertDepositDetails
{
/**
* The label of the source of the deposit to check
*/
const char *label_deposit;
unsigned int index_deposit;
} insert_deposit;
/**
* Extra data requiered for the #PERF_TALER_MINTDB_CMD_GET_DEPOSIT command
*/
struct PERF_TALER_MINTDB_CMD_getDepositDetails
{
/**
* The label of the source of the deposit to check
*/
const char *label_deposit;
unsigned int index_deposit;
} get_deposit;
/**
* Data requiered for the #PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION command * Data requiered for the #PERF_TALER_MINTDB_CMD_GET_REFRESH_SESSION command
*/ */
struct PERF_TALER_MINTDB_CMD_getRefreshSessionDetails struct PERF_TALER_MINTDB_CMD_getRefreshSessionDetails

View File

@ -88,7 +88,9 @@ main (int argc, char ** argv)
PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("01 - denomination loop",
NB_DENOMINATION_INIT), NB_DENOMINATION_INIT),
PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("01 - start transaction"), PERF_TALER_MINTDB_INIT_CMD_START_TRANSACTION ("01 - start transaction"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - denomination"), PERF_TALER_MINTDB_INIT_CMD_CREATE_DENOMINATION ("01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_DENOMINATION ("01 - insert",
"01 - denomination"),
PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("01 - commit transaction"), PERF_TALER_MINTDB_INIT_CMD_COMMIT_TRANSACTION ("01 - commit transaction"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("01 - save denomination",
"01 - denomination loop", "01 - denomination loop",
@ -101,7 +103,10 @@ main (int argc, char ** argv)
// Reserve initialization // Reserve initialization
PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop", PERF_TALER_MINTDB_INIT_CMD_LOOP ("02 - init reserve loop",
NB_RESERVE_INIT), NB_RESERVE_INIT),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_CREATE_RESERVE ("02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_INSERT_RESERVE ("02 - insert",
"02 - reserve"),
PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve", PERF_TALER_MINTDB_INIT_CMD_SAVE_ARRAY ("02 - save reserve",
"02 - init reserve loop", "02 - init reserve loop",
"02 - reserve", "02 - reserve",