aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_sampler.h
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-01-16 00:57:50 +0000
committerJulius Bünger <buenger@mytum.de>2015-01-16 00:57:50 +0000
commitd9a59c38bc4928dceacb2cacbc6aa361e0381996 (patch)
tree111d8f93a91ecf0c8aed742d13b53ad6fe7232bf /src/rps/gnunet-service-rps_sampler.h
parent13faf361bba55fda139ce33d7e57af02ec4c9ce0 (diff)
downloadgnunet-d9a59c38bc4928dceacb2cacbc6aa361e0381996.tar.gz
gnunet-d9a59c38bc4928dceacb2cacbc6aa361e0381996.zip
restructured the sampler
Diffstat (limited to 'src/rps/gnunet-service-rps_sampler.h')
-rw-r--r--src/rps/gnunet-service-rps_sampler.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/rps/gnunet-service-rps_sampler.h b/src/rps/gnunet-service-rps_sampler.h
index 3772f9f0b..b6aaf1b41 100644
--- a/src/rps/gnunet-service-rps_sampler.h
+++ b/src/rps/gnunet-service-rps_sampler.h
@@ -49,6 +49,18 @@ typedef void
49 const struct GNUNET_PeerIdentity *id); 49 const struct GNUNET_PeerIdentity *id);
50 50
51/** 51/**
52 * Callback that is called from _get_n_rand_peers() when the PeerIDs are ready.
53 *
54 * @param cls the closure given alongside this function.
55 * @param ids the PeerIDs that were returned
56 * to be freed
57 */
58 typedef void
59(*RPS_sampler_n_rand_peers_ready_cb) (void *cls,
60 struct GNUNET_PeerIdentity *ids, uint64_t num_peers);
61
62
63/**
52 * A sampler sampling a stream of PeerIDs. 64 * A sampler sampling a stream of PeerIDs.
53 */ 65 */
54//struct RPS_Sampler; 66//struct RPS_Sampler;
@@ -102,15 +114,15 @@ RPS_sampler_reinitialise_by_value (const struct GNUNET_PeerIdentity *id);
102 114
103 115
104/** 116/**
105 * Get one random peer out of the sampled peers. 117 * Get n random peers out of the sampled peers.
106 * 118 *
107 * We might want to reinitialise this sampler after giving the 119 * We might want to reinitialise this sampler after giving the
108 * corrsponding peer to the client. 120 * corrsponding peer to the client.
109 * 121 * Random with or without consumption?
110 * @return a random PeerID of the PeerIDs previously put into the sampler. 122 * Only used internally
111 */ 123 */
112 const struct GNUNET_PeerIdentity * 124 const struct GNUNET_PeerIdentity *
113RPS_sampler_get_rand_peer (); 125RPS_sampler_get_n_rand_peers_ (uint64_t n);
114 126
115 127
116/** 128/**
@@ -120,10 +132,13 @@ RPS_sampler_get_rand_peer ();
120 * corrsponding peer to the client. 132 * corrsponding peer to the client.
121 * Random with or without consumption? 133 * Random with or without consumption?
122 * 134 *
123 * @return n random PeerIDs of the PeerIDs previously put into the sampler. 135 * @param cb callback that will be called once the ids are ready.
136 * @param cls closure given to @a cb
137 * @param num_peers the number of peers requested
124 */ 138 */
125 const struct GNUNET_PeerIdentity * 139 void
126RPS_sampler_get_n_rand_peers (uint64_t n); 140RPS_sampler_get_n_rand_peers (RPS_sampler_n_rand_peers_ready_cb cb,
141 void *cls, uint64_t num_peers);
127 142
128 143
129/** 144/**