aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set.h
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-08-12 18:00:43 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-08-12 18:00:43 +0000
commit566dfe32be22ed1f071b974be3c4dd8bc5721151 (patch)
treedc4e89e80aab53e1cb69604c2960eaaf5043bb17 /src/set/gnunet-service-set.h
parentd734cfd6677de174aa51a07437b0e0cae4c870be (diff)
downloadgnunet-566dfe32be22ed1f071b974be3c4dd8bc5721151.tar.gz
gnunet-566dfe32be22ed1f071b974be3c4dd8bc5721151.zip
- correct iteraion in multihashmap
- iterate over elements with client ack in set
Diffstat (limited to 'src/set/gnunet-service-set.h')
-rw-r--r--src/set/gnunet-service-set.h70
1 files changed, 69 insertions, 1 deletions
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h
index c93cc660a..ae28b24c2 100644
--- a/src/set/gnunet-service-set.h
+++ b/src/set/gnunet-service-set.h
@@ -57,6 +57,7 @@ struct OperationState;
57/* forward declarations */ 57/* forward declarations */
58struct Set; 58struct Set;
59struct TunnelContext; 59struct TunnelContext;
60struct ElementEntry;
60 61
61 62
62/** 63/**
@@ -103,6 +104,8 @@ struct OperationSpecification
103}; 104};
104 105
105 106
107
108
106/** 109/**
107 * Signature of functions that create the implementation-specific 110 * Signature of functions that create the implementation-specific
108 * state for a set supporting a specific operation. 111 * state for a set supporting a specific operation.
@@ -119,7 +122,7 @@ typedef struct SetState *(*CreateImpl) (void);
119 * @param set implementation-specific set state 122 * @param set implementation-specific set state
120 * @param msg element message from the client 123 * @param msg element message from the client
121 */ 124 */
122typedef void (*AddRemoveImpl) (struct SetState *state, const struct GNUNET_SET_Element *element); 125typedef void (*AddRemoveImpl) (struct SetState *state, struct ElementEntry *ee);
123 126
124 127
125/** 128/**
@@ -240,6 +243,54 @@ struct SetVT
240 243
241 244
242/** 245/**
246 * Information about an element element in the set.
247 * All elements are stored in a hash-table
248 * from their hash-code to their 'struct Element',
249 * so that the remove and add operations are reasonably
250 * fast.
251 */
252struct ElementEntry
253{
254 /**
255 * The actual element. The data for the element
256 * should be allocated at the end of this struct.
257 */
258 struct GNUNET_SET_Element element;
259
260 /**
261 * Hash of the element.
262 * Will be used to derive the different IBF keys
263 * for different salts.
264 */
265 struct GNUNET_HashCode element_hash;
266
267 /**
268 * Generation the element was added by the client.
269 * Operations of earlier generations will not consider the element.
270 */
271 unsigned int generation_added;
272
273 /**
274 * GNUNET_YES if the element has been removed in some generation.
275 */
276 int removed;
277
278 /**
279 * Generation the element was removed by the client.
280 * Operations of later generations will not consider the element.
281 * Only valid if is_removed is GNUNET_YES.
282 */
283 unsigned int generation_removed;
284
285 /**
286 * GNUNET_YES if the element is a remote element, and does not belong
287 * to the operation's set.
288 */
289 int remote;
290};
291
292
293/**
243 * A set that supports a specific operation 294 * A set that supports a specific operation
244 * with other peers. 295 * with other peers.
245 */ 296 */
@@ -281,6 +332,23 @@ struct Set
281 * Implementation-specific state. 332 * Implementation-specific state.
282 */ 333 */
283 struct SetState *state; 334 struct SetState *state;
335
336 /**
337 * Current state of iterating elements for the client.
338 * NULL if we are not currently iterating.
339 */
340 struct GNUNET_CONTAINER_MultiHashMapIterator *iter;
341
342 /**
343 * Maps 'struct GNUNET_HashCode' to 'struct ElementEntry'.
344 */
345 struct GNUNET_CONTAINER_MultiHashMap *elements;
346
347 /**
348 * Current generation, that is, number of
349 * previously executed operations on this set
350 */
351 unsigned int current_generation;
284}; 352};
285 353
286 354