summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-01-16 17:49:32 +0100
committerChristian Grothoff <christian@grothoff.org>2023-01-16 17:49:32 +0100
commit3de9e044eddbe4d7054df875d516be1273f5be7c (patch)
tree282809e2cff093e7d575223e3e370f00267bbfac /src
parent117b8006d628b03d6e5945338c2362720a7f0e94 (diff)
downloadmerchant-3de9e044eddbe4d7054df875d516be1273f5be7c.tar.gz
merchant-3de9e044eddbe4d7054df875d516be1273f5be7c.tar.bz2
merchant-3de9e044eddbe4d7054df875d516be1273f5be7c.zip
-typos and indentation
Diffstat (limited to 'src')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c102
-rw-r--r--src/include/taler_merchantdb_plugin.h295
2 files changed, 203 insertions, 194 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);
}
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 2ae91046..764bdab6 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -404,7 +404,6 @@ typedef void
const char *body_template);
-
/**
* Typically called by `lookup_pending_webhooks`.
*
@@ -420,7 +419,8 @@ typedef void
typedef void
(*TALER_MERCHANTDB_PendingWebhooksCallback)(void *cls,
uint64_t webhook_serial,
- struct GNUNET_TIME_Absolute next_attempt,
+ struct GNUNET_TIME_Absolute
+ next_attempt,
uint32_t retries,
const char *url,
const char *http_method,
@@ -469,7 +469,6 @@ struct TALER_MERCHANTDB_PendingWebhookDetails
};
-
/**
* Filter preferences.
*/
@@ -2554,15 +2553,15 @@ struct TALER_MERCHANTDB_Plugin
const struct TALER_BlindedDenominationSignature *blind_sig);
-/**
- * Lookup all of the templates the given instance has configured.
- *
- * @param cls closure
- * @param instance_id instance to lookup template for
- * @param cb function to call on all template found
- * @param cb_cls closure for @a cb
- * @return database result code
- */
+ /**
+ * Lookup all of the templates the given instance has configured.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup template for
+ * @param cb function to call on all template found
+ * @param cb_cls closure for @a cb
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*lookup_templates)(void *cls,
const char *instance_id,
@@ -2570,46 +2569,46 @@ struct TALER_MERCHANTDB_Plugin
void *cb_cls);
-/**
- * Lookup details about a particular template.
- *
- * @param cls closure
- * @param instance_id instance to lookup template for
- * @param template_id template to lookup
- * @param[out] td set to the template details on success, can be NULL
- * (in that case we only want to check if the template exists)
- * @return database result code
- */
+ /**
+ * Lookup details about a particular template.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup template for
+ * @param template_id template to lookup
+ * @param[out] td set to the template details on success, can be NULL
+ * (in that case we only want to check if the template exists)
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*lookup_template)(void *cls,
const char *instance_id,
const char *template_id,
struct TALER_MERCHANTDB_TemplateDetails *td);
-/**
- * Delete information about a template.
- *
- * @param cls closure
- * @param instance_id instance to delete template of
- * @param template_id template to delete
- * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
- * if template unknown.
- */
+ /**
+ * Delete information about a template.
+ *
+ * @param cls closure
+ * @param instance_id instance to delete template of
+ * @param template_id template to delete
+ * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
+ * if template unknown.
+ */
enum GNUNET_DB_QueryStatus
(*delete_template)(void *cls,
const char *instance_id,
const char *template_id);
-/**
- * Insert details about a particular template.
- *
- * @param cls closure
- * @param instance_id instance to insert template for
- * @param template_id template identifier of template to insert
- * @param td the template details to insert
- * @return database result code
- */
+ /**
+ * Insert details about a particular template.
+ *
+ * @param cls closure
+ * @param instance_id instance to insert template for
+ * @param template_id template identifier of template to insert
+ * @param td the template details to insert
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*insert_template)(void *cls,
const char *instance_id,
@@ -2617,18 +2616,17 @@ struct TALER_MERCHANTDB_Plugin
const struct TALER_MERCHANTDB_TemplateDetails *td);
-/**
- * Update details about a particular template.
- *
- * @param cls closure
- * @param instance_id instance to update template for
- * @param template_id template to update
- * @param td update to the template details on success, can be NULL
- * (in that case we only want to check if the template exists)
- * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the template
- * does not yet exist.
- */
-
+ /**
+ * Update details about a particular template.
+ *
+ * @param cls closure
+ * @param instance_id instance to update template for
+ * @param template_id template to update
+ * @param td update to the template details on success, can be NULL
+ * (in that case we only want to check if the template exists)
+ * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the template
+ * does not yet exist.
+ */
enum GNUNET_DB_QueryStatus
(*update_template)(void *cls,
const char *instance_id,
@@ -2636,86 +2634,85 @@ struct TALER_MERCHANTDB_Plugin
const struct TALER_MERCHANTDB_TemplateDetails *td);
-/**
- * Lookup all of the webhooks the given instance has configured.
- *
- * @param cls closure
- * @param instance_id instance to lookup webhook for
- * @param cb function to call on all webhook found
- * @param cb_cls closure for @a cb
- * @return database result code
- */
+ /**
+ * Lookup all of the webhooks the given instance has configured.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup webhook for
+ * @param cb function to call on all webhook found
+ * @param cb_cls closure for @a cb
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*lookup_webhooks)(void *cls,
- const char *instance_id,
- TALER_MERCHANTDB_WebhooksCallback cb,
- void *cb_cls);
+ const char *instance_id,
+ TALER_MERCHANTDB_WebhooksCallback cb,
+ void *cb_cls);
-/**
- * Lookup details about a particular webhook.
- *
- * @param cls closure
- * @param instance_id instance to lookup webhook for
- * @param webhook_id webhook to lookup
- * @param[out] wb set to the webhook details on success, can be NULL
- * (in that case we only want to check if the webhook exists)
- * @return database result code
- */
+ /**
+ * Lookup details about a particular webhook.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup webhook for
+ * @param webhook_id webhook to lookup
+ * @param[out] wb set to the webhook details on success, can be NULL
+ * (in that case we only want to check if the webhook exists)
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*lookup_webhook)(void *cls,
- const char *instance_id,
- const char *webhook_id,
- struct TALER_MERCHANTDB_WebhookDetails *wb);
+ const char *instance_id,
+ const char *webhook_id,
+ struct TALER_MERCHANTDB_WebhookDetails *wb);
-/**
- * Delete information about a webhook.
- *
- * @param cls closure
- * @param instance_id instance to delete webhook of
- * @param webhook_id webhook to delete
- * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
- * if webhook unknown.
- */
+ /**
+ * Delete information about a webhook.
+ *
+ * @param cls closure
+ * @param instance_id instance to delete webhook of
+ * @param webhook_id webhook to delete
+ * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
+ * if webhook unknown.
+ */
enum GNUNET_DB_QueryStatus
(*delete_webhook)(void *cls,
- const char *instance_id,
- const char *webhook_id);
+ const char *instance_id,
+ const char *webhook_id);
-/**
- * Insert details about a particular webhook.
- *
- * @param cls closure
- * @param instance_id instance to insert webhook for
- * @param webhook_id webhook identifier of webhook to insert
- * @param wb the webhook details to insert
- * @return database result code
- */
+ /**
+ * Insert details about a particular webhook.
+ *
+ * @param cls closure
+ * @param instance_id instance to insert webhook for
+ * @param webhook_id webhook identifier of webhook to insert
+ * @param wb the webhook details to insert
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*insert_webhook)(void *cls,
- const char *instance_id,
- const char *webhook_id,
- const struct TALER_MERCHANTDB_WebhookDetails *wb);
-
+ const char *instance_id,
+ const char *webhook_id,
+ const struct TALER_MERCHANTDB_WebhookDetails *wb);
-/**
- * Update details about a particular webhook.
- *
- * @param cls closure
- * @param instance_id instance to update webhook for
- * @param webhook_id webhook to update
- * @param wb update to the webhook details on success, can be NULL
- * (in that case we only want to check if the webhook exists)
- * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the webhook
- * does not yet exist.
- */
+ /**
+ * Update details about a particular webhook.
+ *
+ * @param cls closure
+ * @param instance_id instance to update webhook for
+ * @param webhook_id webhook to update
+ * @param wb update to the webhook details on success, can be NULL
+ * (in that case we only want to check if the webhook exists)
+ * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the webhook
+ * does not yet exist.
+ */
enum GNUNET_DB_QueryStatus
(*update_webhook)(void *cls,
- const char *instance_id,
- const char *webhook_id,
- const struct TALER_MERCHANTDB_WebhookDetails *wb);
+ const char *instance_id,
+ const char *webhook_id,
+ const struct TALER_MERCHANTDB_WebhookDetails *wb);
/**
* Lookup webhook by event
@@ -2734,18 +2731,18 @@ struct TALER_MERCHANTDB_Plugin
TALER_MERCHANTDB_WebhookDetailCallback cb,
void *cb_cls);
-/**
- * Insert webhook in the pending webhook.
- *
- * @param cls closure
- * @param instance_id instance to insert webhook for
- * @param webhook_serial webhook to insert in the pending webhook
- * @param url to make the request to
- * @param http_method for the webhook
- * @param header of the webhook
- * @param body of the webhook
- * @return database result code
- */
+ /**
+ * Insert webhook in the pending webhook.
+ *
+ * @param cls closure
+ * @param instance_id instance to insert webhook for
+ * @param webhook_serial webhook to insert in the pending webhook
+ * @param url to make the request to
+ * @param http_method for the webhook
+ * @param header of the webhook
+ * @param body of the webhook
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*insert_pending_webhook)(void *cls,
const char *instance_id,
@@ -2766,10 +2763,10 @@ struct TALER_MERCHANTDB_Plugin
* @return database result code
*/
enum GNUNET_DB_QueryStatus
- (*lookup_pending_webhook) (void *cls,
- const char *instance_id,
- uint64_t *webhook_serial,
- struct TALER_MERCHANTDB_PendingWebhookDetails *pwb);
+ (*lookup_pending_webhook)(void *cls,
+ const char *instance_id,
+ uint64_t *webhook_serial,
+ struct TALER_MERCHANTDB_PendingWebhookDetails *pwb);
/**
* Lookup the webhook that need to be send in priority. These webhooks are not successfully
* send.
@@ -2796,7 +2793,7 @@ struct TALER_MERCHANTDB_Plugin
enum GNUNET_DB_QueryStatus
(*lookup_future_webhook)(void *cls,
TALER_MERCHANTDB_PendingWebhooksCallback cb,
- void *cb_cls);
+ void *cb_cls);
/**
* Lookup all the webhooks in the pending webhook.
@@ -2819,27 +2816,29 @@ struct TALER_MERCHANTDB_Plugin
void *cb_cls);
-/**
- * Update the pending webhook. It is use if the webhook can't be send.
- *
- * @param cls closure
- * @param webhook_serial webhook that need to be update
- * @param next_attempt when we should make the next request to the webhook
- * @return database result code
- */
+ /**
+ * Update the pending webhook. It is use if the webhook can't be send.
+ *
+ * @param cls closure
+ * @param webhook_serial webhook that need to be update
+ * @param next_attempt when we should make the next request to the webhook
+ * @return database result code
+ */
enum GNUNET_DB_QueryStatus
(*update_pending_webhook)(void *cls,
uint64_t webhook_serial,
struct GNUNET_TIME_Absolute next_attempt);
- // maybe add: http status of failure?
+ // maybe add: http status of failure?
-/**
- * Delete a webhook in the pending webhook if it is successfull
- *
- * @param cls closure
- * @param webhook_serial webhook that need to be delete in the pending webhook
- * @return database result code
- */
+
+ /**
+ * 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
+ */
enum GNUNET_DB_QueryStatus
(*delete_pending_webhook)(void *cls,
uint64_t webhook_serial);