aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_psycstore_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-09-16 04:59:05 +0000
committerGabor X Toth <*@tg-x.net>2013-09-16 04:59:05 +0000
commitf78e9753a91497f1deb5e20d10868c27ab4a6013 (patch)
treef49653367e00fd4b611ec6ec281144d4568bd111 /src/include/gnunet_psycstore_service.h
parentfbae7143d25a258b9dfabefa9ca3956e9228cb0e (diff)
downloadgnunet-f78e9753a91497f1deb5e20d10868c27ab4a6013.tar.gz
gnunet-f78e9753a91497f1deb5e20d10868c27ab4a6013.zip
PSYCstore service and API implementation
Diffstat (limited to 'src/include/gnunet_psycstore_service.h')
-rw-r--r--src/include/gnunet_psycstore_service.h118
1 files changed, 75 insertions, 43 deletions
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h
index 4f8c6c6c0..fcccfc304 100644
--- a/src/include/gnunet_psycstore_service.h
+++ b/src/include/gnunet_psycstore_service.h
@@ -108,7 +108,7 @@ struct GNUNET_PSYCSTORE_OperationHandle;
108 */ 108 */
109typedef void 109typedef void
110(*GNUNET_PSYCSTORE_ResultCallback) (void *cls, 110(*GNUNET_PSYCSTORE_ResultCallback) (void *cls,
111 int result, 111 int64_t result,
112 const char *err_msg); 112 const char *err_msg);
113 113
114 114
@@ -202,7 +202,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
202 * @param cls Closure. 202 * @param cls Closure.
203 * @param message The retrieved message fragment. A NULL value indicates that 203 * @param message The retrieved message fragment. A NULL value indicates that
204 * there are no more results to be returned. 204 * there are no more results to be returned.
205 * @param flags Flags stored with the message. 205 * @param psycstore_flags Flags stored with the message.
206 * 206 *
207 * @return #GNUNET_NO to stop calling this callback with further fragments, 207 * @return #GNUNET_NO to stop calling this callback with further fragments,
208 * #GNUNET_YES to continue. 208 * #GNUNET_YES to continue.
@@ -210,7 +210,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
210typedef int 210typedef int
211(*GNUNET_PSYCSTORE_FragmentCallback) (void *cls, 211(*GNUNET_PSYCSTORE_FragmentCallback) (void *cls,
212 struct GNUNET_MULTICAST_MessageHeader *message, 212 struct GNUNET_MULTICAST_MessageHeader *message,
213 enum GNUNET_PSYCSTORE_MessageFlags flags); 213 enum GNUNET_PSYCSTORE_MessageFlags psycstore_flags);
214 214
215 215
216/** 216/**
@@ -219,8 +219,9 @@ typedef int
219 * @param h Handle for the PSYCstore. 219 * @param h Handle for the PSYCstore.
220 * @param channel_key The channel we are interested in. 220 * @param channel_key The channel we are interested in.
221 * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment. 221 * @param fragment_id Fragment ID to check. Use 0 to get the latest message fragment.
222 * @param cb Callback to call with the retrieved fragment. 222 * @param fcb Callback to call with the retrieved fragment.
223 * @param cb_cls Closure for the callback. 223 * @param rcb Callback to call with the result of the operation.
224 * @param cls Closure for the callbacks.
224 * 225 *
225 * @return Handle that can be used to cancel the operation. 226 * @return Handle that can be used to cancel the operation.
226 */ 227 */
@@ -228,8 +229,9 @@ struct GNUNET_PSYCSTORE_OperationHandle *
228GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, 229GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
229 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 230 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
230 uint64_t fragment_id, 231 uint64_t fragment_id,
231 GNUNET_PSYCSTORE_FragmentCallback cb, 232 GNUNET_PSYCSTORE_FragmentCallback fcb,
232 void *cb_cls); 233 GNUNET_PSYCSTORE_ResultCallback rcb,
234 void *cls);
233 235
234 236
235/** 237/**
@@ -238,8 +240,9 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h,
238 * @param h Handle for the PSYCstore. 240 * @param h Handle for the PSYCstore.
239 * @param channel_key The channel we are interested in. 241 * @param channel_key The channel we are interested in.
240 * @param message_id Message ID to check. Use 0 to get the latest message. 242 * @param message_id Message ID to check. Use 0 to get the latest message.
241 * @param cb Callback to call with the retrieved fragments. 243 * @param fcb Callback to call with the retrieved fragments.
242 * @param cb_cls Closure for the callback. 244 * @param rcb Callback to call with the result of the operation.
245 * @param cls Closure for the callbacks.
243 * 246 *
244 * @return Handle that can be used to cancel the operation. 247 * @return Handle that can be used to cancel the operation.
245 */ 248 */
@@ -247,8 +250,9 @@ struct GNUNET_PSYCSTORE_OperationHandle *
247GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, 250GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
248 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 251 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
249 uint64_t message_id, 252 uint64_t message_id,
250 GNUNET_PSYCSTORE_FragmentCallback cb, 253 GNUNET_PSYCSTORE_FragmentCallback fcb,
251 void *cb_cls); 254 GNUNET_PSYCSTORE_ResultCallback rcb,
255 void *cls);
252 256
253 257
254/** 258/**
@@ -259,8 +263,9 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
259 * @param channel_key The channel we are interested in. 263 * @param channel_key The channel we are interested in.
260 * @param message_id Message ID to check. Use 0 to get the latest message. 264 * @param message_id Message ID to check. Use 0 to get the latest message.
261 * @param fragment_offset Offset of the fragment to retrieve. 265 * @param fragment_offset Offset of the fragment to retrieve.
262 * @param cb Callback to call with the retrieved fragments. 266 * @param fcb Callback to call with the retrieved fragments.
263 * @param cb_cls Closure for the callback. 267 * @param rcb Callback to call with the result of the operation.
268 * @param cls Closure for the callbacks.
264 * 269 *
265 * @return Handle that can be used to cancel the operation. 270 * @return Handle that can be used to cancel the operation.
266 */ 271 */
@@ -269,8 +274,9 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
269 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 274 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
270 uint64_t message_id, 275 uint64_t message_id,
271 uint64_t fragment_offset, 276 uint64_t fragment_offset,
272 GNUNET_PSYCSTORE_FragmentCallback cb, 277 GNUNET_PSYCSTORE_FragmentCallback fcb,
273 void *cb_cls); 278 GNUNET_PSYCSTORE_ResultCallback rcb,
279 void *cls);
274 280
275 281
276/** 282/**
@@ -312,16 +318,16 @@ typedef void
312 * 318 *
313 * @param h Handle for the PSYCstore. 319 * @param h Handle for the PSYCstore.
314 * @param channel_key Public key that identifies the channel. 320 * @param channel_key Public key that identifies the channel.
315 * @param cb Callback to call with the result. 321 * @param mccb Callback to call with the result.
316 * @param cb_cls Closure for the callback. 322 * @param mccb_cls Closure for the callback.
317 * 323 *
318 * @return 324 * @return Handle that can be used to cancel the operation.
319 */ 325 */
320struct GNUNET_PSYCSTORE_OperationHandle * 326struct GNUNET_PSYCSTORE_OperationHandle *
321GNUNET_PSYCSTORE_counters_get_master (struct GNUNET_PSYCSTORE_Handle *h, 327GNUNET_PSYCSTORE_counters_get_master (struct GNUNET_PSYCSTORE_Handle *h,
322 struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 328 struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
323 GNUNET_PSYCSTORE_MasterCountersCallback *cb, 329 GNUNET_PSYCSTORE_MasterCountersCallback mccb,
324 void *cb_cls); 330 void *mccb_cls);
325 331
326 332
327/** 333/**
@@ -332,16 +338,16 @@ GNUNET_PSYCSTORE_counters_get_master (struct GNUNET_PSYCSTORE_Handle *h,
332 * 338 *
333 * @param h Handle for the PSYCstore. 339 * @param h Handle for the PSYCstore.
334 * @param channel_key Public key that identifies the channel. 340 * @param channel_key Public key that identifies the channel.
335 * @param cb Callback to call with the result. 341 * @param sccb Callback to call with the result.
336 * @param cb_cls Closure for the callback. 342 * @param sccb_cls Closure for the callback.
337 * 343 *
338 * @return 344 * @return Handle that can be used to cancel the operation.
339 */ 345 */
340struct GNUNET_PSYCSTORE_OperationHandle * 346struct GNUNET_PSYCSTORE_OperationHandle *
341GNUNET_PSYCSTORE_counters_get_slave (struct GNUNET_PSYCSTORE_Handle *h, 347GNUNET_PSYCSTORE_counters_get_slave (struct GNUNET_PSYCSTORE_Handle *h,
342 struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 348 struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
343 GNUNET_PSYCSTORE_SlaveCountersCallback *cb, 349 GNUNET_PSYCSTORE_SlaveCountersCallback sccb,
344 void *cb_cls); 350 void *sccb_cls);
345 351
346 352
347/** 353/**
@@ -353,7 +359,7 @@ GNUNET_PSYCSTORE_counters_get_slave (struct GNUNET_PSYCSTORE_Handle *h,
353 * @param h Handle for the PSYCstore. 359 * @param h Handle for the PSYCstore.
354 * @param channel_key The channel we are interested in. 360 * @param channel_key The channel we are interested in.
355 * @param message_id ID of the message that contains the @a modifiers. 361 * @param message_id ID of the message that contains the @a modifiers.
356 * @param state_delta Value of the _state_delta PSYC header variable of the message. 362 * @param state_delta Value of the @e state_delta PSYC header variable of the message.
357 * @param modifier_count Number of elements in the @a modifiers array. 363 * @param modifier_count Number of elements in the @a modifiers array.
358 * @param modifiers List of modifiers to apply. 364 * @param modifiers List of modifiers to apply.
359 * @param rcb Callback to call with the result of the operation. 365 * @param rcb Callback to call with the result of the operation.
@@ -373,6 +379,30 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
373 379
374 380
375/** 381/**
382 * Store synchronized state.
383 *
384 * @param h Handle for the PSYCstore.
385 * @param channel_key The channel we are interested in.
386 * @param message_id ID of the message that contains the state_hash PSYC header variable.
387 * @param modifier_count Number of elements in the @a modifiers array.
388 * @param modifiers Full state to store.
389 * @param rcb Callback to call with the result of the operation.
390 * @param rcb_cls Closure for the callback.
391 *
392 * @return Handle that can be used to cancel the operation.
393 */
394struct GNUNET_PSYCSTORE_OperationHandle *
395GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
396 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
397 uint64_t message_id,
398 size_t modifier_count,
399 const struct GNUNET_ENV_Modifier *modifiers,
400 GNUNET_PSYCSTORE_ResultCallback rcb,
401 void *rcb_cls);
402
403
404
405/**
376 * Reset the state of a channel. 406 * Reset the state of a channel.
377 * 407 *
378 * Delete all state variables stored for the given channel. 408 * Delete all state variables stored for the given channel.
@@ -384,7 +414,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
384 * 414 *
385 * @return Handle that can be used to cancel the operation. 415 * @return Handle that can be used to cancel the operation.
386 */ 416 */
387struct GNUNET_PSYCSTORE_Handle * 417struct GNUNET_PSYCSTORE_OperationHandle *
388GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, 418GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h,
389 const struct GNUNET_CRYPTO_EccPublicSignKey 419 const struct GNUNET_CRYPTO_EccPublicSignKey
390 *channel_key, 420 *channel_key,
@@ -423,12 +453,10 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h,
423 * 453 *
424 * @return #GNUNET_NO to stop calling this callback with further variables, 454 * @return #GNUNET_NO to stop calling this callback with further variables,
425 * #GNUNET_YES to continue. 455 * #GNUNET_YES to continue.
426 */ 456 */;
427typedef int 457typedef int
428(*GNUNET_PSYCSTORE_StateCallback) (void *cls, 458(*GNUNET_PSYCSTORE_StateCallback) (void *cls, const char *name,
429 const char *name, 459 const void *value, size_t value_size);
430 const void *value,
431 size_t value_size);
432 460
433 461
434/** 462/**
@@ -437,8 +465,9 @@ typedef int
437 * @param h Handle for the PSYCstore. 465 * @param h Handle for the PSYCstore.
438 * @param channel_key The channel we are interested in. 466 * @param channel_key The channel we are interested in.
439 * @param name Name of variable to match, the returned variable might be less specific. 467 * @param name Name of variable to match, the returned variable might be less specific.
440 * @param cb Callback to return matching state variables. 468 * @param scb Callback to return the matching state variable.
441 * @param cb_cls Closure for the callback. 469 * @param rcb Callback to call with the result of the operation.
470 * @param cls Closure for the callbacks.
442 * 471 *
443 * @return Handle that can be used to cancel the operation. 472 * @return Handle that can be used to cancel the operation.
444 */ 473 */
@@ -446,8 +475,9 @@ struct GNUNET_PSYCSTORE_OperationHandle *
446GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, 475GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
447 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 476 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
448 const char *name, 477 const char *name,
449 GNUNET_PSYCSTORE_StateCallback cb, 478 GNUNET_PSYCSTORE_StateCallback scb,
450 void *cb_cls); 479 GNUNET_PSYCSTORE_ResultCallback rcb,
480 void *cls);
451 481
452 482
453/** 483/**
@@ -456,17 +486,19 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
456 * @param h Handle for the PSYCstore. 486 * @param h Handle for the PSYCstore.
457 * @param channel_key The channel we are interested in. 487 * @param channel_key The channel we are interested in.
458 * @param name_prefix Prefix of state variable names to match. 488 * @param name_prefix Prefix of state variable names to match.
459 * @param cb Callback to return matching state variables. 489 * @param scb Callback to return matching state variables.
460 * @param cb_cls Closure for the callback. 490 * @param rcb Callback to call with the result of the operation.
491 * @param cls Closure for the callbacks.
461 * 492 *
462 * @return Handle that can be used to cancel the operation. 493 * @return Handle that can be used to cancel the operation.
463 */ 494 */
464struct GNUNET_PSYCSTORE_OperationHandle * 495struct GNUNET_PSYCSTORE_OperationHandle *
465GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, 496GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h,
466 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, 497 const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
467 const char *name_prefix, 498 const char *name_prefix,
468 GNUNET_PSYCSTORE_StateCallback cb, 499 GNUNET_PSYCSTORE_StateCallback scb,
469 void *cb_cls); 500 GNUNET_PSYCSTORE_ResultCallback rcb,
501 void *cls);
470 502
471 503
472/** 504/**