log: add \n
[oweals/gnunet.git] / src / set / gnunet-service-set.h
index d23291c828f922886798e0c46225216425c7eae3..9e1ffd01ad9a4d6434004ce92389dbb67038daf8 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2013, 2014 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2013, 2014 GNUnet e.V.
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -126,7 +126,7 @@ struct OperationSpecification
  * Signature of functions that create the implementation-specific
  * state for a set supporting a specific operation.
  *
- * @return a set state specific to the supported operation
+ * @return a set state specific to the supported operation, NULL on error
  */
 typedef struct SetState *
 (*CreateImpl) (void);
@@ -323,6 +323,9 @@ struct ElementEntry
    */
   struct MutationEvent *mutations;
 
+  /**
+   * Number of elements in the array @a mutations.
+   */
   unsigned int mutations_size;
 
   /**
@@ -333,6 +336,9 @@ struct ElementEntry
 };
 
 
+struct Listener;
+
+
 /**
  * Operation context used to execute a set operation.
  */
@@ -350,6 +356,11 @@ struct Operation
    */
   struct GNUNET_CADET_Channel *channel;
 
+  /**
+   * Port this operation runs on.
+   */
+  struct Listener *listener;
+
   /**
    * Message queue for the channel.
    */
@@ -437,6 +448,25 @@ struct SetContent
   struct GNUNET_CONTAINER_MultiHashMap *elements;
 
   unsigned int latest_generation;
+
+  /**
+   * Mutations requested by the client that we're
+   * unable to execute right now because we're iterating
+   * over the underlying hash map of elements.
+   */
+  struct PendingMutation *pending_mutations_head;
+
+  /**
+   * Mutations requested by the client that we're
+   * unable to execute right now because we're iterating
+   * over the underlying hash map of elements.
+   */
+  struct PendingMutation *pending_mutations_tail;
+
+  /**
+   * Number of concurrently active iterators.
+   */
+  int iterator_count;
 };
 
 
@@ -454,6 +484,22 @@ struct GenerationRange
 };
 
 
+struct PendingMutation
+{
+  struct PendingMutation *prev;
+  struct PendingMutation *next;
+
+  struct Set *set;
+
+  /**
+   * Message that describes the desired mutation.
+   * May only be a GNUNET_MESSAGE_TYPE_SET_ADD or
+   * GNUNET_MESSAGE_TYPE_SET_REMOVE.
+   */
+  struct GNUNET_MessageHeader *mutation_message;
+};
+
+
 /**
  * A set that supports a specific operation with other peers.
  */
@@ -522,6 +568,9 @@ struct Set
    */
   struct GenerationRange *excluded_generations;
 
+  /**
+   * Number of elements in array @a excluded_generations.
+   */
   unsigned int excluded_generations_size;
 
   /**
@@ -535,15 +584,22 @@ struct Set
    */
   uint16_t iteration_id;
 
+  /**
+   * Generation we're currently iteration over.
+   */
+  unsigned int iter_generation;
+
   /**
    * Content, possibly shared by multiple sets,
    * and thus reference counted.
    */
   struct SetContent *content;
-
 };
 
 
+extern struct GNUNET_STATISTICS_Handle *_GSS_statistics;
+
+
 /**
  * Destroy the given operation.  Call the implementation-specific
  * cancel function of the operation.  Disconnects from the remote