convert another function for #5010
This commit is contained in:
parent
75b0879f4e
commit
d66a29e383
@ -577,6 +577,8 @@ deposit_cb (void *cls,
|
|||||||
struct GNUNET_TIME_Absolute wire_deadline,
|
struct GNUNET_TIME_Absolute wire_deadline,
|
||||||
const json_t *wire)
|
const json_t *wire)
|
||||||
{
|
{
|
||||||
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
au->merchant_pub = *merchant_pub;
|
au->merchant_pub = *merchant_pub;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TALER_amount_subtract (&au->total_amount,
|
TALER_amount_subtract (&au->total_amount,
|
||||||
@ -623,11 +625,12 @@ deposit_cb (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
qs = db_plugin->mark_deposit_done (db_plugin->cls,
|
||||||
db_plugin->mark_deposit_done (db_plugin->cls,
|
|
||||||
au->session,
|
au->session,
|
||||||
row_id))
|
row_id);
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
|
||||||
{
|
{
|
||||||
|
/* FIXME #5010 */
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
au->failed = GNUNET_YES;
|
au->failed = GNUNET_YES;
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
@ -664,6 +667,7 @@ aggregate_cb (void *cls,
|
|||||||
const json_t *wire)
|
const json_t *wire)
|
||||||
{
|
{
|
||||||
struct TALER_Amount delta;
|
struct TALER_Amount delta;
|
||||||
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
|
||||||
GNUNET_break (0 ==
|
GNUNET_break (0 ==
|
||||||
memcmp (&au->merchant_pub,
|
memcmp (&au->merchant_pub,
|
||||||
@ -714,11 +718,12 @@ aggregate_cb (void *cls,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
qs = db_plugin->mark_deposit_done (db_plugin->cls,
|
||||||
db_plugin->mark_deposit_done (db_plugin->cls,
|
|
||||||
au->session,
|
au->session,
|
||||||
row_id))
|
row_id);
|
||||||
|
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
|
||||||
{
|
{
|
||||||
|
/* FIXME: #5010 */
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
au->failed = GNUNET_YES;
|
au->failed = GNUNET_YES;
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
@ -1102,7 +1107,7 @@ run_aggregation (void *cls)
|
|||||||
{
|
{
|
||||||
static int swap;
|
static int swap;
|
||||||
struct TALER_EXCHANGEDB_Session *session;
|
struct TALER_EXCHANGEDB_Session *session;
|
||||||
unsigned int i;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
int ret;
|
int ret;
|
||||||
const struct GNUNET_SCHEDULER_TaskContext *tc;
|
const struct GNUNET_SCHEDULER_TaskContext *tc;
|
||||||
|
|
||||||
@ -1246,18 +1251,46 @@ run_aggregation (void *cls)
|
|||||||
}
|
}
|
||||||
/* Mark transactions by row_id as minor */
|
/* Mark transactions by row_id as minor */
|
||||||
ret = GNUNET_OK;
|
ret = GNUNET_OK;
|
||||||
if (GNUNET_OK !=
|
qs = db_plugin->mark_deposit_tiny (db_plugin->cls,
|
||||||
db_plugin->mark_deposit_tiny (db_plugin->cls,
|
|
||||||
session,
|
session,
|
||||||
au->row_id))
|
au->row_id);
|
||||||
ret = GNUNET_SYSERR;
|
if (0 <= qs)
|
||||||
else
|
{
|
||||||
for (i=0;i<au->rows_offset;i++)
|
for (unsigned int i=0;i<au->rows_offset;i++)
|
||||||
if (GNUNET_OK !=
|
{
|
||||||
db_plugin->mark_deposit_tiny (db_plugin->cls,
|
qs = db_plugin->mark_deposit_tiny (db_plugin->cls,
|
||||||
session,
|
session,
|
||||||
au->additional_rows[i]))
|
au->additional_rows[i]);
|
||||||
ret = GNUNET_SYSERR;
|
if (0 > qs)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||||
|
{
|
||||||
|
db_plugin->rollback (db_plugin->cls,
|
||||||
|
session);
|
||||||
|
GNUNET_free_non_null (au->additional_rows);
|
||||||
|
if (NULL != au->wire)
|
||||||
|
json_decref (au->wire);
|
||||||
|
GNUNET_free (au);
|
||||||
|
au = NULL;
|
||||||
|
/* start again */
|
||||||
|
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
|
||||||
|
NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
|
||||||
|
{
|
||||||
|
db_plugin->rollback (db_plugin->cls,
|
||||||
|
session);
|
||||||
|
GNUNET_free_non_null (au->additional_rows);
|
||||||
|
if (NULL != au->wire)
|
||||||
|
json_decref (au->wire);
|
||||||
|
GNUNET_free (au);
|
||||||
|
au = NULL;
|
||||||
|
GNUNET_SCHEDULER_shutdown ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* commit */
|
/* commit */
|
||||||
(void) commit_or_warn (session);
|
(void) commit_or_warn (session);
|
||||||
GNUNET_free_non_null (au->additional_rows);
|
GNUNET_free_non_null (au->additional_rows);
|
||||||
|
@ -2793,11 +2793,9 @@ postgres_have_deposit (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 the database
|
* @param session connection to the database
|
||||||
* @param rowid identifies the deposit row to modify
|
* @param rowid identifies the deposit row to modify
|
||||||
* @return #GNUNET_OK on success,
|
* @return query result status
|
||||||
* #GNUNET_NO on transient error
|
|
||||||
* #GNUNET_SYSERR on error
|
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_mark_deposit_tiny (void *cls,
|
postgres_mark_deposit_tiny (void *cls,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
uint64_t rowid)
|
uint64_t rowid)
|
||||||
@ -2807,7 +2805,7 @@ postgres_mark_deposit_tiny (void *cls,
|
|||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
return execute_prepared_non_select (session,
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
"mark_deposit_tiny",
|
"mark_deposit_tiny",
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
@ -2890,11 +2888,9 @@ postgres_test_deposit_done (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 the database
|
* @param session connection to the database
|
||||||
* @param rowid identifies the deposit row to modify
|
* @param rowid identifies the deposit row to modify
|
||||||
* @return #GNUNET_OK on success,
|
* @return query result status
|
||||||
* #GNUNET_NO on transient error,
|
|
||||||
* #GNUNET_SYSERR on error
|
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_mark_deposit_done (void *cls,
|
postgres_mark_deposit_done (void *cls,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
uint64_t rowid)
|
uint64_t rowid)
|
||||||
@ -2904,7 +2900,7 @@ postgres_mark_deposit_done (void *cls,
|
|||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
return execute_prepared_non_select (session,
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
"mark_deposit_done",
|
"mark_deposit_done",
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
|
@ -1801,7 +1801,7 @@ run (void *cls)
|
|||||||
FAILIF (GNUNET_OK !=
|
FAILIF (GNUNET_OK !=
|
||||||
plugin->start (plugin->cls,
|
plugin->start (plugin->cls,
|
||||||
session));
|
session));
|
||||||
FAILIF (GNUNET_OK !=
|
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
|
||||||
plugin->mark_deposit_tiny (plugin->cls,
|
plugin->mark_deposit_tiny (plugin->cls,
|
||||||
session,
|
session,
|
||||||
deposit_rowid));
|
deposit_rowid));
|
||||||
|
@ -1343,11 +1343,9 @@ struct TALER_EXCHANGEDB_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 the database
|
* @param session connection to the database
|
||||||
* @param deposit_rowid identifies the deposit row to modify
|
* @param deposit_rowid identifies the deposit row to modify
|
||||||
* @return #GNUNET_OK on success
|
* @return query result status
|
||||||
* #GNUNET_NO on transient error
|
|
||||||
* #GNUNET_SYSERR on error
|
|
||||||
*/
|
*/
|
||||||
int
|
enum GNUNET_DB_QueryStatus
|
||||||
(*mark_deposit_tiny) (void *cls,
|
(*mark_deposit_tiny) (void *cls,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
uint64_t rowid);
|
uint64_t rowid);
|
||||||
|
Loading…
Reference in New Issue
Block a user