[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: return full array of policy pro
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: return full array of policy providers |
Date: |
Sat, 20 Mar 2021 10:12:47 +0100 |
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 ef48964 return full array of policy providers
ef48964 is described below
commit ef48964be1eb9c0f9b440f476071eeefc24db1ae
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sat Mar 20 10:12:40 2021 +0100
return full array of policy providers
---
src/include/anastasis.h | 23 +++++++++++++++++++----
src/lib/anastasis_backup.c | 18 +++++++++++++-----
src/reducer/anastasis_api_backup_redux.c | 28 +++++++++++++++++++++++-----
3 files changed, 55 insertions(+), 14 deletions(-)
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 34a3934..48a7769 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -795,10 +795,25 @@ struct ANASTASIS_ShareResult
union
{
- /**
- * Version number of the resulting policy (on success).
- */
- unsigned long long max_policy_version;
+ struct
+ {
+
+ /**
+ * Array of version numbers of the resulting policy (on success).
+ */
+ unsigned long long *policy_versions;
+
+ /**
+ * Array of Base URLs of the providers that stored the policy.
+ */
+ const char **provider_urls;
+
+ /**
+ * Length of the @e policy_version and @e provider_urls arrays.
+ */
+ unsigned int num_providers;
+
+ } success;
struct
{
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c
index 3c1cd62..879e5bd 100644
--- a/src/lib/anastasis_backup.c
+++ b/src/lib/anastasis_backup.c
@@ -706,17 +706,23 @@ policy_store_cb (void *cls,
pr_cnt++;
{
struct ANASTASIS_SharePaymentRequest spr[GNUNET_NZL (pr_cnt)];
+ const char *provider_urls[GNUNET_NZL (pr_cnt)];
+ unsigned long long versions[GNUNET_NZL (pr_cnt)];
unsigned int off = 0;
+ unsigned int voff = 0;
struct ANASTASIS_ShareResult sr;
- unsigned long long policy_version = 0;
for (unsigned int i = 0; i<ss->pss_length; i++)
{
struct PolicyStoreState *pssi = &ss->pss[i];
- policy_version = GNUNET_MAX (policy_version,
- pssi->policy_version);
- if (NULL != ss->pss[i].payment_request)
+ if (NULL == pssi->payment_request)
+ {
+ versions[voff] = pssi->policy_version;
+ provider_urls[voff] = pssi->anastasis_url;
+ voff++;
+ }
+ else
{
spr[off].payment_request_url = pssi->payment_request;
spr[off].provider_url = pssi->anastasis_url;
@@ -732,7 +738,9 @@ policy_store_cb (void *cls,
else
{
sr.ss = ANASTASIS_SHARE_STATUS_SUCCESS;
- sr.details.max_policy_version = policy_version;
+ sr.details.success.policy_versions = versions;
+ sr.details.success.provider_urls = provider_urls;
+ sr.details.success.num_providers = voff;
}
ss->src (ss->src_cls,
&sr);
diff --git a/src/reducer/anastasis_api_backup_redux.c
b/src/reducer/anastasis_api_backup_redux.c
index df012d0..a5129a1 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -1401,11 +1401,29 @@ secret_share_result_cb (void *cls,
accidentally preserved anywhere */
(void) json_object_del (uc->state,
"core_secret");
- GNUNET_assert (0 ==
- json_object_set (uc->state,
- "max_policy_version",
- json_integer (
- sr->details.max_policy_version)));
+ {
+ json_t *sa = json_array ();
+
+ GNUNET_assert (NULL != sa);
+ for (unsigned int i = 0; i<sr->details.success.num_providers; i++)
+ {
+ json_t *d;
+
+ d = json_pack ("{s:s, s:I}",
+ "provider_url",
+ sr->details.success.provider_urls[i],
+ "policy_version",
+ (json_int_t) sr->details.success.policy_versions[i]);
+ GNUNET_assert (NULL != d);
+ GNUNET_assert (0 ==
+ json_array_append_new (sa,
+ d));
+ }
+ GNUNET_assert (0 ==
+ json_object_set_new (uc->state,
+ "success_details",
+ sa));
+ }
set_state (uc->state,
ANASTASIS_BACKUP_STATE_BACKUP_FINISHED);
uc->cb (uc->cb_cls,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: return full array of policy providers,
gnunet <=