diff options
author | Julius Bünger <buenger@mytum.de> | 2019-04-04 13:41:25 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2019-04-04 13:42:57 +0200 |
commit | 8c3d9fc59cd5617c4f5b7ea621971bdff25f5353 (patch) | |
tree | 910d8bdd653c13d47d943c69b405e2818aac2d14 /src/rps/rps-sampler_common.c | |
parent | a6f561efa7359dae5af8bfd3763e4f16168030ab (diff) | |
download | gnunet-8c3d9fc59cd5617c4f5b7ea621971bdff25f5353.tar.gz gnunet-8c3d9fc59cd5617c4f5b7ea621971bdff25f5353.zip |
RPS: Return peers to client after many observed ids
Diffstat (limited to 'src/rps/rps-sampler_common.c')
-rw-r--r-- | src/rps/rps-sampler_common.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/rps/rps-sampler_common.c b/src/rps/rps-sampler_common.c index 2b0569c61..3ed4ef989 100644 --- a/src/rps/rps-sampler_common.c +++ b/src/rps/rps-sampler_common.c | |||
@@ -116,6 +116,60 @@ struct RPS_SamplerRequestHandle | |||
116 | 116 | ||
117 | 117 | ||
118 | /** | 118 | /** |
119 | * @brief Update the current estimate of the network size stored at the sampler | ||
120 | * | ||
121 | * Used for computing the condition when to return elements to the client | ||
122 | * | ||
123 | * Only used/useful with the client sampler | ||
124 | * (Maybe move to rps-sampler_client.{h|c} ?) | ||
125 | * | ||
126 | * @param sampler The sampler to update | ||
127 | * @param num_peers The estimated value | ||
128 | */ | ||
129 | void | ||
130 | RPS_sampler_update_with_nw_size (struct RPS_Sampler *sampler, | ||
131 | uint32_t num_peers) | ||
132 | { | ||
133 | sampler->num_peers_estim = num_peers; | ||
134 | } | ||
135 | |||
136 | |||
137 | /** | ||
138 | * @brief Set the probability that is needed at least with what a sampler | ||
139 | * element has to have observed all elements from the network. | ||
140 | * | ||
141 | * Only used/useful with the client sampler | ||
142 | * (Maybe move to rps-sampler_client.{h|c} ?) | ||
143 | * | ||
144 | * @param sampler | ||
145 | * @param desired_probability | ||
146 | */ | ||
147 | void | ||
148 | RPS_sampler_set_desired_probability (struct RPS_Sampler *sampler, | ||
149 | double desired_probability) | ||
150 | { | ||
151 | sampler->desired_probability = desired_probability; | ||
152 | } | ||
153 | |||
154 | |||
155 | /** | ||
156 | * @brief Set the deficiency factor. | ||
157 | * | ||
158 | * Only used/useful with the client sampler | ||
159 | * (Maybe move to rps-sampler_client.{h|c} ?) | ||
160 | * | ||
161 | * @param sampler | ||
162 | * @param desired_probability | ||
163 | */ | ||
164 | void | ||
165 | RPS_sampler_set_deficiency_factor (struct RPS_Sampler *sampler, | ||
166 | double deficiency_factor) | ||
167 | { | ||
168 | sampler->deficiency_factor = deficiency_factor; | ||
169 | } | ||
170 | |||
171 | |||
172 | /** | ||
119 | * @brief Add a callback that will be called when the next peer is inserted | 173 | * @brief Add a callback that will be called when the next peer is inserted |
120 | * into the sampler | 174 | * into the sampler |
121 | * | 175 | * |