[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 02/08: description
From: |
gnunet |
Subject: |
[taler-anastasis] 02/08: description |
Date: |
Fri, 06 Nov 2020 18:06:27 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 685b5316c5c990591f0e61bfa527da7f85b92b8e
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Tue Nov 3 14:01:04 2020 +0100
description
---
src/lib/anastasis_api_redux.c | 118 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 113 insertions(+), 5 deletions(-)
diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 9029057..e21aa15 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -161,13 +161,15 @@ const json_t *redux_id_attr;
/**
- * Callback function FIXME: Description.
+ * Callback function which is called by the reducer in dependence of
+ * given state and action.
*
- * @param state FIXME: Description
- * @param arguments FIXME: Description
+ * @param state the previous state to operate on
+ * @param arguments the arguments needed by operation to operate on state
* @param ctx Curl context
- * @param cb FIXME: Description
- * @param cb_cls FIXME: Description
+ * @param cb Callback function which returns the new state
+ * @param cb_cls closure for @a cb
+ * @return handle to cancel async actions, NULL if @a cb was already called
*/
typedef struct ANASTASIS_ReduxAction *
(*DispatchHandler)(json_t *state,
@@ -177,6 +179,11 @@ typedef struct ANASTASIS_ReduxAction *
void *cb_cls);
+/**
+ * Function to free a #ConfigRequest an async operation.
+ *
+ * @param cr state for a "get config" operation
+ */
static void
free_config_request (struct ConfigRequest *cr)
{
@@ -190,6 +197,11 @@ free_config_request (struct ConfigRequest *cr)
}
+/**
+ * Function to free a #SelectCountryHandle.
+ *
+ * @param cls closure for a #SelectCountryHandle.
+ */
static void
free_select_country (void *cls)
{
@@ -208,6 +220,13 @@ free_select_country (void *cls)
}
+/**
+ * Adds the server configuration from async #ConfigRequest
+ * to the json state.
+ *
+ * @param cr the config request
+ * @param state the json state to operate on
+ */
static void
add_config_to_state (struct ConfigRequest *cr,
json_t *state)
@@ -265,6 +284,12 @@ add_config_to_state (struct ConfigRequest *cr,
}
+/**
+ * Function which collects all configurations from the different
+ * servers and calls the #ANASTASIS_ActionCallback.
+ *
+ * @param sch a handle to a country selection action
+ */
static void
conclude_select_country (struct SelectCountryHandle *sch)
{
@@ -299,6 +324,11 @@ conclude_select_country (struct SelectCountryHandle *sch)
}
+/**
+ * Retries a "get config" after timeout.
+ *
+ * @param cls closure for a "get config" request
+ */
static void
config_request_timeout (void *cls)
{
@@ -413,6 +443,7 @@ ANASTASIS_redux_countries_init_ (void)
/**
* Function to validate an AHV number.
+ *
* @param ahv_number ahv number to validate
* @param regexp regular expression to validate form of ahv number
* @return true if validation passed, else false
@@ -547,6 +578,18 @@ redux_id_attr_init (const char *country_code)
}
+/**
+ * DispatchHandler/Callback function which is called for a
+ * "select_continent" action.
+ * Returns an #ANASTASIS_ReduxAction if operation is async.
+ *
+ * @param state state to operate on
+ * @param arguments arguments to use for operation on state
+ * @param ctx CURL context
+ * @param cb callback (#DispatchHandler) to call during/after operation
+ * @param cb_cls callback closure
+ * @return NULL
+ */
static struct ANASTASIS_ReduxAction *
select_continent (json_t *state,
const json_t *arguments,
@@ -602,6 +645,18 @@ select_continent (json_t *state,
}
+/**
+ * DispatchHandler/Callback function which is called for a
+ * "select_country" action.
+ * Returns an #ANASTASIS_ReduxAction if operation is async.
+ *
+ * @param state state to operate on
+ * @param arguments arguments to use for operation on state
+ * @param ctx CURL context
+ * @param cb callback (#DispatchHandler) to call during/after operation
+ * @param cb_cls callback closure
+ * @return #ANASTASIS_ReduxAction
+ */
static struct ANASTASIS_ReduxAction *
select_country (json_t *state,
const json_t *arguments,
@@ -736,6 +791,18 @@ select_country (json_t *state,
}
+/**
+ * DispatchHandler/Callback function which is called for a
+ * "unselect_country" action.
+ * Returns an #ANASTASIS_ReduxAction if operation is async.
+ *
+ * @param state state to operate on
+ * @param arguments arguments to use for operation on state
+ * @param ctx CURL context
+ * @param cb callback (#DispatchHandler) to call during/after operation
+ * @param cb_cls callback closure
+ * @return NULL
+ */
static struct ANASTASIS_ReduxAction *
unselect_country (json_t *state,
const json_t *arguments,
@@ -759,6 +826,18 @@ unselect_country (json_t *state,
}
+/**
+ * DispatchHandler/Callback function which is called for a
+ * "unselect_continent" action.
+ * Returns an #ANASTASIS_ReduxAction if operation is async.
+ *
+ * @param state state to operate on
+ * @param arguments arguments to use for operation on state
+ * @param ctx CURL context
+ * @param cb callback (#DispatchHandler) to call during/after operation
+ * @param cb_cls callback closure
+ * @return NULL
+ */
static struct ANASTASIS_ReduxAction *
unselect_continent (json_t *state,
const json_t *arguments,
@@ -783,6 +862,18 @@ unselect_continent (json_t *state,
}
+/**
+ * DispatchHandler/Callback function which is called for a
+ * "enter_user_attributes" action.
+ * Returns an #ANASTASIS_ReduxAction if operation is async.
+ *
+ * @param state state to operate on
+ * @param arguments arguments to use for operation on state
+ * @param ctx CURL context
+ * @param cb callback (#DispatchHandler) to call during/after operation
+ * @param cb_cls callback closure
+ * @return NULL
+ */
static struct ANASTASIS_ReduxAction *
enter_user_attributes (json_t *state,
const json_t *arguments,
@@ -858,6 +949,18 @@ enter_user_attributes (json_t *state,
}
+/**
+ * A generic DispatchHandler/Callback function which is called for a
+ * "back" action.
+ * Returns an #ANASTASIS_ReduxAction if operation is async.
+ *
+ * @param state state to operate on
+ * @param arguments arguments to use for operation on state
+ * @param ctx CURL context
+ * @param cb callback (#DispatchHandler) to call during/after operation
+ * @param cb_cls callback closure
+ * @return NULL
+ */
struct ANASTASIS_ReduxAction *
ANASTASIS_back_generic_decrement_ (json_t *state,
const json_t *arguments,
@@ -1032,6 +1135,11 @@ ANASTASIS_redux_action (const json_t *state,
}
+/**
+ * Function to cancel an async activity.
+ *
+ * @param ra generic container for async activities
+ */
void
ANASTASIS_redux_action_cancel (struct ANASTASIS_ReduxAction *ra)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (f7e2529 -> eb4a3aa), gnunet, 2020/11/06
- [taler-anastasis] 02/08: description,
gnunet <=
- [taler-anastasis] 04/08: reducer - worked on payment/upload, gnunet, 2020/11/06
- [taler-anastasis] 01/08: add insurance to config, gnunet, 2020/11/06
- [taler-anastasis] 06/08: work on truth upload, gnunet, 2020/11/06
- [taler-anastasis] 05/08: initialize truths, gnunet, 2020/11/06
- [taler-anastasis] 07/08: Merge branch 'master' of ssh://git.taler.net/anastasis, gnunet, 2020/11/06
- [taler-anastasis] 08/08: fix db, fix reducer, gnunet, 2020/11/06
- [taler-anastasis] 03/08: reducer - better error handling, gnunet, 2020/11/06