[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 10/19: Renaming the DB and /history.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 10/19: Renaming the DB and /history. |
Date: |
Fri, 10 Feb 2017 14:23:01 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
commit 5b9a806f7ab57d2cde27fc98c962dcb5908fc97f
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Feb 6 10:13:03 2017 +0100
Renaming the DB and /history.
---
src/backend/taler-merchant-httpd_history.c | 10 +++---
src/backenddb/plugin_merchantdb_postgres.c | 50 ++++++++++++++----------------
src/include/taler_merchantdb_plugin.h | 24 +++++++-------
3 files changed, 39 insertions(+), 45 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_history.c
b/src/backend/taler-merchant-httpd_history.c
index 972ecf9..32f31cf 100644
--- a/src/backend/taler-merchant-httpd_history.c
+++ b/src/backend/taler-merchant-httpd_history.c
@@ -29,10 +29,9 @@
* Function called with information about a transaction.
*
* @param cls closure
- * @param transaction_id of the contract
* @param merchant_pub merchant's public key
* @param exchange_uri URI of the exchange
- * @param h_contract hash of the contract
+ * @param transaction_id proposal's transaction id
* @param h_wire hash of our wire details
* @param timestamp time of the confirmation
* @param refund refund deadline
@@ -41,10 +40,9 @@
static void
history_cb (void *cls,
- uint64_t transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *exchange_uri,
- const struct GNUNET_HashCode *h_contract,
+ const char *transaction_id,
const struct GNUNET_HashCode *h_wire,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Absolute refund,
@@ -54,10 +52,10 @@ history_cb (void *cls,
json_t *entry;
GNUNET_break (NULL !=
- (entry = json_pack ("{s:I, s:s, s:o, s:o, s:o}",
+ (entry = json_pack ("{s:s, s:s, s:s, s:o}",
"transaction_id", transaction_id,
"exchange", exchange_uri,
- "h_contract", GNUNET_JSON_from_data_auto
(h_contract),
+ "transaction_id", transaction_id,
"timestamp", GNUNET_JSON_from_time_abs
(timestamp),
"total_amount",
TALER_JSON_from_amount (total_amount))));
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 0131456..06af5a3 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -171,7 +171,7 @@ postgres_initialize (void *cls)
PG_EXEC (pg,
"CREATE TABLE IF NOT EXISTS merchant_transactions ("
- " transaction_id INT8"
+ " transaction_id VARCHAR NOT NULL"
",exchange_uri VARCHAR NOT NULL"
",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)"
",h_contract BYTEA NOT NULL CHECK (LENGTH(h_contract)=64)"
@@ -185,7 +185,7 @@ postgres_initialize (void *cls)
");");
PG_EXEC (pg,
"CREATE TABLE IF NOT EXISTS merchant_deposits ("
- " transaction_id INT8"
+ " transaction_id VARCHAR NOT NULL"
",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)"
",FOREIGN KEY (transaction_id, merchant_pub) REFERENCES
merchant_transactions (transaction_id, merchant_pub)"
",coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)"
@@ -213,7 +213,7 @@ postgres_initialize (void *cls)
Hence those cannot be foreign keys into deposits/transactions! */
PG_EXEC (pg,
"CREATE TABLE IF NOT EXISTS merchant_transfers ("
- " transaction_id INT8"
+ " transaction_id VARCHAR NOT NULL"
",coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)"
",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)"
",PRIMARY KEY (transaction_id, coin_pub)"
@@ -508,7 +508,7 @@ postgres_insert_proposal_data (void *cls,
* Insert transaction data into the database.
*
* @param cls closure
- * @param transaction_id of the contract
+ * @param transaction_id of the proposal
* @param merchant_pub merchant's public key
* @param exchange_uri URI of the exchange
* @param h_contract hash of the contract
@@ -520,7 +520,7 @@ postgres_insert_proposal_data (void *cls,
*/
static int
postgres_store_transaction (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *exchange_uri,
const struct GNUNET_HashCode *h_contract,
@@ -534,7 +534,7 @@ postgres_store_transaction (void *cls,
int ret;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string (transaction_id),
GNUNET_PQ_query_param_string (exchange_uri),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_auto_from_type (h_contract),
@@ -577,7 +577,7 @@ postgres_store_transaction (void *cls,
*/
static int
postgres_store_deposit (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee,
@@ -590,7 +590,7 @@ postgres_store_deposit (void *cls,
int ret;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string (transaction_id),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_auto_from_type (coin_pub),
TALER_PQ_query_param_amount (amount_with_fee),
@@ -630,7 +630,7 @@ postgres_store_deposit (void *cls,
*/
static int
postgres_store_coin_to_transfer (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_CoinSpendPublicKeyP
*coin_pub,
const struct TALER_WireTransferIdentifierRawP
*wtid)
{
@@ -639,7 +639,7 @@ postgres_store_coin_to_transfer (void *cls,
int ret;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string (transaction_id),
GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_auto_from_type (wtid),
GNUNET_PQ_query_param_end
@@ -758,11 +758,11 @@ postgres_find_transactions_by_date (void *cls,
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Absolute refund_deadline;
struct TALER_Amount total_amount;
- uint64_t transaction_id;
+ char *transaction_id;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_string ("exchange_uri",
&exchange_uri),
- GNUNET_PQ_result_spec_uint64 ("transaction_id",
+ GNUNET_PQ_result_spec_string ("transaction_id",
&transaction_id),
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
&merchant_pub),
@@ -789,10 +789,9 @@ postgres_find_transactions_by_date (void *cls,
return GNUNET_SYSERR;
}
cb (cb_cls,
- transaction_id,
&merchant_pub,
exchange_uri,
- &h_contract,
+ transaction_id,
&h_wire,
timestamp,
refund_deadline,
@@ -817,7 +816,7 @@ postgres_find_transactions_by_date (void *cls,
*/
static int
postgres_find_transaction (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
TALER_MERCHANTDB_TransactionCallback cb,
void *cb_cls)
@@ -825,7 +824,7 @@ postgres_find_transaction (void *cls,
struct PostgresClosure *pg = cls;
PGresult *result;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string(transaction_id),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_end
};
@@ -884,10 +883,9 @@ postgres_find_transaction (void *cls,
return GNUNET_SYSERR;
}
cb (cb_cls,
- transaction_id,
merchant_pub,
exchange_uri,
- &h_contract,
+ transaction_id,
&h_wire,
timestamp,
refund_deadline,
@@ -912,7 +910,7 @@ postgres_find_transaction (void *cls,
*/
static int
postgres_find_payments (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
TALER_MERCHANTDB_CoinDepositCallback cb,
void *cb_cls)
@@ -922,7 +920,7 @@ postgres_find_payments (void *cls,
unsigned int i;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string (transaction_id),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_end
};
@@ -1000,7 +998,7 @@ postgres_find_payments (void *cls,
*/
static int
postgres_find_payments_by_id_and_coin (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP
*merchant_pub,
const struct TALER_CoinSpendPublicKeyP
*coin_pub,
TALER_MERCHANTDB_CoinDepositCallback cb,
@@ -1011,7 +1009,7 @@ postgres_find_payments_by_id_and_coin (void *cls,
unsigned int i;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string (transaction_id),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_end
@@ -1089,7 +1087,7 @@ postgres_find_payments_by_id_and_coin (void *cls,
*/
static int
postgres_find_transfers_by_id (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
TALER_MERCHANTDB_TransferCallback cb,
void *cb_cls)
{
@@ -1098,7 +1096,7 @@ postgres_find_transfers_by_id (void *cls,
unsigned int i;
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&transaction_id),
+ GNUNET_PQ_query_param_string (transaction_id),
GNUNET_PQ_query_param_end
};
result = GNUNET_PQ_exec_prepared (pg->conn,
@@ -1198,14 +1196,14 @@ postgres_find_deposits_by_wtid (void *cls,
for (i=0;i<PQntuples (result);i++)
{
- uint64_t transaction_id;
+ char *transaction_id;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_Amount amount_with_fee;
struct TALER_Amount deposit_fee;
json_t *exchange_proof;
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_uint64 ("transaction_id",
+ GNUNET_PQ_result_spec_string ("transaction_id",
&transaction_id),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&coin_pub),
diff --git a/src/include/taler_merchantdb_plugin.h
b/src/include/taler_merchantdb_plugin.h
index 0522e38..2fe1c5e 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -35,10 +35,9 @@ struct TALER_MERCHANTDB_Plugin;
* Function called with information about a transaction.
*
* @param cls closure
- * @param transaction_id of the contract
* @param merchant_pub merchant's public key
* @param exchange_uri URI of the exchange
- * @param h_contract hash of the contract
+ * @param transaction_id proposal's transaction id
* @param h_wire hash of our wire details
* @param timestamp time of the confirmation
* @param refund refund deadline
@@ -46,10 +45,9 @@ struct TALER_MERCHANTDB_Plugin;
*/
typedef void
(*TALER_MERCHANTDB_TransactionCallback)(void *cls,
- uint64_t transaction_id,
const struct TALER_MerchantPublicKeyP
*merchant_pub,
const char *exchange_uri,
- const struct GNUNET_HashCode
*h_contract,
+ const char *transaction_id,
const struct GNUNET_HashCode *h_wire,
struct GNUNET_TIME_Absolute timestamp,
struct GNUNET_TIME_Absolute refund,
@@ -69,7 +67,7 @@ typedef void
*/
typedef void
(*TALER_MERCHANTDB_CoinDepositCallback)(void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_CoinSpendPublicKeyP
*coin_pub,
const struct TALER_Amount
*amount_with_fee,
const struct TALER_Amount *deposit_fee,
@@ -95,7 +93,7 @@ typedef void
*/
typedef void
(*TALER_MERCHANTDB_TransferCallback)(void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_CoinSpendPublicKeyP
*coin_pub,
const struct
TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Absolute
execution_time,
@@ -197,7 +195,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*store_transaction) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *exchange_uri,
const struct GNUNET_HashCode *h_contract,
@@ -222,7 +220,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*store_deposit) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee,
@@ -244,7 +242,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*store_coin_to_transfer) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_WireTransferIdentifierRawP
*wtid);
@@ -298,7 +296,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*find_transaction) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
TALER_MERCHANTDB_TransactionCallback cb,
void *cb_cls);
@@ -318,7 +316,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*find_payments) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP *merchant_pub,
TALER_MERCHANTDB_CoinDepositCallback cb,
void *cb_cls);
@@ -338,7 +336,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*find_payments_by_id_and_coin) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
const struct TALER_MerchantPublicKeyP
*merchant_pub,
const struct TALER_CoinSpendPublicKeyP
*coin_pub,
TALER_MERCHANTDB_CoinDepositCallback cb,
@@ -361,7 +359,7 @@ struct TALER_MERCHANTDB_Plugin
*/
int
(*find_transfers_by_id) (void *cls,
- uint64_t transaction_id,
+ const char *transaction_id,
TALER_MERCHANTDB_TransferCallback cb,
void *cb_cls);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] 06/19: Removing h_contract from /pay handler., (continued)
- [GNUnet-SVN] [taler-merchant] 06/19: Removing h_contract from /pay handler., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 11/19: Updating notes., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 09/19: Typo, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 02/19: Renaming proposal data db operations, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 04/19: First run about renaming in lib's testcase., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 18/19: Fix backenddb, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 14/19: renaming (a little part of) /track/transfer handler, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 07/19: Removing _map.c from repo, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 15/19: Renaming in /track/transaction handler., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 08/19: Garbage removal, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 10/19: Renaming the DB and /history.,
gnunet <=
- [GNUnet-SVN] [taler-merchant] 03/19: Removing obsolete /map requests and renaming contract->proposal/order, within lib., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 13/19: Renaming /track/transaction handler to the point where it depends on a few exchange-lib's renamings., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 16/19: Huge renaming about removing transaction_id use, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 05/19: renaming: proposal logic ported, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 17/19: More fixes on renaming, mostly in db., gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 12/19: Fix backenddb tests after renaming, gnunet, 2017/02/10
- [GNUnet-SVN] [taler-merchant] 19/19: Fixing testcases according to the renaming occurred in the protocol. Please note, comments do NOT match code, /proposal uses the POST method, and tracking API are NOT tested yet., gnunet, 2017/02/10