commit 7ecc2c5cf10f27caad5c2f1aefa8a135cc884667 parent 46811dac9fd3c64debe448b7863857e701932782 Author: Christian Grothoff <christian@grothoff.org> Date: Tue, 3 Jun 2025 14:06:41 +0200 database transform towards #9053: enable incremental iterating over sanction list Diffstat:
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/exchange/taler-exchange-sanctionscheck.c b/src/exchange/taler-exchange-sanctionscheck.c @@ -109,6 +109,10 @@ static struct Account *acc_head; */ static struct Account *acc_tail; +/** + * Minimum row ID to process records from. + */ +static uint64_t min_row_id; /** * We're being aborted with CTRL-C (or SIGTERM). Shut down. @@ -479,6 +483,7 @@ run (void *cls, return; } qs = db_plugin->select_all_kyc_attributes (db_plugin->cls, + min_row_id, &account_cb, NULL); if (qs < 0) diff --git a/src/exchangedb/pg_select_all_kyc_attributes.c b/src/exchangedb/pg_select_all_kyc_attributes.c @@ -123,11 +123,13 @@ get_attributes_cb (void *cls, enum GNUNET_DB_QueryStatus TEH_PG_select_all_kyc_attributes ( void *cls, + uint64_t min_row_id, TALER_EXCHANGEDB_AllAttributesCallback cb, void *cb_cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&min_row_id), GNUNET_PQ_query_param_end }; struct GetAttributesContext ctx = { @@ -155,6 +157,8 @@ TEH_PG_select_all_kyc_attributes ( " ON (ka.h_payto = lo.h_payto)" /* **IF** we joined with 'lo', the lo must be active */ " WHERE COALESCE(lo.is_active,TRUE)" + " AND kyc_attributes_serial_id > $1" + " ORDER BY kyc_attributes_serial_id ASC" ); qs = GNUNET_PQ_eval_prepared_multi_select ( pg->conn, diff --git a/src/exchangedb/pg_select_all_kyc_attributes.h b/src/exchangedb/pg_select_all_kyc_attributes.h @@ -27,9 +27,10 @@ /** - * Lookup all KYC attributes. + * Lookup all KYC attributes above @a min_row_id. * * @param cls closure + * @param min_row_id minimum row ID to return (exclusive) * @param cb callback to invoke on each match * @param cb_cls closure for @a cb * @return database transaction status @@ -37,6 +38,7 @@ enum GNUNET_DB_QueryStatus TEH_PG_select_all_kyc_attributes ( void *cls, + uint64_t min_row_id, TALER_EXCHANGEDB_AllAttributesCallback cb, void *cb_cls); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h @@ -7500,9 +7500,10 @@ struct TALER_EXCHANGEDB_Plugin /** - * Lookup all KYC attributes. + * Lookup all KYC attributes above @a min_row_id. * * @param cls closure + * @param min_row_id minimum row ID to return (exclusive) * @param cb callback to invoke on each match * @param cb_cls closure for @a cb * @return database transaction status @@ -7510,6 +7511,7 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*select_all_kyc_attributes)( void *cls, + uint64_t min_row_id, TALER_EXCHANGEDB_AllAttributesCallback cb, void *cb_cls);