split up progress points of auditor by coin/reserve/aggregation to minimize DB conflicts
This commit is contained in:
parent
2024ccd2f9
commit
7b62deabac
@ -109,9 +109,19 @@ static struct GNUNET_TIME_Relative idle_reserve_expiration_time;
|
|||||||
static struct TALER_MasterPublicKeyP master_pub;
|
static struct TALER_MasterPublicKeyP master_pub;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last reserve_in serial ID seen.
|
* Checkpointing our progress for reserves.
|
||||||
*/
|
*/
|
||||||
static struct TALER_AUDITORDB_ProgressPoint pp;
|
static struct TALER_AUDITORDB_ProgressPointReserve ppr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checkpointing our progress for aggregations.
|
||||||
|
*/
|
||||||
|
static struct TALER_AUDITORDB_ProgressPointAggregation ppa;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checkpointing our progress for coins.
|
||||||
|
*/
|
||||||
|
static struct TALER_AUDITORDB_ProgressPointCoin ppc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of reports about denomination keys with an
|
* Array of reports about denomination keys with an
|
||||||
@ -773,8 +783,8 @@ handle_reserve_in (void *cls,
|
|||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
/* should be monotonically increasing */
|
/* should be monotonically increasing */
|
||||||
GNUNET_assert (rowid >= pp.last_reserve_in_serial_id);
|
GNUNET_assert (rowid >= ppr.last_reserve_in_serial_id);
|
||||||
pp.last_reserve_in_serial_id = rowid + 1;
|
ppr.last_reserve_in_serial_id = rowid + 1;
|
||||||
|
|
||||||
GNUNET_CRYPTO_hash (reserve_pub,
|
GNUNET_CRYPTO_hash (reserve_pub,
|
||||||
sizeof (*reserve_pub),
|
sizeof (*reserve_pub),
|
||||||
@ -861,8 +871,8 @@ handle_reserve_out (void *cls,
|
|||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
/* should be monotonically increasing */
|
/* should be monotonically increasing */
|
||||||
GNUNET_assert (rowid >= pp.last_reserve_out_serial_id);
|
GNUNET_assert (rowid >= ppr.last_reserve_out_serial_id);
|
||||||
pp.last_reserve_out_serial_id = rowid + 1;
|
ppr.last_reserve_out_serial_id = rowid + 1;
|
||||||
|
|
||||||
/* lookup denomination pub data (make sure denom_pub is valid, establish fees) */
|
/* lookup denomination pub data (make sure denom_pub is valid, establish fees) */
|
||||||
qs = get_denomination_info (denom_pub,
|
qs = get_denomination_info (denom_pub,
|
||||||
@ -1011,8 +1021,8 @@ handle_payback_by_reserve (void *cls,
|
|||||||
const char *rev;
|
const char *rev;
|
||||||
|
|
||||||
/* should be monotonically increasing */
|
/* should be monotonically increasing */
|
||||||
GNUNET_assert (rowid >= pp.last_reserve_payback_serial_id);
|
GNUNET_assert (rowid >= ppr.last_reserve_payback_serial_id);
|
||||||
pp.last_reserve_payback_serial_id = rowid + 1;
|
ppr.last_reserve_payback_serial_id = rowid + 1;
|
||||||
GNUNET_CRYPTO_rsa_public_key_hash (coin->denom_pub.rsa_public_key,
|
GNUNET_CRYPTO_rsa_public_key_hash (coin->denom_pub.rsa_public_key,
|
||||||
&pr.h_denom_pub);
|
&pr.h_denom_pub);
|
||||||
|
|
||||||
@ -1202,8 +1212,8 @@ handle_reserve_closed (void *cls,
|
|||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
/* should be monotonically increasing */
|
/* should be monotonically increasing */
|
||||||
GNUNET_assert (rowid >= pp.last_reserve_close_serial_id);
|
GNUNET_assert (rowid >= ppr.last_reserve_close_serial_id);
|
||||||
pp.last_reserve_close_serial_id = rowid + 1;
|
ppr.last_reserve_close_serial_id = rowid + 1;
|
||||||
|
|
||||||
GNUNET_CRYPTO_hash (reserve_pub,
|
GNUNET_CRYPTO_hash (reserve_pub,
|
||||||
sizeof (*reserve_pub),
|
sizeof (*reserve_pub),
|
||||||
@ -1507,9 +1517,33 @@ analyze_reserves (void *cls)
|
|||||||
struct ReserveContext rc;
|
struct ReserveContext rc;
|
||||||
enum GNUNET_DB_QueryStatus qsx;
|
enum GNUNET_DB_QueryStatus qsx;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
enum GNUNET_DB_QueryStatus qsp;
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Analyzing reserves\n");
|
"Analyzing reserves\n");
|
||||||
|
qsp = adb->get_auditor_progress_reserve (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppr);
|
||||||
|
if (0 > qsp)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
|
||||||
|
return qsp;
|
||||||
|
}
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
||||||
|
_("First analysis using this auditor, starting audit from scratch\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
_("Resuming reserve audit at %llu/%llu/%llu/%llu\n"),
|
||||||
|
(unsigned long long) ppr.last_reserve_in_serial_id,
|
||||||
|
(unsigned long long) ppr.last_reserve_out_serial_id,
|
||||||
|
(unsigned long long) ppr.last_reserve_payback_serial_id,
|
||||||
|
(unsigned long long) ppr.last_reserve_close_serial_id);
|
||||||
|
}
|
||||||
rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
rc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
qsx = adb->get_reserve_summary (adb->cls,
|
qsx = adb->get_reserve_summary (adb->cls,
|
||||||
asession,
|
asession,
|
||||||
@ -1528,7 +1562,7 @@ analyze_reserves (void *cls)
|
|||||||
|
|
||||||
qs = edb->select_reserves_in_above_serial_id (edb->cls,
|
qs = edb->select_reserves_in_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_reserve_in_serial_id,
|
ppr.last_reserve_in_serial_id,
|
||||||
&handle_reserve_in,
|
&handle_reserve_in,
|
||||||
&rc);
|
&rc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -1538,7 +1572,7 @@ analyze_reserves (void *cls)
|
|||||||
}
|
}
|
||||||
qs = edb->select_reserves_out_above_serial_id (edb->cls,
|
qs = edb->select_reserves_out_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_reserve_out_serial_id,
|
ppr.last_reserve_out_serial_id,
|
||||||
&handle_reserve_out,
|
&handle_reserve_out,
|
||||||
&rc);
|
&rc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -1548,7 +1582,7 @@ analyze_reserves (void *cls)
|
|||||||
}
|
}
|
||||||
qs = edb->select_payback_above_serial_id (edb->cls,
|
qs = edb->select_payback_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_reserve_payback_serial_id,
|
ppr.last_reserve_payback_serial_id,
|
||||||
&handle_payback_by_reserve,
|
&handle_payback_by_reserve,
|
||||||
&rc);
|
&rc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -1558,7 +1592,7 @@ analyze_reserves (void *cls)
|
|||||||
}
|
}
|
||||||
qs = edb->select_reserve_closed_above_serial_id (edb->cls,
|
qs = edb->select_reserve_closed_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_reserve_close_serial_id,
|
ppr.last_reserve_close_serial_id,
|
||||||
&handle_reserve_closed,
|
&handle_reserve_closed,
|
||||||
&rc);
|
&rc);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
@ -1599,6 +1633,29 @@ analyze_reserves (void *cls)
|
|||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
|
||||||
|
qs = adb->update_auditor_progress_reserve (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppr);
|
||||||
|
else
|
||||||
|
qs = adb->insert_auditor_progress_reserve (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppr);
|
||||||
|
if (0 >= qs)
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
"Failed to update auditor DB, not recording progress\n");
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
_("Concluded reserve audit step at %llu/%llu/%llu/%llu\n"),
|
||||||
|
(unsigned long long) ppr.last_reserve_in_serial_id,
|
||||||
|
(unsigned long long) ppr.last_reserve_out_serial_id,
|
||||||
|
(unsigned long long) ppr.last_reserve_payback_serial_id,
|
||||||
|
(unsigned long long) ppr.last_reserve_close_serial_id);
|
||||||
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2388,8 +2445,8 @@ check_wire_out_cb (void *cls,
|
|||||||
char *method;
|
char *method;
|
||||||
|
|
||||||
/* should be monotonically increasing */
|
/* should be monotonically increasing */
|
||||||
GNUNET_assert (rowid >= pp.last_wire_out_serial_id);
|
GNUNET_assert (rowid >= ppa.last_wire_out_serial_id);
|
||||||
pp.last_wire_out_serial_id = rowid + 1;
|
ppa.last_wire_out_serial_id = rowid + 1;
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Checking wire transfer %s over %s performed on %s\n",
|
"Checking wire transfer %s over %s performed on %s\n",
|
||||||
@ -2565,9 +2622,31 @@ analyze_aggregations (void *cls)
|
|||||||
struct WireFeeInfo *wfi;
|
struct WireFeeInfo *wfi;
|
||||||
enum GNUNET_DB_QueryStatus qsx;
|
enum GNUNET_DB_QueryStatus qsx;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
enum GNUNET_DB_QueryStatus qsp;
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Analyzing aggregations\n");
|
"Analyzing aggregations\n");
|
||||||
|
qsp = adb->get_auditor_progress_aggregation (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppa);
|
||||||
|
if (0 > qsp)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
|
||||||
|
return qsp;
|
||||||
|
}
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
||||||
|
_("First analysis using this auditor, starting audit from scratch\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
_("Resuming aggregation audit at %llu\n"),
|
||||||
|
(unsigned long long) ppa.last_wire_out_serial_id);
|
||||||
|
}
|
||||||
|
|
||||||
memset (&ac,
|
memset (&ac,
|
||||||
0,
|
0,
|
||||||
sizeof (ac));
|
sizeof (ac));
|
||||||
@ -2583,7 +2662,7 @@ analyze_aggregations (void *cls)
|
|||||||
ac.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
ac.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
qs = edb->select_wire_out_above_serial_id (edb->cls,
|
qs = edb->select_wire_out_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_wire_out_serial_id,
|
ppa.last_wire_out_serial_id,
|
||||||
&check_wire_out_cb,
|
&check_wire_out_cb,
|
||||||
&ac);
|
&ac);
|
||||||
if (0 > qs)
|
if (0 > qs)
|
||||||
@ -2627,6 +2706,27 @@ analyze_aggregations (void *cls)
|
|||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == ac.qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == ac.qs);
|
||||||
return ac.qs;
|
return ac.qs;
|
||||||
}
|
}
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
|
||||||
|
qs = adb->update_auditor_progress_aggregation (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppa);
|
||||||
|
else
|
||||||
|
qs = adb->insert_auditor_progress_aggregation (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppa);
|
||||||
|
if (0 >= qs)
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
"Failed to update auditor DB, not recording progress\n");
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
_("Concluded aggregation audit step at %llu\n"),
|
||||||
|
(unsigned long long) ppa.last_wire_out_serial_id);
|
||||||
|
|
||||||
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2925,8 +3025,8 @@ withdraw_cb (void *cls,
|
|||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
GNUNET_assert (rowid >= pp.last_withdraw_serial_id); /* should be monotonically increasing */
|
GNUNET_assert (rowid >= ppc.last_withdraw_serial_id); /* should be monotonically increasing */
|
||||||
pp.last_withdraw_serial_id = rowid + 1;
|
ppc.last_withdraw_serial_id = rowid + 1;
|
||||||
|
|
||||||
qs = get_denomination_info (denom_pub,
|
qs = get_denomination_info (denom_pub,
|
||||||
&dki,
|
&dki,
|
||||||
@ -3078,8 +3178,8 @@ refresh_session_cb (void *cls,
|
|||||||
struct TALER_Amount tmp;
|
struct TALER_Amount tmp;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
GNUNET_assert (rowid >= pp.last_melt_serial_id); /* should be monotonically increasing */
|
GNUNET_assert (rowid >= ppc.last_melt_serial_id); /* should be monotonically increasing */
|
||||||
pp.last_melt_serial_id = rowid + 1;
|
ppc.last_melt_serial_id = rowid + 1;
|
||||||
|
|
||||||
qs = get_denomination_info (denom_pub,
|
qs = get_denomination_info (denom_pub,
|
||||||
&dki,
|
&dki,
|
||||||
@ -3412,8 +3512,8 @@ deposit_cb (void *cls,
|
|||||||
struct TALER_Amount tmp;
|
struct TALER_Amount tmp;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
GNUNET_assert (rowid >= pp.last_deposit_serial_id); /* should be monotonically increasing */
|
GNUNET_assert (rowid >= ppc.last_deposit_serial_id); /* should be monotonically increasing */
|
||||||
pp.last_deposit_serial_id = rowid + 1;
|
ppc.last_deposit_serial_id = rowid + 1;
|
||||||
|
|
||||||
qs = get_denomination_info (denom_pub,
|
qs = get_denomination_info (denom_pub,
|
||||||
&dki,
|
&dki,
|
||||||
@ -3562,8 +3662,8 @@ refund_cb (void *cls,
|
|||||||
struct TALER_Amount refund_fee;
|
struct TALER_Amount refund_fee;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
GNUNET_assert (rowid >= pp.last_refund_serial_id); /* should be monotonically increasing */
|
GNUNET_assert (rowid >= ppc.last_refund_serial_id); /* should be monotonically increasing */
|
||||||
pp.last_refund_serial_id = rowid + 1;
|
ppc.last_refund_serial_id = rowid + 1;
|
||||||
|
|
||||||
qs = get_denomination_info (denom_pub,
|
qs = get_denomination_info (denom_pub,
|
||||||
&dki,
|
&dki,
|
||||||
@ -3702,9 +3802,34 @@ analyze_coins (void *cls)
|
|||||||
struct CoinContext cc;
|
struct CoinContext cc;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
enum GNUNET_DB_QueryStatus qsx;
|
enum GNUNET_DB_QueryStatus qsx;
|
||||||
|
enum GNUNET_DB_QueryStatus qsp;
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||||
"Analyzing coins\n");
|
"Analyzing coins\n");
|
||||||
|
qsp = adb->get_auditor_progress_coin (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppc);
|
||||||
|
if (0 > qsp)
|
||||||
|
{
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsp);
|
||||||
|
return qsp;
|
||||||
|
}
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsp)
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
||||||
|
_("First analysis using this auditor, starting audit from scratch\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
_("Resuming coin audit at %llu/%llu/%llu/%llu\n"),
|
||||||
|
(unsigned long long) ppc.last_deposit_serial_id,
|
||||||
|
(unsigned long long) ppc.last_melt_serial_id,
|
||||||
|
(unsigned long long) ppc.last_refund_serial_id,
|
||||||
|
(unsigned long long) ppc.last_withdraw_serial_id);
|
||||||
|
}
|
||||||
|
|
||||||
/* setup 'cc' */
|
/* setup 'cc' */
|
||||||
cc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
cc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
|
||||||
cc.denom_summaries = GNUNET_CONTAINER_multihashmap_create (256,
|
cc.denom_summaries = GNUNET_CONTAINER_multihashmap_create (256,
|
||||||
@ -3727,7 +3852,7 @@ analyze_coins (void *cls)
|
|||||||
if (0 >
|
if (0 >
|
||||||
(qs = edb->select_reserves_out_above_serial_id (edb->cls,
|
(qs = edb->select_reserves_out_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_withdraw_serial_id,
|
ppc.last_withdraw_serial_id,
|
||||||
&withdraw_cb,
|
&withdraw_cb,
|
||||||
&cc)) )
|
&cc)) )
|
||||||
{
|
{
|
||||||
@ -3739,7 +3864,7 @@ analyze_coins (void *cls)
|
|||||||
if (0 >
|
if (0 >
|
||||||
(qs = edb->select_refunds_above_serial_id (edb->cls,
|
(qs = edb->select_refunds_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_refund_serial_id,
|
ppc.last_refund_serial_id,
|
||||||
&refund_cb,
|
&refund_cb,
|
||||||
&cc)))
|
&cc)))
|
||||||
{
|
{
|
||||||
@ -3751,7 +3876,7 @@ analyze_coins (void *cls)
|
|||||||
if (0 >
|
if (0 >
|
||||||
(qs = edb->select_refreshs_above_serial_id (edb->cls,
|
(qs = edb->select_refreshs_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_melt_serial_id,
|
ppc.last_melt_serial_id,
|
||||||
&refresh_session_cb,
|
&refresh_session_cb,
|
||||||
&cc)))
|
&cc)))
|
||||||
{
|
{
|
||||||
@ -3763,7 +3888,7 @@ analyze_coins (void *cls)
|
|||||||
if (0 >
|
if (0 >
|
||||||
(qs = edb->select_deposits_above_serial_id (edb->cls,
|
(qs = edb->select_deposits_above_serial_id (edb->cls,
|
||||||
esession,
|
esession,
|
||||||
pp.last_deposit_serial_id,
|
ppc.last_deposit_serial_id,
|
||||||
&deposit_cb,
|
&deposit_cb,
|
||||||
&cc)))
|
&cc)))
|
||||||
{
|
{
|
||||||
@ -3805,6 +3930,30 @@ analyze_coins (void *cls)
|
|||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsp)
|
||||||
|
qs = adb->update_auditor_progress_coin (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppc);
|
||||||
|
else
|
||||||
|
qs = adb->insert_auditor_progress_coin (adb->cls,
|
||||||
|
asession,
|
||||||
|
&master_pub,
|
||||||
|
&ppc);
|
||||||
|
if (0 >= qs)
|
||||||
|
{
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
"Failed to update auditor DB, not recording progress\n");
|
||||||
|
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
|
_("Concluded coin audit step at %llu/%llu/%llu/%llu\n"),
|
||||||
|
(unsigned long long) ppc.last_deposit_serial_id,
|
||||||
|
(unsigned long long) ppc.last_melt_serial_id,
|
||||||
|
(unsigned long long) ppc.last_refund_serial_id,
|
||||||
|
(unsigned long long) ppc.last_withdraw_serial_id);
|
||||||
return qs;
|
return qs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3822,88 +3971,6 @@ typedef enum GNUNET_DB_QueryStatus
|
|||||||
(*Analysis)(void *cls);
|
(*Analysis)(void *cls);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform the given @a analysis incrementally, checkpointing our
|
|
||||||
* progress in the auditor DB.
|
|
||||||
*
|
|
||||||
* @param analysis analysis to run
|
|
||||||
* @param analysis_cls closure for @a analysis
|
|
||||||
* @return transaction status code
|
|
||||||
*/
|
|
||||||
static enum GNUNET_DB_QueryStatus
|
|
||||||
incremental_processing (Analysis analysis,
|
|
||||||
void *analysis_cls)
|
|
||||||
{
|
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
|
||||||
enum GNUNET_DB_QueryStatus qsx;
|
|
||||||
|
|
||||||
qsx = adb->get_auditor_progress (adb->cls,
|
|
||||||
asession,
|
|
||||||
&master_pub,
|
|
||||||
&pp);
|
|
||||||
if (0 > qsx)
|
|
||||||
{
|
|
||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
|
|
||||||
return qsx;
|
|
||||||
}
|
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qsx)
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
|
|
||||||
_("First analysis using this auditor, starting audit from scratch\n"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
|
||||||
_("Resuming audit at %llu/%llu/%llu/%llu/%llu/%llu/%llu\n"),
|
|
||||||
(unsigned long long) pp.last_reserve_in_serial_id,
|
|
||||||
(unsigned long long) pp.last_reserve_out_serial_id,
|
|
||||||
(unsigned long long) pp.last_withdraw_serial_id,
|
|
||||||
(unsigned long long) pp.last_deposit_serial_id,
|
|
||||||
(unsigned long long) pp.last_melt_serial_id,
|
|
||||||
(unsigned long long) pp.last_refund_serial_id,
|
|
||||||
(unsigned long long) pp.last_wire_out_serial_id);
|
|
||||||
}
|
|
||||||
qs = analysis (analysis_cls);
|
|
||||||
if (0 > qs)
|
|
||||||
{
|
|
||||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
|
||||||
"Serialization issue, not recording progress\n");
|
|
||||||
else
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
|
||||||
"Hard database error, not recording progress\n");
|
|
||||||
return qs;
|
|
||||||
}
|
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qsx)
|
|
||||||
qs = adb->update_auditor_progress (adb->cls,
|
|
||||||
asession,
|
|
||||||
&master_pub,
|
|
||||||
&pp);
|
|
||||||
else
|
|
||||||
qs = adb->insert_auditor_progress (adb->cls,
|
|
||||||
asession,
|
|
||||||
&master_pub,
|
|
||||||
&pp);
|
|
||||||
if (0 >= qs)
|
|
||||||
{
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
|
||||||
"Failed to update auditor DB, not recording progress\n");
|
|
||||||
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
|
|
||||||
return qs;
|
|
||||||
}
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
|
||||||
_("Concluded audit step at %llu/%llu/%llu/%llu/%llu/%llu/%llu\n\n"),
|
|
||||||
(unsigned long long) pp.last_reserve_in_serial_id,
|
|
||||||
(unsigned long long) pp.last_reserve_out_serial_id,
|
|
||||||
(unsigned long long) pp.last_withdraw_serial_id,
|
|
||||||
(unsigned long long) pp.last_deposit_serial_id,
|
|
||||||
(unsigned long long) pp.last_melt_serial_id,
|
|
||||||
(unsigned long long) pp.last_refund_serial_id,
|
|
||||||
(unsigned long long) pp.last_wire_out_serial_id);
|
|
||||||
return qs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the given @a analysis within a transaction scope.
|
* Perform the given @a analysis within a transaction scope.
|
||||||
* Commit on success.
|
* Commit on success.
|
||||||
@ -3938,8 +4005,7 @@ transact (Analysis analysis,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
qs = incremental_processing (analysis,
|
qs = analysis (analysis_cls);
|
||||||
analysis_cls);
|
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
|
||||||
{
|
{
|
||||||
qs = edb->commit (edb->cls,
|
qs = edb->commit (edb->cls,
|
||||||
|
@ -147,7 +147,9 @@ postgres_drop_tables (void *cls)
|
|||||||
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_reserve_balance;"),
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_reserve_balance;"),
|
||||||
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_wire_fee_balance;"),
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_wire_fee_balance;"),
|
||||||
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_reserves;"),
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_reserves;"),
|
||||||
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress;"),
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_reserve;"),
|
||||||
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_aggregation;"),
|
||||||
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_coin;"),
|
||||||
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_auditor_progress;"),
|
GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_auditor_progress;"),
|
||||||
GNUNET_PQ_EXECUTE_STATEMENT_END
|
GNUNET_PQ_EXECUTE_STATEMENT_END
|
||||||
};
|
};
|
||||||
@ -206,28 +208,37 @@ postgres_create_tables (void *cls)
|
|||||||
",fee_refund_frac INT4 NOT NULL"
|
",fee_refund_frac INT4 NOT NULL"
|
||||||
",fee_refund_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
",fee_refund_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
||||||
")"),
|
")"),
|
||||||
|
/* List of exchanges audited by this auditor */
|
||||||
|
// TODO: not yet used!
|
||||||
|
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS exchanges"
|
||||||
|
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
||||||
|
",exchange_url VARCHAR NOT NULL"
|
||||||
|
")"),
|
||||||
|
|
||||||
/* Table indicating up to which transactions the auditor has
|
/* Table indicating up to which transactions the auditor has
|
||||||
processed the exchange database. Used for SELECTing the
|
processed the exchange database. Used for SELECTing the
|
||||||
statements to process. We basically trace the exchange's
|
statements to process. The indices below include the last
|
||||||
operations by the 6 primary tables: reserves_in,
|
serial ID from the respective tables that we have
|
||||||
reserves_out, deposits, refresh_sessions, refunds and prewire. The
|
processed. Thus, we need to select those table entries that are
|
||||||
other tables of the exchange DB just provide supporting
|
strictly larger (and process in monotonically increasing
|
||||||
evidence which is checked alongside the audit of these
|
order). */
|
||||||
five tables. The 6 indices below include the last serial
|
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS auditor_progress_reserve"
|
||||||
ID from the respective tables that we have processed. Thus,
|
|
||||||
we need to select those table entries that are strictly
|
|
||||||
larger (and process in monotonically increasing order). */
|
|
||||||
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS auditor_progress"
|
|
||||||
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
||||||
",last_reserve_in_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_reserve_in_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_reserve_out_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_reserve_out_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_reserve_payback_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_reserve_payback_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_reserve_close_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_reserve_close_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
|
")"),
|
||||||
|
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS auditor_progress_aggregation"
|
||||||
|
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
||||||
|
",last_wire_out_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
|
")"),
|
||||||
|
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS auditor_progress_coin"
|
||||||
|
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
||||||
",last_withdraw_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_withdraw_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_deposit_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_deposit_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_melt_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_melt_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_refund_serial_id INT8 NOT NULL DEFAULT 0"
|
",last_refund_serial_id INT8 NOT NULL DEFAULT 0"
|
||||||
",last_wire_out_serial_id INT8 NOT NULL DEFAULT 0"
|
|
||||||
")"),
|
")"),
|
||||||
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS wire_auditor_progress"
|
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS wire_auditor_progress"
|
||||||
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
|
||||||
@ -494,7 +505,7 @@ postgres_prepare (PGconn *db_conn)
|
|||||||
" FROM auditor_denominations"
|
" FROM auditor_denominations"
|
||||||
" WHERE master_pub=$1;",
|
" WHERE master_pub=$1;",
|
||||||
1),
|
1),
|
||||||
/* Used in #postgres_insert_auditor_progress() */
|
/* Used in #postgres_insert_deposit_confirmation() */
|
||||||
GNUNET_PQ_make_prepare ("auditor_deposit_confirmation_insert",
|
GNUNET_PQ_make_prepare ("auditor_deposit_confirmation_insert",
|
||||||
"INSERT INTO deposit_confirmations "
|
"INSERT INTO deposit_confirmations "
|
||||||
"(master_pub"
|
"(master_pub"
|
||||||
@ -512,50 +523,84 @@ postgres_prepare (PGconn *db_conn)
|
|||||||
",master_sig" /* master_sig could be normalized... */
|
",master_sig" /* master_sig could be normalized... */
|
||||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);",
|
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13);",
|
||||||
11),
|
11),
|
||||||
/* Used in #postgres_insert_auditor_progress() */
|
/* Used in #postgres_update_auditor_progress_reserve() */
|
||||||
GNUNET_PQ_make_prepare ("auditor_progress_insert",
|
GNUNET_PQ_make_prepare ("auditor_progress_update_reserve",
|
||||||
"INSERT INTO auditor_progress "
|
"UPDATE auditor_progress_reserve SET "
|
||||||
"(master_pub"
|
|
||||||
",last_reserve_in_serial_id"
|
|
||||||
",last_reserve_out_serial_id"
|
|
||||||
",last_reserve_payback_serial_id"
|
|
||||||
",last_reserve_close_serial_id"
|
|
||||||
",last_withdraw_serial_id"
|
|
||||||
",last_deposit_serial_id"
|
|
||||||
",last_melt_serial_id"
|
|
||||||
",last_refund_serial_id"
|
|
||||||
",last_wire_out_serial_id"
|
|
||||||
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10);",
|
|
||||||
10),
|
|
||||||
/* Used in #postgres_update_auditor_progress() */
|
|
||||||
GNUNET_PQ_make_prepare ("auditor_progress_update",
|
|
||||||
"UPDATE auditor_progress SET "
|
|
||||||
" last_reserve_in_serial_id=$1"
|
" last_reserve_in_serial_id=$1"
|
||||||
",last_reserve_out_serial_id=$2"
|
",last_reserve_out_serial_id=$2"
|
||||||
",last_reserve_payback_serial_id=$3"
|
",last_reserve_payback_serial_id=$3"
|
||||||
",last_reserve_close_serial_id=$4"
|
",last_reserve_close_serial_id=$4"
|
||||||
",last_withdraw_serial_id=$5"
|
" WHERE master_pub=$5",
|
||||||
",last_deposit_serial_id=$6"
|
5),
|
||||||
",last_melt_serial_id=$7"
|
/* Used in #postgres_get_auditor_progress_reserve() */
|
||||||
",last_refund_serial_id=$8"
|
GNUNET_PQ_make_prepare ("auditor_progress_select_reserve",
|
||||||
",last_wire_out_serial_id=$9"
|
|
||||||
" WHERE master_pub=$10",
|
|
||||||
10),
|
|
||||||
/* Used in #postgres_get_auditor_progress() */
|
|
||||||
GNUNET_PQ_make_prepare ("auditor_progress_select",
|
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" last_reserve_in_serial_id"
|
" last_reserve_in_serial_id"
|
||||||
",last_reserve_out_serial_id"
|
",last_reserve_out_serial_id"
|
||||||
",last_reserve_payback_serial_id"
|
",last_reserve_payback_serial_id"
|
||||||
",last_reserve_close_serial_id"
|
",last_reserve_close_serial_id"
|
||||||
|
" FROM auditor_progress_reserve"
|
||||||
|
" WHERE master_pub=$1;",
|
||||||
|
1),
|
||||||
|
/* Used in #postgres_insert_auditor_progress_reserve() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_insert_reserve",
|
||||||
|
"INSERT INTO auditor_progress_reserve "
|
||||||
|
"(master_pub"
|
||||||
|
",last_reserve_in_serial_id"
|
||||||
|
",last_reserve_out_serial_id"
|
||||||
|
",last_reserve_payback_serial_id"
|
||||||
|
",last_reserve_close_serial_id"
|
||||||
|
") VALUES ($1,$2,$3,$4,$5);",
|
||||||
|
5),
|
||||||
|
/* Used in #postgres_update_auditor_progress_aggregation() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_update_aggregation",
|
||||||
|
"UPDATE auditor_progress_aggregation SET "
|
||||||
|
" last_wire_out_serial_id=$1"
|
||||||
|
" WHERE master_pub=$2",
|
||||||
|
2),
|
||||||
|
/* Used in #postgres_get_auditor_progress_aggregation() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_select_aggregation",
|
||||||
|
"SELECT"
|
||||||
|
" last_wire_out_serial_id"
|
||||||
|
" FROM auditor_progress_aggregation"
|
||||||
|
" WHERE master_pub=$1;",
|
||||||
|
1),
|
||||||
|
/* Used in #postgres_insert_auditor_progress_aggregation() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_insert_aggregation",
|
||||||
|
"INSERT INTO auditor_progress_aggregation "
|
||||||
|
"(master_pub"
|
||||||
|
",last_wire_out_serial_id"
|
||||||
|
") VALUES ($1,$2);",
|
||||||
|
2),
|
||||||
|
/* Used in #postgres_update_auditor_progress_coin() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_update_coin",
|
||||||
|
"UPDATE auditor_progress_coin SET "
|
||||||
|
" last_withdraw_serial_id=$1"
|
||||||
|
",last_deposit_serial_id=$2"
|
||||||
|
",last_melt_serial_id=$3"
|
||||||
|
",last_refund_serial_id=$4"
|
||||||
|
" WHERE master_pub=$5",
|
||||||
|
4),
|
||||||
|
/* Used in #postgres_get_auditor_progress_coin() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_select_coin",
|
||||||
|
"SELECT"
|
||||||
|
" last_withdraw_serial_id"
|
||||||
|
",last_deposit_serial_id"
|
||||||
|
",last_melt_serial_id"
|
||||||
|
",last_refund_serial_id"
|
||||||
|
" FROM auditor_progress_coin"
|
||||||
|
" WHERE master_pub=$1;",
|
||||||
|
1),
|
||||||
|
/* Used in #postgres_insert_auditor_progress() */
|
||||||
|
GNUNET_PQ_make_prepare ("auditor_progress_insert_coin",
|
||||||
|
"INSERT INTO auditor_progress_coin "
|
||||||
|
"(master_pub"
|
||||||
",last_withdraw_serial_id"
|
",last_withdraw_serial_id"
|
||||||
",last_deposit_serial_id"
|
",last_deposit_serial_id"
|
||||||
",last_melt_serial_id"
|
",last_melt_serial_id"
|
||||||
",last_refund_serial_id"
|
",last_refund_serial_id"
|
||||||
",last_wire_out_serial_id"
|
") VALUES ($1,$2,$3,$4,$5);",
|
||||||
" FROM auditor_progress"
|
5),
|
||||||
" WHERE master_pub=$1;",
|
|
||||||
1),
|
|
||||||
/* Used in #postgres_insert_wire_auditor_progress() */
|
/* Used in #postgres_insert_wire_auditor_progress() */
|
||||||
GNUNET_PQ_make_prepare ("wire_auditor_progress_insert",
|
GNUNET_PQ_make_prepare ("wire_auditor_progress_insert",
|
||||||
"INSERT INTO wire_auditor_progress "
|
"INSERT INTO wire_auditor_progress "
|
||||||
@ -1296,31 +1341,26 @@ postgres_select_denomination_info (void *cls,
|
|||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param session connection to use
|
* @param session connection to use
|
||||||
* @param master_pub master key of the exchange
|
* @param master_pub master key of the exchange
|
||||||
* @param pp where is the auditor in processing
|
* @param ppr where is the auditor in processing
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_insert_auditor_progress (void *cls,
|
postgres_insert_auditor_progress_reserve (void *cls,
|
||||||
struct TALER_AUDITORDB_Session *session,
|
struct TALER_AUDITORDB_Session *session,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
const struct TALER_AUDITORDB_ProgressPoint *pp)
|
const struct TALER_AUDITORDB_ProgressPointReserve *ppr)
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_in_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_out_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_payback_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_payback_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_withdraw_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_wire_out_serial_id),
|
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
"auditor_progress_insert",
|
"auditor_progress_insert_reserve",
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,31 +1372,26 @@ postgres_insert_auditor_progress (void *cls,
|
|||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param session connection to use
|
* @param session connection to use
|
||||||
* @param master_pub master key of the exchange
|
* @param master_pub master key of the exchange
|
||||||
* @param pp where is the auditor in processing
|
* @param ppr where is the auditor in processing
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_update_auditor_progress (void *cls,
|
postgres_update_auditor_progress_reserve (void *cls,
|
||||||
struct TALER_AUDITORDB_Session *session,
|
struct TALER_AUDITORDB_Session *session,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
const struct TALER_AUDITORDB_ProgressPoint *pp)
|
const struct TALER_AUDITORDB_ProgressPointReserve *ppr)
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_in_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_in_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_out_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_out_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_payback_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_payback_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_reserve_close_serial_id),
|
GNUNET_PQ_query_param_uint64 (&ppr->last_reserve_close_serial_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_withdraw_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_deposit_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_melt_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_refund_serial_id),
|
|
||||||
GNUNET_PQ_query_param_uint64 (&pp->last_wire_out_serial_id),
|
|
||||||
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
"auditor_progress_update",
|
"auditor_progress_update_reserve",
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1367,14 +1402,14 @@ postgres_update_auditor_progress (void *cls,
|
|||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param session connection to use
|
* @param session connection to use
|
||||||
* @param master_pub master key of the exchange
|
* @param master_pub master key of the exchange
|
||||||
* @param[out] pp set to where the auditor is in processing
|
* @param[out] ppr set to where the auditor is in processing
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_get_auditor_progress (void *cls,
|
postgres_get_auditor_progress_reserve (void *cls,
|
||||||
struct TALER_AUDITORDB_Session *session,
|
struct TALER_AUDITORDB_Session *session,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
struct TALER_AUDITORDB_ProgressPoint *pp)
|
struct TALER_AUDITORDB_ProgressPointReserve *ppr)
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
@ -1382,28 +1417,206 @@ postgres_get_auditor_progress (void *cls,
|
|||||||
};
|
};
|
||||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_reserve_in_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_reserve_in_serial_id",
|
||||||
&pp->last_reserve_in_serial_id),
|
&ppr->last_reserve_in_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_reserve_out_serial_id",
|
||||||
&pp->last_reserve_out_serial_id),
|
&ppr->last_reserve_out_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_reserve_payback_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_reserve_payback_serial_id",
|
||||||
&pp->last_reserve_payback_serial_id),
|
&ppr->last_reserve_payback_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_reserve_close_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("last_reserve_close_serial_id",
|
||||||
&pp->last_reserve_close_serial_id),
|
&ppr->last_reserve_close_serial_id),
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_withdraw_serial_id",
|
|
||||||
&pp->last_withdraw_serial_id),
|
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_deposit_serial_id",
|
|
||||||
&pp->last_deposit_serial_id),
|
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_melt_serial_id",
|
|
||||||
&pp->last_melt_serial_id),
|
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id",
|
|
||||||
&pp->last_refund_serial_id),
|
|
||||||
GNUNET_PQ_result_spec_uint64 ("last_wire_out_serial_id",
|
|
||||||
&pp->last_wire_out_serial_id),
|
|
||||||
GNUNET_PQ_result_spec_end
|
GNUNET_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
|
|
||||||
return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
|
return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
|
||||||
"auditor_progress_select",
|
"auditor_progress_select_reserve",
|
||||||
|
params,
|
||||||
|
rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert information about the auditor's progress with an exchange's
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppa where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
static enum GNUNET_DB_QueryStatus
|
||||||
|
postgres_insert_auditor_progress_aggregation (void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointAggregation *ppa)
|
||||||
|
{
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppa->last_wire_out_serial_id),
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
|
||||||
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
|
"auditor_progress_insert_aggregation",
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update information about the progress of the auditor. There
|
||||||
|
* must be an existing record for the exchange.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppa where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
static enum GNUNET_DB_QueryStatus
|
||||||
|
postgres_update_auditor_progress_aggregation (void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointAggregation *ppa)
|
||||||
|
{
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppa->last_wire_out_serial_id),
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
|
||||||
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
|
"auditor_progress_update_aggregation",
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about the progress of the auditor.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param[out] ppa set to where the auditor is in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
static enum GNUNET_DB_QueryStatus
|
||||||
|
postgres_get_auditor_progress_aggregation (void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
struct TALER_AUDITORDB_ProgressPointAggregation *ppa)
|
||||||
|
{
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("last_wire_out_serial_id",
|
||||||
|
&ppa->last_wire_out_serial_id),
|
||||||
|
GNUNET_PQ_result_spec_end
|
||||||
|
};
|
||||||
|
|
||||||
|
return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
|
||||||
|
"auditor_progress_select_aggregation",
|
||||||
|
params,
|
||||||
|
rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert information about the auditor's progress with an exchange's
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppc where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
static enum GNUNET_DB_QueryStatus
|
||||||
|
postgres_insert_auditor_progress_coin (void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointCoin *ppc)
|
||||||
|
{
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_withdraw_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_melt_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id),
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
|
||||||
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
|
"auditor_progress_insert_coin",
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update information about the progress of the auditor. There
|
||||||
|
* must be an existing record for the exchange.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppc where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
static enum GNUNET_DB_QueryStatus
|
||||||
|
postgres_update_auditor_progress_coin (void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointCoin *ppc)
|
||||||
|
{
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_withdraw_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_deposit_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_melt_serial_id),
|
||||||
|
GNUNET_PQ_query_param_uint64 (&ppc->last_refund_serial_id),
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
|
||||||
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
|
"auditor_progress_update_coin",
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about the progress of the auditor.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param[out] ppc set to where the auditor is in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
static enum GNUNET_DB_QueryStatus
|
||||||
|
postgres_get_auditor_progress_coin (void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
struct TALER_AUDITORDB_ProgressPointCoin *ppc)
|
||||||
|
{
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_auto_from_type (master_pub),
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("last_withdraw_serial_id",
|
||||||
|
&ppc->last_withdraw_serial_id),
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("last_deposit_serial_id",
|
||||||
|
&ppc->last_deposit_serial_id),
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("last_melt_serial_id",
|
||||||
|
&ppc->last_melt_serial_id),
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("last_refund_serial_id",
|
||||||
|
&ppc->last_refund_serial_id),
|
||||||
|
GNUNET_PQ_result_spec_end
|
||||||
|
};
|
||||||
|
|
||||||
|
return GNUNET_PQ_eval_prepared_singleton_select (session->conn,
|
||||||
|
"auditor_progress_select_coin",
|
||||||
params,
|
params,
|
||||||
rs);
|
rs);
|
||||||
}
|
}
|
||||||
@ -2702,9 +2915,15 @@ libtaler_plugin_auditordb_postgres_init (void *cls)
|
|||||||
plugin->select_denomination_info = &postgres_select_denomination_info;
|
plugin->select_denomination_info = &postgres_select_denomination_info;
|
||||||
plugin->insert_denomination_info = &postgres_insert_denomination_info;
|
plugin->insert_denomination_info = &postgres_insert_denomination_info;
|
||||||
|
|
||||||
plugin->get_auditor_progress = &postgres_get_auditor_progress;
|
plugin->get_auditor_progress_reserve = &postgres_get_auditor_progress_reserve;
|
||||||
plugin->update_auditor_progress = &postgres_update_auditor_progress;
|
plugin->update_auditor_progress_reserve = &postgres_update_auditor_progress_reserve;
|
||||||
plugin->insert_auditor_progress = &postgres_insert_auditor_progress;
|
plugin->insert_auditor_progress_reserve = &postgres_insert_auditor_progress_reserve;
|
||||||
|
plugin->get_auditor_progress_aggregation = &postgres_get_auditor_progress_aggregation;
|
||||||
|
plugin->update_auditor_progress_aggregation = &postgres_update_auditor_progress_aggregation;
|
||||||
|
plugin->insert_auditor_progress_aggregation = &postgres_insert_auditor_progress_aggregation;
|
||||||
|
plugin->get_auditor_progress_coin = &postgres_get_auditor_progress_coin;
|
||||||
|
plugin->update_auditor_progress_coin = &postgres_update_auditor_progress_coin;
|
||||||
|
plugin->insert_auditor_progress_coin = &postgres_insert_auditor_progress_coin;
|
||||||
|
|
||||||
plugin->get_wire_auditor_progress = &postgres_get_wire_auditor_progress;
|
plugin->get_wire_auditor_progress = &postgres_get_wire_auditor_progress;
|
||||||
plugin->update_wire_auditor_progress = &postgres_update_wire_auditor_progress;
|
plugin->update_wire_auditor_progress = &postgres_update_wire_auditor_progress;
|
||||||
|
@ -215,58 +215,50 @@ run (void *cls)
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Test: insert_auditor_progress\n");
|
"Test: insert_auditor_progress\n");
|
||||||
|
|
||||||
struct TALER_AUDITORDB_ProgressPoint pp = {
|
struct TALER_AUDITORDB_ProgressPointCoin ppc = {
|
||||||
.last_reserve_in_serial_id = 1234,
|
|
||||||
.last_reserve_out_serial_id = 5678,
|
|
||||||
.last_deposit_serial_id = 123,
|
.last_deposit_serial_id = 123,
|
||||||
.last_melt_serial_id = 456,
|
.last_melt_serial_id = 456,
|
||||||
.last_refund_serial_id = 789,
|
.last_refund_serial_id = 789,
|
||||||
.last_wire_out_serial_id = 555
|
.last_withdraw_serial_id = 555
|
||||||
};
|
};
|
||||||
struct TALER_AUDITORDB_ProgressPoint pp2 = {
|
struct TALER_AUDITORDB_ProgressPointCoin ppc2 = {
|
||||||
.last_reserve_in_serial_id = 0,
|
|
||||||
.last_reserve_out_serial_id = 0,
|
|
||||||
.last_deposit_serial_id = 0,
|
.last_deposit_serial_id = 0,
|
||||||
.last_melt_serial_id = 0,
|
.last_melt_serial_id = 0,
|
||||||
.last_refund_serial_id = 0,
|
.last_refund_serial_id = 0,
|
||||||
.last_wire_out_serial_id = 0
|
.last_withdraw_serial_id = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->insert_auditor_progress (plugin->cls,
|
plugin->insert_auditor_progress_coin (plugin->cls,
|
||||||
session,
|
session,
|
||||||
&master_pub,
|
&master_pub,
|
||||||
&pp));
|
&ppc));
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Test: update_auditor_progress\n");
|
"Test: update_auditor_progress\n");
|
||||||
|
|
||||||
pp.last_reserve_in_serial_id++;
|
ppc.last_deposit_serial_id++;
|
||||||
pp.last_reserve_out_serial_id++;
|
ppc.last_melt_serial_id++;
|
||||||
pp.last_deposit_serial_id++;
|
ppc.last_refund_serial_id++;
|
||||||
pp.last_melt_serial_id++;
|
ppc.last_withdraw_serial_id++;
|
||||||
pp.last_refund_serial_id++;
|
|
||||||
pp.last_wire_out_serial_id++;
|
|
||||||
|
|
||||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->update_auditor_progress (plugin->cls,
|
plugin->update_auditor_progress_coin (plugin->cls,
|
||||||
session,
|
session,
|
||||||
&master_pub,
|
&master_pub,
|
||||||
&pp));
|
&ppc));
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Test: get_auditor_progress\n");
|
"Test: get_auditor_progress\n");
|
||||||
|
|
||||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->get_auditor_progress (plugin->cls,
|
plugin->get_auditor_progress_coin (plugin->cls,
|
||||||
session,
|
session,
|
||||||
&master_pub,
|
&master_pub,
|
||||||
&pp2));
|
&ppc2));
|
||||||
FAILIF ( (pp.last_reserve_in_serial_id != pp2.last_reserve_in_serial_id) ||
|
FAILIF ( (ppc.last_deposit_serial_id != ppc2.last_deposit_serial_id) ||
|
||||||
(pp.last_reserve_out_serial_id != pp2.last_reserve_out_serial_id) ||
|
(ppc.last_melt_serial_id != ppc2.last_melt_serial_id) ||
|
||||||
(pp.last_deposit_serial_id != pp2.last_deposit_serial_id) ||
|
(ppc.last_refund_serial_id != ppc2.last_refund_serial_id) ||
|
||||||
(pp.last_melt_serial_id != pp2.last_melt_serial_id) ||
|
(ppc.last_withdraw_serial_id != ppc2.last_withdraw_serial_id) );
|
||||||
(pp.last_refund_serial_id != pp2.last_refund_serial_id) ||
|
|
||||||
(pp.last_wire_out_serial_id != pp2.last_wire_out_serial_id) );
|
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Test: insert_reserve_info\n");
|
"Test: insert_reserve_info\n");
|
||||||
@ -399,10 +391,10 @@ run (void *cls)
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Test: update_denomination_balance\n");
|
"Test: update_denomination_balance\n");
|
||||||
|
|
||||||
pp.last_reserve_out_serial_id++;
|
ppc.last_withdraw_serial_id++;
|
||||||
pp.last_deposit_serial_id++;
|
ppc.last_deposit_serial_id++;
|
||||||
pp.last_melt_serial_id++;
|
ppc.last_melt_serial_id++;
|
||||||
pp.last_refund_serial_id++;
|
ppc.last_refund_serial_id++;
|
||||||
|
|
||||||
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->update_denomination_balance (plugin->cls,
|
plugin->update_denomination_balance (plugin->cls,
|
||||||
|
@ -131,10 +131,10 @@ struct TALER_AUDITORDB_WireProgressPoint
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure for remembering the auditor's progress over the
|
* Structure for remembering the auditor's progress over the various
|
||||||
* various tables and (auditor) transactions.
|
* tables and (auditor) transactions when analyzing reserves.
|
||||||
*/
|
*/
|
||||||
struct TALER_AUDITORDB_ProgressPoint
|
struct TALER_AUDITORDB_ProgressPointReserve
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* last_reserve_in_serial_id serial ID of the last reserve_in transfer the auditor processed
|
* last_reserve_in_serial_id serial ID of the last reserve_in transfer the auditor processed
|
||||||
@ -158,6 +158,29 @@ struct TALER_AUDITORDB_ProgressPoint
|
|||||||
*/
|
*/
|
||||||
uint64_t last_reserve_close_serial_id;
|
uint64_t last_reserve_close_serial_id;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure for remembering the auditor's progress over the various
|
||||||
|
* tables and (auditor) transactions when analyzing aggregations.
|
||||||
|
*/
|
||||||
|
struct TALER_AUDITORDB_ProgressPointAggregation
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* last_prewire_serial_id serial ID of the last prewire transfer the auditor processed
|
||||||
|
*/
|
||||||
|
uint64_t last_wire_out_serial_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure for remembering the auditor's progress over the various
|
||||||
|
* tables and (auditor) transactions when analyzing coins.
|
||||||
|
*/
|
||||||
|
struct TALER_AUDITORDB_ProgressPointCoin
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* last_reserve_out_serial_id serial ID of the last withdraw the auditor processed
|
* last_reserve_out_serial_id serial ID of the last withdraw the auditor processed
|
||||||
*/
|
*/
|
||||||
@ -178,11 +201,6 @@ struct TALER_AUDITORDB_ProgressPoint
|
|||||||
*/
|
*/
|
||||||
uint64_t last_refund_serial_id;
|
uint64_t last_refund_serial_id;
|
||||||
|
|
||||||
/**
|
|
||||||
* last_prewire_serial_id serial ID of the last prewire transfer the auditor processed
|
|
||||||
*/
|
|
||||||
uint64_t last_wire_out_serial_id;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -473,14 +491,14 @@ struct TALER_AUDITORDB_Plugin
|
|||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param session connection to use
|
* @param session connection to use
|
||||||
* @param master_pub master key of the exchange
|
* @param master_pub master key of the exchange
|
||||||
* @param pp where is the auditor in processing
|
* @param ppc where is the auditor in processing
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*insert_auditor_progress)(void *cls,
|
(*insert_auditor_progress_coin)(void *cls,
|
||||||
struct TALER_AUDITORDB_Session *session,
|
struct TALER_AUDITORDB_Session *session,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
const struct TALER_AUDITORDB_ProgressPoint *pp);
|
const struct TALER_AUDITORDB_ProgressPointCoin *ppc);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -490,14 +508,14 @@ struct TALER_AUDITORDB_Plugin
|
|||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param session connection to use
|
* @param session connection to use
|
||||||
* @param master_pub master key of the exchange
|
* @param master_pub master key of the exchange
|
||||||
* @param pp where is the auditor in processing
|
* @param ppc where is the auditor in processing
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*update_auditor_progress)(void *cls,
|
(*update_auditor_progress_coin)(void *cls,
|
||||||
struct TALER_AUDITORDB_Session *session,
|
struct TALER_AUDITORDB_Session *session,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
const struct TALER_AUDITORDB_ProgressPoint *pp);
|
const struct TALER_AUDITORDB_ProgressPointCoin *ppc);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -506,14 +524,112 @@ struct TALER_AUDITORDB_Plugin
|
|||||||
* @param cls the @e cls of this struct with the plugin-specific state
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
* @param session connection to use
|
* @param session connection to use
|
||||||
* @param master_pub master key of the exchange
|
* @param master_pub master key of the exchange
|
||||||
* @param[out] pp set to where the auditor is in processing
|
* @param[out] ppc set to where the auditor is in processing
|
||||||
* @return transaction status code
|
* @return transaction status code
|
||||||
*/
|
*/
|
||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*get_auditor_progress)(void *cls,
|
(*get_auditor_progress_coin)(void *cls,
|
||||||
struct TALER_AUDITORDB_Session *session,
|
struct TALER_AUDITORDB_Session *session,
|
||||||
const struct TALER_MasterPublicKeyP *master_pub,
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
struct TALER_AUDITORDB_ProgressPoint *pp);
|
struct TALER_AUDITORDB_ProgressPointCoin *ppc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert information about the auditor's progress with an exchange's
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppr where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
(*insert_auditor_progress_reserve)(void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointReserve *ppr);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update information about the progress of the auditor. There
|
||||||
|
* must be an existing record for the exchange.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppr where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
(*update_auditor_progress_reserve)(void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointReserve *ppr);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about the progress of the auditor.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param[out] ppr set to where the auditor is in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
(*get_auditor_progress_reserve)(void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
struct TALER_AUDITORDB_ProgressPointReserve *ppr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert information about the auditor's progress with an exchange's
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppa where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
(*insert_auditor_progress_aggregation)(void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointAggregation *ppa);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update information about the progress of the auditor. There
|
||||||
|
* must be an existing record for the exchange.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param ppa where is the auditor in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
(*update_auditor_progress_aggregation)(void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
const struct TALER_AUDITORDB_ProgressPointAggregation *ppa);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about the progress of the auditor.
|
||||||
|
*
|
||||||
|
* @param cls the @e cls of this struct with the plugin-specific state
|
||||||
|
* @param session connection to use
|
||||||
|
* @param master_pub master key of the exchange
|
||||||
|
* @param[out] ppa set to where the auditor is in processing
|
||||||
|
* @return transaction status code
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
(*get_auditor_progress_aggregation)(void *cls,
|
||||||
|
struct TALER_AUDITORDB_Session *session,
|
||||||
|
const struct TALER_MasterPublicKeyP *master_pub,
|
||||||
|
struct TALER_AUDITORDB_ProgressPointAggregation *pp);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user