summaryrefslogtreecommitdiff
path: root/src/rps/rps-sampler_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps-sampler_common.h')
-rw-r--r--src/rps/rps-sampler_common.h62
1 files changed, 32 insertions, 30 deletions
diff --git a/src/rps/rps-sampler_common.h b/src/rps/rps-sampler_common.h
index 4a45c0193..72202dc93 100644
--- a/src/rps/rps-sampler_common.h
+++ b/src/rps/rps-sampler_common.h
@@ -103,7 +103,8 @@ typedef void
103/** 103/**
104 * Closure for #sampler_mod_get_rand_peer() and #sampler_get_rand_peer 104 * Closure for #sampler_mod_get_rand_peer() and #sampler_get_rand_peer
105 */ 105 */
106struct GetPeerCls { 106struct GetPeerCls
107{
107 /** 108 /**
108 * DLL 109 * DLL
109 */ 110 */
@@ -150,12 +151,13 @@ struct GetPeerCls {
150/** 151/**
151 * Sampler with its own array of SamplerElements 152 * Sampler with its own array of SamplerElements
152 */ 153 */
153struct RPS_Sampler { 154struct RPS_Sampler
155{
154 /** 156 /**
155 * Number of sampler elements we hold. 157 * Number of sampler elements we hold.
156 */ 158 */
157 unsigned int sampler_size; 159 unsigned int sampler_size;
158 //size_t size; 160 // size_t size;
159 161
160 /** 162 /**
161 * All sampler elements in one array. 163 * All sampler elements in one array.
@@ -220,8 +222,8 @@ struct RPS_Sampler {
220 * @param num_peers The estimated value 222 * @param num_peers The estimated value
221 */ 223 */
222void 224void
223RPS_sampler_update_with_nw_size(struct RPS_Sampler *sampler, 225RPS_sampler_update_with_nw_size (struct RPS_Sampler *sampler,
224 uint32_t num_peers); 226 uint32_t num_peers);
225 227
226 228
227/** 229/**
@@ -235,8 +237,8 @@ RPS_sampler_update_with_nw_size(struct RPS_Sampler *sampler,
235 * @param desired_probability 237 * @param desired_probability
236 */ 238 */
237void 239void
238RPS_sampler_set_desired_probability(struct RPS_Sampler *sampler, 240RPS_sampler_set_desired_probability (struct RPS_Sampler *sampler,
239 double desired_probability); 241 double desired_probability);
240 242
241 243
242/** 244/**
@@ -249,8 +251,8 @@ RPS_sampler_set_desired_probability(struct RPS_Sampler *sampler,
249 * @param desired_probability 251 * @param desired_probability
250 */ 252 */
251void 253void
252RPS_sampler_set_deficiency_factor(struct RPS_Sampler *sampler, 254RPS_sampler_set_deficiency_factor (struct RPS_Sampler *sampler,
253 double deficiency_factor); 255 double deficiency_factor);
254 256
255 257
256/** 258/**
@@ -264,9 +266,9 @@ RPS_sampler_set_deficiency_factor(struct RPS_Sampler *sampler,
264 * @return The context containing callback and closure 266 * @return The context containing callback and closure
265 */ 267 */
266struct SamplerNotifyUpdateCTX * 268struct SamplerNotifyUpdateCTX *
267sampler_notify_on_update(struct RPS_Sampler *sampler, 269sampler_notify_on_update (struct RPS_Sampler *sampler,
268 SamplerNotifyUpdateCB notify_cb, 270 SamplerNotifyUpdateCB notify_cb,
269 void *cls); 271 void *cls);
270 272
271 273
272/** 274/**
@@ -276,8 +278,8 @@ sampler_notify_on_update(struct RPS_Sampler *sampler,
276 * @param id the PeerID that is put in the sampler 278 * @param id the PeerID that is put in the sampler
277 */ 279 */
278void 280void
279RPS_sampler_update(struct RPS_Sampler *sampler, 281RPS_sampler_update (struct RPS_Sampler *sampler,
280 const struct GNUNET_PeerIdentity *id); 282 const struct GNUNET_PeerIdentity *id);
281 283
282 284
283/** 285/**
@@ -289,8 +291,8 @@ RPS_sampler_update(struct RPS_Sampler *sampler,
289 * @param id the id of the sampler elements to update. 291 * @param id the id of the sampler elements to update.
290 */ 292 */
291void 293void
292RPS_sampler_reinitialise_by_value(struct RPS_Sampler *sampler, 294RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
293 const struct GNUNET_PeerIdentity *id); 295 const struct GNUNET_PeerIdentity *id);
294 296
295 297
296/** 298/**
@@ -300,7 +302,7 @@ RPS_sampler_reinitialise_by_value(struct RPS_Sampler *sampler,
300 * @return the size of the sampler 302 * @return the size of the sampler
301 */ 303 */
302unsigned int 304unsigned int
303RPS_sampler_get_size(struct RPS_Sampler *sampler); 305RPS_sampler_get_size (struct RPS_Sampler *sampler);
304 306
305 307
306/** 308/**
@@ -310,7 +312,7 @@ RPS_sampler_get_size(struct RPS_Sampler *sampler);
310 * @param new_size the new size of the sampler 312 * @param new_size the new size of the sampler
311 */ 313 */
312void 314void
313RPS_sampler_resize(struct RPS_Sampler *sampler, unsigned int new_size); 315RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size);
314 316
315 317
316/** 318/**
@@ -328,10 +330,10 @@ RPS_sampler_resize(struct RPS_Sampler *sampler, unsigned int new_size);
328 * @param num_peers the number of peers requested 330 * @param num_peers the number of peers requested
329 */ 331 */
330struct RPS_SamplerRequestHandle * 332struct RPS_SamplerRequestHandle *
331RPS_sampler_get_n_rand_peers(struct RPS_Sampler *sampler, 333RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler,
332 uint32_t num_peers, 334 uint32_t num_peers,
333 RPS_sampler_n_rand_peers_ready_cb cb, 335 RPS_sampler_n_rand_peers_ready_cb cb,
334 void *cls); 336 void *cls);
335 337
336 338
337/** 339/**
@@ -342,9 +344,9 @@ RPS_sampler_get_n_rand_peers(struct RPS_Sampler *sampler,
342 * @param cls closure given to @a cb 344 * @param cls closure given to @a cb
343 */ 345 */
344struct RPS_SamplerRequestHandleSingleInfo * 346struct RPS_SamplerRequestHandleSingleInfo *
345RPS_sampler_get_rand_peer_info(struct RPS_Sampler *sampler, 347RPS_sampler_get_rand_peer_info (struct RPS_Sampler *sampler,
346 RPS_sampler_sinlge_info_ready_cb cb, 348 RPS_sampler_sinlge_info_ready_cb cb,
347 void *cls); 349 void *cls);
348 350
349 351
350/** 352/**
@@ -356,8 +358,8 @@ RPS_sampler_get_rand_peer_info(struct RPS_Sampler *sampler,
356 * @return the number of occurrences of id. 358 * @return the number of occurrences of id.
357 */ 359 */
358uint32_t 360uint32_t
359RPS_sampler_count_id(struct RPS_Sampler *sampler, 361RPS_sampler_count_id (struct RPS_Sampler *sampler,
360 const struct GNUNET_PeerIdentity *id); 362 const struct GNUNET_PeerIdentity *id);
361 363
362 364
363/** 365/**
@@ -366,7 +368,7 @@ RPS_sampler_count_id(struct RPS_Sampler *sampler,
366 * @param req_handle the handle to the request 368 * @param req_handle the handle to the request
367 */ 369 */
368void 370void
369RPS_sampler_request_cancel(struct RPS_SamplerRequestHandle *req_handle); 371RPS_sampler_request_cancel (struct RPS_SamplerRequestHandle *req_handle);
370 372
371 373
372/** 374/**
@@ -375,7 +377,7 @@ RPS_sampler_request_cancel(struct RPS_SamplerRequestHandle *req_handle);
375 * @param req_handle the handle to the request 377 * @param req_handle the handle to the request
376 */ 378 */
377void 379void
378RPS_sampler_request_single_info_cancel( 380RPS_sampler_request_single_info_cancel (
379 struct RPS_SamplerRequestHandleSingleInfo *req_single_info_handle); 381 struct RPS_SamplerRequestHandleSingleInfo *req_single_info_handle);
380 382
381 383
@@ -383,7 +385,7 @@ RPS_sampler_request_single_info_cancel(
383 * Cleans the sampler. 385 * Cleans the sampler.
384 */ 386 */
385void 387void
386RPS_sampler_destroy(struct RPS_Sampler *sampler); 388RPS_sampler_destroy (struct RPS_Sampler *sampler);
387 389
388#endif /* RPS_SAMPLER_COMMON_H */ 390#endif /* RPS_SAMPLER_COMMON_H */
389/* end of rps-sampler_common.h */ 391/* end of rps-sampler_common.h */