aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-01-25 15:08:29 +0100
committerChristian Grothoff <christian@grothoff.org>2016-01-25 15:08:29 +0100
commitbd3700e608daf2ae52400275b1957656ccf2d6aa (patch)
tree72d8251b2eccd8a4103986f7e17fbe9f389785c9 /src
parent57c1d2318f14c4b5c21609cb96f32517d02752e7 (diff)
getting aggregator structure laid out for #4141
Diffstat (limited to 'src')
-rw-r--r--src/include/taler_mintdb_plugin.h74
-rw-r--r--src/mint/taler-mint-aggregator.c21
2 files changed, 86 insertions, 9 deletions
diff --git a/src/include/taler_mintdb_plugin.h b/src/include/taler_mintdb_plugin.h
index 4230a761f..e91eb7d48 100644
--- a/src/include/taler_mintdb_plugin.h
+++ b/src/include/taler_mintdb_plugin.h
@@ -619,6 +619,19 @@ typedef void
/**
+ * Callback with data about a prepared transaction.
+ *
+ * @param cls closure
+ * @param buf transaction data that was persisted, NULL on error
+ * @param buf_size number of bytes in @a buf, 0 on error
+ */
+typedef void
+(*TALER_MINTDB_WirePreparationCallback) (void *cls,
+ const char *buf,
+ size_t buf_size);
+
+
+/**
* @brief The plugin API, returned from the plugin's "init" function.
* The argument given to "init" is simply a configuration handle.
*/
@@ -1308,7 +1321,66 @@ struct TALER_MINTDB_Plugin
const struct TALER_Amount *transfer_value);
+
+ /**
+ * Function called to insert wire transfer commit data into the DB.
+ *
+ * @param cls closure
+ * @param session database connection
+ * @param type type fo the wire transfer (i.e. "sepa")
+ * @param buf buffer with wire transfer preparation data
+ * @param buf_size number of bytes in @a buf
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on DB errors
+ */
+ int
+ (*wire_prepare_data_insert)(void *cls,
+ struct TALER_MINTDB_Session *session,
+ const char *type,
+ const char *buf,
+ size_t buf_size);
+
+
+ /**
+ * Function called to mark wire transfer commit data as finished.
+ *
+ * @param cls closure
+ * @param session database connection
+ * @param type type fo the wire transfer (i.e. "sepa")
+ * @param buf buffer with wire transfer preparation data
+ * @param buf_size number of bytes in @a buf
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on DB errors
+ */
+ int
+ (*wire_prepare_data_mark_finished)(void *cls,
+ struct TALER_MINTDB_Session *session,
+ const char *type,
+ const char *buf,
+ size_t buf_size);
+
+
+ /**
+ * Function called to iterate over unfinished wire transfer
+ * preparation data. Fetches at most one item.
+ *
+ * @param cls closure
+ * @param session database connection
+ * @param type type fo the wire transfer (i.e. "sepa")
+ * @param cb function to call for ONE unfinished item
+ * @param cb_cls closure for @a cb
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO if there are no entries,
+ * #GNUNET_SYSERR on DB errors
+ */
+ int
+ (*wire_prepare_data_iterate)(void *cls,
+ struct TALER_MINTDB_Session *session,
+ const char *type,
+ TALER_MINTDB_WirePreparationCallback cb,
+ void *cb_cls);
+
+
+
};
-#endif /* _NEURO_MINT_DB_H */
+#endif /* _TALER_MINT_DB_H */
diff --git a/src/mint/taler-mint-aggregator.c b/src/mint/taler-mint-aggregator.c
index d3c66f025..70a68d007 100644
--- a/src/mint/taler-mint-aggregator.c
+++ b/src/mint/taler-mint-aggregator.c
@@ -220,9 +220,11 @@ run (void *cls,
return;
}
/* FIXME: finish aggregate computation */
- /* FIXME: insert pre-commit data for transaction into DB */
- /* FIXME: mark transactions selected for aggregate as finished */
+ /* wire_plugin->prepare_wire_transfer () -- ASYNC! */
+ /* db_plugin->wire_prepare_data_insert () -- transactional! */
+ /* db_plugin->XXX () -- mark transactions selected for aggregate as finished */
+ /* then finally: commit! */
if (GNUNET_OK !=
db_plugin->commit (db_plugin->cls,
session))
@@ -231,12 +233,15 @@ run (void *cls,
"Failed to commit database transaction!\n");
}
- /* FIXME: run 2nd transaction:
- - begin
- - select pre-commit data from DB
- - execute wire transfer
- - insert aggregation tracking information into DB
- - commit!
+ /* While possible, run 2nd type of transaction:
+ db_plugin->start()
+ - select pre-commit data from DB:
+ db_plugin->wire_prepare_data_iterate ()
+ - execute wire transfer (successfully!)
+ wire_plugin->execute_wire_transfer() # ASYNC!
+ db_plugin->wire_prepare_data_mark_finished ()
+ db_plugin->insert_aggregation_tracking ()
+ db_plugin->commit()
*/