summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-11-17 00:13:00 +0100
committerChristian Grothoff <christian@grothoff.org>2019-11-17 00:13:00 +0100
commit8b1e276a316d29a752b26cdc070330e688aea221 (patch)
tree203a9de2a95edae1dae9979ec4296e63b3bb61e9 /src/include
parent9badf80eb4228a9c009839a4856710127efe8601 (diff)
downloadsync-8b1e276a316d29a752b26cdc070330e688aea221.tar.gz
sync-8b1e276a316d29a752b26cdc070330e688aea221.tar.bz2
sync-8b1e276a316d29a752b26cdc070330e688aea221.zip
breaking the build badly, big hacking
Diffstat (limited to 'src/include')
-rw-r--r--src/include/sync_database_plugin.h80
-rw-r--r--src/include/sync_service.h30
2 files changed, 107 insertions, 3 deletions
diff --git a/src/include/sync_database_plugin.h b/src/include/sync_database_plugin.h
index d5759ee..ac88828 100644
--- a/src/include/sync_database_plugin.h
+++ b/src/include/sync_database_plugin.h
@@ -65,6 +65,24 @@ enum SYNC_DB_QueryStatus
/**
+ * Function called on all pending payments.
+ *
+ * @param cls closure
+ * @param account_pub which account is the order for
+ * @param timestamp for how long have we been waiting
+ * @param order_id order id in the backend
+ * @param amount how much is the order for
+ */
+typedef void
+(*SYNC_DB_PaymentPendingIterator)(void *cls,
+ const struct
+ SYNC_AccountPublicKeyP *account_pub,
+ struct GNUNET_TIME_Absolute timestamp,
+ const char *order_id,
+ const struct TALER_Amount *amount);
+
+
+/**
* Handle to interact with the database.
*
* Functions ending with "_TR" run their OWN transaction scope
@@ -104,12 +122,16 @@ struct SYNC_DatabasePlugin
* truth and financial records older than @a fin_expire.
*
* @param cls closure
- * @param expire backups older than the given time stamp should be garbage collected
+ * @param expire_backups backups older than the given time stamp should be garbage collected
+ * @param expire_pending_payments payments still pending from since before
+ * this value should be garbage collected
* @return transaction status
*/
enum SYNC_DB_QueryStatus
(*gc)(void *cls,
- struct GNUNET_TIME_Absolute expire);
+ struct GNUNET_TIME_Absolute expire,
+ struct GNUNET_TIME_Absolute expire_pending_payments);
+
/**
* Store backup. Only applicable for the FIRST backup under
@@ -132,6 +154,55 @@ struct SYNC_DatabasePlugin
size_t backup_size,
const void *backup);
+
+ /**
+ * Store payment. Used to begin a payment, not indicative
+ * that the payment actually was made. (That is done
+ * when we increment the account's lifetime.)
+ *
+ * @param cls closure
+ * @param account_pub account to store @a backup under
+ * @param order_id order we created
+ * @param amount how much we asked for
+ * @return transaction status
+ */
+ enum SYNC_DB_QueryStatus
+ (*store_payment_TR)(void *cls,
+ const struct SYNC_AccountPublicKeyP *account_pub,
+ const char *order_id,
+ const struct TALER_Amount *amount);
+
+
+ /**
+ * Lookup pending payments.
+ *
+ * @param cls closure
+ * @param it iterator to call on all pending payments
+ * @param it_cls closure for @a it
+ * @return transaction status
+ */
+ enum SYNC_DB_QueryStatus
+ (*lookup_pending_payments_TR)(void *cls,
+ SYNC_DB_PaymentPendingIterator it,
+ void *it_cls);
+
+
+ /**
+ * Lookup pending payments by account.
+ *
+ * @param cls closure
+ * @param account_pub account to look for pending payments under
+ * @param it iterator to call on all pending payments
+ * @param it_cls closure for @a it
+ * @return transaction status
+ */
+ enum SYNC_DB_QueryStatus
+ (*lookup_pending_payments_by_account_TR)(void *cls,
+ const struct
+ SYNC_AccountPublicKeyP *account_pub,
+ SYNC_DB_PaymentPendingIterator it,
+ void *it_cls);
+
/**
* Update backup.
*
@@ -189,16 +260,19 @@ struct SYNC_DatabasePlugin
void **backup);
/**
- * Increment account lifetime.
+ * Increment account lifetime and mark the associated payment
+ * as successful.
*
* @param cls closure
* @param account_pub which account received a payment
+ * @param order_id order which was paid, must be unique and match pending payment
* @param lifetime for how long is the account now paid (increment)
* @return transaction status
*/
enum SYNC_DB_QueryStatus
(*increment_lifetime_TR)(void *cls,
const struct SYNC_AccountPublicKeyP *account_pub,
+ const char *order_id,
struct GNUNET_TIME_Relative lifetime);
};
diff --git a/src/include/sync_service.h b/src/include/sync_service.h
index 20bbe67..595df3c 100644
--- a/src/include/sync_service.h
+++ b/src/include/sync_service.h
@@ -50,6 +50,36 @@ struct SYNC_AccountPublicKeyP
};
+GNUNET_NETWORK_STRUCT_BEGIN
+
+
+/**
+ * Data signed by the account public key of a sync client to
+ * authorize the upload of the backup.
+ */
+struct SYNC_UploadSignaturePS
+{
+ /**
+ * Set to #TALER_SIGNATURE_SYNC_BACKUP_UPLOAD.
+ */
+ struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+ /**
+ * Hash of the previous backup, all zeros for none.
+ */
+ struct GNUNET_HashCode old_backup_hash GNUNET_PACKED;
+
+ /**
+ * Hash of the new backup.
+ */
+ struct GNUNET_HashCode new_backup_hash GNUNET_PACKED;
+
+};
+
+
+GNUNET_NETWORK_STRUCT_END
+
+
/**
* Signature made with an account's public key.
*/