aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-16 12:11:49 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-16 17:57:29 +0200
commit4a845205144875ae6be960fa02d5c0f4a82130dc (patch)
tree0364e2e01e831a3a257291ebd0db580ddea31446
parent2cddf524a8f5286431d134daee8fa0b36f42baed (diff)
resolve #4963
-rw-r--r--ChangeLog3
-rw-r--r--src/auditor/taler-auditor.c1
-rw-r--r--src/auditor/taler-wire-auditor.c68
3 files changed, 59 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 33b105c76..441cc8051 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Mon Oct 16 12:10:35 CEST 2017
+ Realize JSON-based report formats from auditor (#4963). -CG
+
Sun Sep 17 16:46:13 CEST 2017
Implement /keys cherry picking (#4840). -CG
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index f050f7870..3e4eca15b 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -25,7 +25,6 @@
* given in the 'wire_out' table. This needs to be checked separately!
*
* KNOWN BUGS:
- * - calculate, store and report aggregation fee balance!
* - error handling if denomination keys are used that are not known to the
* auditor is, eh, awful / non-existent. We just throw the DB's constraint
* violation back at the user. Great UX.
diff --git a/src/auditor/taler-wire-auditor.c b/src/auditor/taler-wire-auditor.c
index c0b29eb15..8cc579f82 100644
--- a/src/auditor/taler-wire-auditor.c
+++ b/src/auditor/taler-wire-auditor.c
@@ -129,6 +129,16 @@ static void *out_wire_off;
*/
static size_t wire_off_size;
+/**
+ * Array of reports about row inconsitencies.
+ */
+static json_t *report_row_inconsistencies;
+
+/**
+ * Array of reports about minor row inconcistencies.
+ */
+static json_t *report_row_minor_inconsistencies;
+
/* ***************************** Shutdown **************************** */
@@ -240,6 +250,21 @@ free_roi (void *cls,
static void
do_shutdown (void *cls)
{
+ if (NULL != report_row_inconsistencies)
+ {
+ json_t *report;
+
+ GNUNET_assert (NULL != report_row_minor_inconsistencies);
+ report = json_pack ("{s:o, s:o}",
+ "row-inconsistencies", report_row_inconsistencies,
+ "row-minor-inconsistencies", report_row_minor_inconsistencies);
+ json_dumpf (report,
+ stdout,
+ JSON_INDENT (2));
+ json_decref (report);
+ report_row_inconsistencies = NULL;
+ report_row_minor_inconsistencies = NULL;
+ }
if (NULL != hh)
{
wp->get_history_cancel (wp->cls,
@@ -284,6 +309,23 @@ do_shutdown (void *cls)
/**
+ * Add @a object to the report @a array. Fail hard if this fails.
+ *
+ * @param array report array to append @a object to
+ * @param object object to append, should be check that it is not NULL
+ */
+static void
+report (json_t *array,
+ json_t *object)
+{
+ GNUNET_assert (NULL != object);
+ GNUNET_assert (0 ==
+ json_array_append_new (array,
+ object));
+}
+
+
+/**
* Report a (serious) inconsistency in the exchange's database.
*
* @param table affected table
@@ -295,12 +337,11 @@ report_row_inconsistency (const char *table,
uint64_t rowid,
const char *diagnostic)
{
- // TODO (#4963): implement proper reporting logic writing to file.
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Database inconsistency detected in table %s at row %llu: %s\n",
- table,
- (unsigned long long) rowid,
- diagnostic);
+ report (report_row_inconsistencies,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", diagnostic));
}
@@ -317,12 +358,11 @@ report_row_minor_inconsistency (const char *table,
uint64_t rowid,
const char *diagnostic)
{
- // TODO (#4963): implement proper reporting logic writing to file.
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Minor inconsistency detected in table %s at row %llu: %s\n",
- table,
- (unsigned long long) rowid,
- diagnostic);
+ report (report_row_minor_inconsistencies,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", table,
+ "row", (json_int_t) rowid,
+ "diagnostic", diagnostic));
}
@@ -961,6 +1001,10 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
+ GNUNET_assert (NULL !=
+ (report_row_inconsistencies = json_array ()));
+ GNUNET_assert (NULL !=
+ (report_row_minor_inconsistencies = json_array ()));
qsx = adb->get_wire_auditor_progress (adb->cls,
asession,
&master_pub,