gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28276 - gnunet/src/include


From: gnunet
Subject: [GNUnet-SVN] r28276 - gnunet/src/include
Date: Tue, 23 Jul 2013 18:18:30 +0200

Author: dold
Date: 2013-07-23 18:18:30 +0200 (Tue, 23 Jul 2013)
New Revision: 28276

Modified:
   gnunet/src/include/gnunet_set_service.h
Log:
- set iterate declaration


Modified: gnunet/src/include/gnunet_set_service.h
===================================================================
--- gnunet/src/include/gnunet_set_service.h     2013-07-23 15:33:01 UTC (rev 
28275)
+++ gnunet/src/include/gnunet_set_service.h     2013-07-23 16:18:30 UTC (rev 
28276)
@@ -188,7 +188,17 @@
                                            const struct GNUNET_SET_Element 
*element,
                                            enum GNUNET_SET_Status status);
 
+/**
+ * Iterator for set elements.
+ *
+ * @param cls closure
+ * @param element the element
+ * @return GNUNET_YES to continue iterating, GNUNET_NO to stop.
+ */
+typedef int (*GNUNET_SET_ElementIterator) (void *cls,
+                                           const struct GNUNET_SET_Element 
*element);
 
+
 /**
  * Called when another peer wants to do a set operation with the
  * local peer. If a listen error occurs, the 'request' is NULL.
@@ -239,8 +249,10 @@
  * @param element element to add to the set
  * @param cont continuation called after the element has been added
  * @param cont_cls closure for cont
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ *         set is invalid (e.g. the set service crashed)
  */
-void
+int
 GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
                         const struct GNUNET_SET_Element *element,
                         GNUNET_SET_Continuation cont,
@@ -257,8 +269,10 @@
  * @param element element to remove from the set
  * @param cont continuation called after the element has been removed
  * @param cont_cls closure for cont
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ *         set is invalid (e.g. the set service crashed)
  */
-void
+int
 GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set,
                            const struct GNUNET_SET_Element *element,
                            GNUNET_SET_Continuation cont,
@@ -359,8 +373,10 @@
  *
  * @param oh handle to the set operation 
  * @param set the set to use for the operation
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ *         set is invalid (e.g. the set service crashed)
  */
-void
+int
 GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh,
                    struct GNUNET_SET_Handle *set);
 
@@ -376,6 +392,22 @@
 GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh);
 
 
+/**
+ * Iterate over all elements in the given set.
+ * Note that this operation involves transferring every element of the set
+ * from the service to the client, and is thus costly.
+ *
+ * @param set the set to iterate over
+ * @param iter the iterator to call for each element
+ * @param cls closure for 'iter'
+ * @return GNUNET_YES if every element was iterated over, GNUNET_NO
+ *         if the iterator prematurely stopped, GNUNET_SYSERR if the set
+ *         is invalid (e.g. the server crashed, disconnected)
+ */
+int
+GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator 
iter, void *cls);
+
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]