aboutsummaryrefslogtreecommitdiff
path: root/src/auditordb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-19 01:09:00 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-19 01:09:00 +0100
commitb42ce7e80a1cc342722e3634c687fcb148f511d0 (patch)
treeb0be0810ae8545f8468588731b633cd429b66c25 /src/auditordb
parente4a4a7e193705a12e04ab6b4a3360168ffb4b27a (diff)
alpha-renaming to better describe what functions/tables do
Diffstat (limited to 'src/auditordb')
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c86
-rw-r--r--src/auditordb/test_auditordb.c12
2 files changed, 49 insertions, 49 deletions
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c
index ddacca657..73ec92db2 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2016 GNUnet e.V.
+ Copyright (C) 2014-2017 GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -336,10 +336,10 @@ postgres_create_tables (void *cls)
/* Table with the sum of the outstanding coins from
"denomination_pending" (denom_pubs must belong to the
respective's exchange's master public key); it represents the
- total_liabilities of the exchange at this point (modulo
+ balance_summary of the exchange at this point (modulo
unexpected historic_loss-style events where denomination keys are
compromised) */
- SQLEXEC ("CREATE TABLE IF NOT EXISTS total_liabilities"
+ SQLEXEC ("CREATE TABLE IF NOT EXISTS balance_summary"
"(master_pub BYTEA PRIMARY KEY CHECK (LENGTH(master_pub)=32)"
",denom_balance_val INT8 NOT NULL"
",denom_balance_frac INT4 NOT NULL"
@@ -697,9 +697,9 @@ postgres_prepare (PGconn *db_conn)
" WHERE denom_pub_hash=$1",
1, NULL);
- /* Used in #postgres_insert_denomination_summary() */
- PREPARE ("total_liabilities_insert",
- "INSERT INTO total_liabilities "
+ /* Used in #postgres_insert_balance_summary() */
+ PREPARE ("balance_summary_insert",
+ "INSERT INTO balance_summary "
"(master_pub"
",denom_balance_val"
",denom_balance_frac"
@@ -719,9 +719,9 @@ postgres_prepare (PGconn *db_conn)
") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16);",
16, NULL);
- /* Used in #postgres_update_denomination_summary() */
- PREPARE ("total_liabilities_update",
- "UPDATE total_liabilities SET"
+ /* Used in #postgres_update_balance_summary() */
+ PREPARE ("balance_summary_update",
+ "UPDATE balance_summary SET"
" denom_balance_val=$1"
",denom_balance_frac=$2"
",denom_balance_curr=$3"
@@ -740,8 +740,8 @@ postgres_prepare (PGconn *db_conn)
" WHERE master_pub=$16;",
16, NULL);
- /* Used in #postgres_get_denomination_summary() */
- PREPARE ("total_liabilities_select",
+ /* Used in #postgres_get_balance_summary() */
+ PREPARE ("balance_summary_select",
"SELECT"
" denom_balance_val"
",denom_balance_frac"
@@ -758,7 +758,7 @@ postgres_prepare (PGconn *db_conn)
",risk_val"
",risk_frac"
",risk_curr"
- " FROM total_liabilities"
+ " FROM balance_summary"
" WHERE master_pub=$1;",
1, NULL);
@@ -1921,14 +1921,14 @@ postgres_get_denomination_balance (void *cls,
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/
static int
-postgres_insert_denomination_summary (void *cls,
- struct TALER_AUDITORDB_Session *session,
- const struct TALER_MasterPublicKeyP *master_pub,
- const struct TALER_Amount *denom_balance,
- const struct TALER_Amount *deposit_fee_balance,
- const struct TALER_Amount *melt_fee_balance,
- const struct TALER_Amount *refund_fee_balance,
- const struct TALER_Amount *risk)
+postgres_insert_balance_summary (void *cls,
+ struct TALER_AUDITORDB_Session *session,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ const struct TALER_Amount *denom_balance,
+ const struct TALER_Amount *deposit_fee_balance,
+ const struct TALER_Amount *melt_fee_balance,
+ const struct TALER_Amount *refund_fee_balance,
+ const struct TALER_Amount *risk)
{
PGresult *result;
int ret;
@@ -1955,7 +1955,7 @@ postgres_insert_denomination_summary (void *cls,
refund_fee_balance));
result = GNUNET_PQ_exec_prepared (session->conn,
- "total_liabilities_insert",
+ "balance_summary_insert",
params);
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
@@ -1986,14 +1986,14 @@ postgres_insert_denomination_summary (void *cls,
* @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
*/
static int
-postgres_update_denomination_summary (void *cls,
- struct TALER_AUDITORDB_Session *session,
- const struct TALER_MasterPublicKeyP *master_pub,
- const struct TALER_Amount *denom_balance,
- const struct TALER_Amount *deposit_fee_balance,
- const struct TALER_Amount *melt_fee_balance,
- const struct TALER_Amount *refund_fee_balance,
- const struct TALER_Amount *risk)
+postgres_update_balance_summary (void *cls,
+ struct TALER_AUDITORDB_Session *session,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ const struct TALER_Amount *denom_balance,
+ const struct TALER_Amount *deposit_fee_balance,
+ const struct TALER_Amount *melt_fee_balance,
+ const struct TALER_Amount *refund_fee_balance,
+ const struct TALER_Amount *risk)
{
PGresult *result;
int ret;
@@ -2008,7 +2008,7 @@ postgres_update_denomination_summary (void *cls,
};
result = GNUNET_PQ_exec_prepared (session->conn,
- "total_liabilities_update",
+ "balance_summary_update",
params);
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
@@ -2039,14 +2039,14 @@ postgres_update_denomination_summary (void *cls,
* for this @a master_pub; #GNUNET_SYSERR on failure
*/
static int
-postgres_get_denomination_summary (void *cls,
- struct TALER_AUDITORDB_Session *session,
- const struct TALER_MasterPublicKeyP *master_pub,
- struct TALER_Amount *denom_balance,
- struct TALER_Amount *deposit_fee_balance,
- struct TALER_Amount *melt_fee_balance,
- struct TALER_Amount *refund_fee_balance,
- struct TALER_Amount *risk)
+postgres_get_balance_summary (void *cls,
+ struct TALER_AUDITORDB_Session *session,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ struct TALER_Amount *denom_balance,
+ struct TALER_Amount *deposit_fee_balance,
+ struct TALER_Amount *melt_fee_balance,
+ struct TALER_Amount *refund_fee_balance,
+ struct TALER_Amount *risk)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
@@ -2055,7 +2055,7 @@ postgres_get_denomination_summary (void *cls,
PGresult *result;
result = GNUNET_PQ_exec_prepared (session->conn,
- "total_liabilities_select",
+ "balance_summary_select",
params);
if (PGRES_TUPLES_OK !=
PQresultStatus (result))
@@ -2069,7 +2069,7 @@ postgres_get_denomination_summary (void *cls,
if (0 == nrows)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "postgres_get_denomination_summary() returned 0 matching rows\n");
+ "postgres_get_balance_summary() returned 0 matching rows\n");
PQclear (result);
return GNUNET_NO;
}
@@ -2701,9 +2701,9 @@ libtaler_plugin_auditordb_postgres_init (void *cls)
plugin->update_denomination_balance = &postgres_update_denomination_balance;
plugin->insert_denomination_balance = &postgres_insert_denomination_balance;
- plugin->get_denomination_summary = &postgres_get_denomination_summary;
- plugin->update_denomination_summary = &postgres_update_denomination_summary;
- plugin->insert_denomination_summary = &postgres_insert_denomination_summary;
+ plugin->get_balance_summary = &postgres_get_balance_summary;
+ plugin->update_balance_summary = &postgres_update_balance_summary;
+ plugin->insert_balance_summary = &postgres_insert_balance_summary;
plugin->select_historic_denom_revenue = &postgres_select_historic_denom_revenue;
plugin->insert_historic_denom_revenue = &postgres_insert_historic_denom_revenue;
diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c
index 24184aee9..0e146e3a4 100644
--- a/src/auditordb/test_auditordb.c
+++ b/src/auditordb/test_auditordb.c
@@ -401,10 +401,10 @@ run (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Test: insert_denomination_summary\n");
+ "Test: insert_balance_summary\n");
FAILIF (GNUNET_OK !=
- plugin->insert_denomination_summary (plugin->cls,
+ plugin->insert_balance_summary (plugin->cls,
session,
&master_pub,
&refund_fee_balance,
@@ -414,10 +414,10 @@ run (void *cls)
&rbalance));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Test: update_denomination_summary\n");
+ "Test: update_balance_summary\n");
FAILIF (GNUNET_OK !=
- plugin->update_denomination_summary (plugin->cls,
+ plugin->update_balance_summary (plugin->cls,
session,
&master_pub,
&denom_balance,
@@ -427,7 +427,7 @@ run (void *cls)
&rbalance));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Test: get_denomination_summary\n");
+ "Test: get_balance_summary\n");
ZR_BLK (&denom_balance2);
ZR_BLK (&deposit_fee_balance2);
@@ -436,7 +436,7 @@ run (void *cls)
ZR_BLK (&rbalance2);
FAILIF (GNUNET_OK !=
- plugin->get_denomination_summary (plugin->cls,
+ plugin->get_balance_summary (plugin->cls,
session,
&master_pub,
&denom_balance2,