aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_psycstore_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-09-03 22:33:21 +0000
committerGabor X Toth <*@tg-x.net>2013-09-03 22:33:21 +0000
commiteb9556bf2983ca19a5cbcf7cf460a0b2509b290a (patch)
tree285d31e951f7ecf9308b22257adcadd5b07d80ea /src/include/gnunet_psycstore_service.h
parent37bafa60a6f0e447cb5b61547404f0902fa7ad41 (diff)
downloadgnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.tar.gz
gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.zip
PSYCstore SQLite backend; API fixes/enhancements
Diffstat (limited to 'src/include/gnunet_psycstore_service.h')
-rw-r--r--src/include/gnunet_psycstore_service.h78
1 files changed, 65 insertions, 13 deletions
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h
index bbf5a7d19..fab2594df 100644
--- a/src/include/gnunet_psycstore_service.h
+++ b/src/include/gnunet_psycstore_service.h
@@ -45,6 +45,28 @@ extern "C"
45 */ 45 */
46#define GNUNET_PSYCSTORE_VERSION 0x00000000 46#define GNUNET_PSYCSTORE_VERSION 0x00000000
47 47
48/**
49 * Flags for stored messages.
50 */
51enum GNUNET_PSYCSTORE_MessageFlags
52{
53 /**
54 * The message contains state modifiers.
55 */
56 GNUNET_PSYCSTORE_MESSAGE_STATE = 1 << 0,
57
58 /**
59 * The state modifiers have been applied to the state store.
60 */
61 GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED = 1 << 1,
62
63 /**
64 * The message contains a state hash.
65 */
66 GNUNET_PSYCSTORE_MESSAGE_STATE_HASH = 1 << 2
67};
68
69
48/** 70/**
49 * Handle for a PSYCstore 71 * Handle for a PSYCstore
50 */ 72 */
@@ -157,6 +179,8 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h,
157 * @param h Handle for the PSYCstore. 179 * @param h Handle for the PSYCstore.
158 * @param channel_key The channel the message belongs to. 180 * @param channel_key The channel the message belongs to.
159 * @param message Message to store. 181 * @param message Message to store.
182 * @param psycstore_flags Flags indicating whether the PSYC message contains
183 * state modifiers.
160 * @param rcb Callback to call with the result of the operation. 184 * @param rcb Callback to call with the result of the operation.
161 * @param rcb_cls Closure for the callback. 185 * @param rcb_cls Closure for the callback.
162 * 186 *
@@ -166,6 +190,7 @@ struct GNUNET_PSYCSTORE_OperationHandle *
166GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, 190GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
167 const struct GNUNET_CRYPTO_EccPublicKey *channel_key, 191 const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
168 const struct GNUNET_MULTICAST_MessageHeader *message, 192 const struct GNUNET_MULTICAST_MessageHeader *message,
193 uint32_t psycstore_flags,
169 GNUNET_PSYCSTORE_ResultCallback rcb, 194 GNUNET_PSYCSTORE_ResultCallback rcb,
170 void *rcb_cls); 195 void *rcb_cls);
171 196
@@ -177,12 +202,15 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
177 * @param cls Closure. 202 * @param cls Closure.
178 * @param message The retrieved message fragment. A NULL value indicates that 203 * @param message The retrieved message fragment. A NULL value indicates that
179 * there are no more results to be returned. 204 * there are no more results to be returned.
180 * @param flags Message flags indicating fragmentation status. 205 * @param flags Flags stored with the message.
206 *
207 * @return #GNUNET_NO to stop calling this callback with further fragments,
208 * #GNUNET_YES to continue.
181 */ 209 */
182typedef void 210typedef int
183(*GNUNET_PSYCSTORE_FragmentCallback) (void *cls, 211(*GNUNET_PSYCSTORE_FragmentCallback) (void *cls,
184 const struct GNUNET_MULTICAST_MessageHeader *message, 212 struct GNUNET_MULTICAST_MessageHeader *message,
185 enum GNUNET_PSYC_MessageFlags flags); 213 enum GNUNET_PSYCSTORE_MessageFlags flags);
186 214
187 215
188/** 216/**
@@ -224,7 +252,8 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
224 252
225 253
226/** 254/**
227 * Retrieve a fragment of message specified by its message ID and fragment offset. 255 * Retrieve a fragment of message specified by its message ID and fragment
256 * offset.
228 * 257 *
229 * @param h Handle for the PSYCstore. 258 * @param h Handle for the PSYCstore.
230 * @param channel_key The channel we are interested in. 259 * @param channel_key The channel we are interested in.
@@ -267,7 +296,8 @@ typedef void
267 * @see GNUNET_PSYCSTORE_counters_get_slave() 296 * @see GNUNET_PSYCSTORE_counters_get_slave()
268 * 297 *
269 * @param cls Closure. 298 * @param cls Closure.
270 * @param max_state_msg_id Latest message ID containing state modifiers that was applied to the state store. Used for the state sync process. 299 * @param max_state_msg_id Latest message ID containing state modifiers that was
300 * applied to the state store. Used for the state sync process.
271 */ 301 */
272typedef void 302typedef void
273(*GNUNET_PSYCSTORE_SlaveCountersCallback) (void *cls, 303(*GNUNET_PSYCSTORE_SlaveCountersCallback) (void *cls,
@@ -343,6 +373,26 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
343 373
344 374
345/** 375/**
376 * Reset the state of a channel.
377 *
378 * Delete all state variables stored for the given channel.
379 *
380 * @param h Handle for the PSYCstore.
381 * @param channel_key The channel we are interested in.
382 * @param rcb Callback to call with the result of the operation.
383 * @param rcb_cls Closure for the callback.
384 *
385 * @return Handle that can be used to cancel the operation.
386 */
387struct GNUNET_PSYCSTORE_Handle *
388GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h,
389 const struct GNUNET_CRYPTO_EccPublicKey
390 *channel_key,
391 GNUNET_PSYCSTORE_ResultCallback rcb,
392 void *rcb_cls);
393
394
395/**
346 * Update signed values of state variables in the state store. 396 * Update signed values of state variables in the state store.
347 * 397 *
348 * @param h Handle for the PSYCstore. 398 * @param h Handle for the PSYCstore.
@@ -368,15 +418,17 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h,
368 * @param cls Closure. 418 * @param cls Closure.
369 * @param name Name of the state variable. A NULL value indicates that there are no more 419 * @param name Name of the state variable. A NULL value indicates that there are no more
370 * state variables to be returned. 420 * state variables to be returned.
371 * @param value_size Number of bytes in @a value.
372 * @param value Value of the state variable. 421 * @param value Value of the state variable.
373t * 422 * @param value_size Number of bytes in @a value.
423 *
424 * @return #GNUNET_NO to stop calling this callback with further variables,
425 * #GNUNET_YES to continue.
374 */ 426 */
375typedef void 427typedef int
376(*GNUNET_PSYCSTORE_StateCallback) (void *cls, 428(*GNUNET_PSYCSTORE_StateCallback) (void *cls,
377 const char *name, 429 const char *name,
378 size_t value_size, 430 const void *value,
379 const void *value); 431 size_t value_size);
380 432
381 433
382/** 434/**
@@ -420,10 +472,10 @@ GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h,
420/** 472/**
421 * Cancel an operation. 473 * Cancel an operation.
422 * 474 *
423 * @param oh Handle for the operation to cancel. 475 * @param op Handle for the operation to cancel.
424 */ 476 */
425void 477void
426GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *oh); 478GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op);
427 479
428 480
429 481