[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: async state management
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: async state management |
Date: |
Wed, 14 Oct 2020 15:30:26 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 7084d6a async state management
7084d6a is described below
commit 7084d6a9743756ed181eb85fd073da0d61e99636
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Oct 14 15:30:24 2020 +0200
async state management
---
src/include/anastasis_redux.h | 16 +++++++++++++---
src/lib/anastasis_api_redux.c | 2 +-
src/lib/anastasis_api_redux.h | 11 +++++++++++
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index 7a973ac..5913453 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -186,6 +186,12 @@ typedef void
json_t *new_state);
+/**
+ * Handle to an ongoing action. Only valid until the #ANASTASIA_ActionCallback
is invoked.
+ */
+struct ANASTASIS_ReduxAction;
+
+
/**
* Operates on a backup state depending on given #ANASTASIS_BackupState
* and #ANASTASIS_BackupAction. The new #ANASTASIS_BackupState is returned
@@ -199,7 +205,7 @@ typedef void
* @param cb function to call with the result
* @param cb_cls closure for @a cb
*/
-void
+struct ANASTASIS_ReduxAction *
ANASTASIS_backup_action (struct GNUNET_CURL_Context *ctx,
json_t *state,
const char *action,
@@ -208,6 +214,10 @@ ANASTASIS_backup_action (struct GNUNET_CURL_Context *ctx,
void *cb_cls);
+void
+ANASTASIS_action_cancel (struct ANASTASIS_ReduxAction *ra);
+
+
/**
* Operates on a recovery state depending on given #ANASTASIS_RecoveryState
* and #ANASTASIS_RecoveryAction. The new #ANASTASIS_RecoveryState is returned
@@ -221,7 +231,7 @@ ANASTASIS_backup_action (struct GNUNET_CURL_Context *ctx,
* @param cb function to call with the result
* @param cb_cls closure for @a cb
*/
-void
+struct ANASTASIS_ReduxAction *
ANASTASIS_recovery_action (struct GNUNET_CURL_Context *ctx,
json_t *state,
const char *action,
@@ -246,7 +256,7 @@ ANASTASIS_recovery_action (struct GNUNET_CURL_Context *ctx,
* @param cb_cls closure for @a cb
* @return failure state or new state
*/
-void
+struct ANASTASIS_ReduxAction *
ANASTASIS_redux_action (const json_t *state,
const char *action,
const json_t *arguments,
diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 956c97d..1ac792b 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -458,7 +458,7 @@ select_continent (json_t *state,
{
size_t index;
json_t *country;
- json_t *redux_countries = redux_countries_init ();
+ json_t *redux_countries = ANASTASIS_redux_countries_init_ ();
json_t *root = json_object_get (redux_countries, "countries");
json_t *countries = json_array ();
json_t *continent = json_object_get (arguments, "continent");
diff --git a/src/lib/anastasis_api_redux.h b/src/lib/anastasis_api_redux.h
index 57b32b9..217478c 100644
--- a/src/lib/anastasis_api_redux.h
+++ b/src/lib/anastasis_api_redux.h
@@ -18,4 +18,15 @@ json_t *
ANASTASIS_redux_countries_init_ (void);
+/**
+ * Generic container for an action with asynchronous activities.
+ */
+struct ANASTASIS_ReduxAction
+{
+ void (*cleanup)(void *cls);
+
+ void *cleanup_cls;
+};
+
+
#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.