gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-anastasis] branch master updated: Worked on db plugi


From: gnunet
Subject: [GNUnet-SVN] [taler-anastasis] branch master updated: Worked on db plugin
Date: Mon, 14 Oct 2019 11:01:49 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 482c250  Worked on db plugin
482c250 is described below

commit 482c25025b02fccb2a59eb559da2288a6dfe8144
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Oct 14 11:01:45 2019 +0200

    Worked on db plugin
---
 src/backup-db/plugin_anastasis_postgres.c | 74 ++++++++++++++++---------------
 1 file changed, 39 insertions(+), 35 deletions(-)

diff --git a/src/backup-db/plugin_anastasis_postgres.c 
b/src/backup-db/plugin_anastasis_postgres.c
index d53e758..a74e22a 100644
--- a/src/backup-db/plugin_anastasis_postgres.c
+++ b/src/backup-db/plugin_anastasis_postgres.c
@@ -7,15 +7,15 @@
   Foundation; either version 3, or (at your option) any later version.
 
   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  WARRANTY; without even the implied warranty of ANASTASISABILITY or FITNESS 
FOR
   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License along with
   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */
 /**
- * @file merchant/plugin_merchantdb_postgres.c
- * @brief database helper functions for postgres used by the merchant
+ * @file anastasis/plugin_anastasisdb_postgres.c
+ * @brief database helper functions for postgres used by the anastasis
  * @author Sree Harsha Totakura <address@hidden>
  * @author Christian Grothoff
  * @author Marcello Stanisci
@@ -60,7 +60,7 @@ struct PostgresClosure
 
 
 /**
- * Drop merchant tables
+ * Drop anastasis tables
  *
  * @param cls closure our `struct Plugin`
  * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
@@ -70,7 +70,11 @@ postgres_drop_tables (void *cls)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_ExecuteStatement es[] = {
-    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_foo CASCADE;"),
+    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_truth 
CASCADE;"),
+    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_user 
CASCADE;"),
+    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_payment 
CASCADE;"),
+    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS 
anastasis_recoverydocument CASCADE;"),
+
     GNUNET_PQ_EXECUTE_STATEMENT_END
   };
 
@@ -148,7 +152,7 @@ postgres_start (void *cls,
   check_connection (pg);
   postgres_preflight (pg);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Starting merchant DB transaction\n");
+              "Starting anastasis DB transaction\n");
   if (GNUNET_OK !=
       GNUNET_PQ_exec_statements (pg->conn,
                                  es))
@@ -178,7 +182,7 @@ postgres_rollback (void *cls)
   };
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Rolling back merchant DB transaction\n");
+              "Rolling back anastasis DB transaction\n");
   GNUNET_break (GNUNET_OK ==
                 GNUNET_PQ_exec_statements (pg->conn,
                                            es));
@@ -201,7 +205,7 @@ postgres_commit (void *cls)
   };
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Committing merchant DB transaction\n");
+              "Committing anastasis DB transaction\n");
   pg->transaction_name = NULL;
   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
                                              "end_transaction",
@@ -210,6 +214,7 @@ postgres_commit (void *cls)
 
 
 /**
+ * FIXME
  * Retrieve proposal data given its proposal data's hashcode
  *
  * @param cls closure
@@ -224,12 +229,12 @@ postgres_find_contract_terms_from_hash (void *cls,
                                         const struct
                                         GNUNET_HashCode *h_contract_terms,
                                         const struct
-                                        TALER_MerchantPublicKeyP *merchant_pub)
+                                        ANASTASIS_AccountPubP *anastasis_pub)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
-    GNUNET_PQ_query_param_auto_from_type (merchant_pub),
+    GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
@@ -251,24 +256,23 @@ postgres_find_contract_terms_from_hash (void *cls,
  *
  * @param cls closure
  * @param order_id identificator of the proposal being stored
- * @param merchant_pub merchant's public key
+ * @param anastasis_pub anastasis's public key
  * @param timestamp timestamp of this proposal data
  * @param contract_terms proposal data to store
  * @return transaction status
  */
 static enum GNUNET_DB_QueryStatus
-postgres_insert_contract_terms (void *cls,
-                                const char *order_id,
-                                const struct
-                                TALER_MerchantPublicKeyP *merchant_pub,
-                                struct GNUNET_TIME_Absolute timestamp,
-                                const json_t *contract_terms)
+postgres_record_payment (void *cls,
+                         const struct TALER_Amount *amount,
+                         const struct ANASTASIS_AccountPubP *account_pub,
+                         unsigned int num_uploads,
+                         struct GNUNET_TIME_Relative lifetime_inc,
+                         const struct ANASTASIS_PaymentSecretP *payment_secret)
 {
   struct PostgresClosure *pg = cls;
-  struct GNUNET_HashCode h_contract_terms;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_string (order_id),
-    GNUNET_PQ_query_param_auto_from_type (merchant_pub),
+    GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
     GNUNET_PQ_query_param_absolute_time (&timestamp),
     TALER_PQ_query_param_json (contract_terms),
     GNUNET_PQ_query_param_auto_from_type (&h_contract_terms),
@@ -283,9 +287,9 @@ postgres_insert_contract_terms (void *cls,
     return GNUNET_SYSERR;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "inserting contract terms: order_id: %s, merchant_pub: %s, 
h_contract_terms: %s.\n",
+              "inserting contract terms: order_id: %s, anastasis_pub: %s, 
h_contract_terms: %s.\n",
               order_id,
-              TALER_B2S (merchant_pub),
+              TALER_B2S (anastasis_pub),
               GNUNET_h2s (&h_contract_terms));
   check_connection (pg);
   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
@@ -302,7 +306,7 @@ struct FindContractsContext
   /**
    * Function to call on each result.
    */
-  TALER_MERCHANTDB_ProposalDataCallback cb;
+  TALER_ANASTASISDB_ProposalDataCallback cb;
 
   /**
    * Closure for @e cb.
@@ -373,7 +377,7 @@ find_contracts_cb (void *cls,
  *
  * @param cls our plugin handle.
  * @param date only results older than this date are returned.
- * @param merchant_pub instance's public key; only rows related to this
+ * @param anastasis_pub instance's public key; only rows related to this
  * instance are returned.
  * @param start only rows with serial id less than start are returned.
  * In other words, you lower `start` to get older records. The tipical
@@ -385,7 +389,7 @@ find_contracts_cb (void *cls,
  * @param nrows only nrows rows are returned.
  * @param past if set to #GNUNET_YES, retrieves rows older than `date`.
  * @param ascending if GNUNET_YES, results will be sorted in chronological 
order.
- * This is tipically used to show live updates on the merchant's backoffice
+ * This is tipically used to show live updates on the anastasis's backoffice
  * Web interface.
  * @param cb function to call with transaction data, can be NULL.
  * @param cb_cls closure for @a cb
@@ -397,19 +401,19 @@ postgres_find_contract_terms_by_date_and_range (void *cls,
                                                 date,
                                                 const struct
                                                 TALER_MerchantPublicKeyP *
-                                                merchant_pub,
+                                                anastasis_pub,
                                                 uint64_t start,
                                                 uint64_t nrows,
                                                 int past,
                                                 unsigned int ascending,
-                                                
TALER_MERCHANTDB_ProposalDataCallback
+                                                
TALER_ANASTASISDB_ProposalDataCallback
                                                 cb,
                                                 void *cb_cls)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_absolute_time (&date),
-    GNUNET_PQ_query_param_auto_from_type (merchant_pub),
+    GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
     GNUNET_PQ_query_param_uint64 (&start),
     GNUNET_PQ_query_param_uint64 (&nrows),
     GNUNET_PQ_query_param_end
@@ -448,14 +452,14 @@ postgres_find_contract_terms_by_date_and_range (void *cls,
  * Initialize Postgres database subsystem.
  *
  * @param cls a configuration instance
- * @return NULL on error, otherwise a `struct TALER_MERCHANTDB_Plugin`
+ * @return NULL on error, otherwise a `struct TALER_ANASTASISDB_Plugin`
  */
 void *
-libtaler_plugin_merchantdb_postgres_init (void *cls)
+libtaler_plugin_anastasisdb_postgres_init (void *cls)
 {
   struct GNUNET_CONFIGURATION_Handle *cfg = cls;
   struct PostgresClosure *pg;
-  struct TALER_MERCHANTDB_Plugin *plugin;
+  struct TALER_ANASTASISDB_Plugin *plugin;
   const char *ec;
   struct GNUNET_PQ_ExecuteStatement es[] = {
     /* Orders created by the frontend, not signed or given a nonce yet.
@@ -487,7 +491,7 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
     GNUNET_free (pg);
     return NULL;
   }
-  plugin = GNUNET_new (struct TALER_MERCHANTDB_Plugin);
+  plugin = GNUNET_new (struct TALER_ANASTASISDB_Plugin);
   plugin->cls = pg;
   plugin->drop_tables = &postgres_drop_tables;
   plugin->start = postgres_start;
@@ -502,13 +506,13 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
 /**
  * Shutdown Postgres database subsystem.
  *
- * @param cls a `struct TALER_MERCHANTDB_Plugin`
+ * @param cls a `struct TALER_ANASTASISDB_Plugin`
  * @return NULL (always)
  */
 void *
-libtaler_plugin_merchantdb_postgres_done (void *cls)
+libtaler_plugin_anastasisdb_postgres_done (void *cls)
 {
-  struct TALER_MERCHANTDB_Plugin *plugin = cls;
+  struct TALER_ANASTASISDB_Plugin *plugin = cls;
   struct PostgresClosure *pg = plugin->cls;
 
   GNUNE_PQ_disconnect (pg->conn);
@@ -517,4 +521,4 @@ libtaler_plugin_merchantdb_postgres_done (void *cls)
   return NULL;
 }
 
-/* end of plugin_merchantdb_postgres.c */
+/* end of plugin_anastasisdb_postgres.c */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]