plugin datastore mysql
[oweals/gnunet.git] / src / rps / gnunet-service-rps_sampler.h
index 708de69807dba3506c74d213ec5c5d6461b6faf1..f33e7430c3095a591424da7a5325369654f6f7cc 100644 (file)
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
  */
 struct RPS_Sampler;
 
+/**
+ * A handle to cancel a request.
+ */
+struct RPS_SamplerRequestHandle;
+
 
 /**
  * Callback that is called from _get_n_rand_peers() when the PeerIDs are ready.
@@ -71,13 +76,7 @@ RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size);
  * Initialise a tuple of samplers.
  *
  * @param init_size the size the sampler is initialised with
- * @param id with which all newly created sampler elements are initialised
- * @param ins_cb the callback that will be called on every PeerID that is
- *               newly inserted into a sampler element
- * @param ins_cls the closure given to #ins_cb
- * @param rem_cb the callback that will be called on every PeerID that is
- *               removed from a sampler element
- * @param rem_cls the closure given to #rem_cb
+ * @param max_round_interval maximum time a round takes
  * @return a handle to a sampler that consists of sampler elements.
  */
 struct RPS_Sampler *
@@ -85,6 +84,18 @@ RPS_sampler_init (size_t init_size,
     struct GNUNET_TIME_Relative max_round_interval);
 
 
+/**
+ * Initialise a modified tuple of sampler elements.
+ *
+ * @param init_size the size the sampler is initialised with
+ * @param max_round_interval maximum time a round takes
+ * @return a handle to a sampler that consists of sampler elements.
+ */
+struct RPS_Sampler *
+RPS_sampler_mod_init (size_t init_size,
+                      struct GNUNET_TIME_Relative max_round_interval);
+
+
 /**
  * A fuction to update every sampler in the given list
  *
@@ -124,10 +135,18 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
  *                   #GNUNET_NO if used internally
  * @param num_peers the number of peers requested
  */
-    void
+struct RPS_SamplerRequestHandle *
 RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler,
                               RPS_sampler_n_rand_peers_ready_cb cb,
-                              void *cls, uint32_t num_peers, int for_client);
+                              void *cls, uint32_t num_peers);
+
+/**
+ * Cancle a request issued through #RPS_sampler_n_rand_peers_ready_cb.
+ *
+ * @param req_handle the handle to the request
+ */
+void
+RPS_sampler_request_cancel (struct RPS_SamplerRequestHandle *req_handle);
 
 
 /**