diff options
Diffstat (limited to 'src/exchangedb/lrbt_callbacks.c')
-rw-r--r-- | src/exchangedb/lrbt_callbacks.c | 96 |
1 files changed, 79 insertions, 17 deletions
diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c index a8f68f4c..023f61cc 100644 --- a/src/exchangedb/lrbt_callbacks.c +++ b/src/exchangedb/lrbt_callbacks.c @@ -895,7 +895,7 @@ lrbt_cb_table_deposits (void *cls, for (unsigned int i = 0; i<num_results; i++) { - bool no_extension; + bool no_policy; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ( "serial", @@ -940,13 +940,13 @@ lrbt_cb_table_deposits (void *cls, "wire_target_h_payto", &td.details.deposits.wire_target_h_payto), GNUNET_PQ_result_spec_auto_from_type ( - "extension_blocked", - &td.details.deposits.extension_blocked), + "policy_blocked", + &td.details.deposits.policy_blocked), GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_uint64 ( - "extension_details_serial_id", - &td.details.deposits.extension_details_serial_id), - &no_extension), + "policy_details_serial_id", + &td.details.deposits.policy_details_serial_id), + &no_policy), GNUNET_PQ_result_spec_end }; @@ -1400,8 +1400,8 @@ lrbt_cb_table_extensions (void *cls, GNUNET_PQ_result_spec_string ("name", &td.details.extensions.name), GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_string ("config", - &td.details.extensions.config), + GNUNET_PQ_result_spec_string ("manifest", + &td.details.extensions.manifest), &no_config), GNUNET_PQ_result_spec_end }; @@ -1423,33 +1423,95 @@ lrbt_cb_table_extensions (void *cls, /** - * Function called with extension_details table entries. + * Function called with policy_details table entries. * * @param cls closure * @param result the postgres result * @param num_results the number of results in @a result */ static void -lrbt_cb_table_extension_details (void *cls, - PGresult *result, - unsigned int num_results) +lrbt_cb_table_policy_details (void *cls, + PGresult *result, + unsigned int num_results) +{ + struct LookupRecordsByTableContext *ctx = cls; + struct TALER_EXCHANGEDB_TableData td = { + .table = TALER_EXCHANGEDB_RT_POLICY_DETAILS + }; + + for (unsigned int i = 0; i<num_results; i++) + { + bool no_config = false; + bool no_fulfilment = false; + struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_uint64 ("policy_details_serial_id", + &td.serial), + GNUNET_PQ_result_spec_auto_from_type ("serial_id", + &td.details.policy_details. + serial_id), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("policy_options", + &td.details.policy_details. + policy_options), + &no_config), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_uint64 ("fulfilment_serial_id", + &td.details.policy_details. + fulfilment_serial_id), + &no_fulfilment), + GNUNET_PQ_result_spec_end + }; + + if (GNUNET_OK != + GNUNET_PQ_extract_result (result, + rs, + i)) + { + GNUNET_break (0); + ctx->error = true; + return; + } + ctx->cb (ctx->cb_cls, + &td); + GNUNET_PQ_cleanup_result (rs); + } +} + + +/** + * Function called with policy_fulfilments table entries. + * + * @param cls closure + * @param result the postgres result + * @param num_results the number of results in @a result + */ +static void +lrbt_cb_table_policy_fulfilments (void *cls, + PGresult *result, + unsigned int num_results) { struct LookupRecordsByTableContext *ctx = cls; struct TALER_EXCHANGEDB_TableData td = { - .table = TALER_EXCHANGEDB_RT_EXTENSION_DETAILS + .table = TALER_EXCHANGEDB_RT_POLICY_FULFILMENTS }; for (unsigned int i = 0; i<num_results; i++) { bool no_config = false; + bool no_timestamp = false; struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("extension_details_serial_id", + GNUNET_PQ_result_spec_uint64 ("policy_fulfilment_serial_id", &td.serial), GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_string ("extension_options", - &td.details.extension_details. - extension_options), + GNUNET_PQ_result_spec_string ("fulfilment_proof", + &td.details.policy_fulfilments. + fulfilment_proof), &no_config), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_timestamp ("fulfilment_timestamp", + &td.details.policy_fulfilments. + fulfilment_timestamp), + &no_timestamp), GNUNET_PQ_result_spec_end }; |