diff options
author | Gabor X Toth <*@tg-x.net> | 2013-09-16 04:59:05 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-09-16 04:59:05 +0000 |
commit | f78e9753a91497f1deb5e20d10868c27ab4a6013 (patch) | |
tree | f49653367e00fd4b611ec6ec281144d4568bd111 /src/include/gnunet_psycstore_plugin.h | |
parent | fbae7143d25a258b9dfabefa9ca3956e9228cb0e (diff) | |
download | gnunet-f78e9753a91497f1deb5e20d10868c27ab4a6013.tar.gz gnunet-f78e9753a91497f1deb5e20d10868c27ab4a6013.zip |
PSYCstore service and API implementation
Diffstat (limited to 'src/include/gnunet_psycstore_plugin.h')
-rw-r--r-- | src/include/gnunet_psycstore_plugin.h | 115 |
1 files changed, 83 insertions, 32 deletions
diff --git a/src/include/gnunet_psycstore_plugin.h b/src/include/gnunet_psycstore_plugin.h index 6852a6dd5..8ceb3e5e5 100644 --- a/src/include/gnunet_psycstore_plugin.h +++ b/src/include/gnunet_psycstore_plugin.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2012, 2013 Christian Grothoff (and other contributing authors) | 3 | (C) 2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -137,6 +137,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
137 | (*message_get) (void *cls, | 137 | (*message_get) (void *cls, |
138 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | 138 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, |
139 | uint64_t message_id, | 139 | uint64_t message_id, |
140 | uint64_t *returned_fragments, | ||
140 | GNUNET_PSYCSTORE_FragmentCallback cb, | 141 | GNUNET_PSYCSTORE_FragmentCallback cb, |
141 | void *cb_cls); | 142 | void *cb_cls); |
142 | 143 | ||
@@ -182,19 +183,88 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
182 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | 183 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, |
183 | uint64_t *max_state_msg_id); | 184 | uint64_t *max_state_msg_id); |
184 | 185 | ||
186 | |||
185 | /** | 187 | /** |
186 | * Set a state variable to the given value. | 188 | * Begin modifying current state. |
187 | * | 189 | * |
188 | * @see GNUNET_PSYCSTORE_state_modify() | 190 | * @see GNUNET_PSYCSTORE_state_modify() |
189 | * | 191 | * |
190 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 192 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
191 | */ | 193 | */ |
192 | int | 194 | int |
193 | (*state_set) (void *cls, | 195 | (*state_modify_begin) (void *cls, |
194 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | 196 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, |
195 | const char *name, | 197 | uint64_t message_id, uint64_t state_delta); |
196 | const void *value, | 198 | |
197 | size_t value_size); | 199 | /** |
200 | * Set the current value of a state variable. | ||
201 | * | ||
202 | * The state modification process is started with state_modify_begin(), | ||
203 | * which is followed by one or more calls to this function, | ||
204 | * and finished with state_modify_end(). | ||
205 | * | ||
206 | * @see GNUNET_PSYCSTORE_state_modify() | ||
207 | * | ||
208 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
209 | */ | ||
210 | int | ||
211 | (*state_modify_set) (void *cls, | ||
212 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | ||
213 | const char *name, const void *value, size_t value_size); | ||
214 | |||
215 | |||
216 | /** | ||
217 | * End modifying current state. | ||
218 | * | ||
219 | * @see GNUNET_PSYCSTORE_state_modify() | ||
220 | * | ||
221 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
222 | */ | ||
223 | int | ||
224 | (*state_modify_end) (void *cls, | ||
225 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | ||
226 | uint64_t message_id); | ||
227 | |||
228 | |||
229 | /** | ||
230 | * Begin synchronizing state. | ||
231 | * | ||
232 | * @see GNUNET_PSYCSTORE_state_sync() | ||
233 | * | ||
234 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
235 | */ | ||
236 | int | ||
237 | (*state_sync_begin) (void *cls, | ||
238 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); | ||
239 | |||
240 | /** | ||
241 | * Set the value of a state variable while synchronizing state. | ||
242 | * | ||
243 | * The state synchronization process is started with state_sync_begin(), | ||
244 | * which is followed by one or more calls to this function, | ||
245 | * and finished with state_sync_end(). | ||
246 | * | ||
247 | * @see GNUNET_PSYCSTORE_state_sync() | ||
248 | * | ||
249 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
250 | */ | ||
251 | int | ||
252 | (*state_sync_set) (void *cls, | ||
253 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | ||
254 | const char *name, const void *value, size_t value_size); | ||
255 | |||
256 | |||
257 | /** | ||
258 | * End synchronizing state. | ||
259 | * | ||
260 | * @see GNUNET_PSYCSTORE_state_sync() | ||
261 | * | ||
262 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
263 | */ | ||
264 | int | ||
265 | (*state_sync_end) (void *cls, | ||
266 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | ||
267 | uint64_t message_id); | ||
198 | 268 | ||
199 | 269 | ||
200 | /** | 270 | /** |
@@ -219,25 +289,6 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
219 | (*state_update_signed) (void *cls, | 289 | (*state_update_signed) (void *cls, |
220 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); | 290 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); |
221 | 291 | ||
222 | /** | ||
223 | * Update signed values of state variables in the state store. | ||
224 | * | ||
225 | * @param h Handle for the PSYCstore. | ||
226 | * @param channel_key The channel we are interested in. | ||
227 | * @param message_id Message ID that contained the state @a hash. | ||
228 | * @param hash Hash of the serialized full state. | ||
229 | * @param rcb Callback to call with the result of the operation. | ||
230 | * @param rcb_cls Closure for the callback. | ||
231 | * | ||
232 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
233 | */ | ||
234 | int | ||
235 | (*state_hash_update) (void *cls, | ||
236 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | ||
237 | uint64_t message_id, | ||
238 | const struct GNUNET_HashCode *hash, | ||
239 | GNUNET_PSYCSTORE_ResultCallback rcb, | ||
240 | void *rcb_cls); | ||
241 | 292 | ||
242 | /** | 293 | /** |
243 | * Retrieve a state variable by name (exact match). | 294 | * Retrieve a state variable by name (exact match). |
@@ -254,16 +305,16 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
254 | /** | 305 | /** |
255 | * Retrieve all state variables for a channel with the given prefix. | 306 | * Retrieve all state variables for a channel with the given prefix. |
256 | * | 307 | * |
257 | * @see GNUNET_PSYCSTORE_state_get_all() | 308 | * @see GNUNET_PSYCSTORE_state_get_prefix() |
258 | * | 309 | * |
259 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 310 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
260 | */ | 311 | */ |
261 | int | 312 | int |
262 | (*state_get_all) (void *cls, | 313 | (*state_get_prefix) (void *cls, |
263 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, | 314 | const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, |
264 | const char *name, | 315 | const char *name, |
265 | GNUNET_PSYCSTORE_StateCallback cb, | 316 | GNUNET_PSYCSTORE_StateCallback cb, |
266 | void *cb_cls); | 317 | void *cb_cls); |
267 | 318 | ||
268 | 319 | ||
269 | /** | 320 | /** |