diff options
author | Gabor X Toth <*@tg-x.net> | 2014-07-30 21:18:13 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-07-30 21:18:13 +0000 |
commit | 40884377f3126bbecbfd3243d47224b3094914f9 (patch) | |
tree | 9f32aab9064b199178282a0c9918313e0aa30049 /src/include/gnunet_psycstore_service.h | |
parent | 831718fa44b2c56577aa4e36a479fef6debb8cea (diff) | |
download | gnunet-40884377f3126bbecbfd3243d47224b3094914f9.tar.gz gnunet-40884377f3126bbecbfd3243d47224b3094914f9.zip |
psyc, psycstore: retrieve state and history
Diffstat (limited to 'src/include/gnunet_psycstore_service.h')
-rw-r--r-- | src/include/gnunet_psycstore_service.h | 146 |
1 files changed, 119 insertions, 27 deletions
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h index 84d69c24d..78d016bb3 100644 --- a/src/include/gnunet_psycstore_service.h +++ b/src/include/gnunet_psycstore_service.h | |||
@@ -107,9 +107,10 @@ struct GNUNET_PSYCSTORE_OperationHandle; | |||
107 | /** | 107 | /** |
108 | * Function called with the result of an asynchronous operation. | 108 | * Function called with the result of an asynchronous operation. |
109 | * | 109 | * |
110 | * @param result #GNUNET_SYSERR on error, | 110 | * @param result |
111 | * #GNUNET_YES on success or if the peer was a member, | 111 | * #GNUNET_YES on success or if the peer was a member, |
112 | * #GNUNET_NO if the peer was not a member | 112 | * #GNUNET_NO if the peer was not a member, |
113 | * #GNUNET_SYSERR on error, | ||
113 | */ | 114 | */ |
114 | typedef void | 115 | typedef void |
115 | (*GNUNET_PSYCSTORE_ResultCallback) (void *cls, | 116 | (*GNUNET_PSYCSTORE_ResultCallback) (void *cls, |
@@ -235,7 +236,7 @@ typedef int | |||
235 | 236 | ||
236 | 237 | ||
237 | /** | 238 | /** |
238 | * Retrieve a message fragment by fragment ID. | 239 | * Retrieve message fragments by fragment ID range. |
239 | * | 240 | * |
240 | * @param h | 241 | * @param h |
241 | * Handle for the PSYCstore. | 242 | * Handle for the PSYCstore. |
@@ -245,11 +246,15 @@ typedef int | |||
245 | * The slave requesting the fragment. If not NULL, a membership test is | 246 | * The slave requesting the fragment. If not NULL, a membership test is |
246 | * performed first and the fragment is only returned if the slave has | 247 | * performed first and the fragment is only returned if the slave has |
247 | * access to it. | 248 | * access to it. |
248 | * @param fragment_id | 249 | * @param first_fragment_id |
249 | * Fragment ID to retrieve. Use 0 to get the latest message fragment. | 250 | * First fragment ID to retrieve. |
250 | * @param fcb | 251 | * Use 0 to get the latest message fragment. |
252 | * @param last_fragment_id | ||
253 | * Last consecutive fragment ID to retrieve. | ||
254 | * Use 0 to get the latest message fragment. | ||
255 | * @param fragment_cb | ||
251 | * Callback to call with the retrieved fragments. | 256 | * Callback to call with the retrieved fragments. |
252 | * @param rcb | 257 | * @param result_cb |
253 | * Callback to call with the result of the operation. | 258 | * Callback to call with the result of the operation. |
254 | * @param cls | 259 | * @param cls |
255 | * Closure for the callbacks. | 260 | * Closure for the callbacks. |
@@ -260,14 +265,53 @@ struct GNUNET_PSYCSTORE_OperationHandle * | |||
260 | GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, | 265 | GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, |
261 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | 266 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, |
262 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 267 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
263 | uint64_t fragment_id, | 268 | uint64_t first_message_id, |
264 | GNUNET_PSYCSTORE_FragmentCallback fcb, | 269 | uint64_t last_message_id, |
265 | GNUNET_PSYCSTORE_ResultCallback rcb, | 270 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, |
271 | GNUNET_PSYCSTORE_ResultCallback result_cb, | ||
266 | void *cls); | 272 | void *cls); |
267 | 273 | ||
268 | 274 | ||
269 | /** | 275 | /** |
270 | * Retrieve all fragments of a message. | 276 | * Retrieve latest message fragments. |
277 | * | ||
278 | * @param h | ||
279 | * Handle for the PSYCstore. | ||
280 | * @param channel_key | ||
281 | * The channel we are interested in. | ||
282 | * @param slave_key | ||
283 | * The slave requesting the fragment. If not NULL, a membership test is | ||
284 | * performed first and the fragment is only returned if the slave has | ||
285 | * access to it. | ||
286 | * @param first_fragment_id | ||
287 | * First fragment ID to retrieve. | ||
288 | * Use 0 to get the latest message fragment. | ||
289 | * @param last_fragment_id | ||
290 | * Last consecutive fragment ID to retrieve. | ||
291 | * Use 0 to get the latest message fragment. | ||
292 | * @param fragment_limit | ||
293 | * Maximum number of fragments to retrieve. | ||
294 | * @param fragment_cb | ||
295 | * Callback to call with the retrieved fragments. | ||
296 | * @param rcb | ||
297 | * Callback to call with the result of the operation. | ||
298 | * @param cls | ||
299 | * Closure for the callbacks. | ||
300 | * | ||
301 | * @return Handle that can be used to cancel the operation. | ||
302 | */ | ||
303 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
304 | GNUNET_PSYCSTORE_fragment_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | ||
305 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | ||
306 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | ||
307 | uint64_t fragment_limit, | ||
308 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, | ||
309 | GNUNET_PSYCSTORE_ResultCallback rcb, | ||
310 | void *cls); | ||
311 | |||
312 | |||
313 | /** | ||
314 | * Retrieve all fragments of messages in a message ID range. | ||
271 | * | 315 | * |
272 | * @param h | 316 | * @param h |
273 | * Handle for the PSYCstore. | 317 | * Handle for the PSYCstore. |
@@ -277,11 +321,15 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
277 | * The slave requesting the message. If not NULL, a membership test is | 321 | * The slave requesting the message. If not NULL, a membership test is |
278 | * performed first and the message is only returned if the slave has | 322 | * performed first and the message is only returned if the slave has |
279 | * access to it. | 323 | * access to it. |
280 | * @param message_id | 324 | * @param first_message_id |
281 | * Message ID to retrieve. Use 0 to get the latest message. | 325 | * First message ID to retrieve. |
282 | * @param fcb | 326 | * Use 0 to get the latest message. |
327 | * @param last_message_id | ||
328 | * Last consecutive message ID to retrieve. | ||
329 | * Use 0 to get the latest message. | ||
330 | * @param fragment_cb | ||
283 | * Callback to call with the retrieved fragments. | 331 | * Callback to call with the retrieved fragments. |
284 | * @param rcb | 332 | * @param result_cb |
285 | * Callback to call with the result of the operation. | 333 | * Callback to call with the result of the operation. |
286 | * @param cls | 334 | * @param cls |
287 | * Closure for the callbacks. | 335 | * Closure for the callbacks. |
@@ -292,23 +340,67 @@ struct GNUNET_PSYCSTORE_OperationHandle * | |||
292 | GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | 340 | GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, |
293 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | 341 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, |
294 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 342 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
295 | uint64_t message_id, | 343 | uint64_t first_message_id, |
296 | GNUNET_PSYCSTORE_FragmentCallback fcb, | 344 | uint64_t last_message_id, |
297 | GNUNET_PSYCSTORE_ResultCallback rcb, | 345 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, |
346 | GNUNET_PSYCSTORE_ResultCallback result_cb, | ||
298 | void *cls); | 347 | void *cls); |
299 | 348 | ||
300 | 349 | ||
301 | /** | 350 | /** |
351 | * Retrieve all fragments of the latest messages. | ||
352 | * | ||
353 | * @param h | ||
354 | * Handle for the PSYCstore. | ||
355 | * @param channel_key | ||
356 | * The channel we are interested in. | ||
357 | * @param slave_key | ||
358 | * The slave requesting the message. If not NULL, a membership test is | ||
359 | * performed first and the message is only returned if the slave has | ||
360 | * access to it. | ||
361 | * @param message_limit | ||
362 | * Maximum number of messages to retrieve. | ||
363 | * @param fragment_cb | ||
364 | * Callback to call with the retrieved fragments. | ||
365 | * @param rcb | ||
366 | * Callback to call with the result of the operation. | ||
367 | * @param cls | ||
368 | * Closure for the callbacks. | ||
369 | * | ||
370 | * @return Handle that can be used to cancel the operation. | ||
371 | */ | ||
372 | struct GNUNET_PSYCSTORE_OperationHandle * | ||
373 | GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | ||
374 | const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | ||
375 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | ||
376 | uint64_t message_limit, | ||
377 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, | ||
378 | GNUNET_PSYCSTORE_ResultCallback rcb, | ||
379 | void *cls); | ||
380 | |||
381 | |||
382 | /** | ||
302 | * Retrieve a fragment of message specified by its message ID and fragment | 383 | * Retrieve a fragment of message specified by its message ID and fragment |
303 | * offset. | 384 | * offset. |
304 | * | 385 | * |
305 | * @param h Handle for the PSYCstore. | 386 | * @param h |
306 | * @param channel_key The channel we are interested in. | 387 | * Handle for the PSYCstore. |
307 | * @param message_id Message ID to check. Use 0 to get the latest message. | 388 | * @param channel_key |
308 | * @param fragment_offset Offset of the fragment to retrieve. | 389 | * The channel we are interested in. |
309 | * @param fcb Callback to call with the retrieved fragments. | 390 | * @param slave_key |
310 | * @param rcb Callback to call with the result of the operation. | 391 | * The slave requesting the message fragment. If not NULL, a membership |
311 | * @param cls Closure for the callbacks. | 392 | * test is performed first and the message fragment is only returned |
393 | * if the slave has access to it. | ||
394 | * @param message_id | ||
395 | * Message ID to retrieve. Use 0 to get the latest message. | ||
396 | * @param fragment_offset | ||
397 | * Offset of the fragment to retrieve. | ||
398 | * @param fragment_cb | ||
399 | * Callback to call with the retrieved fragments. | ||
400 | * @param result_cb | ||
401 | * Callback to call with the result of the operation. | ||
402 | * @param cls | ||
403 | * Closure for the callbacks. | ||
312 | * | 404 | * |
313 | * @return Handle that can be used to cancel the operation. | 405 | * @return Handle that can be used to cancel the operation. |
314 | */ | 406 | */ |
@@ -318,8 +410,8 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, | |||
318 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | 410 | const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, |
319 | uint64_t message_id, | 411 | uint64_t message_id, |
320 | uint64_t fragment_offset, | 412 | uint64_t fragment_offset, |
321 | GNUNET_PSYCSTORE_FragmentCallback fcb, | 413 | GNUNET_PSYCSTORE_FragmentCallback fragment_cb, |
322 | GNUNET_PSYCSTORE_ResultCallback rcb, | 414 | GNUNET_PSYCSTORE_ResultCallback result_cb, |
323 | void *cls); | 415 | void *cls); |
324 | 416 | ||
325 | 417 | ||