aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps-sampler_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps-sampler_common.c')
-rw-r--r--src/rps/rps-sampler_common.c54
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 */
129void
130RPS_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 */
147void
148RPS_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 */
164void
165RPS_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 *