convert rest of exchangedb plugin API to fix #5010-issues

This commit is contained in:
Christian Grothoff 2017-06-24 16:15:42 +02:00
parent 2d662e3f8e
commit c42d544736
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 786 additions and 696 deletions

View File

@ -2405,8 +2405,6 @@ struct CoinContext
/** /**
* Current financial risk of the exchange operator with respect * Current financial risk of the exchange operator with respect
* to key compromise. * to key compromise.
*
* TODO: not yet properly used!
*/ */
struct TALER_Amount risk; struct TALER_Amount risk;

File diff suppressed because it is too large Load Diff

View File

@ -98,7 +98,7 @@ mark_prepare_cb (void *cls,
GNUNET_assert (0 == memcmp (buf, GNUNET_assert (0 == memcmp (buf,
"hello world", "hello world",
buf_size)); buf_size));
GNUNET_break (GNUNET_OK == GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
plugin->wire_prepare_data_mark_finished (plugin->cls, plugin->wire_prepare_data_mark_finished (plugin->cls,
session, session,
rowid)); rowid));
@ -114,7 +114,7 @@ mark_prepare_cb (void *cls,
static int static int
test_wire_prepare (struct TALER_EXCHANGEDB_Session *session) test_wire_prepare (struct TALER_EXCHANGEDB_Session *session)
{ {
FAILIF (GNUNET_NO != FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->wire_prepare_data_get (plugin->cls, plugin->wire_prepare_data_get (plugin->cls,
session, session,
&dead_prepare_cb, &dead_prepare_cb,
@ -125,12 +125,12 @@ test_wire_prepare (struct TALER_EXCHANGEDB_Session *session)
"testcase", "testcase",
"hello world", "hello world",
11)); 11));
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->wire_prepare_data_get (plugin->cls, plugin->wire_prepare_data_get (plugin->cls,
session, session,
&mark_prepare_cb, &mark_prepare_cb,
session)); session));
FAILIF (GNUNET_NO != FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->wire_prepare_data_get (plugin->cls, plugin->wire_prepare_data_get (plugin->cls,
session, session,
&dead_prepare_cb, &dead_prepare_cb,
@ -583,7 +583,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
&ret_refresh_session)); &ret_refresh_session));
auditor_row_cnt = 0; auditor_row_cnt = 0;
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_refreshs_above_serial_id (plugin->cls, plugin->select_refreshs_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -1328,7 +1328,7 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session,
NULL)); NULL));
} }
/* insert WT data */ /* insert WT data */
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_aggregation_tracking (plugin->cls, plugin->insert_aggregation_tracking (plugin->cls,
session, session,
&wire_out_wtid, &wire_out_wtid,
@ -1336,7 +1336,7 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session,
/* Now let's fix the transient constraint violation by /* Now let's fix the transient constraint violation by
putting in the WTID into the wire_out table */ putting in the WTID into the wire_out table */
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->store_wire_transfer_out (plugin->cls, plugin->store_wire_transfer_out (plugin->cls,
session, session,
wire_out_date, wire_out_date,
@ -1363,7 +1363,7 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session,
&merchant_pub_wt, &merchant_pub_wt,
&cb_wtid_check, &cb_wtid_check,
&cb_wtid_never)); &cb_wtid_never));
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_wire_out_above_serial_id (plugin->cls, plugin->select_wire_out_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -1488,7 +1488,7 @@ run (void *cls)
session)); session));
/* test DB is empty */ /* test DB is empty */
FAILIF (GNUNET_NO != FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->select_payback_above_serial_id (plugin->cls, plugin->select_payback_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -1650,7 +1650,7 @@ run (void *cls)
&value, &value,
&cbc.h_coin_envelope, &cbc.h_coin_envelope,
deadline)); deadline));
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_payback_above_serial_id (plugin->cls, plugin->select_payback_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -1753,13 +1753,13 @@ run (void *cls)
FAILIF (5 != cnt); FAILIF (5 != cnt);
auditor_row_cnt = 0; auditor_row_cnt = 0;
FAILIF (GNUNET_OK != FAILIF (0 >=
plugin->select_reserves_in_above_serial_id (plugin->cls, plugin->select_reserves_in_above_serial_id (plugin->cls,
session, session,
0, 0,
&audit_reserve_in_cb, &audit_reserve_in_cb,
NULL)); NULL));
FAILIF (GNUNET_OK != FAILIF (0 >=
plugin->select_reserves_out_above_serial_id (plugin->cls, plugin->select_reserves_out_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -1791,7 +1791,7 @@ run (void *cls)
session, session,
&deposit)); &deposit));
auditor_row_cnt = 0; auditor_row_cnt = 0;
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_deposits_above_serial_id (plugin->cls, plugin->select_deposits_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -1822,14 +1822,14 @@ run (void *cls)
plugin->mark_deposit_tiny (plugin->cls, plugin->mark_deposit_tiny (plugin->cls,
session, session,
deposit_rowid)); deposit_rowid));
FAILIF (0 != FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->get_ready_deposit (plugin->cls, plugin->get_ready_deposit (plugin->cls,
session, session,
&deposit_cb, &deposit_cb,
&deposit)); &deposit));
plugin->rollback (plugin->cls, plugin->rollback (plugin->cls,
session); session);
FAILIF (1 != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_ready_deposit (plugin->cls, plugin->get_ready_deposit (plugin->cls,
session, session,
&deposit_cb, &deposit_cb,
@ -1937,7 +1937,7 @@ run (void *cls)
deadline)); deadline));
auditor_row_cnt = 0; auditor_row_cnt = 0;
FAILIF (GNUNET_OK != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->select_refunds_above_serial_id (plugin->cls, plugin->select_refunds_above_serial_id (plugin->cls,
session, session,
0, 0,
@ -2131,3 +2131,5 @@ main (int argc,
GNUNET_free (testname); GNUNET_free (testname);
return result; return result;
} }
/* end of test_exchangedb.c */

View File

@ -1963,10 +1963,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id highest serial ID to exclude (select strictly larger) * @param serial_id highest serial ID to exclude (select strictly larger)
* @param cb function to call on each result * @param cb function to call on each result
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_deposits_above_serial_id)(void *cls, (*select_deposits_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -1982,10 +1981,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id highest serial ID to exclude (select strictly larger) * @param serial_id highest serial ID to exclude (select strictly larger)
* @param cb function to call on each result * @param cb function to call on each result
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_refreshs_above_serial_id)(void *cls, (*select_refreshs_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2002,10 +2000,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id highest serial ID to exclude (select strictly larger) * @param serial_id highest serial ID to exclude (select strictly larger)
* @param cb function to call on each result * @param cb function to call on each result
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_refunds_above_serial_id)(void *cls, (*select_refunds_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2022,10 +2019,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id highest serial ID to exclude (select strictly larger) * @param serial_id highest serial ID to exclude (select strictly larger)
* @param cb function to call on each result * @param cb function to call on each result
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_reserves_in_above_serial_id)(void *cls, (*select_reserves_in_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2041,11 +2037,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id highest serial ID to exclude (select strictly larger) * @param serial_id highest serial ID to exclude (select strictly larger)
* @param cb function to call on each result * @param cb function to call on each result
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_NO if no records were found
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_reserves_out_above_serial_id)(void *cls, (*select_reserves_out_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2062,11 +2056,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id lowest serial ID to include (select larger or equal) * @param serial_id lowest serial ID to include (select larger or equal)
* @param cb function to call for ONE unfinished item * @param cb function to call for ONE unfinished item
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_NO if there are no entries,
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_wire_out_above_serial_id)(void *cls, (*select_wire_out_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2083,11 +2075,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id lowest serial ID to include (select larger or equal) * @param serial_id lowest serial ID to include (select larger or equal)
* @param cb function to call for ONE unfinished item * @param cb function to call for ONE unfinished item
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_NO if there are no entries,
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_payback_above_serial_id)(void *cls, (*select_payback_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2104,11 +2094,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param serial_id lowest serial ID to include (select larger or equal) * @param serial_id lowest serial ID to include (select larger or equal)
* @param cb function to call * @param cb function to call
* @param cb_cls closure for @a cb * @param cb_cls closure for @a cb
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_NO if there are no entries,
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*select_reserve_closed_above_serial_id)(void *cls, (*select_reserve_closed_above_serial_id)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
uint64_t serial_id, uint64_t serial_id,
@ -2191,11 +2179,9 @@ struct TALER_EXCHANGEDB_Plugin
* @param denom_pub_hash hash of the revoked denomination key * @param denom_pub_hash hash of the revoked denomination key
* @param[out] master_sig signature affirming the revocation * @param[out] master_sig signature affirming the revocation
* @param[out] rowid row where the information is stored * @param[out] rowid row where the information is stored
* @return #GNUNET_OK on success, * @return transaction status code
* #GNUNET_NO no such entry exists
* #GNUNET_SYSERR on DB errors
*/ */
int enum GNUNET_DB_QueryStatus
(*get_denomination_revocation)(void *cls, (*get_denomination_revocation)(void *cls,
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *denom_pub_hash, const struct GNUNET_HashCode *denom_pub_hash,