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 (60e148a -> 1219ce3


From: gnunet
Subject: [GNUnet-SVN] [taler-anastasis] branch master updated (60e148a -> 1219ce3)
Date: Tue, 15 Oct 2019 13:07:36 +0200

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

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

    from 60e148a  Changed request of encrypted keyshare
     new 87bdfc9  Modified CREATE TABLE of truth
     new 1219ce3  Worked on postgres plugin

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backup-db/plugin_anastasis_postgres.c | 107 ++++++++++++++++++------------
 src/include/anastasis_database_plugin.h   |  17 ++---
 2 files changed, 75 insertions(+), 49 deletions(-)

diff --git a/src/backup-db/plugin_anastasis_postgres.c 
b/src/backup-db/plugin_anastasis_postgres.c
index 8359e55..8e698bf 100644
--- a/src/backup-db/plugin_anastasis_postgres.c
+++ b/src/backup-db/plugin_anastasis_postgres.c
@@ -209,6 +209,53 @@ postgres_commit (void *cls)
                                              params);
 }
 
+/**
+  * FIXME
+  * Upload encrypted recovery document.
+  *
+  * @param cls closure
+  * @param anastasis_pub public key of the user's account
+  * @param data contains encrypted_recovery_document
+  * @param data_size size of data blob
+  * @param payment_secret identifier for the payment, used to later charge on 
uploads
+  * @param version[OUT] set to the version assigned to the document by the 
database
+  * @return transaction status, 0 if upload could not be finished because @a 
payment_secret
+  *         did not have enough upload left; HARD error if @a payment_secret 
is unknown, ...
+  */
+static enum GNUNET_DB_QueryStatus
+postgres_store_recovery_document (void *cls,
+                                  const struct ANASTASIS_AccountPubP 
*anastasis_pub,
+                                  const void *data,
+                                  size_t data_size,
+                                  const struct
+                                  ANASTASIS_PaymentSecretP *payment_secret,
+                                  uint32_t *version)
+{
+  struct PostgresClosure *pg = cls;
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
+    GNUNET_PQ_query_param_auto_from_type (&h_contract_terms),
+    GNUNET_PQ_query_param_end
+  };
+
+  if (GNUNET_OK !=
+      TALER_JSON_hash (contract_terms,
+                       &h_contract_terms))
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "inserting contract terms: order_id: %s, anastasis_pub: %s, 
h_contract_terms: %s.\n",
+              order_id,
+              TALER_B2S (anastasis_pub),
+              GNUNET_h2s (&h_contract_terms));
+  check_connection (pg);
+  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+                                             "insert_contract_terms",
+                                             params);
+}
+
 
 /**
  * FIXME
@@ -249,30 +296,32 @@ postgres_find_contract_terms_from_hash (void *cls,
 
 
 /**
+ * FIXME
  * Insert proposal data and its hashcode into db
  *
  * @param cls closure
- * @param order_id identificator of the proposal being stored
+ * @param payment_id identifier of the payment
+ * @param amount amount of taler to be paid
  * @param anastasis_pub anastasis's public key
- * @param timestamp timestamp of this proposal data
- * @param contract_terms proposal data to store
+ * @param num_uploads number of uploads the user can make
+ * @param lifetime_inc time the payment is valid till
+ * @param payment_secret payment secret which the user must provide with every 
upload
  * @return transaction status
  */
 static enum GNUNET_DB_QueryStatus
 postgres_record_payment (void *cls,
+                         const *payment_id,
                          const struct TALER_Amount *amount,
-                         const struct ANASTASIS_AccountPubP *account_pub,
-                         unsigned int num_uploads,
+                         const struct ANASTASIS_AccountPubP *anastasis_pub,
+                         unsigned int *num_uploads,
                          struct GNUNET_TIME_Relative lifetime_inc,
                          const struct ANASTASIS_PaymentSecretP *payment_secret)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_string (order_id),
+    GNUNET_PQ_query_param_string (payment_id),
     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),
+    GNUNET_PQ_query_param_absolute_time (&lifetime_inc),
     GNUNET_PQ_query_param_end
   };
 
@@ -294,30 +343,8 @@ postgres_record_payment (void *cls,
                                              params);
 }
 
-
-/**
- * Closure for #find_contracts_cb().
- */
-struct FindContractsContext
-{
-  /**
-   * Function to call on each result.
-   */
-  TALER_ANASTASISDB_ProposalDataCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Transaction status code to set.
-   */
-  enum GNUNET_DB_QueryStatus qs;
-};
-
-
 /**
+ * FIXME
  * Function to be called with the results of a SELECT statement
  * that has returned @a num_results results.
  *
@@ -366,7 +393,8 @@ find_contracts_cb (void *cls,
 }
 
 
-/**
+/** 
+ * FIXME
  * Return proposals whose timestamp are older than `date`.
  * Among those proposals, only those ones being between the
  * start-th and (start-nrows)-th record are returned.  The rows
@@ -397,13 +425,13 @@ postgres_find_contract_terms_by_date_and_range (void *cls,
                                                 struct GNUNET_TIME_Absolute
                                                 date,
                                                 const struct
-                                                TALER_MerchantPublicKeyP *
+                                                AnastasisPublicKeyP *
                                                 anastasis_pub,
                                                 uint64_t start,
                                                 uint64_t nrows,
                                                 int past,
                                                 unsigned int ascending,
-                                                
TALER_ANASTASISDB_ProposalDataCallback
+                                                
ANASTASIS_DB_ProposalDataCallback
                                                 cb,
                                                 void *cb_cls)
 {
@@ -452,7 +480,7 @@ postgres_find_contract_terms_by_date_and_range (void *cls,
  * @return NULL on error, otherwise a `struct TALER_ANASTASISDB_Plugin`
  */
 void *
-plugin_anastasis_db_postgres_init (void *cls)
+libtaler_plugin_anastasis_db_postgres_init (void *cls)
 {
   struct GNUNET_CONFIGURATION_Handle *cfg = cls;
   struct PostgresClosure *pg;
@@ -464,11 +492,8 @@ plugin_anastasis_db_postgres_init (void *cls)
        contract terms table */
     GNUNET_PQ_make_execute ("CREATE TABLE anastasis_truth
                             ( truth_id uuid PRIMARY KEY NOT NULL,
-                              truth_method VARCHAR,
-                              truth_mimetype VARCHAR,
                               truth bytea,
-                              expiration timestamp,
-                              key_share_data bytea
+                              expiration timestamp
                             );"),                 
 
     GNUNET_PQ_make_execute ("CREATE TABLE anastasis_user
@@ -526,7 +551,7 @@ plugin_anastasis_db_postgres_init (void *cls)
  * @return NULL (always)
  */
 void *
-plugin_anastasisdb_postgres_done (void *cls)
+plugin_anastasis_db_postgres_done (void *cls)
 {
   struct ANASTASIS_DB_Plugin *plugin = cls;
   struct PostgresClosure *pg = plugin->cls;
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 433c7aa..1ff906d 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -111,8 +111,9 @@ struct AnastasisDatabasePlugin
    * Record user payment.
    *
    * @param cls closure
+   * @param payment_id identifier of the payment
    * @param amount how much was paid
-   * @param account_pub public key of the user's account
+   * @param anastasis_pub public key of the user's account
    * @param num_uploads how many uploads does @a amount pay for
    * @param lifetime_inc for how long does @a amount pay for account 
maintenance
    * @param payment_secret identifier for the payment, used to later charge on 
uploads
@@ -121,7 +122,7 @@ struct AnastasisDatabasePlugin
   enum GNUNET_DB_QueryStatus
   (*record_payment)(void *cls,
                     const struct TALER_Amount *amount,
-                    const struct ANASTASIS_AccountPubP *account_pub,
+                    const struct ANASTASIS_AccountPubP *anastasis_pub,
                     unsigned int num_uploads,
                     struct GNUNET_TIME_Relative lifetime_inc,
                     const struct ANASTASIS_PaymentSecretP *payment_secret);
@@ -130,7 +131,7 @@ struct AnastasisDatabasePlugin
    * Upload encrypted recovery document.
    *
    * @param cls closure
-   * @param account_pub public key of the user's account
+   * @param anastasis_pub public key of the user's account
    * @param data contains encrypted_recovery_document
    * @param data_size size of data blob
    * @param payment_secret identifier for the payment, used to later charge on 
uploads
@@ -140,7 +141,7 @@ struct AnastasisDatabasePlugin
    */
   enum GNUNET_DB_QueryStatus
   (*store_recovery_document)(void *cls,
-                             const struct ANASTASIS_AccountPubP *account_pub,
+                             const struct ANASTASIS_AccountPubP *anastasis_pub,
                              const void *data,
                              size_t data_size,
                              const struct
@@ -151,7 +152,7 @@ struct AnastasisDatabasePlugin
    * Fetch recovery document for user.
    *
    * @param cls closure
-   * @param account_pub public key of the user's account
+   * @param anastasis_pub public key of the user's account
    * @param version[OUT] set to the version number of the policy the user 
requested
    * @param data_size size of data blob
    * @param data blob which contains the recovery document
@@ -159,7 +160,7 @@ struct AnastasisDatabasePlugin
    */
   enum GNUNET_DB_QueryStatus
   (*get_recovery_document)(void *cls,
-                           const struct ANASTASIS_AccountPubP *account_pub,
+                           const struct ANASTASIS_AccountPubP *anastasis_pub,
                            uint32_t version,
                            size_t *data_size,
                            void **data);
@@ -168,7 +169,7 @@ struct AnastasisDatabasePlugin
    * Fetch latest recovery document for user.
    *
    * @param cls closure
-   * @param account_pub public key of the user's account
+   * @param anastasis_pub public key of the user's account
    * @param version[OUT] set to the version number of the policy being returned
    * @param data_size size of data blob
    * @param data blob which contains the recovery document
@@ -177,7 +178,7 @@ struct AnastasisDatabasePlugin
   enum GNUNET_DB_QueryStatus
   (*get_latest_recovery_document)(void *cls,
                                   const struct
-                                  ANASTASIS_AccountPubP *account_pub,
+                                  ANASTASIS_AccountPubP *anastasis_pub,
                                   size_t *data_size,
                                   void **data,
                                   uint32_t *version);

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



reply via email to

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