diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-23 08:24:59 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-23 08:24:59 +0200 |
commit | 01e06eb715938b914c54123c21c7c7678e08ee02 (patch) | |
tree | 85d8053916faa7bfddb711023d8c7959cb83aa5f | |
parent | 82a5038acf5302957ca450d9c262f6fed59a45ba (diff) | |
download | exchange-01e06eb715938b914c54123c21c7c7678e08ee02.tar.gz exchange-01e06eb715938b914c54123c21c7c7678e08ee02.zip |
-remove sessions also from auditor
-rw-r--r-- | src/auditor/report-lib.c | 29 | ||||
-rw-r--r-- | src/auditor/report-lib.h | 5 | ||||
-rw-r--r-- | src/auditor/taler-auditor-exchange.c | 11 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_deposit-confirmation.c | 7 | ||||
-rw-r--r-- | src/auditor/taler-auditor-httpd_exchanges.c | 6 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-aggregation.c | 6 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-coins.c | 11 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-deposits.c | 4 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-reserves.c | 10 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-wire.c | 27 | ||||
-rw-r--r-- | src/auditordb/plugin_auditordb_postgres.c | 433 | ||||
-rw-r--r-- | src/auditordb/test_auditordb.c | 57 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keys.c | 7 | ||||
-rw-r--r-- | src/include/taler_auditordb_plugin.h | 140 | ||||
-rw-r--r-- | src/mhd/mhd_config.c | 13 | ||||
-rw-r--r-- | src/util/test_payto.c | 2 |
16 files changed, 211 insertions, 557 deletions
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 0ae1cc1f6..4addce9e2 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c | |||
@@ -47,11 +47,6 @@ const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg; | |||
47 | struct TALER_AUDITORDB_Plugin *TALER_ARL_adb; | 47 | struct TALER_AUDITORDB_Plugin *TALER_ARL_adb; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Our session with the #TALER_ARL_adb. | ||
51 | */ | ||
52 | struct TALER_AUDITORDB_Session *TALER_ARL_asession; | ||
53 | |||
54 | /** | ||
55 | * Master public key of the exchange to audit. | 50 | * Master public key of the exchange to audit. |
56 | */ | 51 | */ |
57 | struct TALER_MasterPublicKeyP TALER_ARL_master_pub; | 52 | struct TALER_MasterPublicKeyP TALER_ARL_master_pub; |
@@ -310,8 +305,7 @@ transact (TALER_ARL_Analysis analysis, | |||
310 | int ret; | 305 | int ret; |
311 | enum GNUNET_DB_QueryStatus qs; | 306 | enum GNUNET_DB_QueryStatus qs; |
312 | 307 | ||
313 | ret = TALER_ARL_adb->start (TALER_ARL_adb->cls, | 308 | ret = TALER_ARL_adb->start (TALER_ARL_adb->cls); |
314 | TALER_ARL_asession); | ||
315 | if (GNUNET_OK != ret) | 309 | if (GNUNET_OK != ret) |
316 | { | 310 | { |
317 | GNUNET_break (0); | 311 | GNUNET_break (0); |
@@ -340,13 +334,11 @@ transact (TALER_ARL_Analysis analysis, | |||
340 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); | 334 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); |
341 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
342 | "Exchange DB commit failed, rolling back transaction\n"); | 336 | "Exchange DB commit failed, rolling back transaction\n"); |
343 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, | 337 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls); |
344 | TALER_ARL_asession); | ||
345 | } | 338 | } |
346 | else | 339 | else |
347 | { | 340 | { |
348 | qs = TALER_ARL_adb->commit (TALER_ARL_adb->cls, | 341 | qs = TALER_ARL_adb->commit (TALER_ARL_adb->cls); |
349 | TALER_ARL_asession); | ||
350 | if (0 > qs) | 342 | if (0 > qs) |
351 | { | 343 | { |
352 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); | 344 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); |
@@ -359,8 +351,7 @@ transact (TALER_ARL_Analysis analysis, | |||
359 | { | 351 | { |
360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
361 | "Processing failed (or no changes), rolling back transaction\n"); | 353 | "Processing failed (or no changes), rolling back transaction\n"); |
362 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, | 354 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls); |
363 | TALER_ARL_asession); | ||
364 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); | 355 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); |
365 | } | 356 | } |
366 | switch (qs) | 357 | switch (qs) |
@@ -389,15 +380,15 @@ int | |||
389 | TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana, | 380 | TALER_ARL_setup_sessions_and_run (TALER_ARL_Analysis ana, |
390 | void *ana_cls) | 381 | void *ana_cls) |
391 | { | 382 | { |
392 | if (GNUNET_OK != | 383 | if (GNUNET_SYSERR == |
393 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls)) | 384 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls)) |
394 | { | 385 | { |
395 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 386 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
396 | "Failed to initialize exchange connection.\n"); | 387 | "Failed to initialize exchange connection.\n"); |
397 | return GNUNET_SYSERR; | 388 | return GNUNET_SYSERR; |
398 | } | 389 | } |
399 | TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls); | 390 | if (GNUNET_SYSERR == |
400 | if (NULL == TALER_ARL_asession) | 391 | TALER_ARL_adb->preflight (TALER_ARL_adb->cls)) |
401 | { | 392 | { |
402 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 393 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
403 | "Failed to initialize auditor session.\n"); | 394 | "Failed to initialize auditor session.\n"); |
@@ -804,11 +795,10 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
804 | return GNUNET_SYSERR; | 795 | return GNUNET_SYSERR; |
805 | } | 796 | } |
806 | { | 797 | { |
807 | struct TALER_AUDITORDB_Session *as; | ||
808 | int found; | 798 | int found; |
809 | 799 | ||
810 | as = TALER_ARL_adb->get_session (TALER_ARL_adb->cls); | 800 | if (GNUNET_SYSERR == |
811 | if (NULL == as) | 801 | TALER_ARL_adb->preflight (TALER_ARL_adb->cls)) |
812 | { | 802 | { |
813 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 803 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
814 | "Failed to start session with auditor database.\n"); | 804 | "Failed to start session with auditor database.\n"); |
@@ -817,7 +807,6 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
817 | } | 807 | } |
818 | found = GNUNET_NO; | 808 | found = GNUNET_NO; |
819 | (void) TALER_ARL_adb->list_exchanges (TALER_ARL_adb->cls, | 809 | (void) TALER_ARL_adb->list_exchanges (TALER_ARL_adb->cls, |
820 | as, | ||
821 | &test_master_present, | 810 | &test_master_present, |
822 | &found); | 811 | &found); |
823 | if (GNUNET_NO == found) | 812 | if (GNUNET_NO == found) |
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h index d8d825914..7c01b1685 100644 --- a/src/auditor/report-lib.h +++ b/src/auditor/report-lib.h | |||
@@ -60,11 +60,6 @@ extern const struct GNUNET_CONFIGURATION_Handle *TALER_ARL_cfg; | |||
60 | extern struct TALER_AUDITORDB_Plugin *TALER_ARL_adb; | 60 | extern struct TALER_AUDITORDB_Plugin *TALER_ARL_adb; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Our session with the #TALER_ARL_adb. | ||
64 | */ | ||
65 | extern struct TALER_AUDITORDB_Session *TALER_ARL_asession; | ||
66 | |||
67 | /** | ||
68 | * Master public key of the exchange to audit. | 63 | * Master public key of the exchange to audit. |
69 | */ | 64 | */ |
70 | extern struct TALER_MasterPublicKeyP TALER_ARL_master_pub; | 65 | extern struct TALER_MasterPublicKeyP TALER_ARL_master_pub; |
diff --git a/src/auditor/taler-auditor-exchange.c b/src/auditor/taler-auditor-exchange.c index b751ea9a4..04181ce3f 100644 --- a/src/auditor/taler-auditor-exchange.c +++ b/src/auditor/taler-auditor-exchange.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2014, 2015, 2018, 2019 Taler Systems SA | 3 | Copyright (C) 2014-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -176,13 +176,12 @@ main (int argc, | |||
176 | /* Update DB */ | 176 | /* Update DB */ |
177 | { | 177 | { |
178 | enum GNUNET_DB_QueryStatus qs; | 178 | enum GNUNET_DB_QueryStatus qs; |
179 | struct TALER_AUDITORDB_Session *session; | ||
180 | 179 | ||
181 | session = adb->get_session (adb->cls); | 180 | if (GNUNET_SYSERR == |
182 | if (NULL == session) | 181 | adb->preflight (adb->cls)) |
183 | { | 182 | { |
184 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 183 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
185 | "Failed to initialize database session\n"); | 184 | "Failed to initialize database connection\n"); |
186 | TALER_AUDITORDB_plugin_unload (adb); | 185 | TALER_AUDITORDB_plugin_unload (adb); |
187 | return EXIT_FAILURE; | 186 | return EXIT_FAILURE; |
188 | } | 187 | } |
@@ -190,13 +189,11 @@ main (int argc, | |||
190 | if (remove_flag) | 189 | if (remove_flag) |
191 | { | 190 | { |
192 | qs = adb->delete_exchange (adb->cls, | 191 | qs = adb->delete_exchange (adb->cls, |
193 | session, | ||
194 | &master_public_key); | 192 | &master_public_key); |
195 | } | 193 | } |
196 | else | 194 | else |
197 | { | 195 | { |
198 | qs = adb->insert_exchange (adb->cls, | 196 | qs = adb->insert_exchange (adb->cls, |
199 | session, | ||
200 | &master_public_key, | 197 | &master_public_key, |
201 | exchange_url); | 198 | exchange_url); |
202 | } | 199 | } |
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c b/src/auditor/taler-auditor-httpd_deposit-confirmation.c index f38e8ee71..c7a23d718 100644 --- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c +++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c | |||
@@ -62,7 +62,6 @@ verify_and_execute_deposit_confirmation ( | |||
62 | const struct TALER_AUDITORDB_DepositConfirmation *dc, | 62 | const struct TALER_AUDITORDB_DepositConfirmation *dc, |
63 | const struct TALER_AUDITORDB_ExchangeSigningKey *es) | 63 | const struct TALER_AUDITORDB_ExchangeSigningKey *es) |
64 | { | 64 | { |
65 | struct TALER_AUDITORDB_Session *session; | ||
66 | enum GNUNET_DB_QueryStatus qs; | 65 | enum GNUNET_DB_QueryStatus qs; |
67 | struct GNUNET_TIME_Absolute now; | 66 | struct GNUNET_TIME_Absolute now; |
68 | struct GNUNET_HashCode h; | 67 | struct GNUNET_HashCode h; |
@@ -96,8 +95,8 @@ verify_and_execute_deposit_confirmation ( | |||
96 | cached = GNUNET_CONTAINER_multihashmap_get (cache, | 95 | cached = GNUNET_CONTAINER_multihashmap_get (cache, |
97 | &h); | 96 | &h); |
98 | GNUNET_assert (0 == pthread_mutex_unlock (&lock)); | 97 | GNUNET_assert (0 == pthread_mutex_unlock (&lock)); |
99 | session = TAH_plugin->get_session (TAH_plugin->cls); | 98 | if (GNUNET_SYSERR == |
100 | if (NULL == session) | 99 | TAH_plugin->preflight (TAH_plugin->cls)) |
101 | { | 100 | { |
102 | GNUNET_break (0); | 101 | GNUNET_break (0); |
103 | return TALER_MHD_reply_with_error (connection, | 102 | return TALER_MHD_reply_with_error (connection, |
@@ -126,7 +125,6 @@ verify_and_execute_deposit_confirmation ( | |||
126 | 125 | ||
127 | /* execute transaction */ | 126 | /* execute transaction */ |
128 | qs = TAH_plugin->insert_exchange_signkey (TAH_plugin->cls, | 127 | qs = TAH_plugin->insert_exchange_signkey (TAH_plugin->cls, |
129 | session, | ||
130 | es); | 128 | es); |
131 | if (0 > qs) | 129 | if (0 > qs) |
132 | { | 130 | { |
@@ -216,7 +214,6 @@ verify_and_execute_deposit_confirmation ( | |||
216 | 214 | ||
217 | /* execute transaction */ | 215 | /* execute transaction */ |
218 | qs = TAH_plugin->insert_deposit_confirmation (TAH_plugin->cls, | 216 | qs = TAH_plugin->insert_deposit_confirmation (TAH_plugin->cls, |
219 | session, | ||
220 | dc); | 217 | dc); |
221 | if (0 > qs) | 218 | if (0 > qs) |
222 | { | 219 | { |
diff --git a/src/auditor/taler-auditor-httpd_exchanges.c b/src/auditor/taler-auditor-httpd_exchanges.c index 7b54b6d49..f9a9e9e60 100644 --- a/src/auditor/taler-auditor-httpd_exchanges.c +++ b/src/auditor/taler-auditor-httpd_exchanges.c | |||
@@ -75,15 +75,14 @@ TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, | |||
75 | size_t *upload_data_size) | 75 | size_t *upload_data_size) |
76 | { | 76 | { |
77 | json_t *ja; | 77 | json_t *ja; |
78 | struct TALER_AUDITORDB_Session *session; | ||
79 | enum GNUNET_DB_QueryStatus qs; | 78 | enum GNUNET_DB_QueryStatus qs; |
80 | 79 | ||
81 | (void) rh; | 80 | (void) rh; |
82 | (void) connection_cls; | 81 | (void) connection_cls; |
83 | (void) upload_data; | 82 | (void) upload_data; |
84 | (void) upload_data_size; | 83 | (void) upload_data_size; |
85 | session = TAH_plugin->get_session (TAH_plugin->cls); | 84 | if (GNUNET_SYSERR == |
86 | if (NULL == session) | 85 | TAH_plugin->preflight (TAH_plugin->cls)) |
87 | { | 86 | { |
88 | GNUNET_break (0); | 87 | GNUNET_break (0); |
89 | return TALER_MHD_reply_with_error (connection, | 88 | return TALER_MHD_reply_with_error (connection, |
@@ -94,7 +93,6 @@ TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh, | |||
94 | ja = json_array (); | 93 | ja = json_array (); |
95 | GNUNET_break (NULL != ja); | 94 | GNUNET_break (NULL != ja); |
96 | qs = TAH_plugin->list_exchanges (TAH_plugin->cls, | 95 | qs = TAH_plugin->list_exchanges (TAH_plugin->cls, |
97 | session, | ||
98 | &add_exchange, | 96 | &add_exchange, |
99 | ja); | 97 | ja); |
100 | if (0 > qs) | 98 | if (0 > qs) |
diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c index 3bc8c7701..468f66b44 100644 --- a/src/auditor/taler-helper-auditor-aggregation.c +++ b/src/auditor/taler-helper-auditor-aggregation.c | |||
@@ -1218,7 +1218,6 @@ analyze_aggregations (void *cls) | |||
1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1219 | "Analyzing aggregations\n"); | 1219 | "Analyzing aggregations\n"); |
1220 | qsp = TALER_ARL_adb->get_auditor_progress_aggregation (TALER_ARL_adb->cls, | 1220 | qsp = TALER_ARL_adb->get_auditor_progress_aggregation (TALER_ARL_adb->cls, |
1221 | TALER_ARL_asession, | ||
1222 | &TALER_ARL_master_pub, | 1221 | &TALER_ARL_master_pub, |
1223 | &ppa); | 1222 | &ppa); |
1224 | if (0 > qsp) | 1223 | if (0 > qsp) |
@@ -1243,7 +1242,6 @@ analyze_aggregations (void *cls) | |||
1243 | 0, | 1242 | 0, |
1244 | sizeof (ac)); | 1243 | sizeof (ac)); |
1245 | qsx = TALER_ARL_adb->get_wire_fee_summary (TALER_ARL_adb->cls, | 1244 | qsx = TALER_ARL_adb->get_wire_fee_summary (TALER_ARL_adb->cls, |
1246 | TALER_ARL_asession, | ||
1247 | &TALER_ARL_master_pub, | 1245 | &TALER_ARL_master_pub, |
1248 | &total_aggregation_fee_income); | 1246 | &total_aggregation_fee_income); |
1249 | if (0 > qsx) | 1247 | if (0 > qsx) |
@@ -1282,13 +1280,11 @@ analyze_aggregations (void *cls) | |||
1282 | if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx) | 1280 | if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx) |
1283 | ac.qs = TALER_ARL_adb->insert_wire_fee_summary ( | 1281 | ac.qs = TALER_ARL_adb->insert_wire_fee_summary ( |
1284 | TALER_ARL_adb->cls, | 1282 | TALER_ARL_adb->cls, |
1285 | TALER_ARL_asession, | ||
1286 | &TALER_ARL_master_pub, | 1283 | &TALER_ARL_master_pub, |
1287 | &total_aggregation_fee_income); | 1284 | &total_aggregation_fee_income); |
1288 | else | 1285 | else |
1289 | ac.qs = TALER_ARL_adb->update_wire_fee_summary ( | 1286 | ac.qs = TALER_ARL_adb->update_wire_fee_summary ( |
1290 | TALER_ARL_adb->cls, | 1287 | TALER_ARL_adb->cls, |
1291 | TALER_ARL_asession, | ||
1292 | &TALER_ARL_master_pub, | 1288 | &TALER_ARL_master_pub, |
1293 | &total_aggregation_fee_income); | 1289 | &total_aggregation_fee_income); |
1294 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != ac.qs) | 1290 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != ac.qs) |
@@ -1299,13 +1295,11 @@ analyze_aggregations (void *cls) | |||
1299 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) | 1295 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) |
1300 | qs = TALER_ARL_adb->update_auditor_progress_aggregation ( | 1296 | qs = TALER_ARL_adb->update_auditor_progress_aggregation ( |
1301 | TALER_ARL_adb->cls, | 1297 | TALER_ARL_adb->cls, |
1302 | TALER_ARL_asession, | ||
1303 | &TALER_ARL_master_pub, | 1298 | &TALER_ARL_master_pub, |
1304 | &ppa); | 1299 | &ppa); |
1305 | else | 1300 | else |
1306 | qs = TALER_ARL_adb->insert_auditor_progress_aggregation ( | 1301 | qs = TALER_ARL_adb->insert_auditor_progress_aggregation ( |
1307 | TALER_ARL_adb->cls, | 1302 | TALER_ARL_adb->cls, |
1308 | TALER_ARL_asession, | ||
1309 | &TALER_ARL_master_pub, | 1303 | &TALER_ARL_master_pub, |
1310 | &ppa); | 1304 | &ppa); |
1311 | if (0 >= qs) | 1305 | if (0 >= qs) |
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index a2c8b8cee..ba9cf6d18 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c | |||
@@ -679,7 +679,6 @@ init_denomination (const struct GNUNET_HashCode *denom_hash, | |||
679 | uint64_t rowid; | 679 | uint64_t rowid; |
680 | 680 | ||
681 | qs = TALER_ARL_adb->get_denomination_balance (TALER_ARL_adb->cls, | 681 | qs = TALER_ARL_adb->get_denomination_balance (TALER_ARL_adb->cls, |
682 | TALER_ARL_asession, | ||
683 | denom_hash, | 682 | denom_hash, |
684 | &ds->denom_balance, | 683 | &ds->denom_balance, |
685 | &ds->denom_loss, | 684 | &ds->denom_loss, |
@@ -819,7 +818,6 @@ sync_denomination (void *cls, | |||
819 | outstanding coins as revenue; and reduce cc->risk exposure. */ | 818 | outstanding coins as revenue; and reduce cc->risk exposure. */ |
820 | if (ds->in_db) | 819 | if (ds->in_db) |
821 | qs = TALER_ARL_adb->del_denomination_balance (TALER_ARL_adb->cls, | 820 | qs = TALER_ARL_adb->del_denomination_balance (TALER_ARL_adb->cls, |
822 | TALER_ARL_asession, | ||
823 | denom_hash); | 821 | denom_hash); |
824 | else | 822 | else |
825 | qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; | 823 | qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; |
@@ -851,7 +849,6 @@ sync_denomination (void *cls, | |||
851 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 849 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
852 | (qs = TALER_ARL_adb->insert_historic_denom_revenue ( | 850 | (qs = TALER_ARL_adb->insert_historic_denom_revenue ( |
853 | TALER_ARL_adb->cls, | 851 | TALER_ARL_adb->cls, |
854 | TALER_ARL_asession, | ||
855 | &TALER_ARL_master_pub, | 852 | &TALER_ARL_master_pub, |
856 | denom_hash, | 853 | denom_hash, |
857 | expire_deposit, | 854 | expire_deposit, |
@@ -905,7 +902,6 @@ sync_denomination (void *cls, | |||
905 | } | 902 | } |
906 | if (ds->in_db) | 903 | if (ds->in_db) |
907 | qs = TALER_ARL_adb->update_denomination_balance (TALER_ARL_adb->cls, | 904 | qs = TALER_ARL_adb->update_denomination_balance (TALER_ARL_adb->cls, |
908 | TALER_ARL_asession, | ||
909 | denom_hash, | 905 | denom_hash, |
910 | &ds->denom_balance, | 906 | &ds->denom_balance, |
911 | &ds->denom_loss, | 907 | &ds->denom_loss, |
@@ -914,7 +910,6 @@ sync_denomination (void *cls, | |||
914 | ds->num_issued); | 910 | ds->num_issued); |
915 | else | 911 | else |
916 | qs = TALER_ARL_adb->insert_denomination_balance (TALER_ARL_adb->cls, | 912 | qs = TALER_ARL_adb->insert_denomination_balance (TALER_ARL_adb->cls, |
917 | TALER_ARL_asession, | ||
918 | denom_hash, | 913 | denom_hash, |
919 | &ds->denom_balance, | 914 | &ds->denom_balance, |
920 | &ds->denom_loss, | 915 | &ds->denom_loss, |
@@ -2333,7 +2328,6 @@ analyze_coins (void *cls) | |||
2333 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2328 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2334 | "Analyzing coins\n"); | 2329 | "Analyzing coins\n"); |
2335 | qsp = TALER_ARL_adb->get_auditor_progress_coin (TALER_ARL_adb->cls, | 2330 | qsp = TALER_ARL_adb->get_auditor_progress_coin (TALER_ARL_adb->cls, |
2336 | TALER_ARL_asession, | ||
2337 | &TALER_ARL_master_pub, | 2331 | &TALER_ARL_master_pub, |
2338 | &ppc); | 2332 | &ppc); |
2339 | if (0 > qsp) | 2333 | if (0 > qsp) |
@@ -2363,7 +2357,6 @@ analyze_coins (void *cls) | |||
2363 | cc.denom_summaries = GNUNET_CONTAINER_multihashmap_create (256, | 2357 | cc.denom_summaries = GNUNET_CONTAINER_multihashmap_create (256, |
2364 | GNUNET_NO); | 2358 | GNUNET_NO); |
2365 | qsx = TALER_ARL_adb->get_balance_summary (TALER_ARL_adb->cls, | 2359 | qsx = TALER_ARL_adb->get_balance_summary (TALER_ARL_adb->cls, |
2366 | TALER_ARL_asession, | ||
2367 | &TALER_ARL_master_pub, | 2360 | &TALER_ARL_master_pub, |
2368 | &total_escrow_balance, | 2361 | &total_escrow_balance, |
2369 | &total_deposit_fee_income, | 2362 | &total_deposit_fee_income, |
@@ -2473,7 +2466,6 @@ analyze_coins (void *cls) | |||
2473 | } | 2466 | } |
2474 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx) | 2467 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx) |
2475 | qs = TALER_ARL_adb->update_balance_summary (TALER_ARL_adb->cls, | 2468 | qs = TALER_ARL_adb->update_balance_summary (TALER_ARL_adb->cls, |
2476 | TALER_ARL_asession, | ||
2477 | &TALER_ARL_master_pub, | 2469 | &TALER_ARL_master_pub, |
2478 | &total_escrow_balance, | 2470 | &total_escrow_balance, |
2479 | &total_deposit_fee_income, | 2471 | &total_deposit_fee_income, |
@@ -2484,7 +2476,6 @@ analyze_coins (void *cls) | |||
2484 | &total_irregular_recoups); | 2476 | &total_irregular_recoups); |
2485 | else | 2477 | else |
2486 | qs = TALER_ARL_adb->insert_balance_summary (TALER_ARL_adb->cls, | 2478 | qs = TALER_ARL_adb->insert_balance_summary (TALER_ARL_adb->cls, |
2487 | TALER_ARL_asession, | ||
2488 | &TALER_ARL_master_pub, | 2479 | &TALER_ARL_master_pub, |
2489 | &total_escrow_balance, | 2480 | &total_escrow_balance, |
2490 | &total_deposit_fee_income, | 2481 | &total_deposit_fee_income, |
@@ -2501,12 +2492,10 @@ analyze_coins (void *cls) | |||
2501 | 2492 | ||
2502 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) | 2493 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) |
2503 | qs = TALER_ARL_adb->update_auditor_progress_coin (TALER_ARL_adb->cls, | 2494 | qs = TALER_ARL_adb->update_auditor_progress_coin (TALER_ARL_adb->cls, |
2504 | TALER_ARL_asession, | ||
2505 | &TALER_ARL_master_pub, | 2495 | &TALER_ARL_master_pub, |
2506 | &ppc); | 2496 | &ppc); |
2507 | else | 2497 | else |
2508 | qs = TALER_ARL_adb->insert_auditor_progress_coin (TALER_ARL_adb->cls, | 2498 | qs = TALER_ARL_adb->insert_auditor_progress_coin (TALER_ARL_adb->cls, |
2509 | TALER_ARL_asession, | ||
2510 | &TALER_ARL_master_pub, | 2499 | &TALER_ARL_master_pub, |
2511 | &ppc); | 2500 | &ppc); |
2512 | if (0 >= qs) | 2501 | if (0 >= qs) |
diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c index 58b41fbc3..58f8226f4 100644 --- a/src/auditor/taler-helper-auditor-deposits.c +++ b/src/auditor/taler-helper-auditor-deposits.c | |||
@@ -188,7 +188,6 @@ analyze_deposit_confirmations (void *cls) | |||
188 | ppdc.last_deposit_confirmation_serial_id = 0; | 188 | ppdc.last_deposit_confirmation_serial_id = 0; |
189 | qsp = TALER_ARL_adb->get_auditor_progress_deposit_confirmation ( | 189 | qsp = TALER_ARL_adb->get_auditor_progress_deposit_confirmation ( |
190 | TALER_ARL_adb->cls, | 190 | TALER_ARL_adb->cls, |
191 | TALER_ARL_asession, | ||
192 | &TALER_ARL_master_pub, | 191 | &TALER_ARL_master_pub, |
193 | &ppdc); | 192 | &ppdc); |
194 | if (0 > qsp) | 193 | if (0 > qsp) |
@@ -217,7 +216,6 @@ analyze_deposit_confirmations (void *cls) | |||
217 | dcc.first_missed_coin_serial = UINT64_MAX; | 216 | dcc.first_missed_coin_serial = UINT64_MAX; |
218 | qsx = TALER_ARL_adb->get_deposit_confirmations ( | 217 | qsx = TALER_ARL_adb->get_deposit_confirmations ( |
219 | TALER_ARL_adb->cls, | 218 | TALER_ARL_adb->cls, |
220 | TALER_ARL_asession, | ||
221 | &TALER_ARL_master_pub, | 219 | &TALER_ARL_master_pub, |
222 | ppdc.last_deposit_confirmation_serial_id, | 220 | ppdc.last_deposit_confirmation_serial_id, |
223 | &test_dc, | 221 | &test_dc, |
@@ -245,13 +243,11 @@ analyze_deposit_confirmations (void *cls) | |||
245 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) | 243 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) |
246 | qs = TALER_ARL_adb->update_auditor_progress_deposit_confirmation ( | 244 | qs = TALER_ARL_adb->update_auditor_progress_deposit_confirmation ( |
247 | TALER_ARL_adb->cls, | 245 | TALER_ARL_adb->cls, |
248 | TALER_ARL_asession, | ||
249 | &TALER_ARL_master_pub, | 246 | &TALER_ARL_master_pub, |
250 | &ppdc); | 247 | &ppdc); |
251 | else | 248 | else |
252 | qs = TALER_ARL_adb->insert_auditor_progress_deposit_confirmation ( | 249 | qs = TALER_ARL_adb->insert_auditor_progress_deposit_confirmation ( |
253 | TALER_ARL_adb->cls, | 250 | TALER_ARL_adb->cls, |
254 | TALER_ARL_asession, | ||
255 | &TALER_ARL_master_pub, | 251 | &TALER_ARL_master_pub, |
256 | &ppdc); | 252 | &ppdc); |
257 | if (0 >= qs) | 253 | if (0 >= qs) |
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c index 592663da6..aa9c241bb 100644 --- a/src/auditor/taler-helper-auditor-reserves.c +++ b/src/auditor/taler-helper-auditor-reserves.c | |||
@@ -317,7 +317,6 @@ load_auditor_reserve_summary (struct ReserveSummary *rs) | |||
317 | uint64_t rowid; | 317 | uint64_t rowid; |
318 | 318 | ||
319 | qs = TALER_ARL_adb->get_reserve_info (TALER_ARL_adb->cls, | 319 | qs = TALER_ARL_adb->get_reserve_info (TALER_ARL_adb->cls, |
320 | TALER_ARL_asession, | ||
321 | &rs->reserve_pub, | 320 | &rs->reserve_pub, |
322 | &TALER_ARL_master_pub, | 321 | &TALER_ARL_master_pub, |
323 | &rowid, | 322 | &rowid, |
@@ -1255,7 +1254,6 @@ verify_reserve_balance (void *cls, | |||
1255 | TALER_B2S (&rs->reserve_pub), | 1254 | TALER_B2S (&rs->reserve_pub), |
1256 | TALER_amount2s (&nbalance)); | 1255 | TALER_amount2s (&nbalance)); |
1257 | qs = TALER_ARL_adb->del_reserve_info (TALER_ARL_adb->cls, | 1256 | qs = TALER_ARL_adb->del_reserve_info (TALER_ARL_adb->cls, |
1258 | TALER_ARL_asession, | ||
1259 | &rs->reserve_pub, | 1257 | &rs->reserve_pub, |
1260 | &TALER_ARL_master_pub); | 1258 | &TALER_ARL_master_pub); |
1261 | if (0 >= qs) | 1259 | if (0 >= qs) |
@@ -1282,7 +1280,6 @@ verify_reserve_balance (void *cls, | |||
1282 | TALER_amount2s (&nbalance)); | 1280 | TALER_amount2s (&nbalance)); |
1283 | if (rs->had_ri) | 1281 | if (rs->had_ri) |
1284 | qs = TALER_ARL_adb->update_reserve_info (TALER_ARL_adb->cls, | 1282 | qs = TALER_ARL_adb->update_reserve_info (TALER_ARL_adb->cls, |
1285 | TALER_ARL_asession, | ||
1286 | &rs->reserve_pub, | 1283 | &rs->reserve_pub, |
1287 | &TALER_ARL_master_pub, | 1284 | &TALER_ARL_master_pub, |
1288 | &nbalance, | 1285 | &nbalance, |
@@ -1290,7 +1287,6 @@ verify_reserve_balance (void *cls, | |||
1290 | rs->a_expiration_date); | 1287 | rs->a_expiration_date); |
1291 | else | 1288 | else |
1292 | qs = TALER_ARL_adb->insert_reserve_info (TALER_ARL_adb->cls, | 1289 | qs = TALER_ARL_adb->insert_reserve_info (TALER_ARL_adb->cls, |
1293 | TALER_ARL_asession, | ||
1294 | &rs->reserve_pub, | 1290 | &rs->reserve_pub, |
1295 | &TALER_ARL_master_pub, | 1291 | &TALER_ARL_master_pub, |
1296 | &nbalance, | 1292 | &nbalance, |
@@ -1333,7 +1329,6 @@ analyze_reserves (void *cls) | |||
1333 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1329 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1334 | "Analyzing reserves\n"); | 1330 | "Analyzing reserves\n"); |
1335 | qsp = TALER_ARL_adb->get_auditor_progress_reserve (TALER_ARL_adb->cls, | 1331 | qsp = TALER_ARL_adb->get_auditor_progress_reserve (TALER_ARL_adb->cls, |
1336 | TALER_ARL_asession, | ||
1337 | &TALER_ARL_master_pub, | 1332 | &TALER_ARL_master_pub, |
1338 | &ppr); | 1333 | &ppr); |
1339 | if (0 > qsp) | 1334 | if (0 > qsp) |
@@ -1358,7 +1353,6 @@ analyze_reserves (void *cls) | |||
1358 | } | 1353 | } |
1359 | rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; | 1354 | rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; |
1360 | qsx = TALER_ARL_adb->get_reserve_summary (TALER_ARL_adb->cls, | 1355 | qsx = TALER_ARL_adb->get_reserve_summary (TALER_ARL_adb->cls, |
1361 | TALER_ARL_asession, | ||
1362 | &TALER_ARL_master_pub, | 1356 | &TALER_ARL_master_pub, |
1363 | &total_escrow_balance, | 1357 | &total_escrow_balance, |
1364 | &total_withdraw_fee_income); | 1358 | &total_withdraw_fee_income); |
@@ -1427,7 +1421,6 @@ analyze_reserves (void *cls) | |||
1427 | if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx) | 1421 | if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx) |
1428 | { | 1422 | { |
1429 | qs = TALER_ARL_adb->insert_reserve_summary (TALER_ARL_adb->cls, | 1423 | qs = TALER_ARL_adb->insert_reserve_summary (TALER_ARL_adb->cls, |
1430 | TALER_ARL_asession, | ||
1431 | &TALER_ARL_master_pub, | 1424 | &TALER_ARL_master_pub, |
1432 | &total_escrow_balance, | 1425 | &total_escrow_balance, |
1433 | &total_withdraw_fee_income); | 1426 | &total_withdraw_fee_income); |
@@ -1435,7 +1428,6 @@ analyze_reserves (void *cls) | |||
1435 | else | 1428 | else |
1436 | { | 1429 | { |
1437 | qs = TALER_ARL_adb->update_reserve_summary (TALER_ARL_adb->cls, | 1430 | qs = TALER_ARL_adb->update_reserve_summary (TALER_ARL_adb->cls, |
1438 | TALER_ARL_asession, | ||
1439 | &TALER_ARL_master_pub, | 1431 | &TALER_ARL_master_pub, |
1440 | &total_escrow_balance, | 1432 | &total_escrow_balance, |
1441 | &total_withdraw_fee_income); | 1433 | &total_withdraw_fee_income); |
@@ -1447,12 +1439,10 @@ analyze_reserves (void *cls) | |||
1447 | } | 1439 | } |
1448 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) | 1440 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp) |
1449 | qs = TALER_ARL_adb->update_auditor_progress_reserve (TALER_ARL_adb->cls, | 1441 | qs = TALER_ARL_adb->update_auditor_progress_reserve (TALER_ARL_adb->cls, |
1450 | TALER_ARL_asession, | ||
1451 | &TALER_ARL_master_pub, | 1442 | &TALER_ARL_master_pub, |
1452 | &ppr); | 1443 | &ppr); |
1453 | else | 1444 | else |
1454 | qs = TALER_ARL_adb->insert_auditor_progress_reserve (TALER_ARL_adb->cls, | 1445 | qs = TALER_ARL_adb->insert_auditor_progress_reserve (TALER_ARL_adb->cls, |
1455 | TALER_ARL_asession, | ||
1456 | &TALER_ARL_master_pub, | 1446 | &TALER_ARL_master_pub, |
1457 | &ppr); | 1447 | &ppr); |
1458 | if (0 >= qs) | 1448 | if (0 >= qs) |
diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 13ee27b70..2cd076ac9 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c | |||
@@ -663,8 +663,7 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
663 | else | 663 | else |
664 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 664 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
665 | "Hard error, not recording progress\n"); | 665 | "Hard error, not recording progress\n"); |
666 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, | 666 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls); |
667 | TALER_ARL_asession); | ||
668 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); | 667 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); |
669 | return qs; | 668 | return qs; |
670 | } | 669 | } |
@@ -691,7 +690,6 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
691 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx) | 690 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == wa->qsx) |
692 | qs = TALER_ARL_adb->update_wire_auditor_account_progress ( | 691 | qs = TALER_ARL_adb->update_wire_auditor_account_progress ( |
693 | TALER_ARL_adb->cls, | 692 | TALER_ARL_adb->cls, |
694 | TALER_ARL_asession, | ||
695 | &TALER_ARL_master_pub, | 693 | &TALER_ARL_master_pub, |
696 | wa->ai->section_name, | 694 | wa->ai->section_name, |
697 | &wa->pp, | 695 | &wa->pp, |
@@ -700,7 +698,6 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
700 | else | 698 | else |
701 | qs = TALER_ARL_adb->insert_wire_auditor_account_progress ( | 699 | qs = TALER_ARL_adb->insert_wire_auditor_account_progress ( |
702 | TALER_ARL_adb->cls, | 700 | TALER_ARL_adb->cls, |
703 | TALER_ARL_asession, | ||
704 | &TALER_ARL_master_pub, | 701 | &TALER_ARL_master_pub, |
705 | wa->ai->section_name, | 702 | wa->ai->section_name, |
706 | &wa->pp, | 703 | &wa->pp, |
@@ -719,12 +716,10 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
719 | NULL); | 716 | NULL); |
720 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx_gwap) | 717 | if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx_gwap) |
721 | qs = TALER_ARL_adb->update_wire_auditor_progress (TALER_ARL_adb->cls, | 718 | qs = TALER_ARL_adb->update_wire_auditor_progress (TALER_ARL_adb->cls, |
722 | TALER_ARL_asession, | ||
723 | &TALER_ARL_master_pub, | 719 | &TALER_ARL_master_pub, |
724 | &pp); | 720 | &pp); |
725 | else | 721 | else |
726 | qs = TALER_ARL_adb->insert_wire_auditor_progress (TALER_ARL_adb->cls, | 722 | qs = TALER_ARL_adb->insert_wire_auditor_progress (TALER_ARL_adb->cls, |
727 | TALER_ARL_asession, | ||
728 | &TALER_ARL_master_pub, | 723 | &TALER_ARL_master_pub, |
729 | &pp); | 724 | &pp); |
730 | if (0 >= qs) | 725 | if (0 >= qs) |
@@ -746,13 +741,11 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
746 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); | 741 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); |
747 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 742 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
748 | "Exchange DB commit failed, rolling back transaction\n"); | 743 | "Exchange DB commit failed, rolling back transaction\n"); |
749 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, | 744 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls); |
750 | TALER_ARL_asession); | ||
751 | } | 745 | } |
752 | else | 746 | else |
753 | { | 747 | { |
754 | qs = TALER_ARL_adb->commit (TALER_ARL_adb->cls, | 748 | qs = TALER_ARL_adb->commit (TALER_ARL_adb->cls); |
755 | TALER_ARL_asession); | ||
756 | if (0 > qs) | 749 | if (0 > qs) |
757 | { | 750 | { |
758 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); | 751 | GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); |
@@ -765,8 +758,7 @@ commit (enum GNUNET_DB_QueryStatus qs) | |||
765 | { | 758 | { |
766 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 759 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
767 | "Processing failed, rolling back transaction\n"); | 760 | "Processing failed, rolling back transaction\n"); |
768 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls, | 761 | TALER_ARL_adb->rollback (TALER_ARL_adb->cls); |
769 | TALER_ARL_asession); | ||
770 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); | 762 | TALER_ARL_edb->rollback (TALER_ARL_edb->cls); |
771 | } | 763 | } |
772 | return qs; | 764 | return qs; |
@@ -1947,23 +1939,22 @@ reserve_closed_cb (void *cls, | |||
1947 | static enum GNUNET_DB_QueryStatus | 1939 | static enum GNUNET_DB_QueryStatus |
1948 | begin_transaction (void) | 1940 | begin_transaction (void) |
1949 | { | 1941 | { |
1950 | if (GNUNET_OK != | 1942 | if (GNUNET_SYSERR == |
1951 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls)) | 1943 | TALER_ARL_edb->preflight (TALER_ARL_edb->cls)) |
1952 | { | 1944 | { |
1953 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1945 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1954 | "Failed to initialize exchange database connection.\n"); | 1946 | "Failed to initialize exchange database connection.\n"); |
1955 | return GNUNET_DB_STATUS_HARD_ERROR; | 1947 | return GNUNET_DB_STATUS_HARD_ERROR; |
1956 | } | 1948 | } |
1957 | TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls); | 1949 | if (GNUNET_SYSERR == |
1958 | if (NULL == TALER_ARL_asession) | 1950 | TALER_ARL_adb->preflight (TALER_ARL_adb->cls)) |
1959 | { | 1951 | { |
1960 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1952 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1961 | "Failed to initialize auditor database session.\n"); | 1953 | "Failed to initialize auditor database session.\n"); |
1962 | return GNUNET_DB_STATUS_HARD_ERROR; | 1954 | return GNUNET_DB_STATUS_HARD_ERROR; |
1963 | } | 1955 | } |
1964 | if (GNUNET_OK != | 1956 | if (GNUNET_OK != |
1965 | TALER_ARL_adb->start (TALER_ARL_adb->cls, | 1957 | TALER_ARL_adb->start (TALER_ARL_adb->cls)) |
1966 | TALER_ARL_asession)) | ||
1967 | { | 1958 | { |
1968 | GNUNET_break (0); | 1959 | GNUNET_break (0); |
1969 | return GNUNET_DB_STATUS_HARD_ERROR; | 1960 | return GNUNET_DB_STATUS_HARD_ERROR; |
@@ -1982,7 +1973,6 @@ begin_transaction (void) | |||
1982 | { | 1973 | { |
1983 | wa->qsx = TALER_ARL_adb->get_wire_auditor_account_progress ( | 1974 | wa->qsx = TALER_ARL_adb->get_wire_auditor_account_progress ( |
1984 | TALER_ARL_adb->cls, | 1975 | TALER_ARL_adb->cls, |
1985 | TALER_ARL_asession, | ||
1986 | &TALER_ARL_master_pub, | 1976 | &TALER_ARL_master_pub, |
1987 | wa->ai->section_name, | 1977 | wa->ai->section_name, |
1988 | &wa->pp, | 1978 | &wa->pp, |
@@ -1996,7 +1986,6 @@ begin_transaction (void) | |||
1996 | wa->start_pp = wa->pp; | 1986 | wa->start_pp = wa->pp; |
1997 | } | 1987 | } |
1998 | qsx_gwap = TALER_ARL_adb->get_wire_auditor_progress (TALER_ARL_adb->cls, | 1988 | qsx_gwap = TALER_ARL_adb->get_wire_auditor_progress (TALER_ARL_adb->cls, |
1999 | TALER_ARL_asession, | ||
2000 | &TALER_ARL_master_pub, | 1989 | &TALER_ARL_master_pub, |
2001 | &pp); | 1990 | &pp); |
2002 | if (0 > qsx_gwap) | 1991 | if (0 > qsx_gwap) |
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 151c93ad3..be221a8b7 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2014-2020 Taler Systems SA | 3 | Copyright (C) 2014-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -54,10 +54,12 @@ | |||
54 | 54 | ||
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Handle for a database session (per-thread, for transactions). | 57 | * Type of the "cls" argument given to each of the functions in |
58 | * our API. | ||
58 | */ | 59 | */ |
59 | struct TALER_AUDITORDB_Session | 60 | struct PostgresClosure |
60 | { | 61 | { |
62 | |||
61 | /** | 63 | /** |
62 | * Postgres connection handle. | 64 | * Postgres connection handle. |
63 | */ | 65 | */ |
@@ -69,21 +71,6 @@ struct TALER_AUDITORDB_Session | |||
69 | * ROLLBACK. | 71 | * ROLLBACK. |
70 | */ | 72 | */ |
71 | const char *transaction_name; | 73 | const char *transaction_name; |
72 | }; | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Type of the "cls" argument given to each of the functions in | ||
77 | * our API. | ||
78 | */ | ||
79 | struct PostgresClosure | ||
80 | { | ||
81 | |||
82 | /** | ||
83 | * Thread-local database connection. | ||
84 | * Contains a pointer to `PGconn` or NULL. | ||
85 | */ | ||
86 | pthread_key_t db_conn_threadlocal; | ||
87 | 74 | ||
88 | /** | 75 | /** |
89 | * Our configuration. | 76 | * Our configuration. |
@@ -108,7 +95,7 @@ struct PostgresClosure | |||
108 | * used when restarting the auditor | 95 | * used when restarting the auditor |
109 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure | 96 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure |
110 | */ | 97 | */ |
111 | static int | 98 | static enum GNUNET_GenericReturnValue |
112 | postgres_drop_tables (void *cls, | 99 | postgres_drop_tables (void *cls, |
113 | int drop_exchangelist) | 100 | int drop_exchangelist) |
114 | { | 101 | { |
@@ -133,7 +120,7 @@ postgres_drop_tables (void *cls, | |||
133 | * @param cls the `struct PostgresClosure` with the plugin-specific state | 120 | * @param cls the `struct PostgresClosure` with the plugin-specific state |
134 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure | 121 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure |
135 | */ | 122 | */ |
136 | static int | 123 | static enum GNUNET_GenericReturnValue |
137 | postgres_create_tables (void *cls) | 124 | postgres_create_tables (void *cls) |
138 | { | 125 | { |
139 | struct PostgresClosure *pc = cls; | 126 | struct PostgresClosure *pc = cls; |
@@ -152,39 +139,14 @@ postgres_create_tables (void *cls) | |||
152 | 139 | ||
153 | 140 | ||
154 | /** | 141 | /** |
155 | * Close thread-local database connection when a thread is destroyed. | ||
156 | * | ||
157 | * @param cls closure we get from pthreads (the db handle) | ||
158 | */ | ||
159 | static void | ||
160 | db_conn_destroy (void *cls) | ||
161 | { | ||
162 | struct TALER_AUDITORDB_Session *session = cls; | ||
163 | struct GNUNET_PQ_Context *db_conn; | ||
164 | |||
165 | if (NULL == session) | ||
166 | return; | ||
167 | db_conn = session->conn; | ||
168 | session->conn = NULL; | ||
169 | if (NULL != db_conn) | ||
170 | GNUNET_PQ_disconnect (db_conn); | ||
171 | GNUNET_free (session); | ||
172 | } | ||
173 | |||
174 | |||
175 | /** | ||
176 | * Get the thread-local database-handle. | ||
177 | * Connect to the db if the connection does not exist yet. | 142 | * Connect to the db if the connection does not exist yet. |
178 | * | 143 | * |
179 | * @param cls the `struct PostgresClosure` with the plugin-specific state | 144 | * @param[in,out] pg the plugin-specific state |
180 | * @return the database connection, or NULL on error | 145 | * @return #GNUNET_OK on success |
181 | */ | 146 | */ |
182 | static struct TALER_AUDITORDB_Session * | 147 | static int |
183 | postgres_get_session (void *cls) | 148 | setup_connection (struct PostgresClosure *pg) |
184 | { | 149 | { |
185 | struct PostgresClosure *pc = cls; | ||
186 | struct GNUNET_PQ_Context *db_conn; | ||
187 | struct TALER_AUDITORDB_Session *session; | ||
188 | struct GNUNET_PQ_PreparedStatement ps[] = { | 150 | struct GNUNET_PQ_PreparedStatement ps[] = { |
189 | /* used in #postgres_commit */ | 151 | /* used in #postgres_commit */ |
190 | GNUNET_PQ_make_prepare ("do_commit", | 152 | GNUNET_PQ_make_prepare ("do_commit", |
@@ -683,68 +645,70 @@ postgres_get_session (void *cls) | |||
683 | 1), | 645 | 1), |
684 | GNUNET_PQ_PREPARED_STATEMENT_END | 646 | GNUNET_PQ_PREPARED_STATEMENT_END |
685 | }; | 647 | }; |
648 | struct GNUNET_PQ_Context *db_conn; | ||
686 | 649 | ||
687 | if (NULL != (session = pthread_getspecific (pc->db_conn_threadlocal))) | 650 | if (NULL != pg->conn) |
688 | { | 651 | { |
689 | GNUNET_PQ_reconnect_if_down (session->conn); | 652 | GNUNET_PQ_reconnect_if_down (pg->conn); |
690 | return session; | 653 | return GNUNET_OK; |
691 | } | 654 | } |
692 | db_conn = GNUNET_PQ_connect_with_cfg (pc->cfg, | 655 | db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg, |
693 | "auditordb-postgres", | 656 | "auditordb-postgres", |
694 | NULL, | 657 | NULL, |
695 | NULL, | 658 | NULL, |
696 | ps); | 659 | ps); |
697 | if (NULL == db_conn) | 660 | if (NULL == db_conn) |
698 | return NULL; | 661 | return GNUNET_SYSERR; |
699 | session = GNUNET_new (struct TALER_AUDITORDB_Session); | 662 | pg->conn = db_conn; |
700 | session->conn = db_conn; | 663 | return GNUNET_OK; |
701 | if (0 != pthread_setspecific (pc->db_conn_threadlocal, | ||
702 | session)) | ||
703 | { | ||
704 | GNUNET_break (0); | ||
705 | GNUNET_PQ_disconnect (db_conn); | ||
706 | GNUNET_free (session); | ||
707 | return NULL; | ||
708 | } | ||
709 | return session; | ||
710 | } | 664 | } |
711 | 665 | ||
712 | 666 | ||
713 | /** | 667 | /** |
714 | * Do a pre-flight check that we are not in an uncommitted transaction. | 668 | * Do a pre-flight check that we are not in an uncommitted transaction. |
715 | * If we are, try to commit the previous transaction and output a warning. | 669 | * If we are, rollback the previous transaction and output a warning. |
716 | * Does not return anything, as we will continue regardless of the outcome. | ||
717 | * | 670 | * |
718 | * @param cls the `struct PostgresClosure` with the plugin-specific state | 671 | * @param cls the `struct PostgresClosure` with the plugin-specific state |
719 | * @param session the database connection | 672 | * @return #GNUNET_OK on success, |
673 | * #GNUNET_NO if we rolled back an earlier transaction | ||
674 | * #GNUNET_SYSERR if we have no DB connection | ||
720 | */ | 675 | */ |
721 | static void | 676 | static enum GNUNET_GenericReturnValue |
722 | postgres_preflight (void *cls, | 677 | postgres_preflight (void *cls) |
723 | struct TALER_AUDITORDB_Session *session) | ||
724 | { | 678 | { |
679 | struct PostgresClosure *pg = cls; | ||
725 | struct GNUNET_PQ_ExecuteStatement es[] = { | 680 | struct GNUNET_PQ_ExecuteStatement es[] = { |
726 | GNUNET_PQ_make_execute ("ROLLBACK"), | 681 | GNUNET_PQ_make_execute ("ROLLBACK"), |
727 | GNUNET_PQ_EXECUTE_STATEMENT_END | 682 | GNUNET_PQ_EXECUTE_STATEMENT_END |
728 | }; | 683 | }; |
729 | 684 | ||
730 | (void) cls; | 685 | if (NULL == pg->conn) |
731 | if (NULL == session->transaction_name) | 686 | { |
732 | return; /* all good */ | 687 | if (GNUNET_OK != |
688 | setup_connection (pg)) | ||
689 | { | ||
690 | GNUNET_break (0); | ||
691 | return GNUNET_SYSERR; | ||
692 | } | ||
693 | } | ||
694 | if (NULL == pg->transaction_name) | ||
695 | return GNUNET_OK; /* all good */ | ||
733 | if (GNUNET_OK == | 696 | if (GNUNET_OK == |
734 | GNUNET_PQ_exec_statements (session->conn, | 697 | GNUNET_PQ_exec_statements (pg->conn, |
735 | es)) | 698 | es)) |
736 | { | 699 | { |
737 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 700 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
738 | "BUG: Preflight check rolled back transaction `%s'!\n", | 701 | "BUG: Preflight check rolled back transaction `%s'!\n", |
739 | session->transaction_name); | 702 | pg->transaction_name); |
740 | } | 703 | } |
741 | else | 704 | else |
742 | { | 705 | { |
743 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 706 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
744 | "BUG: Preflight check failed to rollback transaction `%s'!\n", | 707 | "BUG: Preflight check failed to rollback transaction `%s'!\n", |
745 | session->transaction_name); | 708 | pg->transaction_name); |
746 | } | 709 | } |
747 | session->transaction_name = NULL; | 710 | pg->transaction_name = NULL; |
711 | return GNUNET_NO; | ||
748 | } | 712 | } |
749 | 713 | ||
750 | 714 | ||
@@ -752,23 +716,20 @@ postgres_preflight (void *cls, | |||
752 | * Start a transaction. | 716 | * Start a transaction. |
753 | * | 717 | * |
754 | * @param cls the `struct PostgresClosure` with the plugin-specific state | 718 | * @param cls the `struct PostgresClosure` with the plugin-specific state |
755 | * @param session the database connection | ||
756 | * @return #GNUNET_OK on success | 719 | * @return #GNUNET_OK on success |
757 | */ | 720 | */ |
758 | static int | 721 | static enum GNUNET_GenericReturnValue |
759 | postgres_start (void *cls, | 722 | postgres_start (void *cls) |
760 | struct TALER_AUDITORDB_Session *session) | ||
761 | { | 723 | { |
724 | struct PostgresClosure *pg = cls; | ||
762 | struct GNUNET_PQ_ExecuteStatement es[] = { | 725 | struct GNUNET_PQ_ExecuteStatement es[] = { |
763 | GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL SERIALIZABLE"), | 726 | GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL SERIALIZABLE"), |
764 | GNUNET_PQ_EXECUTE_STATEMENT_END | 727 | GNUNET_PQ_EXECUTE_STATEMENT_END |
765 | }; | 728 | }; |
766 | 729 | ||
767 | postgres_preflight (cls, | 730 | postgres_preflight (cls); |
768 | session); | ||
769 | (void) cls; | ||
770 | if (GNUNET_OK != | 731 | if (GNUNET_OK != |
771 | GNUNET_PQ_exec_statements (session->conn, | 732 | GNUNET_PQ_exec_statements (pg->conn, |
772 | es)) | 733 | es)) |
773 | { | 734 | { |
774 | TALER_LOG_ERROR ("Failed to start transaction\n"); | 735 | TALER_LOG_ERROR ("Failed to start transaction\n"); |
@@ -783,20 +744,18 @@ postgres_start (void *cls, | |||
783 | * Roll back the current transaction of a database connection. | 744 | * Roll back the current transaction of a database connection. |
784 | * | 745 | * |
785 | * @param cls the `struct PostgresClosure` with the plugin-specific state | 746 | * @param cls the `struct PostgresClosure` with the plugin-specific state |
786 | * @param session the database connection | ||
787 | */ | 747 | */ |
788 | static void | 748 | static void |
789 | postgres_rollback (void *cls, | 749 | postgres_rollback (void *cls) |
790 | struct TALER_AUDITORDB_Session *session) | ||
791 | { | 750 | { |
751 | struct PostgresClosure *pg = cls; | ||
792 | struct GNUNET_PQ_ExecuteStatement es[] = { | 752 | struct GNUNET_PQ_ExecuteStatement es[] = { |
793 | GNUNET_PQ_make_execute ("ROLLBACK"), | 753 | GNUNET_PQ_make_execute ("ROLLBACK"), |
794 | GNUNET_PQ_EXECUTE_STATEMENT_END | 754 | GNUNET_PQ_EXECUTE_STATEMENT_END |
795 | }; | 755 | }; |
796 | 756 | ||
797 | (void) cls; | ||
798 | GNUNET_break (GNUNET_OK == | 757 | GNUNET_break (GNUNET_OK == |
799 | GNUNET_PQ_exec_statements (session->conn, | 758 | GNUNET_PQ_exec_statements (pg->conn, |
800 | es)); | 759 | es)); |
801 | } | 760 | } |
802 | 761 | ||
@@ -805,19 +764,17 @@ postgres_rollback (void *cls, | |||
805 | * Commit the current transaction of a database connection. | 764 | * Commit the current transaction of a database connection. |
806 | * | 765 | * |
807 | * @param cls the `struct PostgresClosure` with the plugin-specific state | 766 | * @param cls the `struct PostgresClosure` with the plugin-specific state |
808 | * @param session the database connection | ||
809 | * @return transaction status code | 767 | * @return transaction status code |
810 | */ | 768 | */ |
811 | enum GNUNET_DB_QueryStatus | 769 | enum GNUNET_DB_QueryStatus |
812 | postgres_commit (void *cls, | 770 | postgres_commit (void *cls) |
813 | struct TALER_AUDITORDB_Session *session) | ||
814 | { | 771 | { |
772 | struct PostgresClosure *pg = cls; | ||
815 | struct GNUNET_PQ_QueryParam params[] = { | 773 | struct GNUNET_PQ_QueryParam params[] = { |
816 | GNUNET_PQ_query_param_end | 774 | GNUNET_PQ_query_param_end |
817 | }; | 775 | }; |
818 | 776 | ||
819 | (void) cls; | 777 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
820 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
821 | "do_commit", | 778 | "do_commit", |
822 | params); | 779 | params); |
823 | } | 780 | } |
@@ -834,7 +791,7 @@ postgres_commit (void *cls, | |||
834 | static int | 791 | static int |
835 | postgres_gc (void *cls) | 792 | postgres_gc (void *cls) |
836 | { | 793 | { |
837 | struct PostgresClosure *pc = cls; | 794 | struct PostgresClosure *pg = cls; |
838 | struct GNUNET_TIME_Absolute now; | 795 | struct GNUNET_TIME_Absolute now; |
839 | struct GNUNET_PQ_QueryParam params_time[] = { | 796 | struct GNUNET_PQ_QueryParam params_time[] = { |
840 | TALER_PQ_query_param_absolute_time (&now), | 797 | TALER_PQ_query_param_absolute_time (&now), |
@@ -852,7 +809,7 @@ postgres_gc (void *cls) | |||
852 | }; | 809 | }; |
853 | 810 | ||
854 | now = GNUNET_TIME_absolute_get (); | 811 | now = GNUNET_TIME_absolute_get (); |
855 | conn = GNUNET_PQ_connect_with_cfg (pc->cfg, | 812 | conn = GNUNET_PQ_connect_with_cfg (pg->cfg, |
856 | "auditordb-postgres", | 813 | "auditordb-postgres", |
857 | NULL, | 814 | NULL, |
858 | NULL, | 815 | NULL, |
@@ -878,25 +835,23 @@ postgres_gc (void *cls) | |||
878 | * Insert information about an exchange this auditor will be auditing. | 835 | * Insert information about an exchange this auditor will be auditing. |
879 | * | 836 | * |
880 | * @param cls the @e cls of this struct with the plugin-specific state | 837 | * @param cls the @e cls of this struct with the plugin-specific state |
881 | * @param session connection to the database | ||
882 | * @param master_pub master public key of the exchange | 838 | * @param master_pub master public key of the exchange |
883 | * @param exchange_url public (base) URL of the API of the exchange | 839 | * @param exchange_url public (base) URL of the API of the exchange |
884 | * @return query result status | 840 | * @return query result status |
885 | */ | 841 | */ |
886 | static enum GNUNET_DB_QueryStatus | 842 | static enum GNUNET_DB_QueryStatus |
887 | postgres_insert_exchange (void *cls, | 843 | postgres_insert_exchange (void *cls, |
888 | struct TALER_AUDITORDB_Session *session, | ||
889 | const struct TALER_MasterPublicKeyP *master_pub, | 844 | const struct TALER_MasterPublicKeyP *master_pub, |
890 | const char *exchange_url) | 845 | const char *exchange_url) |
891 | { | 846 | { |
847 | struct PostgresClosure *pg = cls; | ||
892 | struct GNUNET_PQ_QueryParam params[] = { | 848 | struct GNUNET_PQ_QueryParam params[] = { |
893 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 849 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
894 | GNUNET_PQ_query_param_string (exchange_url), | 850 | GNUNET_PQ_query_param_string (exchange_url), |
895 | GNUNET_PQ_query_param_end | 851 | GNUNET_PQ_query_param_end |
896 | }; | 852 | }; |
897 | 853 | ||
898 | (void) cls; | 854 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
899 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
900 | "auditor_insert_exchange", | 855 | "auditor_insert_exchange", |
901 | params); | 856 | params); |
902 | } | 857 | } |
@@ -908,22 +863,20 @@ postgres_insert_exchange (void *cls, | |||
908 | * to this exchange! | 863 | * to this exchange! |
909 | * | 864 | * |
910 | * @param cls the @e cls of this struct with the plugin-specific state | 865 | * @param cls the @e cls of this struct with the plugin-specific state |
911 | * @param session connection to the database | ||
912 | * @param master_pub master public key of the exchange | 866 | * @param master_pub master public key of the exchange |
913 | * @return query result status | 867 | * @return query result status |
914 | */ | 868 | */ |
915 | static enum GNUNET_DB_QueryStatus | 869 | static enum GNUNET_DB_QueryStatus |
916 | postgres_delete_exchange (void *cls, | 870 | postgres_delete_exchange (void *cls, |
917 | struct TALER_AUDITORDB_Session *session, | ||
918 | const struct TALER_MasterPublicKeyP *master_pub) | 871 | const struct TALER_MasterPublicKeyP *master_pub) |
919 | { | 872 | { |
873 | struct PostgresClosure *pg = cls; | ||
920 | struct GNUNET_PQ_QueryParam params[] = { | 874 | struct GNUNET_PQ_QueryParam params[] = { |
921 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 875 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
922 | GNUNET_PQ_query_param_end | 876 | GNUNET_PQ_query_param_end |
923 | }; | 877 | }; |
924 | 878 | ||
925 | (void) cls; | 879 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
926 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
927 | "auditor_delete_exchange", | 880 | "auditor_delete_exchange", |
928 | params); | 881 | params); |
929 | } | 882 | } |
@@ -968,7 +921,6 @@ exchange_info_cb (void *cls, | |||
968 | { | 921 | { |
969 | struct ExchangeInfoContext *eic = cls; | 922 | struct ExchangeInfoContext *eic = cls; |
970 | 923 | ||
971 | (void) cls; | ||
972 | for (unsigned int i = 0; i < num_results; i++) | 924 | for (unsigned int i = 0; i < num_results; i++) |
973 | { | 925 | { |
974 | struct TALER_MasterPublicKeyP master_pub; | 926 | struct TALER_MasterPublicKeyP master_pub; |
@@ -1001,17 +953,16 @@ exchange_info_cb (void *cls, | |||
1001 | * Obtain information about exchanges this auditor is auditing. | 953 | * Obtain information about exchanges this auditor is auditing. |
1002 | * | 954 | * |
1003 | * @param cls the @e cls of this struct with the plugin-specific state | 955 | * @param cls the @e cls of this struct with the plugin-specific state |
1004 | * @param session connection to the database | ||
1005 | * @param cb function to call with the results | 956 | * @param cb function to call with the results |
1006 | * @param cb_cls closure for @a cb | 957 | * @param cb_cls closure for @a cb |
1007 | * @return query result status | 958 | * @return query result status |
1008 | */ | 959 | */ |
1009 | static enum GNUNET_DB_QueryStatus | 960 | static enum GNUNET_DB_QueryStatus |
1010 | postgres_list_exchanges (void *cls, | 961 | postgres_list_exchanges (void *cls, |
1011 | struct TALER_AUDITORDB_Session *session, | ||
1012 | TALER_AUDITORDB_ExchangeCallback cb, | 962 | TALER_AUDITORDB_ExchangeCallback cb, |
1013 | void *cb_cls) | 963 | void *cb_cls) |
1014 | { | 964 | { |
965 | struct PostgresClosure *pg = cls; | ||
1015 | struct GNUNET_PQ_QueryParam params[] = { | 966 | struct GNUNET_PQ_QueryParam params[] = { |
1016 | GNUNET_PQ_query_param_end | 967 | GNUNET_PQ_query_param_end |
1017 | }; | 968 | }; |
@@ -1021,8 +972,7 @@ postgres_list_exchanges (void *cls, | |||
1021 | }; | 972 | }; |
1022 | enum GNUNET_DB_QueryStatus qs; | 973 | enum GNUNET_DB_QueryStatus qs; |
1023 | 974 | ||
1024 | (void) cls; | 975 | qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, |
1025 | qs = GNUNET_PQ_eval_prepared_multi_select (session->conn, | ||
1026 | "auditor_list_exchanges", | 976 | "auditor_list_exchanges", |
1027 | params, | 977 | params, |
1028 | &exchange_info_cb, | 978 | &exchange_info_cb, |
@@ -1038,16 +988,15 @@ postgres_list_exchanges (void *cls, | |||
1038 | * Insert information about a signing key of the exchange. | 988 | * Insert information about a signing key of the exchange. |
1039 | * | 989 | * |
1040 | * @param cls the @e cls of this struct with the plugin-specific state | 990 | * @param cls the @e cls of this struct with the plugin-specific state |
1041 | * @param session connection to the database | ||
1042 | * @param sk signing key information to store | 991 | * @param sk signing key information to store |
1043 | * @return query result status | 992 | * @return query result status |
1044 | */ | 993 | */ |
1045 | static enum GNUNET_DB_QueryStatus | 994 | static enum GNUNET_DB_QueryStatus |
1046 | postgres_insert_exchange_signkey ( | 995 | postgres_insert_exchange_signkey ( |
1047 | void *cls, | 996 | void *cls, |
1048 | struct TALER_AUDITORDB_Session *session, | ||
1049 | const struct TALER_AUDITORDB_ExchangeSigningKey *sk) | 997 | const struct TALER_AUDITORDB_ExchangeSigningKey *sk) |
1050 | { | 998 | { |
999 | struct PostgresClosure *pg = cls; | ||
1051 | struct GNUNET_PQ_QueryParam params[] = { | 1000 | struct GNUNET_PQ_QueryParam params[] = { |
1052 | GNUNET_PQ_query_param_auto_from_type (&sk->master_public_key), | 1001 | GNUNET_PQ_query_param_auto_from_type (&sk->master_public_key), |
1053 | TALER_PQ_query_param_absolute_time (&sk->ep_start), | 1002 | TALER_PQ_query_param_absolute_time (&sk->ep_start), |
@@ -1058,8 +1007,7 @@ postgres_insert_exchange_signkey ( | |||
1058 | GNUNET_PQ_query_param_end | 1007 | GNUNET_PQ_query_param_end |
1059 | }; | 1008 | }; |
1060 | 1009 | ||
1061 | (void) cls; | 1010 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1062 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1063 | "auditor_insert_exchange_signkey", | 1011 | "auditor_insert_exchange_signkey", |
1064 | params); | 1012 | params); |
1065 | } | 1013 | } |
@@ -1069,16 +1017,15 @@ postgres_insert_exchange_signkey ( | |||
1069 | * Insert information about a deposit confirmation into the database. | 1017 | * Insert information about a deposit confirmation into the database. |
1070 | * | 1018 | * |
1071 | * @param cls the @e cls of this struct with the plugin-specific state | 1019 | * @param cls the @e cls of this struct with the plugin-specific state |
1072 | * @param session connection to the database | ||
1073 | * @param dc deposit confirmation information to store | 1020 | * @param dc deposit confirmation information to store |
1074 | * @return query result status | 1021 | * @return query result status |
1075 | */ | 1022 | */ |
1076 | static enum GNUNET_DB_QueryStatus | 1023 | static enum GNUNET_DB_QueryStatus |
1077 | postgres_insert_deposit_confirmation ( | 1024 | postgres_insert_deposit_confirmation ( |
1078 | void *cls, | 1025 | void *cls, |
1079 | struct TALER_AUDITORDB_Session *session, | ||
1080 | const struct TALER_AUDITORDB_DepositConfirmation *dc) | 1026 | const struct TALER_AUDITORDB_DepositConfirmation *dc) |
1081 | { | 1027 | { |
1028 | struct PostgresClosure *pg = cls; | ||
1082 | struct GNUNET_PQ_QueryParam params[] = { | 1029 | struct GNUNET_PQ_QueryParam params[] = { |
1083 | GNUNET_PQ_query_param_auto_from_type (&dc->master_public_key), | 1030 | GNUNET_PQ_query_param_auto_from_type (&dc->master_public_key), |
1084 | GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms), | 1031 | GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms), |
@@ -1094,8 +1041,7 @@ postgres_insert_deposit_confirmation ( | |||
1094 | GNUNET_PQ_query_param_end | 1041 | GNUNET_PQ_query_param_end |
1095 | }; | 1042 | }; |
1096 | 1043 | ||
1097 | (void) cls; | 1044 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1098 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1099 | "auditor_deposit_confirmation_insert", | 1045 | "auditor_deposit_confirmation_insert", |
1100 | params); | 1046 | params); |
1101 | } | 1047 | } |
@@ -1206,7 +1152,6 @@ deposit_confirmation_cb (void *cls, | |||
1206 | * Get information about deposit confirmations from the database. | 1152 | * Get information about deposit confirmations from the database. |
1207 | * | 1153 | * |
1208 | * @param cls the @e cls of this struct with the plugin-specific state | 1154 | * @param cls the @e cls of this struct with the plugin-specific state |
1209 | * @param session connection to the database | ||
1210 | * @param master_public_key for which exchange do we want to get deposit confirmations | 1155 | * @param master_public_key for which exchange do we want to get deposit confirmations |
1211 | * @param start_id row/serial ID where to start the iteration (0 from | 1156 | * @param start_id row/serial ID where to start the iteration (0 from |
1212 | * the start, exclusive, i.e. serial_ids must start from 1) | 1157 | * the start, exclusive, i.e. serial_ids must start from 1) |
@@ -1217,7 +1162,6 @@ deposit_confirmation_cb (void *cls, | |||
1217 | static enum GNUNET_DB_QueryStatus | 1162 | static enum GNUNET_DB_QueryStatus |
1218 | postgres_get_deposit_confirmations ( | 1163 | postgres_get_deposit_confirmations ( |
1219 | void *cls, | 1164 | void *cls, |
1220 | struct TALER_AUDITORDB_Session *session, | ||
1221 | const struct TALER_MasterPublicKeyP *master_public_key, | 1165 | const struct TALER_MasterPublicKeyP *master_public_key, |
1222 | uint64_t start_id, | 1166 | uint64_t start_id, |
1223 | TALER_AUDITORDB_DepositConfirmationCallback cb, | 1167 | TALER_AUDITORDB_DepositConfirmationCallback cb, |
@@ -1237,7 +1181,7 @@ postgres_get_deposit_confirmations ( | |||
1237 | }; | 1181 | }; |
1238 | enum GNUNET_DB_QueryStatus qs; | 1182 | enum GNUNET_DB_QueryStatus qs; |
1239 | 1183 | ||
1240 | qs = GNUNET_PQ_eval_prepared_multi_select (session->conn, | 1184 | qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, |
1241 | "auditor_deposit_confirmation_select", | 1185 | "auditor_deposit_confirmation_select", |
1242 | params, | 1186 | params, |
1243 | &deposit_confirmation_cb, | 1187 | &deposit_confirmation_cb, |
@@ -1254,7 +1198,6 @@ postgres_get_deposit_confirmations ( | |||
1254 | * data. | 1198 | * data. |
1255 | * | 1199 | * |
1256 | * @param cls the @e cls of this struct with the plugin-specific state | 1200 | * @param cls the @e cls of this struct with the plugin-specific state |
1257 | * @param session connection to use | ||
1258 | * @param master_pub master key of the exchange | 1201 | * @param master_pub master key of the exchange |
1259 | * @param ppr where is the auditor in processing | 1202 | * @param ppr where is the auditor in processing |
1260 | * @return transaction status code | 1203 | * @return transaction status code |
@@ -1262,10 +1205,10 @@ postgres_get_deposit_confirmations ( | |||
1262 | static enum GNUNET_DB_QueryStatus | 1205 | static enum GNUNET_DB_QueryStatus |
1263 | postgres_insert_auditor_progress_reserve ( | 1206 | postgres_insert_auditor_progress_reserve ( |
1264 | void *cls, | 1207 | void *cls, |
1265 | struct TALER_AUDITORDB_Session *session, | ||
1266 | const struct TALER_MasterPublicKeyP *master_pub, | 1208 | const struct TALER_MasterPublicKeyP *master_pub, |
1267 | const struct TALER_AUDITORDB_ProgressPointReserve *ppr) | 1209 | const struct TALER_AUDITORDB_ProgressPointReserve *ppr) |
1268 | { | 1210 | { |
1211 | struct PostgresClosure *pg = cls; | ||
1269 | struct GNUNET_PQ_QueryParam params[] = { | 1212 | struct GNUNET_PQ_QueryParam params[] = { |
1270 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1213 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1271 | GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id), | 1214 | GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id), |
@@ -1275,8 +1218,7 @@ postgres_insert_auditor_progress_reserve ( | |||
1275 | GNUNET_PQ_query_param_end | 1218 | GNUNET_PQ_query_param_end |
1276 | }; | 1219 | }; |
1277 | 1220 | ||
1278 | (void) cls; | 1221 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1279 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1280 | "auditor_progress_insert_reserve", | 1222 | "auditor_progress_insert_reserve", |
1281 | params); | 1223 | params); |
1282 | } | 1224 | } |
@@ -1287,7 +1229,6 @@ postgres_insert_auditor_progress_reserve ( | |||
1287 | * must be an existing record for the exchange. | 1229 | * must be an existing record for the exchange. |
1288 | * | 1230 | * |
1289 | * @param cls the @e cls of this struct with the plugin-specific state | 1231 | * @param cls the @e cls of this struct with the plugin-specific state |
1290 | * @param session connection to use | ||
1291 | * @param master_pub master key of the exchange | 1232 | * @param master_pub master key of the exchange |
1292 | * @param ppr where is the auditor in processing | 1233 | * @param ppr where is the auditor in processing |
1293 | * @return transaction status code | 1234 | * @return transaction status code |
@@ -1295,10 +1236,10 @@ postgres_insert_auditor_progress_reserve ( | |||
1295 | static enum GNUNET_DB_QueryStatus | 1236 | static enum GNUNET_DB_QueryStatus |
1296 | postgres_update_auditor_progress_reserve ( | 1237 | postgres_update_auditor_progress_reserve ( |
1297 | void *cls, | 1238 | void *cls, |
1298 | struct TALER_AUDITORDB_Session *session, | ||
1299 | const struct TALER_MasterPublicKeyP *master_pub, | 1239 | const struct TALER_MasterPublicKeyP *master_pub, |
1300 | const struct TALER_AUDITORDB_ProgressPointReserve *ppr) | 1240 | const struct TALER_AUDITORDB_ProgressPointReserve *ppr) |
1301 | { | 1241 | { |
1242 | struct PostgresClosure *pg = cls; | ||
1302 | struct GNUNET_PQ_QueryParam params[] = { | 1243 | struct GNUNET_PQ_QueryParam params[] = { |
1303 | GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id), | 1244 | GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id), |
1304 | GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id), | 1245 | GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id), |
@@ -1308,8 +1249,7 @@ postgres_update_auditor_progress_reserve ( | |||
1308 | GNUNET_PQ_query_param_end | 1249 | GNUNET_PQ_query_param_end |
1309 | }; | 1250 | }; |
1310 | 1251 | ||
1311 | (void) cls; | 1252 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1312 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1313 | "auditor_progress_update_reserve", | 1253 | "auditor_progress_update_reserve", |
1314 | params); | 1254 | params); |
1315 | } | 1255 | } |
@@ -1319,7 +1259,6 @@ postgres_update_auditor_progress_reserve ( | |||
1319 | * Get information about the progress of the auditor. | 1259 | * Get information about the progress of the auditor. |
1320 | * | 1260 | * |
1321 | * @param cls the @e cls of this struct with the plugin-specific state | 1261 | * @param cls the @e cls of this struct with the plugin-specific state |
1322 | * @param session connection to use | ||
1323 | * @param master_pub master key of the exchange | 1262 | * @param master_pub master key of the exchange |
1324 | * @param[out] ppr set to where the auditor is in processing | 1263 | * @param[out] ppr set to where the auditor is in processing |
1325 | * @return transaction status code | 1264 | * @return transaction status code |
@@ -1327,10 +1266,10 @@ postgres_update_auditor_progress_reserve ( | |||
1327 | static enum GNUNET_DB_QueryStatus | 1266 | static enum GNUNET_DB_QueryStatus |
1328 | postgres_get_auditor_progress_reserve ( | 1267 | postgres_get_auditor_progress_reserve ( |
1329 | void *cls, | 1268 | void *cls, |
1330 | struct TALER_AUDITORDB_Session *session, | ||
1331 | const struct TALER_MasterPublicKeyP *master_pub, | 1269 | const struct TALER_MasterPublicKeyP *master_pub, |
1332 | struct TALER_AUDITORDB_ProgressPointReserve *ppr) | 1270 | struct TALER_AUDITORDB_ProgressPointReserve *ppr) |
1333 | { | 1271 | { |
1272 | struct PostgresClosure *pg = cls; | ||
1334 | struct GNUNET_PQ_QueryParam params[] = { | 1273 | struct GNUNET_PQ_QueryParam params[] = { |
1335 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1274 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1336 | GNUNET_PQ_query_param_end | 1275 | GNUNET_PQ_query_param_end |
@@ -1347,8 +1286,7 @@ postgres_get_auditor_progress_reserve ( | |||
1347 | GNUNET_PQ_result_spec_end | 1286 | GNUNET_PQ_result_spec_end |
1348 | }; | 1287 | }; |
1349 | 1288 | ||
1350 | (void) cls; | 1289 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
1351 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
1352 | "auditor_progress_select_reserve", | 1290 | "auditor_progress_select_reserve", |
1353 | params, | 1291 | params, |
1354 | rs); | 1292 | rs); |
@@ -1360,7 +1298,6 @@ postgres_get_auditor_progress_reserve ( | |||
1360 | * data. | 1298 | * data. |
1361 | * | 1299 | * |
1362 | * @param cls the @e cls of this struct with the plugin-specific state | 1300 | * @param cls the @e cls of this struct with the plugin-specific state |
1363 | * @param session connection to use | ||
1364 | * @param master_pub master key of the exchange | 1301 | * @param master_pub master key of the exchange |
1365 | * @param ppa where is the auditor in processing | 1302 | * @param ppa where is the auditor in processing |
1366 | * @return transaction status code | 1303 | * @return transaction status code |
@@ -1368,18 +1305,17 @@ postgres_get_auditor_progress_reserve ( | |||
1368 | static enum GNUNET_DB_QueryStatus | 1305 | static enum GNUNET_DB_QueryStatus |
1369 | postgres_insert_auditor_progress_aggregation ( | 1306 | postgres_insert_auditor_progress_aggregation ( |
1370 | void *cls, | 1307 | void *cls, |
1371 | struct TALER_AUDITORDB_Session *session, | ||
1372 | const struct TALER_MasterPublicKeyP *master_pub, | 1308 | const struct TALER_MasterPublicKeyP *master_pub, |
1373 | const struct TALER_AUDITORDB_ProgressPointAggregation *ppa) | 1309 | const struct TALER_AUDITORDB_ProgressPointAggregation *ppa) |
1374 | { | 1310 | { |
1311 | struct PostgresClosure *pg = cls; | ||
1375 | struct GNUNET_PQ_QueryParam params[] = { | 1312 | struct GNUNET_PQ_QueryParam params[] = { |
1376 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1313 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1377 | GNUNET_PQ_query_param_uint64 (&ppa->last_wire_out_serial_id), | 1314 | GNUNET_PQ_query_param_uint64 (&ppa->last_wire_out_serial_id), |
1378 | GNUNET_PQ_query_param_end | 1315 | GNUNET_PQ_query_param_end |
1379 | }; | 1316 | }; |
1380 | 1317 | ||
1381 | (void) cls; | 1318 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1382 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1383 | "auditor_progress_insert_aggregation", | 1319 | "auditor_progress_insert_aggregation", |
1384 | params); | 1320 | params); |
1385 | } | 1321 | } |
@@ -1390,7 +1326,6 @@ postgres_insert_auditor_progress_aggregation ( | |||
1390 | * must be an existing record for the exchange. | 1326 | * must be an existing record for the exchange. |
1391 | * | 1327 | * |
1392 | * @param cls the @e cls of this struct with the plugin-specific state | 1328 | * @param cls the @e cls of this struct with the plugin-specific state |
1393 | * @param session connection to use | ||
1394 | * @param master_pub master key of the exchange | 1329 | * @param master_pub master key of the exchange |
1395 | * @param ppa where is the auditor in processing | 1330 | * @param ppa where is the auditor in processing |
1396 | * @return transaction status code | 1331 | * @return transaction status code |
@@ -1398,18 +1333,17 @@ postgres_insert_auditor_progress_aggregation ( | |||
1398 | static enum GNUNET_DB_QueryStatus | 1333 | static enum GNUNET_DB_QueryStatus |
1399 | postgres_update_auditor_progress_aggregation ( | 1334 | postgres_update_auditor_progress_aggregation ( |
1400 | void *cls, | 1335 | void *cls, |
1401 | struct TALER_AUDITORDB_Session *session, | ||
1402 | const struct TALER_MasterPublicKeyP *master_pub, | 1336 | const struct TALER_MasterPublicKeyP *master_pub, |
1403 | const struct TALER_AUDITORDB_ProgressPointAggregation *ppa) | 1337 | const struct TALER_AUDITORDB_ProgressPointAggregation *ppa) |
1404 | { | 1338 | { |
1339 | struct PostgresClosure *pg = cls; | ||
1405 | struct GNUNET_PQ_QueryParam params[] = { | 1340 | struct GNUNET_PQ_QueryParam params[] = { |
1406 | GNUNET_PQ_query_param_uint64 (&ppa->last_wire_out_serial_id), | 1341 | GNUNET_PQ_query_param_uint64 (&ppa->last_wire_out_serial_id), |
1407 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1342 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1408 | GNUNET_PQ_query_param_end | 1343 | GNUNET_PQ_query_param_end |
1409 | }; | 1344 | }; |
1410 | 1345 | ||
1411 | (void) cls; | 1346 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1412 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1413 | "auditor_progress_update_aggregation", | 1347 | "auditor_progress_update_aggregation", |
1414 | params); | 1348 | params); |
1415 | } | 1349 | } |
@@ -1419,7 +1353,6 @@ postgres_update_auditor_progress_aggregation ( | |||
1419 | * Get information about the progress of the auditor. | 1353 | * Get information about the progress of the auditor. |
1420 | * | 1354 | * |
1421 | * @param cls the @e cls of this struct with the plugin-specific state | 1355 | * @param cls the @e cls of this struct with the plugin-specific state |
1422 | * @param session connection to use | ||
1423 | * @param master_pub master key of the exchange | 1356 | * @param master_pub master key of the exchange |
1424 | * @param[out] ppa set to where the auditor is in processing | 1357 | * @param[out] ppa set to where the auditor is in processing |
1425 | * @return transaction status code | 1358 | * @return transaction status code |
@@ -1427,10 +1360,10 @@ postgres_update_auditor_progress_aggregation ( | |||
1427 | static enum GNUNET_DB_QueryStatus | 1360 | static enum GNUNET_DB_QueryStatus |
1428 | postgres_get_auditor_progress_aggregation ( | 1361 | postgres_get_auditor_progress_aggregation ( |
1429 | void *cls, | 1362 | void *cls, |
1430 | struct TALER_AUDITORDB_Session *session, | ||
1431 | const struct TALER_MasterPublicKeyP *master_pub, | 1363 | const struct TALER_MasterPublicKeyP *master_pub, |
1432 | struct TALER_AUDITORDB_ProgressPointAggregation *ppa) | 1364 | struct TALER_AUDITORDB_ProgressPointAggregation *ppa) |
1433 | { | 1365 | { |
1366 | struct PostgresClosure *pg = cls; | ||
1434 | struct GNUNET_PQ_QueryParam params[] = { | 1367 | struct GNUNET_PQ_QueryParam params[] = { |
1435 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1368 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1436 | GNUNET_PQ_query_param_end | 1369 | GNUNET_PQ_query_param_end |
@@ -1441,8 +1374,7 @@ postgres_get_auditor_progress_aggregation ( | |||
1441 | GNUNET_PQ_result_spec_end | 1374 | GNUNET_PQ_result_spec_end |
1442 | }; | 1375 | }; |
1443 | 1376 | ||
1444 | (void) cls; | 1377 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
1445 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
1446 | "auditor_progress_select_aggregation", | 1378 | "auditor_progress_select_aggregation", |
1447 | params, | 1379 | params, |
1448 | rs); | 1380 | rs); |
@@ -1454,7 +1386,6 @@ postgres_get_auditor_progress_aggregation ( | |||
1454 | * data. | 1386 | * data. |
1455 | * | 1387 | * |
1456 | * @param cls the @e cls of this struct with the plugin-specific state | 1388 | * @param cls the @e cls of this struct with the plugin-specific state |
1457 | * @param session connection to use | ||
1458 | * @param master_pub master key of the exchange | 1389 | * @param master_pub master key of the exchange |
1459 | * @param ppdc where is the auditor in processing | 1390 | * @param ppdc where is the auditor in processing |
1460 | * @return transaction status code | 1391 | * @return transaction status code |
@@ -1462,18 +1393,17 @@ postgres_get_auditor_progress_aggregation ( | |||
1462 | static enum GNUNET_DB_QueryStatus | 1393 | static enum GNUNET_DB_QueryStatus |
1463 | postgres_insert_auditor_progress_deposit_confirmation ( | 1394 | postgres_insert_auditor_progress_deposit_confirmation ( |
1464 | void *cls, | 1395 | void *cls, |
1465 | struct TALER_AUDITORDB_Session *session, | ||
1466 | const struct TALER_MasterPublicKeyP *master_pub, | 1396 | const struct TALER_MasterPublicKeyP *master_pub, |
1467 | const struct TALER_AUDITORDB_ProgressPointDepositConfirmation *ppdc) | 1397 | const struct TALER_AUDITORDB_ProgressPointDepositConfirmation *ppdc) |
1468 | { | 1398 | { |
1399 | struct PostgresClosure *pg = cls; | ||
1469 | struct GNUNET_PQ_QueryParam params[] = { | 1400 | struct GNUNET_PQ_QueryParam params[] = { |
1470 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1401 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1471 | GNUNET_PQ_query_param_uint64 (&ppdc->last_deposit_confirmation_serial_id), | 1402 | GNUNET_PQ_query_param_uint64 (&ppdc->last_deposit_confirmation_serial_id), |
1472 | GNUNET_PQ_query_param_end | 1403 | GNUNET_PQ_query_param_end |
1473 | }; | 1404 | }; |
1474 | 1405 | ||
1475 | (void) cls; | 1406 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1476 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1477 | "auditor_progress_insert_deposit_confirmation", | 1407 | "auditor_progress_insert_deposit_confirmation", |
1478 | params); | 1408 | params); |
1479 | } | 1409 | } |
@@ -1484,7 +1414,6 @@ postgres_insert_auditor_progress_deposit_confirmation ( | |||
1484 | * must be an existing record for the exchange. | 1414 | * must be an existing record for the exchange. |
1485 | * | 1415 | * |
1486 | * @param cls the @e cls of this struct with the plugin-specific state | 1416 | * @param cls the @e cls of this struct with the plugin-specific state |
1487 | * @param session connection to use | ||
1488 | * @param master_pub master key of the exchange | 1417 | * @param master_pub master key of the exchange |
1489 | * @param ppdc where is the auditor in processing | 1418 | * @param ppdc where is the auditor in processing |
1490 | * @return transaction status code | 1419 | * @return transaction status code |
@@ -1492,18 +1421,17 @@ postgres_insert_auditor_progress_deposit_confirmation ( | |||
1492 | static enum GNUNET_DB_QueryStatus | 1421 | static enum GNUNET_DB_QueryStatus |
1493 | postgres_update_auditor_progress_deposit_confirmation ( | 1422 | postgres_update_auditor_progress_deposit_confirmation ( |
1494 | void *cls, | 1423 | void *cls, |
1495 | struct TALER_AUDITORDB_Session *session, | ||
1496 | const struct TALER_MasterPublicKeyP *master_pub, | 1424 | const struct TALER_MasterPublicKeyP *master_pub, |
1497 | const struct TALER_AUDITORDB_ProgressPointDepositConfirmation *ppdc) | 1425 | const struct TALER_AUDITORDB_ProgressPointDepositConfirmation *ppdc) |
1498 | { | 1426 | { |
1427 | struct PostgresClosure *pg = cls; | ||
1499 | struct GNUNET_PQ_QueryParam params[] = { | 1428 | struct GNUNET_PQ_QueryParam params[] = { |
1500 | GNUNET_PQ_query_param_uint64 (&ppdc->last_deposit_confirmation_serial_id), | 1429 | GNUNET_PQ_query_param_uint64 (&ppdc->last_deposit_confirmation_serial_id), |
1501 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1430 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1502 | GNUNET_PQ_query_param_end | 1431 | GNUNET_PQ_query_param_end |
1503 | }; | 1432 | }; |
1504 | 1433 | ||
1505 | (void) cls; | 1434 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1506 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1507 | "auditor_progress_update_deposit_confirmation", | 1435 | "auditor_progress_update_deposit_confirmation", |
1508 | params); | 1436 | params); |
1509 | } | 1437 | } |
@@ -1513,7 +1441,6 @@ postgres_update_auditor_progress_deposit_confirmation ( | |||
1513 | * Get information about the progress of the auditor. | 1441 | * Get information about the progress of the auditor. |
1514 | * | 1442 | * |
1515 | * @param cls the @e cls of this struct with the plugin-specific state | 1443 | * @param cls the @e cls of this struct with the plugin-specific state |
1516 | * @param session connection to use | ||
1517 | * @param master_pub master key of the exchange | 1444 | * @param master_pub master key of the exchange |
1518 | * @param[out] ppdc set to where the auditor is in processing | 1445 | * @param[out] ppdc set to where the auditor is in processing |
1519 | * @return transaction status code | 1446 | * @return transaction status code |
@@ -1521,10 +1448,10 @@ postgres_update_auditor_progress_deposit_confirmation ( | |||
1521 | static enum GNUNET_DB_QueryStatus | 1448 | static enum GNUNET_DB_QueryStatus |
1522 | postgres_get_auditor_progress_deposit_confirmation ( | 1449 | postgres_get_auditor_progress_deposit_confirmation ( |
1523 | void *cls, | 1450 | void *cls, |
1524 | struct TALER_AUDITORDB_Session *session, | ||
1525 | const struct TALER_MasterPublicKeyP *master_pub, | 1451 | const struct TALER_MasterPublicKeyP *master_pub, |
1526 | struct TALER_AUDITORDB_ProgressPointDepositConfirmation *ppdc) | 1452 | struct TALER_AUDITORDB_ProgressPointDepositConfirmation *ppdc) |
1527 | { | 1453 | { |
1454 | struct PostgresClosure *pg = cls; | ||
1528 | struct GNUNET_PQ_QueryParam params[] = { | 1455 | struct GNUNET_PQ_QueryParam params[] = { |
1529 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1456 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1530 | GNUNET_PQ_query_param_end | 1457 | GNUNET_PQ_query_param_end |
@@ -1535,8 +1462,7 @@ postgres_get_auditor_progress_deposit_confirmation ( | |||
1535 | GNUNET_PQ_result_spec_end | 1462 | GNUNET_PQ_result_spec_end |
1536 | }; | 1463 | }; |
1537 | 1464 | ||
1538 | (void) cls; | 1465 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
1539 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
1540 | "auditor_progress_select_deposit_confirmation", | 1466 | "auditor_progress_select_deposit_confirmation", |
1541 | params, | 1467 | params, |
1542 | rs); | 1468 | rs); |
@@ -1548,7 +1474,6 @@ postgres_get_auditor_progress_deposit_confirmation ( | |||
1548 | * data. | 1474 | * data. |
1549 | * | 1475 | * |
1550 | * @param cls the @e cls of this struct with the plugin-specific state | 1476 | * @param cls the @e cls of this struct with the plugin-specific state |
1551 | * @param session connection to use | ||
1552 | * @param master_pub master key of the exchange | 1477 | * @param master_pub master key of the exchange |
1553 | * @param ppc where is the auditor in processing | 1478 | * @param ppc where is the auditor in processing |
1554 | * @return transaction status code | 1479 | * @return transaction status code |
@@ -1556,10 +1481,10 @@ postgres_get_auditor_progress_deposit_confirmation ( | |||
1556 | static enum GNUNET_DB_QueryStatus | 1481 | static enum GNUNET_DB_QueryStatus |
1557 | postgres_insert_auditor_progress_coin ( | 1482 | postgres_insert_auditor_progress_coin ( |
1558 | void *cls, | 1483 | void *cls, |
1559 | struct TALER_AUDITORDB_Session *session, | ||
1560 | const struct TALER_MasterPublicKeyP *master_pub, | 1484 | const struct TALER_MasterPublicKeyP *master_pub, |
1561 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc) | 1485 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc) |
1562 | { | 1486 | { |
1487 | struct PostgresClosure *pg = cls; | ||
1563 | struct GNUNET_PQ_QueryParam params[] = { | 1488 | struct GNUNET_PQ_QueryParam params[] = { |
1564 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1489 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1565 | GNUNET_PQ_query_param_uint64 (&ppc->last_withdraw_serial_id), | 1490 | GNUNET_PQ_query_param_uint64 (&ppc->last_withdraw_serial_id), |
@@ -1571,8 +1496,7 @@ postgres_insert_auditor_progress_coin ( | |||
1571 | GNUNET_PQ_query_param_end | 1496 | GNUNET_PQ_query_param_end |
1572 | }; | 1497 | }; |
1573 | 1498 | ||
1574 | (void) cls; | 1499 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1575 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1576 | "auditor_progress_insert_coin", | 1500 | "auditor_progress_insert_coin", |
1577 | params); | 1501 | params); |
1578 | } | 1502 | } |
@@ -1583,7 +1507,6 @@ postgres_insert_auditor_progress_coin ( | |||
1583 | * must be an existing record for the exchange. | 1507 | * must be an existing record for the exchange. |
1584 | * | 1508 | * |
1585 | * @param cls the @e cls of this struct with the plugin-specific state | 1509 | * @param cls the @e cls of this struct with the plugin-specific state |
1586 | * @param session connection to use | ||
1587 | * @param master_pub master key of the exchange | 1510 | * @param master_pub master key of the exchange |
1588 | * @param ppc where is the auditor in processing | 1511 | * @param ppc where is the auditor in processing |
1589 | * @return transaction status code | 1512 | * @return transaction status code |
@@ -1591,10 +1514,10 @@ postgres_insert_auditor_progress_coin ( | |||
1591 | static enum GNUNET_DB_QueryStatus | 1514 | static enum GNUNET_DB_QueryStatus |
1592 | postgres_update_auditor_progress_coin ( | 1515 | postgres_update_auditor_progress_coin ( |
1593 | void *cls, | 1516 | void *cls, |
1594 | struct TALER_AUDITORDB_Session *session, | ||
1595 | const struct TALER_MasterPublicKeyP *master_pub, | 1517 | const struct TALER_MasterPublicKeyP *master_pub, |
1596 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc) | 1518 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc) |
1597 | { | 1519 | { |
1520 | struct PostgresClosure *pg = cls; | ||
1598 | struct GNUNET_PQ_QueryParam params[] = { | 1521 | struct GNUNET_PQ_QueryParam params[] = { |
1599 | GNUNET_PQ_query_param_uint64 (&ppc->last_withdraw_serial_id), | 1522 | GNUNET_PQ_query_param_uint64 (&ppc->last_withdraw_serial_id), |
1600 | GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id), | 1523 | GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id), |
@@ -1606,8 +1529,7 @@ postgres_update_auditor_progress_coin ( | |||
1606 | GNUNET_PQ_query_param_end | 1529 | GNUNET_PQ_query_param_end |
1607 | }; | 1530 | }; |
1608 | 1531 | ||
1609 | (void) cls; | 1532 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1610 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1611 | "auditor_progress_update_coin", | 1533 | "auditor_progress_update_coin", |
1612 | params); | 1534 | params); |
1613 | } | 1535 | } |
@@ -1617,7 +1539,6 @@ postgres_update_auditor_progress_coin ( | |||
1617 | * Get information about the progress of the auditor. | 1539 | * Get information about the progress of the auditor. |
1618 | * | 1540 | * |
1619 | * @param cls the @e cls of this struct with the plugin-specific state | 1541 | * @param cls the @e cls of this struct with the plugin-specific state |
1620 | * @param session connection to use | ||
1621 | * @param master_pub master key of the exchange | 1542 | * @param master_pub master key of the exchange |
1622 | * @param[out] ppc set to where the auditor is in processing | 1543 | * @param[out] ppc set to where the auditor is in processing |
1623 | * @return transaction status code | 1544 | * @return transaction status code |
@@ -1625,10 +1546,10 @@ postgres_update_auditor_progress_coin ( | |||
1625 | static enum GNUNET_DB_QueryStatus | 1546 | static enum GNUNET_DB_QueryStatus |
1626 | postgres_get_auditor_progress_coin ( | 1547 | postgres_get_auditor_progress_coin ( |
1627 | void *cls, | 1548 | void *cls, |
1628 | struct TALER_AUDITORDB_Session *session, | ||
1629 | const struct TALER_MasterPublicKeyP *master_pub, | 1549 | const struct TALER_MasterPublicKeyP *master_pub, |
1630 | struct TALER_AUDITORDB_ProgressPointCoin *ppc) | 1550 | struct TALER_AUDITORDB_ProgressPointCoin *ppc) |
1631 | { | 1551 | { |
1552 | struct PostgresClosure *pg = cls; | ||
1632 | struct GNUNET_PQ_QueryParam params[] = { | 1553 | struct GNUNET_PQ_QueryParam params[] = { |
1633 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1554 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1634 | GNUNET_PQ_query_param_end | 1555 | GNUNET_PQ_query_param_end |
@@ -1649,8 +1570,7 @@ postgres_get_auditor_progress_coin ( | |||
1649 | GNUNET_PQ_result_spec_end | 1570 | GNUNET_PQ_result_spec_end |
1650 | }; | 1571 | }; |
1651 | 1572 | ||
1652 | (void) cls; | 1573 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
1653 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
1654 | "auditor_progress_select_coin", | 1574 | "auditor_progress_select_coin", |
1655 | params, | 1575 | params, |
1656 | rs); | 1576 | rs); |
@@ -1662,7 +1582,6 @@ postgres_get_auditor_progress_coin ( | |||
1662 | * data. | 1582 | * data. |
1663 | * | 1583 | * |
1664 | * @param cls the @e cls of this struct with the plugin-specific state | 1584 | * @param cls the @e cls of this struct with the plugin-specific state |
1665 | * @param session connection to use | ||
1666 | * @param master_pub master key of the exchange | 1585 | * @param master_pub master key of the exchange |
1667 | * @param account_name name of the wire account we are auditing | 1586 | * @param account_name name of the wire account we are auditing |
1668 | * @param pp how far are we in the auditor's tables | 1587 | * @param pp how far are we in the auditor's tables |
@@ -1673,13 +1592,13 @@ postgres_get_auditor_progress_coin ( | |||
1673 | static enum GNUNET_DB_QueryStatus | 1592 | static enum GNUNET_DB_QueryStatus |
1674 | postgres_insert_wire_auditor_account_progress ( | 1593 | postgres_insert_wire_auditor_account_progress ( |
1675 | void *cls, | 1594 | void *cls, |
1676 | struct TALER_AUDITORDB_Session *session, | ||
1677 | const struct TALER_MasterPublicKeyP *master_pub, | 1595 | const struct TALER_MasterPublicKeyP *master_pub, |
1678 | const char *account_name, | 1596 | const char *account_name, |
1679 | const struct TALER_AUDITORDB_WireAccountProgressPoint *pp, | 1597 | const struct TALER_AUDITORDB_WireAccountProgressPoint *pp, |
1680 | uint64_t in_wire_off, | 1598 | uint64_t in_wire_off, |
1681 | uint64_t out_wire_off) | 1599 | uint64_t out_wire_off) |
1682 | { | 1600 | { |
1601 | struct PostgresClosure *pg = cls; | ||
1683 | struct GNUNET_PQ_QueryParam params[] = { | 1602 | struct GNUNET_PQ_QueryParam params[] = { |
1684 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1603 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1685 | GNUNET_PQ_query_param_string (account_name), | 1604 | GNUNET_PQ_query_param_string (account_name), |
@@ -1690,8 +1609,7 @@ postgres_insert_wire_auditor_account_progress ( | |||
1690 | GNUNET_PQ_query_param_end | 1609 | GNUNET_PQ_query_param_end |
1691 | }; | 1610 | }; |
1692 | 1611 | ||
1693 | (void) cls; | 1612 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1694 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1695 | "wire_auditor_account_progress_insert", | 1613 | "wire_auditor_account_progress_insert", |
1696 | params); | 1614 | params); |
1697 | } | 1615 | } |
@@ -1702,7 +1620,6 @@ postgres_insert_wire_auditor_account_progress ( | |||
1702 | * must be an existing record for the exchange. | 1620 | * must be an existing record for the exchange. |
1703 | * | 1621 | * |
1704 | * @param cls the @e cls of this struct with the plugin-specific state | 1622 | * @param cls the @e cls of this struct with the plugin-specific state |
1705 | * @param session connection to use | ||
1706 | * @param master_pub master key of the exchange | 1623 | * @param master_pub master key of the exchange |
1707 | * @param account_name name of the wire account we are auditing | 1624 | * @param account_name name of the wire account we are auditing |
1708 | * @param pp where is the auditor in processing | 1625 | * @param pp where is the auditor in processing |
@@ -1713,13 +1630,13 @@ postgres_insert_wire_auditor_account_progress ( | |||
1713 | static enum GNUNET_DB_QueryStatus | 1630 | static enum GNUNET_DB_QueryStatus |
1714 | postgres_update_wire_auditor_account_progress ( | 1631 | postgres_update_wire_auditor_account_progress ( |
1715 | void *cls, | 1632 | void *cls, |
1716 | struct TALER_AUDITORDB_Session *session, | ||
1717 | const struct TALER_MasterPublicKeyP *master_pub, | 1633 | const struct TALER_MasterPublicKeyP *master_pub, |
1718 | const char *account_name, | 1634 | const char *account_name, |
1719 | const struct TALER_AUDITORDB_WireAccountProgressPoint *pp, | 1635 | const struct TALER_AUDITORDB_WireAccountProgressPoint *pp, |
1720 | uint64_t in_wire_off, | 1636 | uint64_t in_wire_off, |
1721 | uint64_t out_wire_off) | 1637 | uint64_t out_wire_off) |
1722 | { | 1638 | { |
1639 | struct PostgresClosure *pg = cls; | ||
1723 | struct GNUNET_PQ_QueryParam params[] = { | 1640 | struct GNUNET_PQ_QueryParam params[] = { |
1724 | GNUNET_PQ_query_param_uint64 (&pp->last_reserve_in_serial_id), | 1641 | GNUNET_PQ_query_param_uint64 (&pp->last_reserve_in_serial_id), |
1725 | GNUNET_PQ_query_param_uint64 (&pp->last_wire_out_serial_id), | 1642 | GNUNET_PQ_query_param_uint64 (&pp->last_wire_out_serial_id), |
@@ -1730,8 +1647,7 @@ postgres_update_wire_auditor_account_progress ( | |||
1730 | GNUNET_PQ_query_param_end | 1647 | GNUNET_PQ_query_param_end |
1731 | }; | 1648 | }; |
1732 | 1649 | ||
1733 | (void) cls; | 1650 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1734 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1735 | "wire_auditor_account_progress_update", | 1651 | "wire_auditor_account_progress_update", |
1736 | params); | 1652 | params); |
1737 | } | 1653 | } |
@@ -1741,7 +1657,6 @@ postgres_update_wire_auditor_account_progress ( | |||
1741 | * Get information about the progress of the auditor. | 1657 | * Get information about the progress of the auditor. |
1742 | * | 1658 | * |
1743 | * @param cls the @e cls of this struct with the plugin-specific state | 1659 | * @param cls the @e cls of this struct with the plugin-specific state |
1744 | * @param session connection to use | ||
1745 | * @param master_pub master key of the exchange | 1660 | * @param master_pub master key of the exchange |
1746 | * @param account_name name of the wire account we are auditing | 1661 | * @param account_name name of the wire account we are auditing |
1747 | * @param[out] pp where is the auditor in processing | 1662 | * @param[out] pp where is the auditor in processing |
@@ -1752,13 +1667,13 @@ postgres_update_wire_auditor_account_progress ( | |||
1752 | static enum GNUNET_DB_QueryStatus | 1667 | static enum GNUNET_DB_QueryStatus |
1753 | postgres_get_wire_auditor_account_progress ( | 1668 | postgres_get_wire_auditor_account_progress ( |
1754 | void *cls, | 1669 | void *cls, |
1755 | struct TALER_AUDITORDB_Session *session, | ||
1756 | const struct TALER_MasterPublicKeyP *master_pub, | 1670 | const struct TALER_MasterPublicKeyP *master_pub, |
1757 | const char *account_name, | 1671 | const char *account_name, |
1758 | struct TALER_AUDITORDB_WireAccountProgressPoint *pp, | 1672 | struct TALER_AUDITORDB_WireAccountProgressPoint *pp, |
1759 | uint64_t *in_wire_off, | 1673 | uint64_t *in_wire_off, |
1760 | uint64_t *out_wire_off) | 1674 | uint64_t *out_wire_off) |
1761 | { | 1675 | { |
1676 | struct PostgresClosure *pg = cls; | ||
1762 | struct GNUNET_PQ_QueryParam params[] = { | 1677 | struct GNUNET_PQ_QueryParam params[] = { |
1763 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1678 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1764 | GNUNET_PQ_query_param_string (account_name), | 1679 | GNUNET_PQ_query_param_string (account_name), |
@@ -1776,8 +1691,7 @@ postgres_get_wire_auditor_account_progress ( | |||
1776 | GNUNET_PQ_result_spec_end | 1691 | GNUNET_PQ_result_spec_end |
1777 | }; | 1692 | }; |
1778 | 1693 | ||
1779 | (void) cls; | 1694 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
1780 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
1781 | "wire_auditor_account_progress_select", | 1695 | "wire_auditor_account_progress_select", |
1782 | params, | 1696 | params, |
1783 | rs); | 1697 | rs); |
@@ -1789,7 +1703,6 @@ postgres_get_wire_auditor_account_progress ( | |||
1789 | * data. | 1703 | * data. |
1790 | * | 1704 | * |
1791 | * @param cls the @e cls of this struct with the plugin-specific state | 1705 | * @param cls the @e cls of this struct with the plugin-specific state |
1792 | * @param session connection to use | ||
1793 | * @param master_pub master key of the exchange | 1706 | * @param master_pub master key of the exchange |
1794 | * @param pp where is the auditor in processing | 1707 | * @param pp where is the auditor in processing |
1795 | * @return transaction status code | 1708 | * @return transaction status code |
@@ -1797,10 +1710,10 @@ postgres_get_wire_auditor_account_progress ( | |||
1797 | static enum GNUNET_DB_QueryStatus | 1710 | static enum GNUNET_DB_QueryStatus |
1798 | postgres_insert_wire_auditor_progress ( | 1711 | postgres_insert_wire_auditor_progress ( |
1799 | void *cls, | 1712 | void *cls, |
1800 | struct TALER_AUDITORDB_Session *session, | ||
1801 | const struct TALER_MasterPublicKeyP *master_pub, | 1713 | const struct TALER_MasterPublicKeyP *master_pub, |
1802 | const struct TALER_AUDITORDB_WireProgressPoint *pp) | 1714 | const struct TALER_AUDITORDB_WireProgressPoint *pp) |
1803 | { | 1715 | { |
1716 | struct PostgresClosure *pg = cls; | ||
1804 | struct GNUNET_PQ_QueryParam params[] = { | 1717 | struct GNUNET_PQ_QueryParam params[] = { |
1805 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1718 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1806 | TALER_PQ_query_param_absolute_time (&pp->last_timestamp), | 1719 | TALER_PQ_query_param_absolute_time (&pp->last_timestamp), |
@@ -1808,8 +1721,7 @@ postgres_insert_wire_auditor_progress ( | |||
1808 | GNUNET_PQ_query_param_end | 1721 | GNUNET_PQ_query_param_end |
1809 | }; | 1722 | }; |
1810 | 1723 | ||
1811 | (void) cls; | 1724 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1812 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1813 | "wire_auditor_progress_insert", | 1725 | "wire_auditor_progress_insert", |
1814 | params); | 1726 | params); |
1815 | } | 1727 | } |
@@ -1820,7 +1732,6 @@ postgres_insert_wire_auditor_progress ( | |||
1820 | * must be an existing record for the exchange. | 1732 | * must be an existing record for the exchange. |
1821 | * | 1733 | * |
1822 | * @param cls the @e cls of this struct with the plugin-specific state | 1734 | * @param cls the @e cls of this struct with the plugin-specific state |
1823 | * @param session connection to use | ||
1824 | * @param master_pub master key of the exchange | 1735 | * @param master_pub master key of the exchange |
1825 | * @param pp where is the auditor in processing | 1736 | * @param pp where is the auditor in processing |
1826 | * @return transaction status code | 1737 | * @return transaction status code |
@@ -1828,10 +1739,10 @@ postgres_insert_wire_auditor_progress ( | |||
1828 | static enum GNUNET_DB_QueryStatus | 1739 | static enum GNUNET_DB_QueryStatus |
1829 | postgres_update_wire_auditor_progress ( | 1740 | postgres_update_wire_auditor_progress ( |
1830 | void *cls, | 1741 | void *cls, |
1831 | struct TALER_AUDITORDB_Session *session, | ||
1832 | const struct TALER_MasterPublicKeyP *master_pub, | 1742 | const struct TALER_MasterPublicKeyP *master_pub, |
1833 | const struct TALER_AUDITORDB_WireProgressPoint *pp) | 1743 | const struct TALER_AUDITORDB_WireProgressPoint *pp) |
1834 | { | 1744 | { |
1745 | struct PostgresClosure *pg = cls; | ||
1835 | struct GNUNET_PQ_QueryParam params[] = { | 1746 | struct GNUNET_PQ_QueryParam params[] = { |
1836 | TALER_PQ_query_param_absolute_time (&pp->last_timestamp), | 1747 | TALER_PQ_query_param_absolute_time (&pp->last_timestamp), |
1837 | GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_uuid), | 1748 | GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_uuid), |
@@ -1839,8 +1750,7 @@ postgres_update_wire_auditor_progress ( | |||
1839 | GNUNET_PQ_query_param_end | 1750 | GNUNET_PQ_query_param_end |
1840 | }; | 1751 | }; |
1841 | 1752 | ||
1842 | (void) cls; | 1753 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1843 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1844 | "wire_auditor_progress_update", | 1754 | "wire_auditor_progress_update", |
1845 | params); | 1755 | params); |
1846 | } | 1756 | } |
@@ -1850,7 +1760,6 @@ postgres_update_wire_auditor_progress ( | |||
1850 | * Get information about the progress of the auditor. | 1760 | * Get information about the progress of the auditor. |
1851 | * | 1761 | * |
1852 | * @param cls the @e cls of this struct with the plugin-specific state | 1762 | * @param cls the @e cls of this struct with the plugin-specific state |
1853 | * @param session connection to use | ||
1854 | * @param master_pub master key of the exchange | 1763 | * @param master_pub master key of the exchange |
1855 | * @param[out] pp set to where the auditor is in processing | 1764 | * @param[out] pp set to where the auditor is in processing |
1856 | * @return transaction status code | 1765 | * @return transaction status code |
@@ -1858,10 +1767,10 @@ postgres_update_wire_auditor_progress ( | |||
1858 | static enum GNUNET_DB_QueryStatus | 1767 | static enum GNUNET_DB_QueryStatus |
1859 | postgres_get_wire_auditor_progress ( | 1768 | postgres_get_wire_auditor_progress ( |
1860 | void *cls, | 1769 | void *cls, |
1861 | struct TALER_AUDITORDB_Session *session, | ||
1862 | const struct TALER_MasterPublicKeyP *master_pub, | 1770 | const struct TALER_MasterPublicKeyP *master_pub, |
1863 | struct TALER_AUDITORDB_WireProgressPoint *pp) | 1771 | struct TALER_AUDITORDB_WireProgressPoint *pp) |
1864 | { | 1772 | { |
1773 | struct PostgresClosure *pg = cls; | ||
1865 | struct GNUNET_PQ_QueryParam params[] = { | 1774 | struct GNUNET_PQ_QueryParam params[] = { |
1866 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1775 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1867 | GNUNET_PQ_query_param_end | 1776 | GNUNET_PQ_query_param_end |
@@ -1874,8 +1783,7 @@ postgres_get_wire_auditor_progress ( | |||
1874 | GNUNET_PQ_result_spec_end | 1783 | GNUNET_PQ_result_spec_end |
1875 | }; | 1784 | }; |
1876 | 1785 | ||
1877 | (void) cls; | 1786 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
1878 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
1879 | "wire_auditor_progress_select", | 1787 | "wire_auditor_progress_select", |
1880 | params, | 1788 | params, |
1881 | rs); | 1789 | rs); |
@@ -1887,7 +1795,6 @@ postgres_get_wire_auditor_progress ( | |||
1887 | * existing record for the reserve. | 1795 | * existing record for the reserve. |
1888 | * | 1796 | * |
1889 | * @param cls the @e cls of this struct with the plugin-specific state | 1797 | * @param cls the @e cls of this struct with the plugin-specific state |
1890 | * @param session connection to use | ||
1891 | * @param reserve_pub public key of the reserve | 1798 | * @param reserve_pub public key of the reserve |
1892 | * @param master_pub master public key of the exchange | 1799 | * @param master_pub master public key of the exchange |
1893 | * @param reserve_balance amount stored in the reserve | 1800 | * @param reserve_balance amount stored in the reserve |
@@ -1899,7 +1806,6 @@ postgres_get_wire_auditor_progress ( | |||
1899 | */ | 1806 | */ |
1900 | static enum GNUNET_DB_QueryStatus | 1807 | static enum GNUNET_DB_QueryStatus |
1901 | postgres_insert_reserve_info (void *cls, | 1808 | postgres_insert_reserve_info (void *cls, |
1902 | struct TALER_AUDITORDB_Session *session, | ||
1903 | const struct TALER_ReservePublicKeyP *reserve_pub, | 1809 | const struct TALER_ReservePublicKeyP *reserve_pub, |
1904 | const struct TALER_MasterPublicKeyP *master_pub, | 1810 | const struct TALER_MasterPublicKeyP *master_pub, |
1905 | const struct TALER_Amount *reserve_balance, | 1811 | const struct TALER_Amount *reserve_balance, |
@@ -1907,6 +1813,7 @@ postgres_insert_reserve_info (void *cls, | |||
1907 | struct GNUNET_TIME_Absolute expiration_date, | 1813 | struct GNUNET_TIME_Absolute expiration_date, |
1908 | const char *origin_account) | 1814 | const char *origin_account) |
1909 | { | 1815 | { |
1816 | struct PostgresClosure *pg = cls; | ||
1910 | struct GNUNET_PQ_QueryParam params[] = { | 1817 | struct GNUNET_PQ_QueryParam params[] = { |
1911 | GNUNET_PQ_query_param_auto_from_type (reserve_pub), | 1818 | GNUNET_PQ_query_param_auto_from_type (reserve_pub), |
1912 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1819 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
@@ -1917,12 +1824,11 @@ postgres_insert_reserve_info (void *cls, | |||
1917 | GNUNET_PQ_query_param_end | 1824 | GNUNET_PQ_query_param_end |
1918 | }; | 1825 | }; |
1919 | 1826 | ||
1920 | (void) cls; | ||
1921 | GNUNET_assert (GNUNET_YES == | 1827 | GNUNET_assert (GNUNET_YES == |
1922 | TALER_amount_cmp_currency (reserve_balance, | 1828 | TALER_amount_cmp_currency (reserve_balance, |
1923 | withdraw_fee_balance)); | 1829 | withdraw_fee_balance)); |
1924 | 1830 | ||
1925 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | 1831 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1926 | "auditor_reserves_insert", | 1832 | "auditor_reserves_insert", |
1927 | params); | 1833 | params); |
1928 | } | 1834 | } |
@@ -1933,7 +1839,6 @@ postgres_insert_reserve_info (void *cls, | |||
1933 | * existing record, which must already exist. | 1839 | * existing record, which must already exist. |
1934 | * | 1840 | * |
1935 | * @param cls the @e cls of this struct with the plugin-specific state | 1841 | * @param cls the @e cls of this struct with the plugin-specific state |
1936 | * @param session connection to use | ||
1937 | * @param reserve_pub public key of the reserve | 1842 | * @param reserve_pub public key of the reserve |
1938 | * @param master_pub master public key of the exchange | 1843 | * @param master_pub master public key of the exchange |
1939 | * @param reserve_balance amount stored in the reserve | 1844 | * @param reserve_balance amount stored in the reserve |
@@ -1944,13 +1849,13 @@ postgres_insert_reserve_info (void *cls, | |||
1944 | */ | 1849 | */ |
1945 | static enum GNUNET_DB_QueryStatus | 1850 | static enum GNUNET_DB_QueryStatus |
1946 | postgres_update_reserve_info (void *cls, | 1851 | postgres_update_reserve_info (void *cls, |
1947 | struct TALER_AUDITORDB_Session *session, | ||
1948 | const struct TALER_ReservePublicKeyP *reserve_pub, | 1852 | const struct TALER_ReservePublicKeyP *reserve_pub, |
1949 | const struct TALER_MasterPublicKeyP *master_pub, | 1853 | const struct TALER_MasterPublicKeyP *master_pub, |
1950 | const struct TALER_Amount *reserve_balance, | 1854 | const struct TALER_Amount *reserve_balance, |
1951 | const struct TALER_Amount *withdraw_fee_balance, | 1855 | const struct TALER_Amount *withdraw_fee_balance, |
1952 | struct GNUNET_TIME_Absolute expiration_date) | 1856 | struct GNUNET_TIME_Absolute expiration_date) |
1953 | { | 1857 | { |
1858 | struct PostgresClosure *pg = cls; | ||
1954 | struct GNUNET_PQ_QueryParam params[] = { | 1859 | struct GNUNET_PQ_QueryParam params[] = { |
1955 | TALER_PQ_query_param_amount (reserve_balance), | 1860 | TALER_PQ_query_param_amount (reserve_balance), |
1956 | TALER_PQ_query_param_amount (withdraw_fee_balance), | 1861 | TALER_PQ_query_param_amount (withdraw_fee_balance), |
@@ -1960,12 +1865,11 @@ postgres_update_reserve_info (void *cls, | |||
1960 | GNUNET_PQ_query_param_end | 1865 | GNUNET_PQ_query_param_end |
1961 | }; | 1866 | }; |
1962 | 1867 | ||
1963 | (void) cls; | ||
1964 | GNUNET_assert (GNUNET_YES == | 1868 | GNUNET_assert (GNUNET_YES == |
1965 | TALER_amount_cmp_currency (reserve_balance, | 1869 | TALER_amount_cmp_currency (reserve_balance, |
1966 | withdraw_fee_balance)); | 1870 | withdraw_fee_balance)); |
1967 | 1871 | ||
1968 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | 1872 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1969 | "auditor_reserves_update", | 1873 | "auditor_reserves_update", |
1970 | params); | 1874 | params); |
1971 | } | 1875 | } |
@@ -1975,25 +1879,23 @@ postgres_update_reserve_info (void *cls, | |||
1975 | * Delete information about a reserve. | 1879 | * Delete information about a reserve. |
1976 | * | 1880 | * |
1977 | * @param cls the @e cls of this struct with the plugin-specific state | 1881 | * @param cls the @e cls of this struct with the plugin-specific state |
1978 | * @param session connection to use | ||
1979 | * @param reserve_pub public key of the reserve | 1882 | * @param reserve_pub public key of the reserve |
1980 | * @param master_pub master public key of the exchange | 1883 | * @param master_pub master public key of the exchange |
1981 | * @return transaction status code | 1884 | * @return transaction status code |
1982 | */ | 1885 | */ |
1983 | static enum GNUNET_DB_QueryStatus | 1886 | static enum GNUNET_DB_QueryStatus |
1984 | postgres_del_reserve_info (void *cls, | 1887 | postgres_del_reserve_info (void *cls, |
1985 | struct TALER_AUDITORDB_Session *session, | ||
1986 | const struct TALER_ReservePublicKeyP *reserve_pub, | 1888 | const struct TALER_ReservePublicKeyP *reserve_pub, |
1987 | const struct TALER_MasterPublicKeyP *master_pub) | 1889 | const struct TALER_MasterPublicKeyP *master_pub) |
1988 | { | 1890 | { |
1891 | struct PostgresClosure *pg = cls; | ||
1989 | struct GNUNET_PQ_QueryParam params[] = { | 1892 | struct GNUNET_PQ_QueryParam params[] = { |
1990 | GNUNET_PQ_query_param_auto_from_type (reserve_pub), | 1893 | GNUNET_PQ_query_param_auto_from_type (reserve_pub), |
1991 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1894 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
1992 | GNUNET_PQ_query_param_end | 1895 | GNUNET_PQ_query_param_end |
1993 | }; | 1896 | }; |
1994 | 1897 | ||
1995 | (void) cls; | 1898 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
1996 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
1997 | "auditor_reserves_delete", | 1899 | "auditor_reserves_delete", |
1998 | params); | 1900 | params); |
1999 | } | 1901 | } |
@@ -2003,7 +1905,6 @@ postgres_del_reserve_info (void *cls, | |||
2003 | * Get information about a reserve. | 1905 | * Get information about a reserve. |
2004 | * | 1906 | * |
2005 | * @param cls the @e cls of this struct with the plugin-specific state | 1907 | * @param cls the @e cls of this struct with the plugin-specific state |
2006 | * @param session connection to use | ||
2007 | * @param reserve_pub public key of the reserve | 1908 | * @param reserve_pub public key of the reserve |
2008 | * @param master_pub master public key of the exchange | 1909 | * @param master_pub master public key of the exchange |
2009 | * @param[out] rowid which row did we get the information from | 1910 | * @param[out] rowid which row did we get the information from |
@@ -2016,7 +1917,6 @@ postgres_del_reserve_info (void *cls, | |||
2016 | */ | 1917 | */ |
2017 | static enum GNUNET_DB_QueryStatus | 1918 | static enum GNUNET_DB_QueryStatus |
2018 | postgres_get_reserve_info (void *cls, | 1919 | postgres_get_reserve_info (void *cls, |
2019 | struct TALER_AUDITORDB_Session *session, | ||
2020 | const struct TALER_ReservePublicKeyP *reserve_pub, | 1920 | const struct TALER_ReservePublicKeyP *reserve_pub, |
2021 | const struct TALER_MasterPublicKeyP *master_pub, | 1921 | const struct TALER_MasterPublicKeyP *master_pub, |
2022 | uint64_t *rowid, | 1922 | uint64_t *rowid, |
@@ -2040,8 +1940,7 @@ postgres_get_reserve_info (void *cls, | |||
2040 | GNUNET_PQ_result_spec_end | 1940 | GNUNET_PQ_result_spec_end |
2041 | }; | 1941 | }; |
2042 | 1942 | ||
2043 | (void) cls; | 1943 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
2044 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
2045 | "auditor_reserves_select", | 1944 | "auditor_reserves_select", |
2046 | params, | 1945 | params, |
2047 | rs); | 1946 | rs); |
@@ -2053,7 +1952,6 @@ postgres_get_reserve_info (void *cls, | |||
2053 | * existing record for the @a master_pub. | 1952 | * existing record for the @a master_pub. |
2054 | * | 1953 | * |
2055 | * @param cls the @e cls of this struct with the plugin-specific state | 1954 | * @param cls the @e cls of this struct with the plugin-specific state |
2056 | * @param session connection to use | ||
2057 | * @param master_pub master public key of the exchange | 1955 | * @param master_pub master public key of the exchange |
2058 | * @param reserve_balance amount stored in the reserve | 1956 | * @param reserve_balance amount stored in the reserve |
2059 | * @param withdraw_fee_balance amount the exchange gained in withdraw fees | 1957 | * @param withdraw_fee_balance amount the exchange gained in withdraw fees |
@@ -2063,11 +1961,11 @@ postgres_get_reserve_info (void *cls, | |||
2063 | static enum GNUNET_DB_QueryStatus | 1961 | static enum GNUNET_DB_QueryStatus |
2064 | postgres_insert_reserve_summary ( | 1962 | postgres_insert_reserve_summary ( |
2065 | void *cls, | 1963 | void *cls, |
2066 | struct TALER_AUDITORDB_Session *session, | ||
2067 | const struct TALER_MasterPublicKeyP *master_pub, | 1964 | const struct TALER_MasterPublicKeyP *master_pub, |
2068 | const struct TALER_Amount *reserve_balance, | 1965 | const struct TALER_Amount *reserve_balance, |
2069 | const struct TALER_Amount *withdraw_fee_balance) | 1966 | const struct TALER_Amount *withdraw_fee_balance) |
2070 | { | 1967 | { |
1968 | struct PostgresClosure *pg = cls; | ||
2071 | struct GNUNET_PQ_QueryParam params[] = { | 1969 | struct GNUNET_PQ_QueryParam params[] = { |
2072 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 1970 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2073 | TALER_PQ_query_param_amount (reserve_balance), | 1971 | TALER_PQ_query_param_amount (reserve_balance), |
@@ -2075,12 +1973,11 @@ postgres_insert_reserve_summary ( | |||
2075 | GNUNET_PQ_query_param_end | 1973 | GNUNET_PQ_query_param_end |
2076 | }; | 1974 | }; |
2077 | 1975 | ||
2078 | (void) cls; | ||
2079 | GNUNET_assert (GNUNET_YES == | 1976 | GNUNET_assert (GNUNET_YES == |
2080 | TALER_amount_cmp_currency (reserve_balance, | 1977 | TALER_amount_cmp_currency (reserve_balance, |
2081 | withdraw_fee_balance)); | 1978 | withdraw_fee_balance)); |
2082 | 1979 | ||
2083 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | 1980 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2084 | "auditor_reserve_balance_insert", | 1981 | "auditor_reserve_balance_insert", |
2085 | params); | 1982 | params); |
2086 | } | 1983 | } |
@@ -2091,7 +1988,6 @@ postgres_insert_reserve_summary ( | |||
2091 | * existing record, which must already exist. | 1988 | * existing record, which must already exist. |
2092 | * | 1989 | * |
2093 | * @param cls the @e cls of this struct with the plugin-specific state | 1990 | * @param cls the @e cls of this struct with the plugin-specific state |
2094 | * @param session connection to use | ||
2095 | * @param master_pub master public key of the exchange | 1991 | * @param master_pub master public key of the exchange |
2096 | * @param reserve_balance amount stored in the reserve | 1992 | * @param reserve_balance amount stored in the reserve |
2097 | * @param withdraw_fee_balance amount the exchange gained in withdraw fees | 1993 | * @param withdraw_fee_balance amount the exchange gained in withdraw fees |
@@ -2101,11 +1997,11 @@ postgres_insert_reserve_summary ( | |||
2101 | static enum GNUNET_DB_QueryStatus | 1997 | static enum GNUNET_DB_QueryStatus |
2102 | postgres_update_reserve_summary ( | 1998 | postgres_update_reserve_summary ( |
2103 | void *cls, | 1999 | void *cls, |
2104 | struct TALER_AUDITORDB_Session *session, | ||
2105 | const struct TALER_MasterPublicKeyP *master_pub, | 2000 | const struct TALER_MasterPublicKeyP *master_pub, |
2106 | const struct TALER_Amount *reserve_balance, | 2001 | const struct TALER_Amount *reserve_balance, |
2107 | const struct TALER_Amount *withdraw_fee_balance) | 2002 | const struct TALER_Amount *withdraw_fee_balance) |
2108 | { | 2003 | { |
2004 | struct PostgresClosure *pg = cls; | ||
2109 | struct GNUNET_PQ_QueryParam params[] = { | 2005 | struct GNUNET_PQ_QueryParam params[] = { |
2110 | TALER_PQ_query_param_amount (reserve_balance), | 2006 | TALER_PQ_query_param_amount (reserve_balance), |
2111 | TALER_PQ_query_param_amount (withdraw_fee_balance), | 2007 | TALER_PQ_query_param_amount (withdraw_fee_balance), |
@@ -2113,8 +2009,7 @@ postgres_update_reserve_summary ( | |||
2113 | GNUNET_PQ_query_param_end | 2009 | GNUNET_PQ_query_param_end |
2114 | }; | 2010 | }; |
2115 | 2011 | ||
2116 | (void) cls; | 2012 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2117 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2118 | "auditor_reserve_balance_update", | 2013 | "auditor_reserve_balance_update", |
2119 | params); | 2014 | params); |
2120 | } | 2015 | } |
@@ -2124,7 +2019,6 @@ postgres_update_reserve_summary ( | |||
2124 | * Get summary information about all reserves. | 2019 | * Get summary information about all reserves. |
2125 | * | 2020 | * |
2126 | * @param cls the @e cls of this struct with the plugin-specific state | 2021 | * @param cls the @e cls of this struct with the plugin-specific state |
2127 | * @param session connection to use | ||
2128 | * @param master_pub master public key of the exchange | 2022 | * @param master_pub master public key of the exchange |
2129 | * @param[out] reserve_balance amount stored in the reserve | 2023 | * @param[out] reserve_balance amount stored in the reserve |
2130 | * @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees | 2024 | * @param[out] withdraw_fee_balance amount the exchange gained in withdraw fees |
@@ -2133,7 +2027,6 @@ postgres_update_reserve_summary ( | |||
2133 | */ | 2027 | */ |
2134 | static enum GNUNET_DB_QueryStatus | 2028 | static enum GNUNET_DB_QueryStatus |
2135 | postgres_get_reserve_summary (void *cls, | 2029 | postgres_get_reserve_summary (void *cls, |
2136 | struct TALER_AUDITORDB_Session *session, | ||
2137 | const struct TALER_MasterPublicKeyP *master_pub, | 2030 | const struct TALER_MasterPublicKeyP *master_pub, |
2138 | struct TALER_Amount *reserve_balance, | 2031 | struct TALER_Amount *reserve_balance, |
2139 | struct TALER_Amount *withdraw_fee_balance) | 2032 | struct TALER_Amount *withdraw_fee_balance) |
@@ -2150,8 +2043,7 @@ postgres_get_reserve_summary (void *cls, | |||
2150 | GNUNET_PQ_result_spec_end | 2043 | GNUNET_PQ_result_spec_end |
2151 | }; | 2044 | }; |
2152 | 2045 | ||
2153 | (void) cls; | 2046 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
2154 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
2155 | "auditor_reserve_balance_select", | 2047 | "auditor_reserve_balance_select", |
2156 | params, | 2048 | params, |
2157 | rs); | 2049 | rs); |
@@ -2163,7 +2055,6 @@ postgres_get_reserve_summary (void *cls, | |||
2163 | * existing record for the same @a master_pub. | 2055 | * existing record for the same @a master_pub. |
2164 | * | 2056 | * |
2165 | * @param cls the @e cls of this struct with the plugin-specific state | 2057 | * @param cls the @e cls of this struct with the plugin-specific state |
2166 | * @param session connection to use | ||
2167 | * @param master_pub master public key of the exchange | 2058 | * @param master_pub master public key of the exchange |
2168 | * @param wire_fee_balance amount the exchange gained in wire fees | 2059 | * @param wire_fee_balance amount the exchange gained in wire fees |
2169 | * @return transaction status code | 2060 | * @return transaction status code |
@@ -2171,18 +2062,17 @@ postgres_get_reserve_summary (void *cls, | |||
2171 | static enum GNUNET_DB_QueryStatus | 2062 | static enum GNUNET_DB_QueryStatus |
2172 | postgres_insert_wire_fee_summary ( | 2063 | postgres_insert_wire_fee_summary ( |
2173 | void *cls, | 2064 | void *cls, |
2174 | struct TALER_AUDITORDB_Session *session, | ||
2175 | const struct TALER_MasterPublicKeyP *master_pub, | 2065 | const struct TALER_MasterPublicKeyP *master_pub, |
2176 | const struct TALER_Amount *wire_fee_balance) | 2066 | const struct TALER_Amount *wire_fee_balance) |
2177 | { | 2067 | { |
2068 | struct PostgresClosure *pg = cls; | ||
2178 | struct GNUNET_PQ_QueryParam params[] = { | 2069 | struct GNUNET_PQ_QueryParam params[] = { |
2179 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2070 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2180 | TALER_PQ_query_param_amount (wire_fee_balance), | 2071 | TALER_PQ_query_param_amount (wire_fee_balance), |
2181 | GNUNET_PQ_query_param_end | 2072 | GNUNET_PQ_query_param_end |
2182 | }; | 2073 | }; |
2183 | 2074 | ||
2184 | (void) cls; | 2075 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2185 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2186 | "auditor_wire_fee_balance_insert", | 2076 | "auditor_wire_fee_balance_insert", |
2187 | params); | 2077 | params); |
2188 | } | 2078 | } |
@@ -2193,7 +2083,6 @@ postgres_insert_wire_fee_summary ( | |||
2193 | * existing record, which must already exist. | 2083 | * existing record, which must already exist. |
2194 | * | 2084 | * |
2195 | * @param cls the @e cls of this struct with the plugin-specific state | 2085 | * @param cls the @e cls of this struct with the plugin-specific state |
2196 | * @param session connection to use | ||
2197 | * @param master_pub master public key of the exchange | 2086 | * @param master_pub master public key of the exchange |
2198 | * @param wire_fee_balance amount the exchange gained in wire fees | 2087 | * @param wire_fee_balance amount the exchange gained in wire fees |
2199 | * @return transaction status code | 2088 | * @return transaction status code |
@@ -2201,18 +2090,17 @@ postgres_insert_wire_fee_summary ( | |||
2201 | static enum GNUNET_DB_QueryStatus | 2090 | static enum GNUNET_DB_QueryStatus |
2202 | postgres_update_wire_fee_summary ( | 2091 | postgres_update_wire_fee_summary ( |
2203 | void *cls, | 2092 | void *cls, |
2204 | struct TALER_AUDITORDB_Session *session, | ||
2205 | const struct TALER_MasterPublicKeyP *master_pub, | 2093 | const struct TALER_MasterPublicKeyP *master_pub, |
2206 | const struct TALER_Amount *wire_fee_balance) | 2094 | const struct TALER_Amount *wire_fee_balance) |
2207 | { | 2095 | { |
2096 | struct PostgresClosure *pg = cls; | ||
2208 | struct GNUNET_PQ_QueryParam params[] = { | 2097 | struct GNUNET_PQ_QueryParam params[] = { |
2209 | TALER_PQ_query_param_amount (wire_fee_balance), | 2098 | TALER_PQ_query_param_amount (wire_fee_balance), |
2210 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2099 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2211 | GNUNET_PQ_query_param_end | 2100 | GNUNET_PQ_query_param_end |
2212 | }; | 2101 | }; |
2213 | 2102 | ||
2214 | (void) cls; | 2103 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2215 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2216 | "auditor_wire_fee_balance_update", | 2104 | "auditor_wire_fee_balance_update", |
2217 | params); | 2105 | params); |
2218 | } | 2106 | } |
@@ -2222,14 +2110,12 @@ postgres_update_wire_fee_summary ( | |||
2222 | * Get summary information about an exchanges wire fee balance. | 2110 | * Get summary information about an exchanges wire fee balance. |
2223 | * | 2111 | * |
2224 | * @param cls the @e cls of this struct with the plugin-specific state | 2112 | * @param cls the @e cls of this struct with the plugin-specific state |
2225 | * @param session connection to use | ||
2226 | * @param master_pub master public key of the exchange | 2113 | * @param master_pub master public key of the exchange |
2227 | * @param[out] wire_fee_balance set amount the exchange gained in wire fees | 2114 | * @param[out] wire_fee_balance set amount the exchange gained in wire fees |
2228 | * @return transaction status code | 2115 | * @return transaction status code |
2229 | */ | 2116 | */ |
2230 | static enum GNUNET_DB_QueryStatus | 2117 | static enum GNUNET_DB_QueryStatus |
2231 | postgres_get_wire_fee_summary (void *cls, | 2118 | postgres_get_wire_fee_summary (void *cls, |
2232 | struct TALER_AUDITORDB_Session *session, | ||
2233 | const struct TALER_MasterPublicKeyP *master_pub, | 2119 | const struct TALER_MasterPublicKeyP *master_pub, |
2234 | struct TALER_Amount *wire_fee_balance) | 2120 | struct TALER_Amount *wire_fee_balance) |
2235 | { | 2121 | { |
@@ -2244,8 +2130,7 @@ postgres_get_wire_fee_summary (void *cls, | |||
2244 | GNUNET_PQ_result_spec_end | 2130 | GNUNET_PQ_result_spec_end |
2245 | }; | 2131 | }; |
2246 | 2132 | ||
2247 | (void) cls; | 2133 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
2248 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
2249 | "auditor_wire_fee_balance_select", | 2134 | "auditor_wire_fee_balance_select", |
2250 | params, | 2135 | params, |
2251 | rs); | 2136 | rs); |
@@ -2257,7 +2142,6 @@ postgres_get_wire_fee_summary (void *cls, | |||
2257 | * must not be an existing record for the denomination key. | 2142 | * must not be an existing record for the denomination key. |
2258 | * | 2143 | * |
2259 | * @param cls the @e cls of this struct with the plugin-specific state | 2144 | * @param cls the @e cls of this struct with the plugin-specific state |
2260 | * @param session connection to use | ||
2261 | * @param denom_pub_hash hash of the denomination public key | 2145 | * @param denom_pub_hash hash of the denomination public key |
2262 | * @param denom_balance value of coins outstanding with this denomination key | 2146 | * @param denom_balance value of coins outstanding with this denomination key |
2263 | * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) | 2147 | * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) |
@@ -2269,7 +2153,6 @@ postgres_get_wire_fee_summary (void *cls, | |||
2269 | static enum GNUNET_DB_QueryStatus | 2153 | static enum GNUNET_DB_QueryStatus |
2270 | postgres_insert_denomination_balance ( | 2154 | postgres_insert_denomination_balance ( |
2271 | void *cls, | 2155 | void *cls, |
2272 | struct TALER_AUDITORDB_Session *session, | ||
2273 | const struct GNUNET_HashCode *denom_pub_hash, | 2156 | const struct GNUNET_HashCode *denom_pub_hash, |
2274 | const struct TALER_Amount *denom_balance, | 2157 | const struct TALER_Amount *denom_balance, |
2275 | const struct TALER_Amount *denom_loss, | 2158 | const struct TALER_Amount *denom_loss, |
@@ -2277,6 +2160,7 @@ postgres_insert_denomination_balance ( | |||
2277 | const struct TALER_Amount *recoup_loss, | 2160 | const struct TALER_Amount *recoup_loss, |
2278 | uint64_t num_issued) | 2161 | uint64_t num_issued) |
2279 | { | 2162 | { |
2163 | struct PostgresClosure *pg = cls; | ||
2280 | struct GNUNET_PQ_QueryParam params[] = { | 2164 | struct GNUNET_PQ_QueryParam params[] = { |
2281 | GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), | 2165 | GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), |
2282 | TALER_PQ_query_param_amount (denom_balance), | 2166 | TALER_PQ_query_param_amount (denom_balance), |
@@ -2287,8 +2171,7 @@ postgres_insert_denomination_balance ( | |||
2287 | GNUNET_PQ_query_param_end | 2171 | GNUNET_PQ_query_param_end |
2288 | }; | 2172 | }; |
2289 | 2173 | ||
2290 | (void) cls; | 2174 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2291 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2292 | "auditor_denomination_pending_insert", | 2175 | "auditor_denomination_pending_insert", |
2293 | params); | 2176 | params); |
2294 | } | 2177 | } |
@@ -2299,7 +2182,6 @@ postgres_insert_denomination_balance ( | |||
2299 | * must be an existing record for the denomination key. | 2182 | * must be an existing record for the denomination key. |
2300 | * | 2183 | * |
2301 | * @param cls the @e cls of this struct with the plugin-specific state | 2184 | * @param cls the @e cls of this struct with the plugin-specific state |
2302 | * @param session connection to use | ||
2303 | * @param denom_pub_hash hash of the denomination public key | 2185 | * @param denom_pub_hash hash of the denomination public key |
2304 | * @param denom_balance value of coins outstanding with this denomination key | 2186 | * @param denom_balance value of coins outstanding with this denomination key |
2305 | * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) | 2187 | * @param denom_loss value of coins redeemed that were not outstanding (effectively, negative @a denom_balance) |
@@ -2311,7 +2193,6 @@ postgres_insert_denomination_balance ( | |||
2311 | static enum GNUNET_DB_QueryStatus | 2193 | static enum GNUNET_DB_QueryStatus |
2312 | postgres_update_denomination_balance ( | 2194 | postgres_update_denomination_balance ( |
2313 | void *cls, | 2195 | void *cls, |
2314 | struct TALER_AUDITORDB_Session *session, | ||
2315 | const struct GNUNET_HashCode *denom_pub_hash, | 2196 | const struct GNUNET_HashCode *denom_pub_hash, |
2316 | const struct TALER_Amount *denom_balance, | 2197 | const struct TALER_Amount *denom_balance, |
2317 | const struct TALER_Amount *denom_loss, | 2198 | const struct TALER_Amount *denom_loss, |
@@ -2319,6 +2200,7 @@ postgres_update_denomination_balance ( | |||
2319 | const struct TALER_Amount *recoup_loss, | 2200 | const struct TALER_Amount *recoup_loss, |
2320 | uint64_t num_issued) | 2201 | uint64_t num_issued) |
2321 | { | 2202 | { |
2203 | struct PostgresClosure *pg = cls; | ||
2322 | struct GNUNET_PQ_QueryParam params[] = { | 2204 | struct GNUNET_PQ_QueryParam params[] = { |
2323 | TALER_PQ_query_param_amount (denom_balance), | 2205 | TALER_PQ_query_param_amount (denom_balance), |
2324 | TALER_PQ_query_param_amount (denom_loss), | 2206 | TALER_PQ_query_param_amount (denom_loss), |
@@ -2329,8 +2211,7 @@ postgres_update_denomination_balance ( | |||
2329 | GNUNET_PQ_query_param_end | 2211 | GNUNET_PQ_query_param_end |
2330 | }; | 2212 | }; |
2331 | 2213 | ||
2332 | (void) cls; | 2214 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2333 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2334 | "auditor_denomination_pending_update", | 2215 | "auditor_denomination_pending_update", |
2335 | params); | 2216 | params); |
2336 | } | 2217 | } |
@@ -2340,7 +2221,6 @@ postgres_update_denomination_balance ( | |||
2340 | * Get information about a denomination key's balances. | 2221 | * Get information about a denomination key's balances. |
2341 | * | 2222 | * |
2342 | * @param cls the @e cls of this struct with the plugin-specific state | 2223 | * @param cls the @e cls of this struct with the plugin-specific state |
2343 | * @param session connection to use | ||
2344 | * @param denom_pub_hash hash of the denomination public key | 2224 | * @param denom_pub_hash hash of the denomination public key |
2345 | * @param[out] denom_balance value of coins outstanding with this denomination key | 2225 | * @param[out] denom_balance value of coins outstanding with this denomination key |
2346 | * @param[out] denom_risk value of coins issued with this denomination key | 2226 | * @param[out] denom_risk value of coins issued with this denomination key |
@@ -2351,7 +2231,6 @@ postgres_update_denomination_balance ( | |||
2351 | */ | 2231 | */ |
2352 | static enum GNUNET_DB_QueryStatus | 2232 | static enum GNUNET_DB_QueryStatus |
2353 | postgres_get_denomination_balance (void *cls, | 2233 | postgres_get_denomination_balance (void *cls, |
2354 | struct TALER_AUDITORDB_Session *session, | ||
2355 | const struct GNUNET_HashCode *denom_pub_hash, | 2234 | const struct GNUNET_HashCode *denom_pub_hash, |
2356 | struct TALER_Amount *denom_balance, | 2235 | struct TALER_Amount *denom_balance, |
2357 | struct TALER_Amount *denom_loss, | 2236 | struct TALER_Amount *denom_loss, |
@@ -2373,8 +2252,7 @@ postgres_get_denomination_balance (void *cls, | |||
2373 | GNUNET_PQ_result_spec_end | 2252 | GNUNET_PQ_result_spec_end |
2374 | }; | 2253 | }; |
2375 | 2254 | ||
2376 | (void) cls; | 2255 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
2377 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | ||
2378 | "auditor_denomination_pending_select", | 2256 | "auditor_denomination_pending_select", |
2379 | params, | 2257 | params, |
2380 | rs); | 2258 | rs); |
@@ -2386,7 +2264,6 @@ postgres_get_denomination_balance (void *cls, | |||
2386 | * must not be an existing record for the exchange. | 2264 | * must not be an existing record for the exchange. |
2387 | * | 2265 | * |
2388 | * @param cls the @e cls of this struct with the plugin-specific state | 2266 | * @param cls the @e cls of this struct with the plugin-specific state |
2389 | * @param session connection to use | ||
2390 | * @param master_pub master key of the exchange | 2267 | * @param master_pub master key of the exchange |
2391 | * @param denom_balance value of coins outstanding with this denomination key | 2268 | * @param denom_balance value of coins outstanding with this denomination key |
2392 | * @param deposit_fee_balance total deposit fees collected for this DK | 2269 | * @param deposit_fee_balance total deposit fees collected for this DK |
@@ -2400,7 +2277,6 @@ postgres_get_denomination_balance (void *cls, | |||
2400 | static enum GNUNET_DB_QueryStatus | 2277 | static enum GNUNET_DB_QueryStatus |
2401 | postgres_insert_balance_summary ( | 2278 | postgres_insert_balance_summary ( |
2402 | void *cls, | 2279 | void *cls, |
2403 | struct TALER_AUDITORDB_Session *session, | ||
2404 | const struct TALER_MasterPublicKeyP *master_pub, | 2280 | const struct TALER_MasterPublicKeyP *master_pub, |
2405 | const struct TALER_Amount *denom_balance, | 2281 | const struct TALER_Amount *denom_balance, |
2406 | const struct TALER_Amount *deposit_fee_balance, | 2282 | const struct TALER_Amount *deposit_fee_balance, |
@@ -2410,6 +2286,7 @@ postgres_insert_balance_summary ( | |||
2410 | const struct TALER_Amount *loss, | 2286 | const struct TALER_Amount *loss, |
2411 | const struct TALER_Amount *irregular_recoup) | 2287 | const struct TALER_Amount *irregular_recoup) |
2412 | { | 2288 | { |
2289 | struct PostgresClosure *pg = cls; | ||
2413 | struct GNUNET_PQ_QueryParam params[] = { | 2290 | struct GNUNET_PQ_QueryParam params[] = { |
2414 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2291 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2415 | TALER_PQ_query_param_amount (denom_balance), | 2292 | TALER_PQ_query_param_amount (denom_balance), |
@@ -2422,7 +2299,6 @@ postgres_insert_balance_summary ( | |||
2422 | GNUNET_PQ_query_param_end | 2299 | GNUNET_PQ_query_param_end |
2423 | }; | 2300 | }; |
2424 | 2301 | ||
2425 | (void) cls; | ||
2426 | GNUNET_assert (GNUNET_YES == | 2302 | GNUNET_assert (GNUNET_YES == |
2427 | TALER_amount_cmp_currency (denom_balance, | 2303 | TALER_amount_cmp_currency (denom_balance, |
2428 | deposit_fee_balance)); | 2304 | deposit_fee_balance)); |
@@ -2434,7 +2310,7 @@ postgres_insert_balance_summary ( | |||
2434 | TALER_amount_cmp_currency (denom_balance, | 2310 | TALER_amount_cmp_currency (denom_balance, |
2435 | refund_fee_balance)); | 2311 | refund_fee_balance)); |
2436 | 2312 | ||
2437 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | 2313 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2438 | "auditor_balance_summary_insert", | 2314 | "auditor_balance_summary_insert", |
2439 | params); | 2315 | params); |
2440 | } | 2316 | } |
@@ -2445,7 +2321,6 @@ postgres_insert_balance_summary ( | |||
2445 | * must be an existing record for the exchange. | 2321 | * must be an existing record for the exchange. |
2446 | * | 2322 | * |
2447 | * @param cls the @e cls of this struct with the plugin-specific state | 2323 | * @param cls the @e cls of this struct with the plugin-specific state |
2448 | * @param session connection to use | ||
2449 | * @param master_pub master key of the exchange | 2324 | * @param master_pub master key of the exchange |
2450 | * @param denom_balance value of coins outstanding with this denomination key | 2325 | * @param denom_balance value of coins outstanding with this denomination key |
2451 | * @param deposit_fee_balance total deposit fees collected for this DK | 2326 | * @param deposit_fee_balance total deposit fees collected for this DK |
@@ -2459,7 +2334,6 @@ postgres_insert_balance_summary ( | |||
2459 | static enum GNUNET_DB_QueryStatus | 2334 | static enum GNUNET_DB_QueryStatus |
2460 | postgres_update_balance_summary ( | 2335 | postgres_update_balance_summary ( |
2461 | void *cls, | 2336 | void *cls, |
2462 | struct TALER_AUDITORDB_Session *session, | ||
2463 | const struct TALER_MasterPublicKeyP *master_pub, | 2337 | const struct TALER_MasterPublicKeyP *master_pub, |
2464 | const struct TALER_Amount *denom_balance, | 2338 | const struct TALER_Amount *denom_balance, |
2465 | const struct TALER_Amount *deposit_fee_balance, | 2339 | const struct TALER_Amount *deposit_fee_balance, |
@@ -2469,6 +2343,7 @@ postgres_update_balance_summary ( | |||
2469 | const struct TALER_Amount *loss, | 2343 | const struct TALER_Amount *loss, |
2470 | const struct TALER_Amount *irregular_recoup) | 2344 | const struct TALER_Amount *irregular_recoup) |
2471 | { | 2345 | { |
2346 | struct PostgresClosure *pg = cls; | ||
2472 | struct GNUNET_PQ_QueryParam params[] = { | 2347 | struct GNUNET_PQ_QueryParam params[] = { |
2473 | TALER_PQ_query_param_amount (denom_balance), | 2348 | TALER_PQ_query_param_amount (denom_balance), |
2474 | TALER_PQ_query_param_amount (deposit_fee_balance), | 2349 | TALER_PQ_query_param_amount (deposit_fee_balance), |
@@ -2481,8 +2356,7 @@ postgres_update_balance_summary ( | |||
2481 | GNUNET_PQ_query_param_end | 2356 | GNUNET_PQ_query_param_end |
2482 | }; | 2357 | }; |
2483 | 2358 | ||
2484 | (void) cls; | 2359 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2485 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2486 | "auditor_balance_summary_update", | 2360 | "auditor_balance_summary_update", |
2487 | params); | 2361 | params); |
2488 | } | 2362 | } |
@@ -2492,7 +2366,6 @@ postgres_update_balance_summary ( | |||
2492 | * Get information about an exchange's denomination balances. | 2366 | * Get information about an exchange's denomination balances. |
2493 | * | 2367 | * |
2494 | * @param cls the @e cls of this struct with the plugin-specific state | 2368 | * @param cls the @e cls of this struct with the plugin-specific state |
2495 | * @param session connection to use | ||
2496 | * @param master_pub master key of the exchange | 2369 | * @param master_pub master key of the exchange |
2497 | * @param[out] denom_balance value of coins outstanding with this denomination key | 2370 | * @param[out] denom_balance value of coins outstanding with this denomination key |
2498 | * @param[out] deposit_fee_balance total deposit fees collected for this DK | 2371 | * @param[out] deposit_fee_balance total deposit fees collected for this DK |
@@ -2505,7 +2378,6 @@ postgres_update_balance_summary ( | |||
2505 | */ | 2378 | */ |
2506 | static enum GNUNET_DB_QueryStatus | 2379 | static enum GNUNET_DB_QueryStatus |
2507 | postgres_get_balance_summary (void *cls, | 2380 | postgres_get_balance_summary (void *cls, |
2508 | struct TALER_AUDITORDB_Session *session, | ||
2509 | const struct TALER_MasterPublicKeyP *master_pub, | 2381 | const struct TALER_MasterPublicKeyP *master_pub, |
2510 | struct TALER_Amount *denom_balance, | 2382 | struct TALER_Amount *denom_balance, |
2511 | struct TALER_Amount *deposit_fee_balance, | 2383 | struct TALER_Amount *deposit_fee_balance, |
@@ -2531,7 +2403,7 @@ postgres_get_balance_summary (void *cls, | |||
2531 | GNUNET_PQ_result_spec_end | 2403 | GNUNET_PQ_result_spec_end |
2532 | }; | 2404 | }; |
2533 | 2405 | ||
2534 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | 2406 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
2535 | "auditor_balance_summary_select", | 2407 | "auditor_balance_summary_select", |
2536 | params, | 2408 | params, |
2537 | rs); | 2409 | rs); |
@@ -2543,7 +2415,6 @@ postgres_get_balance_summary (void *cls, | |||
2543 | * revenue about a denomination key. | 2415 | * revenue about a denomination key. |
2544 | * | 2416 | * |
2545 | * @param cls the @e cls of this struct with the plugin-specific state | 2417 | * @param cls the @e cls of this struct with the plugin-specific state |
2546 | * @param session connection to use | ||
2547 | * @param master_pub master key of the exchange | 2418 | * @param master_pub master key of the exchange |
2548 | * @param denom_pub_hash hash of the denomination key | 2419 | * @param denom_pub_hash hash of the denomination key |
2549 | * @param revenue_timestamp when did this profit get realized | 2420 | * @param revenue_timestamp when did this profit get realized |
@@ -2556,13 +2427,13 @@ postgres_get_balance_summary (void *cls, | |||
2556 | static enum GNUNET_DB_QueryStatus | 2427 | static enum GNUNET_DB_QueryStatus |
2557 | postgres_insert_historic_denom_revenue ( | 2428 | postgres_insert_historic_denom_revenue ( |
2558 | void *cls, | 2429 | void *cls, |
2559 | struct TALER_AUDITORDB_Session *session, | ||
2560 | const struct TALER_MasterPublicKeyP *master_pub, | 2430 | const struct TALER_MasterPublicKeyP *master_pub, |
2561 | const struct GNUNET_HashCode *denom_pub_hash, | 2431 | const struct GNUNET_HashCode *denom_pub_hash, |
2562 | struct GNUNET_TIME_Absolute revenue_timestamp, | 2432 | struct GNUNET_TIME_Absolute revenue_timestamp, |
2563 | const struct TALER_Amount *revenue_balance, | 2433 | const struct TALER_Amount *revenue_balance, |
2564 | const struct TALER_Amount *loss_balance) | 2434 | const struct TALER_Amount *loss_balance) |
2565 | { | 2435 | { |
2436 | struct PostgresClosure *pg = cls; | ||
2566 | struct GNUNET_PQ_QueryParam params[] = { | 2437 | struct GNUNET_PQ_QueryParam params[] = { |
2567 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2438 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2568 | GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), | 2439 | GNUNET_PQ_query_param_auto_from_type (denom_pub_hash), |
@@ -2572,8 +2443,7 @@ postgres_insert_historic_denom_revenue ( | |||
2572 | GNUNET_PQ_query_param_end | 2443 | GNUNET_PQ_query_param_end |
2573 | }; | 2444 | }; |
2574 | 2445 | ||
2575 | (void) cls; | 2446 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2576 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2577 | "auditor_historic_denomination_revenue_insert", | 2447 | "auditor_historic_denomination_revenue_insert", |
2578 | params); | 2448 | params); |
2579 | } | 2449 | } |
@@ -2665,7 +2535,6 @@ historic_denom_revenue_cb (void *cls, | |||
2665 | * of the given @a master_pub. | 2535 | * of the given @a master_pub. |
2666 | * | 2536 | * |
2667 | * @param cls the @e cls of this struct with the plugin-specific state | 2537 | * @param cls the @e cls of this struct with the plugin-specific state |
2668 | * @param session connection to use | ||
2669 | * @param master_pub master key of the exchange | 2538 | * @param master_pub master key of the exchange |
2670 | * @param cb function to call with the results | 2539 | * @param cb function to call with the results |
2671 | * @param cb_cls closure for @a cb | 2540 | * @param cb_cls closure for @a cb |
@@ -2674,7 +2543,6 @@ historic_denom_revenue_cb (void *cls, | |||
2674 | static enum GNUNET_DB_QueryStatus | 2543 | static enum GNUNET_DB_QueryStatus |
2675 | postgres_select_historic_denom_revenue ( | 2544 | postgres_select_historic_denom_revenue ( |
2676 | void *cls, | 2545 | void *cls, |
2677 | struct TALER_AUDITORDB_Session *session, | ||
2678 | const struct TALER_MasterPublicKeyP *master_pub, | 2546 | const struct TALER_MasterPublicKeyP *master_pub, |
2679 | TALER_AUDITORDB_HistoricDenominationRevenueDataCallback cb, | 2547 | TALER_AUDITORDB_HistoricDenominationRevenueDataCallback cb, |
2680 | void *cb_cls) | 2548 | void *cb_cls) |
@@ -2691,7 +2559,7 @@ postgres_select_historic_denom_revenue ( | |||
2691 | }; | 2559 | }; |
2692 | enum GNUNET_DB_QueryStatus qs; | 2560 | enum GNUNET_DB_QueryStatus qs; |
2693 | 2561 | ||
2694 | qs = GNUNET_PQ_eval_prepared_multi_select (session->conn, | 2562 | qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, |
2695 | "auditor_historic_denomination_revenue_select", | 2563 | "auditor_historic_denomination_revenue_select", |
2696 | params, | 2564 | params, |
2697 | &historic_denom_revenue_cb, | 2565 | &historic_denom_revenue_cb, |
@@ -2706,7 +2574,6 @@ postgres_select_historic_denom_revenue ( | |||
2706 | * Insert information about an exchange's historic revenue from reserves. | 2574 | * Insert information about an exchange's historic revenue from reserves. |
2707 | * | 2575 | * |
2708 | * @param cls the @e cls of this struct with the plugin-specific state | 2576 | * @param cls the @e cls of this struct with the plugin-specific state |
2709 | * @param session connection to use | ||
2710 | * @param master_pub master key of the exchange | 2577 | * @param master_pub master key of the exchange |
2711 | * @param start_time beginning of aggregated time interval | 2578 | * @param start_time beginning of aggregated time interval |
2712 | * @param end_time end of aggregated time interval | 2579 | * @param end_time end of aggregated time interval |
@@ -2716,12 +2583,12 @@ postgres_select_historic_denom_revenue ( | |||
2716 | static enum GNUNET_DB_QueryStatus | 2583 | static enum GNUNET_DB_QueryStatus |
2717 | postgres_insert_historic_reserve_revenue ( | 2584 | postgres_insert_historic_reserve_revenue ( |
2718 | void *cls, | 2585 | void *cls, |
2719 | struct TALER_AUDITORDB_Session *session, | ||
2720 | const struct TALER_MasterPublicKeyP *master_pub, | 2586 | const struct TALER_MasterPublicKeyP *master_pub, |
2721 | struct GNUNET_TIME_Absolute start_time, | 2587 | struct GNUNET_TIME_Absolute start_time, |
2722 | struct GNUNET_TIME_Absolute end_time, | 2588 | struct GNUNET_TIME_Absolute end_time, |
2723 | const struct TALER_Amount *reserve_profits) | 2589 | const struct TALER_Amount *reserve_profits) |
2724 | { | 2590 | { |
2591 | struct PostgresClosure *pg = cls; | ||
2725 | struct GNUNET_PQ_QueryParam params[] = { | 2592 | struct GNUNET_PQ_QueryParam params[] = { |
2726 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2593 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2727 | TALER_PQ_query_param_absolute_time (&start_time), | 2594 | TALER_PQ_query_param_absolute_time (&start_time), |
@@ -2730,8 +2597,7 @@ postgres_insert_historic_reserve_revenue ( | |||
2730 | GNUNET_PQ_query_param_end | 2597 | GNUNET_PQ_query_param_end |
2731 | }; | 2598 | }; |
2732 | 2599 | ||
2733 | (void) cls; | 2600 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2734 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2735 | "auditor_historic_reserve_summary_insert", | 2601 | "auditor_historic_reserve_summary_insert", |
2736 | params); | 2602 | params); |
2737 | } | 2603 | } |
@@ -2817,7 +2683,6 @@ historic_reserve_revenue_cb (void *cls, | |||
2817 | * Return information about an exchange's historic revenue from reserves. | 2683 | * Return information about an exchange's historic revenue from reserves. |
2818 | * | 2684 | * |
2819 | * @param cls the @e cls of this struct with the plugin-specific state | 2685 | * @param cls the @e cls of this struct with the plugin-specific state |
2820 | * @param session connection to use | ||
2821 | * @param master_pub master key of the exchange | 2686 | * @param master_pub master key of the exchange |
2822 | * @param cb function to call with results | 2687 | * @param cb function to call with results |
2823 | * @param cb_cls closure for @a cb | 2688 | * @param cb_cls closure for @a cb |
@@ -2826,7 +2691,6 @@ historic_reserve_revenue_cb (void *cls, | |||
2826 | static enum GNUNET_DB_QueryStatus | 2691 | static enum GNUNET_DB_QueryStatus |
2827 | postgres_select_historic_reserve_revenue ( | 2692 | postgres_select_historic_reserve_revenue ( |
2828 | void *cls, | 2693 | void *cls, |
2829 | struct TALER_AUDITORDB_Session *session, | ||
2830 | const struct TALER_MasterPublicKeyP *master_pub, | 2694 | const struct TALER_MasterPublicKeyP *master_pub, |
2831 | TALER_AUDITORDB_HistoricReserveRevenueDataCallback cb, | 2695 | TALER_AUDITORDB_HistoricReserveRevenueDataCallback cb, |
2832 | void *cb_cls) | 2696 | void *cb_cls) |
@@ -2843,7 +2707,7 @@ postgres_select_historic_reserve_revenue ( | |||
2843 | .pg = pg | 2707 | .pg = pg |
2844 | }; | 2708 | }; |
2845 | 2709 | ||
2846 | qs = GNUNET_PQ_eval_prepared_multi_select (session->conn, | 2710 | qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, |
2847 | "auditor_historic_reserve_summary_select", | 2711 | "auditor_historic_reserve_summary_select", |
2848 | params, | 2712 | params, |
2849 | &historic_reserve_revenue_cb, | 2713 | &historic_reserve_revenue_cb, |
@@ -2859,7 +2723,6 @@ postgres_select_historic_reserve_revenue ( | |||
2859 | * account balance. | 2723 | * account balance. |
2860 | * | 2724 | * |
2861 | * @param cls the @e cls of this struct with the plugin-specific state | 2725 | * @param cls the @e cls of this struct with the plugin-specific state |
2862 | * @param session connection to use | ||
2863 | * @param master_pub master key of the exchange | 2726 | * @param master_pub master key of the exchange |
2864 | * @param balance what the bank account balance of the exchange should show | 2727 | * @param balance what the bank account balance of the exchange should show |
2865 | * @return transaction status code | 2728 | * @return transaction status code |
@@ -2867,18 +2730,17 @@ postgres_select_historic_reserve_revenue ( | |||
2867 | static enum GNUNET_DB_QueryStatus | 2730 | static enum GNUNET_DB_QueryStatus |
2868 | postgres_insert_predicted_result ( | 2731 | postgres_insert_predicted_result ( |
2869 | void *cls, | 2732 | void *cls, |
2870 | struct TALER_AUDITORDB_Session *session, | ||
2871 | const struct TALER_MasterPublicKeyP *master_pub, | 2733 | const struct TALER_MasterPublicKeyP *master_pub, |
2872 | const struct TALER_Amount *balance) | 2734 | const struct TALER_Amount *balance) |
2873 | { | 2735 | { |
2736 | struct PostgresClosure *pg = cls; | ||
2874 | struct GNUNET_PQ_QueryParam params[] = { | 2737 | struct GNUNET_PQ_QueryParam params[] = { |
2875 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2738 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2876 | TALER_PQ_query_param_amount (balance), | 2739 | TALER_PQ_query_param_amount (balance), |
2877 | GNUNET_PQ_query_param_end | 2740 | GNUNET_PQ_query_param_end |
2878 | }; | 2741 | }; |
2879 | 2742 | ||
2880 | (void) cls; | 2743 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2881 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2882 | "auditor_predicted_result_insert", | 2744 | "auditor_predicted_result_insert", |
2883 | params); | 2745 | params); |
2884 | } | 2746 | } |
@@ -2889,7 +2751,6 @@ postgres_insert_predicted_result ( | |||
2889 | * must be an existing record for the exchange. | 2751 | * must be an existing record for the exchange. |
2890 | * | 2752 | * |
2891 | * @param cls the @e cls of this struct with the plugin-specific state | 2753 | * @param cls the @e cls of this struct with the plugin-specific state |
2892 | * @param session connection to use | ||
2893 | * @param master_pub master key of the exchange | 2754 | * @param master_pub master key of the exchange |
2894 | * @param balance what the bank account balance of the exchange should show | 2755 | * @param balance what the bank account balance of the exchange should show |
2895 | * @return transaction status code | 2756 | * @return transaction status code |
@@ -2897,18 +2758,17 @@ postgres_insert_predicted_result ( | |||
2897 | static enum GNUNET_DB_QueryStatus | 2758 | static enum GNUNET_DB_QueryStatus |
2898 | postgres_update_predicted_result ( | 2759 | postgres_update_predicted_result ( |
2899 | void *cls, | 2760 | void *cls, |
2900 | struct TALER_AUDITORDB_Session *session, | ||
2901 | const struct TALER_MasterPublicKeyP *master_pub, | 2761 | const struct TALER_MasterPublicKeyP *master_pub, |
2902 | const struct TALER_Amount *balance) | 2762 | const struct TALER_Amount *balance) |
2903 | { | 2763 | { |
2764 | struct PostgresClosure *pg = cls; | ||
2904 | struct GNUNET_PQ_QueryParam params[] = { | 2765 | struct GNUNET_PQ_QueryParam params[] = { |
2905 | TALER_PQ_query_param_amount (balance), | 2766 | TALER_PQ_query_param_amount (balance), |
2906 | GNUNET_PQ_query_param_auto_from_type (master_pub), | 2767 | GNUNET_PQ_query_param_auto_from_type (master_pub), |
2907 | GNUNET_PQ_query_param_end | 2768 | GNUNET_PQ_query_param_end |
2908 | }; | 2769 | }; |
2909 | 2770 | ||
2910 | (void) cls; | 2771 | return GNUNET_PQ_eval_prepared_non_select (pg->conn, |
2911 | return GNUNET_PQ_eval_prepared_non_select (session->conn, | ||
2912 | "auditor_predicted_result_update", | 2772 | "auditor_predicted_result_update", |
2913 | params); | 2773 | params); |
2914 | } | 2774 | } |
@@ -2918,14 +2778,12 @@ postgres_update_predicted_result ( | |||
2918 | * Get an exchange's predicted balance. | 2778 | * Get an exchange's predicted balance. |
2919 | * | 2779 | * |
2920 | * @param cls the @e cls of this struct with the plugin-specific state | 2780 | * @param cls the @e cls of this struct with the plugin-specific state |
2921 | * @param session connection to use | ||
2922 | * @param master_pub master key of the exchange | 2781 | * @param master_pub master key of the exchange |
2923 | * @param[out] balance expected bank account balance of the exchange | 2782 | * @param[out] balance expected bank account balance of the exchange |
2924 | * @return transaction status code | 2783 | * @return transaction status code |
2925 | */ | 2784 | */ |
2926 | static enum GNUNET_DB_QueryStatus | 2785 | static enum GNUNET_DB_QueryStatus |
2927 | postgres_get_predicted_balance (void *cls, | 2786 | postgres_get_predicted_balance (void *cls, |
2928 | struct TALER_AUDITORDB_Session *session, | ||
2929 | const struct TALER_MasterPublicKeyP *master_pub, | 2787 | const struct TALER_MasterPublicKeyP *master_pub, |
2930 | struct TALER_Amount *balance) | 2788 | struct TALER_Amount *balance) |
2931 | { | 2789 | { |
@@ -2940,7 +2798,7 @@ postgres_get_predicted_balance (void *cls, | |||
2940 | GNUNET_PQ_result_spec_end | 2798 | GNUNET_PQ_result_spec_end |
2941 | }; | 2799 | }; |
2942 | 2800 | ||
2943 | return GNUNET_PQ_eval_prepared_singleton_select (session->conn, | 2801 | return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, |
2944 | "auditor_predicted_result_select", | 2802 | "auditor_predicted_result_select", |
2945 | params, | 2803 | params, |
2946 | rs); | 2804 | rs); |
@@ -2962,13 +2820,6 @@ libtaler_plugin_auditordb_postgres_init (void *cls) | |||
2962 | 2820 | ||
2963 | pg = GNUNET_new (struct PostgresClosure); | 2821 | pg = GNUNET_new (struct PostgresClosure); |
2964 | pg->cfg = cfg; | 2822 | pg->cfg = cfg; |
2965 | if (0 != pthread_key_create (&pg->db_conn_threadlocal, | ||
2966 | &db_conn_destroy)) | ||
2967 | { | ||
2968 | TALER_LOG_ERROR ("Cannot create pthread key.\n"); | ||
2969 | GNUNET_free (pg); | ||
2970 | return NULL; | ||
2971 | } | ||
2972 | if (GNUNET_OK != | 2823 | if (GNUNET_OK != |
2973 | TALER_config_get_currency (cfg, | 2824 | TALER_config_get_currency (cfg, |
2974 | &pg->currency)) | 2825 | &pg->currency)) |
@@ -2978,7 +2829,7 @@ libtaler_plugin_auditordb_postgres_init (void *cls) | |||
2978 | } | 2829 | } |
2979 | plugin = GNUNET_new (struct TALER_AUDITORDB_Plugin); | 2830 | plugin = GNUNET_new (struct TALER_AUDITORDB_Plugin); |
2980 | plugin->cls = pg; | 2831 | plugin->cls = pg; |
2981 | plugin->get_session = &postgres_get_session; | 2832 | plugin->preflight = &postgres_preflight; |
2982 | plugin->drop_tables = &postgres_drop_tables; | 2833 | plugin->drop_tables = &postgres_drop_tables; |
2983 | plugin->create_tables = &postgres_create_tables; | 2834 | plugin->create_tables = &postgres_create_tables; |
2984 | plugin->start = &postgres_start; | 2835 | plugin->start = &postgres_start; |
@@ -3075,6 +2926,8 @@ libtaler_plugin_auditordb_postgres_done (void *cls) | |||
3075 | struct TALER_AUDITORDB_Plugin *plugin = cls; | 2926 | struct TALER_AUDITORDB_Plugin *plugin = cls; |
3076 | struct PostgresClosure *pg = plugin->cls; | 2927 | struct PostgresClosure *pg = plugin->cls; |
3077 | 2928 | ||
2929 | if (NULL != pg->conn) | ||
2930 | GNUNET_PQ_disconnect (pg->conn); | ||
3078 | GNUNET_free (pg->currency); | 2931 | GNUNET_free (pg->currency); |
3079 | GNUNET_free (pg); | 2932 | GNUNET_free (pg); |
3080 | GNUNET_free (plugin); | 2933 | GNUNET_free (plugin); |
diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index 69328ee48..237d8ec83 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c | |||
@@ -73,7 +73,6 @@ static void | |||
73 | run (void *cls) | 73 | run (void *cls) |
74 | { | 74 | { |
75 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 75 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
76 | struct TALER_AUDITORDB_Session *session; | ||
77 | uint64_t rowid; | 76 | uint64_t rowid; |
78 | 77 | ||
79 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 78 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -94,16 +93,15 @@ run (void *cls) | |||
94 | result = 77; | 93 | result = 77; |
95 | goto unload; | 94 | goto unload; |
96 | } | 95 | } |
97 | if (NULL == | 96 | if (GNUNET_SYSERR == |
98 | (session = plugin->get_session (plugin->cls))) | 97 | plugin->preflight (plugin->cls)) |
99 | { | 98 | { |
100 | result = 77; | 99 | result = 77; |
101 | goto drop; | 100 | goto drop; |
102 | } | 101 | } |
103 | 102 | ||
104 | FAILIF (GNUNET_OK != | 103 | FAILIF (GNUNET_OK != |
105 | plugin->start (plugin->cls, | 104 | plugin->start (plugin->cls)); |
106 | session)); | ||
107 | 105 | ||
108 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 106 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
109 | "initializing\n"); | 107 | "initializing\n"); |
@@ -164,7 +162,6 @@ run (void *cls) | |||
164 | "Test: auditor_insert_exchange\n"); | 162 | "Test: auditor_insert_exchange\n"); |
165 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 163 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
166 | plugin->insert_exchange (plugin->cls, | 164 | plugin->insert_exchange (plugin->cls, |
167 | session, | ||
168 | &master_pub, | 165 | &master_pub, |
169 | "https://exchange/")); | 166 | "https://exchange/")); |
170 | 167 | ||
@@ -187,7 +184,6 @@ run (void *cls) | |||
187 | 184 | ||
188 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 185 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
189 | plugin->insert_auditor_progress_coin (plugin->cls, | 186 | plugin->insert_auditor_progress_coin (plugin->cls, |
190 | session, | ||
191 | &master_pub, | 187 | &master_pub, |
192 | &ppc)); | 188 | &ppc)); |
193 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 189 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -200,7 +196,6 @@ run (void *cls) | |||
200 | 196 | ||
201 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 197 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
202 | plugin->update_auditor_progress_coin (plugin->cls, | 198 | plugin->update_auditor_progress_coin (plugin->cls, |
203 | session, | ||
204 | &master_pub, | 199 | &master_pub, |
205 | &ppc)); | 200 | &ppc)); |
206 | 201 | ||
@@ -209,7 +204,6 @@ run (void *cls) | |||
209 | 204 | ||
210 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 205 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
211 | plugin->get_auditor_progress_coin (plugin->cls, | 206 | plugin->get_auditor_progress_coin (plugin->cls, |
212 | session, | ||
213 | &master_pub, | 207 | &master_pub, |
214 | &ppc2)); | 208 | &ppc2)); |
215 | FAILIF ( (ppc.last_deposit_serial_id != ppc2.last_deposit_serial_id) || | 209 | FAILIF ( (ppc.last_deposit_serial_id != ppc2.last_deposit_serial_id) || |
@@ -233,7 +227,6 @@ run (void *cls) | |||
233 | 227 | ||
234 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 228 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
235 | plugin->insert_reserve_info (plugin->cls, | 229 | plugin->insert_reserve_info (plugin->cls, |
236 | session, | ||
237 | &reserve_pub, | 230 | &reserve_pub, |
238 | &master_pub, | 231 | &master_pub, |
239 | &reserve_balance, | 232 | &reserve_balance, |
@@ -246,7 +239,6 @@ run (void *cls) | |||
246 | 239 | ||
247 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 240 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
248 | plugin->update_reserve_info (plugin->cls, | 241 | plugin->update_reserve_info (plugin->cls, |
249 | session, | ||
250 | &reserve_pub, | 242 | &reserve_pub, |
251 | &master_pub, | 243 | &master_pub, |
252 | &reserve_balance, | 244 | &reserve_balance, |
@@ -260,7 +252,6 @@ run (void *cls) | |||
260 | 252 | ||
261 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 253 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
262 | plugin->get_reserve_info (plugin->cls, | 254 | plugin->get_reserve_info (plugin->cls, |
263 | session, | ||
264 | &reserve_pub, | 255 | &reserve_pub, |
265 | &master_pub, | 256 | &master_pub, |
266 | &rowid, | 257 | &rowid, |
@@ -281,7 +272,6 @@ run (void *cls) | |||
281 | 272 | ||
282 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 273 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
283 | plugin->insert_reserve_summary (plugin->cls, | 274 | plugin->insert_reserve_summary (plugin->cls, |
284 | session, | ||
285 | &master_pub, | 275 | &master_pub, |
286 | &withdraw_fee_balance, | 276 | &withdraw_fee_balance, |
287 | &reserve_balance)); | 277 | &reserve_balance)); |
@@ -291,7 +281,6 @@ run (void *cls) | |||
291 | 281 | ||
292 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 282 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
293 | plugin->update_reserve_summary (plugin->cls, | 283 | plugin->update_reserve_summary (plugin->cls, |
294 | session, | ||
295 | &master_pub, | 284 | &master_pub, |
296 | &reserve_balance, | 285 | &reserve_balance, |
297 | &withdraw_fee_balance)); | 286 | &withdraw_fee_balance)); |
@@ -304,7 +293,6 @@ run (void *cls) | |||
304 | 293 | ||
305 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 294 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
306 | plugin->get_reserve_summary (plugin->cls, | 295 | plugin->get_reserve_summary (plugin->cls, |
307 | session, | ||
308 | &master_pub, | 296 | &master_pub, |
309 | &reserve_balance2, | 297 | &reserve_balance2, |
310 | &withdraw_fee_balance2)); | 298 | &withdraw_fee_balance2)); |
@@ -362,7 +350,6 @@ run (void *cls) | |||
362 | 350 | ||
363 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 351 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
364 | plugin->insert_denomination_balance (plugin->cls, | 352 | plugin->insert_denomination_balance (plugin->cls, |
365 | session, | ||
366 | &denom_pub_hash, | 353 | &denom_pub_hash, |
367 | &denom_balance, | 354 | &denom_balance, |
368 | &denom_loss, | 355 | &denom_loss, |
@@ -380,7 +367,6 @@ run (void *cls) | |||
380 | 367 | ||
381 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 368 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
382 | plugin->update_denomination_balance (plugin->cls, | 369 | plugin->update_denomination_balance (plugin->cls, |
383 | session, | ||
384 | &denom_pub_hash, | 370 | &denom_pub_hash, |
385 | &denom_balance, | 371 | &denom_balance, |
386 | &denom_loss, | 372 | &denom_loss, |
@@ -392,7 +378,6 @@ run (void *cls) | |||
392 | 378 | ||
393 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 379 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
394 | plugin->get_denomination_balance (plugin->cls, | 380 | plugin->get_denomination_balance (plugin->cls, |
395 | session, | ||
396 | &denom_pub_hash, | 381 | &denom_pub_hash, |
397 | &denom_balance2, | 382 | &denom_balance2, |
398 | &denom_loss2, | 383 | &denom_loss2, |
@@ -411,7 +396,6 @@ run (void *cls) | |||
411 | 396 | ||
412 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 397 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
413 | plugin->insert_balance_summary (plugin->cls, | 398 | plugin->insert_balance_summary (plugin->cls, |
414 | session, | ||
415 | &master_pub, | 399 | &master_pub, |
416 | &refund_fee_balance, | 400 | &refund_fee_balance, |
417 | &melt_fee_balance, | 401 | &melt_fee_balance, |
@@ -426,7 +410,6 @@ run (void *cls) | |||
426 | 410 | ||
427 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 411 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
428 | plugin->update_balance_summary (plugin->cls, | 412 | plugin->update_balance_summary (plugin->cls, |
429 | session, | ||
430 | &master_pub, | 413 | &master_pub, |
431 | &denom_balance, | 414 | &denom_balance, |
432 | &deposit_fee_balance, | 415 | &deposit_fee_balance, |
@@ -449,7 +432,6 @@ run (void *cls) | |||
449 | 432 | ||
450 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 433 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
451 | plugin->get_balance_summary (plugin->cls, | 434 | plugin->get_balance_summary (plugin->cls, |
452 | session, | ||
453 | &master_pub, | 435 | &master_pub, |
454 | &denom_balance2, | 436 | &denom_balance2, |
455 | &deposit_fee_balance2, | 437 | &deposit_fee_balance2, |
@@ -480,7 +462,6 @@ run (void *cls) | |||
480 | 462 | ||
481 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 463 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
482 | plugin->insert_historic_denom_revenue (plugin->cls, | 464 | plugin->insert_historic_denom_revenue (plugin->cls, |
483 | session, | ||
484 | &master_pub, | 465 | &master_pub, |
485 | &denom_pub_hash, | 466 | &denom_pub_hash, |
486 | past, | 467 | past, |
@@ -489,7 +470,6 @@ run (void *cls) | |||
489 | 470 | ||
490 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 471 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
491 | plugin->insert_historic_denom_revenue (plugin->cls, | 472 | plugin->insert_historic_denom_revenue (plugin->cls, |
492 | session, | ||
493 | &master_pub, | 473 | &master_pub, |
494 | &rnd_hash, | 474 | &rnd_hash, |
495 | now, | 475 | now, |
@@ -534,7 +514,6 @@ run (void *cls) | |||
534 | 514 | ||
535 | FAILIF (0 >= | 515 | FAILIF (0 >= |
536 | plugin->select_historic_denom_revenue (plugin->cls, | 516 | plugin->select_historic_denom_revenue (plugin->cls, |
537 | session, | ||
538 | &master_pub, | 517 | &master_pub, |
539 | & | 518 | & |
540 | select_historic_denom_revenue_result, | 519 | select_historic_denom_revenue_result, |
@@ -550,7 +529,6 @@ run (void *cls) | |||
550 | 529 | ||
551 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 530 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
552 | plugin->insert_historic_reserve_revenue (plugin->cls, | 531 | plugin->insert_historic_reserve_revenue (plugin->cls, |
553 | session, | ||
554 | &master_pub, | 532 | &master_pub, |
555 | past, | 533 | past, |
556 | future, | 534 | future, |
@@ -558,7 +536,6 @@ run (void *cls) | |||
558 | 536 | ||
559 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 537 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
560 | plugin->insert_historic_reserve_revenue (plugin->cls, | 538 | plugin->insert_historic_reserve_revenue (plugin->cls, |
561 | session, | ||
562 | &master_pub, | 539 | &master_pub, |
563 | now, | 540 | now, |
564 | future, | 541 | future, |
@@ -598,7 +575,6 @@ run (void *cls) | |||
598 | 575 | ||
599 | FAILIF (0 >= | 576 | FAILIF (0 >= |
600 | plugin->select_historic_reserve_revenue (plugin->cls, | 577 | plugin->select_historic_reserve_revenue (plugin->cls, |
601 | session, | ||
602 | &master_pub, | 578 | &master_pub, |
603 | select_historic_reserve_revenue_result, | 579 | select_historic_reserve_revenue_result, |
604 | NULL)); | 580 | NULL)); |
@@ -608,7 +584,6 @@ run (void *cls) | |||
608 | 584 | ||
609 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 585 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
610 | plugin->insert_predicted_result (plugin->cls, | 586 | plugin->insert_predicted_result (plugin->cls, |
611 | session, | ||
612 | &master_pub, | 587 | &master_pub, |
613 | &rbalance)); | 588 | &rbalance)); |
614 | 589 | ||
@@ -621,18 +596,15 @@ run (void *cls) | |||
621 | 596 | ||
622 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 597 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
623 | plugin->update_predicted_result (plugin->cls, | 598 | plugin->update_predicted_result (plugin->cls, |
624 | session, | ||
625 | &master_pub, | 599 | &master_pub, |
626 | &rbalance)); | 600 | &rbalance)); |
627 | 601 | ||
628 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 602 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
629 | plugin->insert_wire_fee_summary (plugin->cls, | 603 | plugin->insert_wire_fee_summary (plugin->cls, |
630 | session, | ||
631 | &master_pub, | 604 | &master_pub, |
632 | &rbalance)); | 605 | &rbalance)); |
633 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 606 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
634 | plugin->update_wire_fee_summary (plugin->cls, | 607 | plugin->update_wire_fee_summary (plugin->cls, |
635 | session, | ||
636 | &master_pub, | 608 | &master_pub, |
637 | &reserve_profits)); | 609 | &reserve_profits)); |
638 | { | 610 | { |
@@ -640,7 +612,6 @@ run (void *cls) | |||
640 | 612 | ||
641 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 613 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
642 | plugin->get_wire_fee_summary (plugin->cls, | 614 | plugin->get_wire_fee_summary (plugin->cls, |
643 | session, | ||
644 | &master_pub, | 615 | &master_pub, |
645 | &rprof)); | 616 | &rprof)); |
646 | FAILIF (0 != | 617 | FAILIF (0 != |
@@ -648,34 +619,29 @@ run (void *cls) | |||
648 | &reserve_profits)); | 619 | &reserve_profits)); |
649 | } | 620 | } |
650 | FAILIF (0 > | 621 | FAILIF (0 > |
651 | plugin->commit (plugin->cls, | 622 | plugin->commit (plugin->cls)); |
652 | session)); | ||
653 | 623 | ||
654 | 624 | ||
655 | FAILIF (GNUNET_OK != | 625 | FAILIF (GNUNET_OK != |
656 | plugin->start (plugin->cls, | 626 | plugin->start (plugin->cls)); |
657 | session)); | ||
658 | 627 | ||
659 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 628 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
660 | "Test: get_predicted_balance\n"); | 629 | "Test: get_predicted_balance\n"); |
661 | 630 | ||
662 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 631 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
663 | plugin->get_predicted_balance (plugin->cls, | 632 | plugin->get_predicted_balance (plugin->cls, |
664 | session, | ||
665 | &master_pub, | 633 | &master_pub, |
666 | &rbalance2)); | 634 | &rbalance2)); |
667 | 635 | ||
668 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != | 636 | FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != |
669 | plugin->del_reserve_info (plugin->cls, | 637 | plugin->del_reserve_info (plugin->cls, |
670 | session, | ||
671 | &reserve_pub, | 638 | &reserve_pub, |
672 | &master_pub)); | 639 | &master_pub)); |
673 | 640 | ||
674 | FAILIF (0 != TALER_amount_cmp (&rbalance2, | 641 | FAILIF (0 != TALER_amount_cmp (&rbalance2, |
675 | &rbalance)); | 642 | &rbalance)); |
676 | 643 | ||
677 | plugin->rollback (plugin->cls, | 644 | plugin->rollback (plugin->cls); |
678 | session); | ||
679 | 645 | ||
680 | #if GC_IMPLEMENTED | 646 | #if GC_IMPLEMENTED |
681 | FAILIF (GNUNET_OK != | 647 | FAILIF (GNUNET_OK != |
@@ -685,22 +651,17 @@ run (void *cls) | |||
685 | result = 0; | 651 | result = 0; |
686 | 652 | ||
687 | drop: | 653 | drop: |
688 | if (NULL != session) | ||
689 | { | 654 | { |
690 | plugin->rollback (plugin->cls, | 655 | plugin->rollback (plugin->cls); |
691 | session); | ||
692 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 656 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
693 | "Test: auditor_delete_exchange\n"); | 657 | "Test: auditor_delete_exchange\n"); |
694 | GNUNET_break (GNUNET_OK == | 658 | GNUNET_break (GNUNET_OK == |
695 | plugin->start (plugin->cls, | 659 | plugin->start (plugin->cls)); |
696 | session)); | ||
697 | GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == | 660 | GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == |
698 | plugin->delete_exchange (plugin->cls, | 661 | plugin->delete_exchange (plugin->cls, |
699 | session, | ||
700 | &master_pub)); | 662 | &master_pub)); |
701 | GNUNET_break (0 <= | 663 | GNUNET_break (0 <= |
702 | plugin->commit (plugin->cls, | 664 | plugin->commit (plugin->cls)); |
703 | session)); | ||
704 | } | 665 | } |
705 | GNUNET_break (GNUNET_OK == | 666 | GNUNET_break (GNUNET_OK == |
706 | plugin->drop_tables (plugin->cls, | 667 | plugin->drop_tables (plugin->cls, |
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index f37aafbd1..3b5616345 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c | |||
@@ -344,9 +344,7 @@ static struct TEH_KeyStateHandle *key_state; | |||
344 | 344 | ||
345 | /** | 345 | /** |
346 | * Counter incremented whenever we have a reason to re-build the keys because | 346 | * Counter incremented whenever we have a reason to re-build the keys because |
347 | * something external changed (in another thread). The counter is manipulated | 347 | * something external changed (in another thread). See #TEH_keys_get_state() and |
348 | * using an atomic update, and thus to ensure that threads notice when it | ||
349 | * changes, the variable MUST be volatile. See #TEH_keys_get_state() and | ||
350 | * #TEH_keys_update_states() for uses of this variable. | 348 | * #TEH_keys_update_states() for uses of this variable. |
351 | */ | 349 | */ |
352 | static uint64_t key_generation; | 350 | static uint64_t key_generation; |
@@ -1721,8 +1719,7 @@ build_key_state (struct HelperState *hs, | |||
1721 | void | 1719 | void |
1722 | TEH_keys_update_states () | 1720 | TEH_keys_update_states () |
1723 | { | 1721 | { |
1724 | __sync_fetch_and_add (&key_generation, | 1722 | key_generation++; |
1725 | 1); | ||
1726 | TEH_resume_keys_requests (false); | 1723 | TEH_resume_keys_requests (false); |
1727 | } | 1724 | } |
1728 | 1725 | ||
diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index 405a90ed5..7733009b7 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2014-2018 Taler Systems SA | 3 | Copyright (C) 2014-2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -357,12 +357,6 @@ typedef int | |||
357 | 357 | ||
358 | 358 | ||
359 | /** | 359 | /** |
360 | * Handle for one session with the database. | ||
361 | */ | ||
362 | struct TALER_AUDITORDB_Session; | ||
363 | |||
364 | |||
365 | /** | ||
366 | * @brief The plugin API, returned from the plugin's "init" function. | 360 | * @brief The plugin API, returned from the plugin's "init" function. |
367 | * The argument given to "init" is simply a configuration handle. | 361 | * The argument given to "init" is simply a configuration handle. |
368 | * | 362 | * |
@@ -384,14 +378,16 @@ struct TALER_AUDITORDB_Plugin | |||
384 | char *library_name; | 378 | char *library_name; |
385 | 379 | ||
386 | /** | 380 | /** |
387 | * Get the thread-local database-handle. | 381 | * Fully connect to the db if the connection does not exist yet |
388 | * Connect to the db if the connection does not exist yet. | 382 | * and check that there is no transaction currently running. |
389 | * | 383 | * |
390 | * @param cls the @e cls of this struct with the plugin-specific state | 384 | * @param cls the @e cls of this struct with the plugin-specific state |
391 | * @param the database connection, or NULL on error | 385 | * @return #GNUNET_OK on success |
386 | * #GNUNET_NO if we rolled back an earlier transaction | ||
387 | * #GNUNET_SYSERR if we have no DB connection | ||
392 | */ | 388 | */ |
393 | struct TALER_AUDITORDB_Session * | 389 | enum GNUNET_GenericReturnValue |
394 | (*get_session) (void *cls); | 390 | (*preflight)(void *cls); |
395 | 391 | ||
396 | 392 | ||
397 | /** | 393 | /** |
@@ -405,9 +401,9 @@ struct TALER_AUDITORDB_Plugin | |||
405 | * used when restarting the auditor | 401 | * used when restarting the auditor |
406 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure | 402 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure |
407 | */ | 403 | */ |
408 | int | 404 | enum GNUNET_GenericReturnValue |
409 | (*drop_tables) (void *cls, | 405 | (*drop_tables)(void *cls, |
410 | int drop_exchangelist); | 406 | int drop_exchangelist); |
411 | 407 | ||
412 | 408 | ||
413 | /** | 409 | /** |
@@ -416,43 +412,37 @@ struct TALER_AUDITORDB_Plugin | |||
416 | * @param cls the @e cls of this struct with the plugin-specific state | 412 | * @param cls the @e cls of this struct with the plugin-specific state |
417 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure | 413 | * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure |
418 | */ | 414 | */ |
419 | int | 415 | enum GNUNET_GenericReturnValue |
420 | (*create_tables) (void *cls); | 416 | (*create_tables)(void *cls); |
421 | 417 | ||
422 | 418 | ||
423 | /** | 419 | /** |
424 | * Start a transaction. | 420 | * Start a transaction. |
425 | * | 421 | * |
426 | * @param cls the @e cls of this struct with the plugin-specific state | 422 | * @param cls the @e cls of this struct with the plugin-specific state |
427 | * @param session connection to use | ||
428 | * @return #GNUNET_OK on success | 423 | * @return #GNUNET_OK on success |
429 | */ | 424 | */ |
430 | int | 425 | enum GNUNET_GenericReturnValue |
431 | (*start) (void *cls, | 426 | (*start)(void *cls); |
432 | struct TALER_AUDITORDB_Session *session); | ||
433 | 427 | ||
434 | 428 | ||
435 | /** | 429 | /** |
436 | * Commit a transaction. | 430 | * Commit a transaction. |
437 | * | 431 | * |
438 | * @param cls the @e cls of this struct with the plugin-specific state | 432 | * @param cls the @e cls of this struct with the plugin-specific state |
439 | * @param session connection to use | ||
440 | * @return transaction status code | 433 | * @return transaction status code |
441 | */ | 434 | */ |
442 | enum GNUNET_DB_QueryStatus | 435 | enum GNUNET_DB_QueryStatus |
443 | (*commit)(void *cls, | 436 | (*commit)(void *cls); |
444 | struct TALER_AUDITORDB_Session *session); | ||
445 | 437 | ||
446 | 438 | ||
447 | /** | 439 | /** |
448 | * Abort/rollback a transaction. | 440 | * Abort/rollback a transaction. |
449 | * | 441 | * |
450 | * @param cls the @e cls of this struct with the plugin-specific state | 442 | * @param cls the @e cls of this struct with the plugin-specific state |
451 | * @param session connection to use | ||
452 | */ | 443 | */ |
453 | void | 444 | void |
454 | (*rollback) (void *cls, | 445 | (*rollback) (void *cls); |
455 | struct TALER_AUDITORDB_Session *session); | ||
456 | 446 | ||
457 | 447 | ||
458 | /** | 448 | /** |
@@ -471,14 +461,12 @@ struct TALER_AUDITORDB_Plugin | |||
471 | * Insert information about an exchange this auditor will be auditing. | 461 | * Insert information about an exchange this auditor will be auditing. |
472 | * | 462 | * |
473 | * @param cls the @e cls of this struct with the plugin-specific state | 463 | * @param cls the @e cls of this struct with the plugin-specific state |
474 | * @param session connection to the database | ||
475 | * @param master_pub master public key of the exchange | 464 | * @param master_pub master public key of the exchange |
476 | * @param exchange_url public (base) URL of the API of the exchange | 465 | * @param exchange_url public (base) URL of the API of the exchange |
477 | * @return query result status | 466 | * @return query result status |
478 | */ | 467 | */ |
479 | enum GNUNET_DB_QueryStatus | 468 | enum GNUNET_DB_QueryStatus |
480 | (*insert_exchange)(void *cls, | 469 | (*insert_exchange)(void *cls, |
481 | struct TALER_AUDITORDB_Session *session, | ||
482 | const struct TALER_MasterPublicKeyP *master_pub, | 470 | const struct TALER_MasterPublicKeyP *master_pub, |
483 | const char *exchange_url); | 471 | const char *exchange_url); |
484 | 472 | ||
@@ -489,13 +477,11 @@ struct TALER_AUDITORDB_Plugin | |||
489 | * to this exchange! | 477 | * to this exchange! |
490 | * | 478 | * |
491 | * @param cls the @e cls of this struct with the plugin-specific state | 479 | * @param cls the @e cls of this struct with the plugin-specific state |
492 | * @param session connection to the database | ||
493 | * @param master_pub master public key of the exchange | 480 | * @param master_pub master public key of the exchange |
494 | * @return query result status | 481 | * @return query result status |
495 | */ | 482 | */ |
496 | enum GNUNET_DB_QueryStatus | 483 | enum GNUNET_DB_QueryStatus |
497 | (*delete_exchange)(void *cls, | 484 | (*delete_exchange)(void *cls, |
498 | struct TALER_AUDITORDB_Session *session, | ||
499 | const struct TALER_MasterPublicKeyP *master_pub); | 485 | const struct TALER_MasterPublicKeyP *master_pub); |
500 | 486 | ||
501 | 487 | ||
@@ -503,14 +489,12 @@ struct TALER_AUDITORDB_Plugin | |||
503 | * Obtain information about exchanges this auditor is auditing. | 489 | * Obtain information about exchanges this auditor is auditing. |
504 | * | 490 | * |
505 | * @param cls the @e cls of this struct with the plugin-specific state | 491 | * @param cls the @e cls of this struct with the plugin-specific state |
506 | * @param session connection to the database | ||
507 | * @param cb function to call with the results | 492 | * @param cb function to call with the results |
508 | * @param cb_cls closure for @a cb | 493 | * @param cb_cls closure for @a cb |
509 | * @return query result status | 494 | * @return query result status |
510 | */ | 495 | */ |
511 | enum GNUNET_DB_QueryStatus | 496 | enum GNUNET_DB_QueryStatus |
512 | (*list_exchanges)(void *cls, | 497 | (*list_exchanges)(void *cls, |
513 | struct TALER_AUDITORDB_Session *session, | ||
514 | TALER_AUDITORDB_ExchangeCallback cb, | 498 | TALER_AUDITORDB_ExchangeCallback cb, |
515 | void *cb_cls); | 499 | void *cb_cls); |
516 | 500 | ||
@@ -518,14 +502,12 @@ struct TALER_AUDITORDB_Plugin | |||
518 | * Insert information about a signing key of the exchange. | 502 | * Insert information about a signing key of the exchange. |
519 | * | 503 | * |
520 | * @param cls the @e cls of this struct with the plugin-specific state | 504 | * @param cls the @e cls of this struct with the plugin-specific state |
521 | * @param session connection to the database | ||
522 | * @param sk signing key information to store | 505 | * @param sk signing key information to store |
523 | * @return query result status | 506 | * @return query result status |
524 | */ | 507 | */ |
525 | enum GNUNET_DB_QueryStatus | 508 | enum GNUNET_DB_QueryStatus |
526 | (*insert_exchange_signkey)( | 509 | (*insert_exchange_signkey)( |
527 | void *cls, | 510 | void *cls, |
528 | struct TALER_AUDITORDB_Session *session, | ||
529 | const struct TALER_AUDITORDB_ExchangeSigningKey *sk); | 511 | const struct TALER_AUDITORDB_ExchangeSigningKey *sk); |
530 | 512 | ||
531 | 513 | ||
@@ -533,14 +515,12 @@ struct TALER_AUDITORDB_Plugin | |||
533 | * Insert information about a deposit confirmation into the database. | 515 | * Insert information about a deposit confirmation into the database. |
534 | * | 516 | * |
535 | * @param cls the @e cls of this struct with the plugin-specific state | 517 | * @param cls the @e cls of this struct with the plugin-specific state |
536 | * @param session connection to the database | ||
537 | * @param dc deposit confirmation information to store | 518 | * @param dc deposit confirmation information to store |
538 | * @return query result status | 519 | * @return query result status |
539 | */ | 520 | */ |
540 | enum GNUNET_DB_QueryStatus | 521 | enum GNUNET_DB_QueryStatus |
541 | (*insert_deposit_confirmation)( | 522 | (*insert_deposit_confirmation)( |
542 | void *cls, | 523 | void *cls, |
543 | struct TALER_AUDITORDB_Session *session, | ||
544 | const struct TALER_AUDITORDB_DepositConfirmation *dc); | 524 | const struct TALER_AUDITORDB_DepositConfirmation *dc); |
545 | 525 | ||
546 | 526 | ||
@@ -548,7 +528,6 @@ struct TALER_AUDITORDB_Plugin | |||
548 | * Get information about deposit confirmations from the database. | 528 | * Get information about deposit confirmations from the database. |
549 | * | 529 | * |
550 | * @param cls the @e cls of this struct with the plugin-specific state | 530 | * @param cls the @e cls of this struct with the plugin-specific state |
551 | * @param session connection to the database | ||
552 | * @param master_public_key for which exchange do we want to get deposit confirmations | 531 | * @param master_public_key for which exchange do we want to get deposit confirmations |
553 | * @param start_id row/serial ID where to start the iteration (0 from | 532 | * @param start_id row/serial ID where to start the iteration (0 from |
554 | * the start, exclusive, i.e. serial_ids must start from 1) | 533 | * the start, exclusive, i.e. serial_ids must start from 1) |
@@ -559,7 +538,6 @@ struct TALER_AUDITORDB_Plugin | |||
559 | enum GNUNET_DB_QueryStatus | 538 | enum GNUNET_DB_QueryStatus |
560 | (*get_deposit_confirmations)( | 539 | (*get_deposit_confirmations)( |
561 | void *cls, | 540 | void *cls, |
562 | struct TALER_AUDITORDB_Session *session, | ||
563 | const struct TALER_MasterPublicKeyP *master_public_key, | 541 | const struct TALER_MasterPublicKeyP *master_public_key, |
564 | uint64_t start_id, | 542 | uint64_t start_id, |
565 | TALER_AUDITORDB_DepositConfirmationCallback cb, | 543 | TALER_AUDITORDB_DepositConfirmationCallback cb, |
@@ -571,7 +549,6 @@ struct TALER_AUDITORDB_Plugin | |||
571 | * data. | 549 | * data. |
572 | * | 550 | * |
573 | * @param cls the @e cls of this struct with the plugin-specific state | 551 | * @param cls the @e cls of this struct with the plugin-specific state |
574 | * @param session connection to use | ||
575 | * @param master_pub master key of the exchange | 552 | * @param master_pub master key of the exchange |
576 | * @param ppc where is the auditor in processing | 553 | * @param ppc where is the auditor in processing |
577 | * @return transaction status code | 554 | * @return transaction status code |
@@ -579,7 +556,6 @@ struct TALER_AUDITORDB_Plugin | |||
579 | enum GNUNET_DB_QueryStatus | 556 | enum GNUNET_DB_QueryStatus |
580 | (*insert_auditor_progress_coin)( | 557 | (*insert_auditor_progress_coin)( |
581 | void *cls, | 558 | void *cls, |
582 | struct TALER_AUDITORDB_Session *session, | ||
583 | const struct TALER_MasterPublicKeyP *master_pub, | 559 | const struct TALER_MasterPublicKeyP *master_pub, |
584 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc); | 560 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc); |
585 | 561 | ||
@@ -589,7 +565,6 @@ struct TALER_AUDITORDB_Plugin | |||
589 | * must be an existing record for the exchange. | 565 | * must be an existing record for the exchange. |
590 | * | 566 | * |
591 | * @param cls the @e cls of this struct with the plugin-specific state | 567 | * @param cls the @e cls of this struct with the plugin-specific state |
592 | * @param session connection to use | ||
593 | * @param master_pub master key of the exchange | 568 | * @param master_pub master key of the exchange |
594 | * @param ppc where is the auditor in processing | 569 | * @param ppc where is the auditor in processing |
595 | * @return transaction status code | 570 | * @return transaction status code |
@@ -597,7 +572,6 @@ struct TALER_AUDITORDB_Plugin | |||
597 | enum GNUNET_DB_QueryStatus | 572 | enum GNUNET_DB_QueryStatus |
598 | (*update_auditor_progress_coin)( | 573 | (*update_auditor_progress_coin)( |
599 | void *cls, | 574 | void *cls, |
600 | struct TALER_AUDITORDB_Session *session, | ||
601 | const struct TALER_MasterPublicKeyP *master_pub, | 575 | const struct TALER_MasterPublicKeyP *master_pub, |
602 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc); | 576 | const struct TALER_AUDITORDB_ProgressPointCoin *ppc); |
603 | 577 | ||
@@ -606,14 +580,12 @@ struct TALER_AUDITORDB_Plugin | |||
606 | * Get information about the progress of the auditor. | 580 | * Get information about the progress of the auditor. |