diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-10-06 23:17:46 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-10-06 23:17:46 +0200 |
commit | 52106eea42698164fef897f4b177f783275d5c75 (patch) | |
tree | 4a529f8a7d7d2e1cddaa69e79318e89a6af3941d /src/exchangedb/plugin_exchangedb_postgres.c | |
parent | dd60d9b9841dcc4c3453b830509ecb2d4abcb8dc (diff) |
refactor: extensions_ -> policy_; added policy_fulfilment
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index a50cbcfc..34ff0bd5 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2993,11 +2993,11 @@ prepare_statements (struct PostgresClosure *pg) " LIMIT 1;", 0), GNUNET_PQ_make_prepare ( - "select_serial_by_table_extension_details", + "select_serial_by_table_policy_details", "SELECT" - " extension_details_serial_id AS serial" - " FROM extension_details" - " ORDER BY extension_details_serial_id DESC" + " policy_details_serial_id AS serial" + " FROM policy_details" + " ORDER BY policy_details_serial_id DESC" " LIMIT 1;", 0), GNUNET_PQ_make_prepare ( @@ -3318,8 +3318,8 @@ prepare_statements (struct PostgresClosure *pg) ",wire_salt" ",wire_target_h_payto" ",done" - ",extension_blocked" - ",extension_details_serial_id" + ",policy_blocked" + ",policy_details_serial_id" " FROM deposits" " WHERE deposit_serial_id > $1" " ORDER BY deposit_serial_id ASC;", @@ -3821,8 +3821,8 @@ prepare_statements (struct PostgresClosure *pg) ",coin_sig" ",wire_salt" ",wire_target_h_payto" - ",extension_blocked" - ",extension_details_serial_id" + ",policy_blocked" + ",policy_details_serial_id" ") VALUES " "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," " $11, $12, $13, $14, $15, $16, $17);", @@ -3927,14 +3927,24 @@ prepare_statements (struct PostgresClosure *pg) "($1, $2, $3);", 3), GNUNET_PQ_make_prepare ( - "insert_into_table_extension_details", - "INSERT INTO extension_details" - "(extension_details_serial_id" - ",extension_options" + "insert_into_table_policy_details", + "INSERT INTO policy_details" + "(policy_details_serial_id" + ",serial_id" + ",policy_options" + ",fulfilment_serial_id" ") VALUES " - "($1, $2);", - 2), - + "($1, $2, $3, $4);", + 4), + GNUNET_PQ_make_prepare ( + "insert_into_table_policy_fulfilments", + "INSERT INTO policy_fulfilments" + "(policy_fulfilments_serial_id" + ",fulfilment_timestamp" + ",fulfilment_proof" + ") VALUES " + "($1, $2, $3);", + 3), GNUNET_PQ_make_prepare ( "insert_into_table_purse_requests", "INSERT INTO purse_requests" @@ -6230,7 +6240,7 @@ compute_shard (const struct TALER_MerchantPublicKeyP *merchant_pub) * @param deposit deposit operation details * @param known_coin_id row of the coin in the known_coins table * @param h_payto hash of the merchant's bank account details - * @param extension_blocked true if an extension is blocking the wire transfer + * @param policy_blocked true if an extension is blocking the wire transfer * @param[in,out] exchange_timestamp time to use for the deposit (possibly updated) * @param[out] balance_ok set to true if the balance was sufficient * @param[out] in_conflict set to true if the deposit conflicted @@ -6242,7 +6252,7 @@ postgres_do_deposit ( const struct TALER_EXCHANGEDB_Deposit *deposit, uint64_t known_coin_id, const struct TALER_PaytoHashP *h_payto, - bool extension_blocked, + bool policy_blocked, struct GNUNET_TIME_Timestamp *exchange_timestamp, bool *balance_ok, bool *in_conflict) @@ -6264,7 +6274,7 @@ postgres_do_deposit ( GNUNET_PQ_query_param_auto_from_type (&deposit->coin.coin_pub), GNUNET_PQ_query_param_auto_from_type (&deposit->csig), GNUNET_PQ_query_param_uint64 (&deposit_shard), - GNUNET_PQ_query_param_bool (extension_blocked), + GNUNET_PQ_query_param_bool (policy_blocked), (NULL == deposit->policy_details) ? GNUNET_PQ_query_param_null () : TALER_PQ_query_param_json (deposit->policy_details), @@ -14225,8 +14235,8 @@ postgres_lookup_serial_by_table (void *cls, case TALER_EXCHANGEDB_RT_EXTENSIONS: statement = "select_serial_by_table_extensions"; break; - case TALER_EXCHANGEDB_RT_EXTENSION_DETAILS: - statement = "select_serial_by_table_extension_details"; + case TALER_EXCHANGEDB_RT_POLICY_DETAILS: + statement = "select_serial_by_table_policy_details"; break; case TALER_EXCHANGEDB_RT_PURSE_REQUESTS: statement = "select_serial_by_table_purse_requests"; @@ -14437,9 +14447,13 @@ postgres_lookup_records_by_table (void *cls, statement = "select_above_serial_by_table_extensions"; rh = &lrbt_cb_table_extensions; break; - case TALER_EXCHANGEDB_RT_EXTENSION_DETAILS: - statement = "select_above_serial_by_table_extension_details"; - rh = &lrbt_cb_table_extension_details; + case TALER_EXCHANGEDB_RT_POLICY_DETAILS: + statement = "select_above_serial_by_table_policy_details"; + rh = &lrbt_cb_table_policy_details; + break; + case TALER_EXCHANGEDB_RT_POLICY_FULFILMENTS: + statement = "select_above_serial_by_table_policy_fulfilments"; + rh = &lrbt_cb_table_policy_fulfilments; break; case TALER_EXCHANGEDB_RT_PURSE_REQUESTS: statement = "select_above_serial_by_table_purse_requests"; @@ -14620,8 +14634,8 @@ postgres_insert_records_by_table (void *cls, case TALER_EXCHANGEDB_RT_EXTENSIONS: rh = &irbt_cb_table_extensions; break; - case TALER_EXCHANGEDB_RT_EXTENSION_DETAILS: - rh = &irbt_cb_table_extension_details; + case TALER_EXCHANGEDB_RT_POLICY_DETAILS: + rh = &irbt_cb_table_policy_details; break; case TALER_EXCHANGEDB_RT_PURSE_REQUESTS: rh = &irbt_cb_table_purse_requests; |