aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-11-15 13:55:33 +0000
committerChristian Grothoff <christian@grothoff.org>2012-11-15 13:55:33 +0000
commit46e7fe13591a6232f7680d048e8a79de21fdd3a7 (patch)
treeec10fd44e40ace31b9044035aead678a2caaebc2
parentbddfc596973e41bd3ca02791f77122463133464a (diff)
downloadgnunet-46e7fe13591a6232f7680d048e8a79de21fdd3a7.tar.gz
gnunet-46e7fe13591a6232f7680d048e8a79de21fdd3a7.zip
-polishing consensus API
-rw-r--r--src/include/gnunet_consensus_service.h47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h
index ade7a03ab..7b555d4f2 100644
--- a/src/include/gnunet_consensus_service.h
+++ b/src/include/gnunet_consensus_service.h
@@ -54,17 +54,6 @@ typedef void (*GNUNET_CONSENSUS_NewElementCallback) (void *cls,
54 const void *element); 54 const void *element);
55 55
56 56
57/**
58 * Called when a conclusion was successful.
59 *
60 * @param cls
61 * @param num_peers_in_consensus
62 * @param peers_in_consensus
63 */
64typedef void (*GNUNET_CONSENSUS_ConcludeCallback) (void *cls,
65 unsigned int num_peers_in_consensus,
66 cnost struct GNUNET_PeerIdentity *peers_in_consensus);
67
68 57
69/** 58/**
70 * Opaque handle for the consensus service. 59 * Opaque handle for the consensus service.
@@ -83,9 +72,8 @@ struct GNUNET_CONSENSUS_Handle;
83 * @param element_size size of the elements in the reconciled set in bytes 72 * @param element_size size of the elements in the reconciled set in bytes
84 * @param new_element callback, called when a new element is added to the set by 73 * @param new_element callback, called when a new element is added to the set by
85 * another peer 74 * another peer
86 * @param cls closure for new_element 75 * @param mew_element_cls closure for new_element
87 * 76 * @return handle to use, NULL on error
88 * @return handle to use
89 */ 77 */
90struct GNUNET_CONSENSUS_Handle * 78struct GNUNET_CONSENSUS_Handle *
91GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg, 79GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -98,6 +86,18 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
98 void *new_element_cls); 86 void *new_element_cls);
99 87
100 88
89/**
90 * Called when an insertion (transmission to consensus service,
91 * which does not imply fully consensus on this element with
92 * all other peers) was successful.
93 *
94 * @param cls
95 * @param success GNUNET_OK on success, GNUNET_SYSERR if
96 * the insertion and thus the consensus failed for good
97 */
98typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
99 int success);
100
101 101
102/** 102/**
103 * Insert an element in the set being reconsiled. Must not be called after 103 * Insert an element in the set being reconsiled. Must not be called after
@@ -106,11 +106,28 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
106 * @param consensus handle for the consensus session 106 * @param consensus handle for the consensus session
107 * @param element_size must match element size from GNUNET_CONSENSUS_create 107 * @param element_size must match element size from GNUNET_CONSENSUS_create
108 * @param element the element to be inserted 108 * @param element the element to be inserted
109 * @param idc function called when we are done with this element and it
110 * is thus allowed to call GNUNET_CONSENSUS_insert again
111 * @param idc_cls closure for 'idc'
109 */ 112 */
110void 113void
111GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus, 114GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
112 size_t element_size, 115 size_t element_size,
113 const void *element); 116 const void *element,
117 GNUNET_CONSENSUS_InsertDoneCallback idc,
118 void *idc_cls);
119
120
121/**
122 * Called when a conclusion was successful.
123 *
124 * @param cls
125 * @param num_peers_in_consensus
126 * @param peers_in_consensus
127 */
128typedef void (*GNUNET_CONSENSUS_ConcludeCallback) (void *cls,
129 unsigned int num_peers_in_consensus,
130 cnost struct GNUNET_PeerIdentity *peers_in_consensus);
114 131
115 132
116/** 133/**