diff options
Diffstat (limited to 'src/rps/rps-sampler_common.h')
-rw-r--r-- | src/rps/rps-sampler_common.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/rps/rps-sampler_common.h b/src/rps/rps-sampler_common.h index e36f6e834..1abe43720 100644 --- a/src/rps/rps-sampler_common.h +++ b/src/rps/rps-sampler_common.h | |||
@@ -147,6 +147,25 @@ struct RPS_Sampler | |||
147 | struct GNUNET_TIME_Relative max_round_interval; | 147 | struct GNUNET_TIME_Relative max_round_interval; |
148 | 148 | ||
149 | /** | 149 | /** |
150 | * @brief The estimated total number of peers in the network | ||
151 | */ | ||
152 | uint32_t num_peers_estim; | ||
153 | |||
154 | /** | ||
155 | * @brief The desired probability with which we want to have observed all | ||
156 | * peers. | ||
157 | */ | ||
158 | double desired_probability; | ||
159 | |||
160 | /** | ||
161 | * @brief A factor that catches the 'bias' of a random stream of peer ids. | ||
162 | * | ||
163 | * As introduced by Brahms: Factor between the number of unique ids in a | ||
164 | * truly random stream and number of unique ids in the gossip stream. | ||
165 | */ | ||
166 | double deficiency_factor; | ||
167 | |||
168 | /** | ||
150 | * Stores the function to return peers. Which one it is depends on whether | 169 | * Stores the function to return peers. Which one it is depends on whether |
151 | * the Sampler is the modified one or not. | 170 | * the Sampler is the modified one or not. |
152 | */ | 171 | */ |
@@ -164,6 +183,48 @@ struct RPS_Sampler | |||
164 | 183 | ||
165 | 184 | ||
166 | /** | 185 | /** |
186 | * @brief Update the current estimate of the network size stored at the sampler | ||
187 | * | ||
188 | * Used for computing the condition when to return elements to the client | ||
189 | * | ||
190 | * @param sampler The sampler to update | ||
191 | * @param num_peers The estimated value | ||
192 | */ | ||
193 | void | ||
194 | RPS_sampler_update_with_nw_size (struct RPS_Sampler *sampler, | ||
195 | uint32_t num_peers); | ||
196 | |||
197 | |||
198 | /** | ||
199 | * @brief Set the probability that is needed at least with what a sampler | ||
200 | * element has to have observed all elements from the network. | ||
201 | * | ||
202 | * Only used/useful with the client sampler | ||
203 | * (Maybe move to rps-sampler_client.{h|c} ?) | ||
204 | * | ||
205 | * @param sampler | ||
206 | * @param desired_probability | ||
207 | */ | ||
208 | void | ||
209 | RPS_sampler_set_desired_probability (struct RPS_Sampler *sampler, | ||
210 | double desired_probability); | ||
211 | |||
212 | |||
213 | /** | ||
214 | * @brief Set the deficiency factor. | ||
215 | * | ||
216 | * Only used/useful with the client sampler | ||
217 | * (Maybe move to rps-sampler_client.{h|c} ?) | ||
218 | * | ||
219 | * @param sampler | ||
220 | * @param desired_probability | ||
221 | */ | ||
222 | void | ||
223 | RPS_sampler_set_deficiency_factor (struct RPS_Sampler *sampler, | ||
224 | double deficiency_factor); | ||
225 | |||
226 | |||
227 | /** | ||
167 | * @brief Add a callback that will be called when the next peer is inserted | 228 | * @brief Add a callback that will be called when the next peer is inserted |
168 | * into the sampler | 229 | * into the sampler |
169 | * | 230 | * |