summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c102
1 files changed, 56 insertions, 46 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index a747ea48..230417e7 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -7428,6 +7428,7 @@ lookup_webhook_by_event_cb (void *cls,
}
}
+
/**
* Lookup webhook by event
*
@@ -7439,7 +7440,7 @@ lookup_webhook_by_event_cb (void *cls,
* @return database result code
*/
static enum GNUNET_DB_QueryStatus
-postgres_lookup_webhook_by_event(void *cls,
+postgres_lookup_webhook_by_event (void *cls,
const char *instance_id,
const char *event_type,
TALER_MERCHANTDB_WebhookDetailCallback cb,
@@ -7471,6 +7472,7 @@ postgres_lookup_webhook_by_event(void *cls,
return qs;
}
+
/**
* Insert webhook in the pending webhook.
*
@@ -7484,13 +7486,13 @@ postgres_lookup_webhook_by_event(void *cls,
* @return database result code
*/
static enum GNUNET_DB_QueryStatus
-postgres_insert_pending_webhook(void *cls,
- const char *instance_id,
- uint64_t webhook_serial,
- const char *url,
- const char *http_method,
- const char *header,
- const char *body)
+postgres_insert_pending_webhook (void *cls,
+ const char *instance_id,
+ uint64_t webhook_serial,
+ const char *url,
+ const char *http_method,
+ const char *header,
+ const char *body)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -7512,6 +7514,7 @@ postgres_insert_pending_webhook(void *cls,
params);
}
+
/**
* Lookup details about a particular pending webhook.
*
@@ -7526,7 +7529,8 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_pending_webhook (void *cls,
const char *instance_id,
uint64_t *webhook_serial,
- struct TALER_MERCHANTDB_PendingWebhookDetails *pwb)
+ struct TALER_MERCHANTDB_PendingWebhookDetails *
+ pwb)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -7573,6 +7577,7 @@ postgres_lookup_pending_webhook (void *cls,
}
}
+
/**
* Context used for postgres_lookup_future_webhook().
*/
@@ -7657,6 +7662,7 @@ lookup_pending_webhooks_cb (void *cls,
}
}
+
/**
* Lookup the webhook that need to be send in priority.
* send.
@@ -7667,9 +7673,9 @@ lookup_pending_webhooks_cb (void *cls,
*/
// WHERE next_attempt <= now ORDER BY next_attempt ASC
static enum GNUNET_DB_QueryStatus
-postgres_lookup_pending_webhooks(void *cls,
- TALER_MERCHANTDB_PendingWebhooksCallback cb,
- void *cb_cls)
+postgres_lookup_pending_webhooks (void *cls,
+ TALER_MERCHANTDB_PendingWebhooksCallback cb,
+ void *cb_cls)
{
struct PostgresClosure *pg = cls;
struct LookupPendingWebhookContext pwlc = {
@@ -7708,9 +7714,9 @@ postgres_lookup_pending_webhooks(void *cls,
*/
// ORDER BY next_attempt ASC LIMIT 1
static enum GNUNET_DB_QueryStatus
-postgres_lookup_future_webhook(void *cls,
- TALER_MERCHANTDB_PendingWebhooksCallback cb,
- void *cb_cls)
+postgres_lookup_future_webhook (void *cls,
+ TALER_MERCHANTDB_PendingWebhooksCallback cb,
+ void *cb_cls)
{
struct PostgresClosure *pg = cls;
struct LookupPendingWebhookContext pwlc = {
@@ -7736,7 +7742,8 @@ postgres_lookup_future_webhook(void *cls,
return qs;
}
- /**
+
+/**
* Lookup all the webhooks in the pending webhook.
* Use by the administrator
*
@@ -7747,15 +7754,15 @@ postgres_lookup_future_webhook(void *cls,
* @param cb pending webhook callback
* @param cb_cls callback closure
*/
- // WHERE webhook_pending_serial > min_row ORDER BY webhook_pending_serial ASC LIMIT max_results
- static enum GNUNET_DB_QueryStatus
- postgres_lookup_all_webhooks(void *cls,
- const char *instance_id,
- uint64_t min_row,
- uint32_t max_results,
- TALER_MERCHANTDB_PendingWebhooksCallback cb,
- void *cb_cls)
- {
+// WHERE webhook_pending_serial > min_row ORDER BY webhook_pending_serial ASC LIMIT max_results
+static enum GNUNET_DB_QueryStatus
+postgres_lookup_all_webhooks (void *cls,
+ const char *instance_id,
+ uint64_t min_row,
+ uint32_t max_results,
+ TALER_MERCHANTDB_PendingWebhooksCallback cb,
+ void *cb_cls)
+{
struct PostgresClosure *pg = cls;
struct LookupPendingWebhookContext pwlc = {
.cb = cb,
@@ -7784,6 +7791,7 @@ postgres_lookup_future_webhook(void *cls,
return qs;
}
+
/**
* Update the pending webhook. It is use if the webhook can't be send.
*
@@ -7792,14 +7800,14 @@ postgres_lookup_future_webhook(void *cls,
* @param next_attempt when we should make the next request to the webhook
* @return database result code
*/
- static enum GNUNET_DB_QueryStatus
- postgres_update_pending_webhook(void *cls,
- uint64_t webhook_serial,
- struct GNUNET_TIME_Absolute next_attempt)
- // maybe add: http status of failure?
+static enum GNUNET_DB_QueryStatus
+postgres_update_pending_webhook (void *cls,
+ uint64_t webhook_serial,
+ struct GNUNET_TIME_Absolute next_attempt)
+// maybe add: http status of failure?
{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&webhook_serial),
GNUNET_PQ_query_param_absolute_time (&next_attempt),
GNUNET_PQ_query_param_end
@@ -7812,26 +7820,28 @@ postgres_lookup_future_webhook(void *cls,
params);
}
+
/**
- * Delete a webhook in the pending webhook if it is successfull
+ * Delete a webhook in the pending webhook after the
+ * webhook was completed successfully.
*
* @param cls closure
* @param webhook_serial webhook that need to be delete in the pending webhook
* @return database result code
*/
- static enum GNUNET_DB_QueryStatus
- postgres_delete_pending_webhook(void *cls,
- uint64_t webhook_serial)
- {
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_uint64 (&webhook_serial),
- GNUNET_PQ_query_param_end
- };
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "delete_pending_webhook",
- params);
+static enum GNUNET_DB_QueryStatus
+postgres_delete_pending_webhook (void *cls,
+ uint64_t webhook_serial)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_uint64 (&webhook_serial),
+ GNUNET_PQ_query_param_end
+ };
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "delete_pending_webhook",
+ params);
}