diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-04-03 20:00:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-04-03 20:00:42 +0000 |
commit | e8f35bb025c25839a52fb502e452393831e4e6f0 (patch) | |
tree | 7a056253bddc61b1e6a3258567e176af128c2b67 /src/include/gnunet_datastore_service.h | |
parent | 9f871785d57da57ba128ac2279fda1db1d9b8bfb (diff) | |
download | gnunet-e8f35bb025c25839a52fb502e452393831e4e6f0.tar.gz gnunet-e8f35bb025c25839a52fb502e452393831e4e6f0.zip |
improving datastore API --- not working yet
Diffstat (limited to 'src/include/gnunet_datastore_service.h')
-rw-r--r-- | src/include/gnunet_datastore_service.h | 88 |
1 files changed, 46 insertions, 42 deletions
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index 1e2e9e050..284d544f5 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -82,11 +82,11 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
82 | * @param cls closure | 82 | * @param cls closure |
83 | * @param success GNUNET_SYSERR on failure, | 83 | * @param success GNUNET_SYSERR on failure, |
84 | * GNUNET_NO on timeout/queue drop | 84 | * GNUNET_NO on timeout/queue drop |
85 | * GNUNET_YES on success | 85 | * GNUNET_YES (or other positive value) on success |
86 | * @param msg NULL on success, otherwise an error message | 86 | * @param msg NULL on success, otherwise an error message |
87 | */ | 87 | */ |
88 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | 88 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, |
89 | int success, | 89 | int32_t success, |
90 | const char *msg); | 90 | const char *msg); |
91 | 91 | ||
92 | 92 | ||
@@ -148,7 +148,7 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
148 | */ | 148 | */ |
149 | struct GNUNET_DATASTORE_QueueEntry * | 149 | struct GNUNET_DATASTORE_QueueEntry * |
150 | GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | 150 | GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, |
151 | int rid, | 151 | uint32_t rid, |
152 | const GNUNET_HashCode * key, | 152 | const GNUNET_HashCode * key, |
153 | size_t size, | 153 | size_t size, |
154 | const void *data, | 154 | const void *data, |
@@ -187,7 +187,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
187 | */ | 187 | */ |
188 | struct GNUNET_DATASTORE_QueueEntry * | 188 | struct GNUNET_DATASTORE_QueueEntry * |
189 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | 189 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, |
190 | int rid, | 190 | uint32_t rid, |
191 | unsigned int queue_priority, | 191 | unsigned int queue_priority, |
192 | unsigned int max_queue_size, | 192 | unsigned int max_queue_size, |
193 | struct GNUNET_TIME_Relative timeout, | 193 | struct GNUNET_TIME_Relative timeout, |
@@ -214,7 +214,7 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
214 | */ | 214 | */ |
215 | struct GNUNET_DATASTORE_QueueEntry * | 215 | struct GNUNET_DATASTORE_QueueEntry * |
216 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | 216 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, |
217 | unsigned long long uid, | 217 | uint64_t uid, |
218 | uint32_t priority, | 218 | uint32_t priority, |
219 | struct GNUNET_TIME_Absolute expiration, | 219 | struct GNUNET_TIME_Absolute expiration, |
220 | unsigned int queue_priority, | 220 | unsigned int queue_priority, |
@@ -287,7 +287,7 @@ typedef void (*GNUNET_DATASTORE_Iterator) (void *cls, | |||
287 | * in the datastore. The iterator will only be called | 287 | * in the datastore. The iterator will only be called |
288 | * once initially; if the first call did contain a | 288 | * once initially; if the first call did contain a |
289 | * result, further results can be obtained by calling | 289 | * result, further results can be obtained by calling |
290 | * "GNUNET_DATASTORE_get_next" with the given argument. | 290 | * "GNUNET_DATASTORE_iterate_get_next" with the given argument. |
291 | * | 291 | * |
292 | * @param h handle to the datastore | 292 | * @param h handle to the datastore |
293 | * @param key maybe NULL (to match all entries) | 293 | * @param key maybe NULL (to match all entries) |
@@ -304,24 +304,54 @@ typedef void (*GNUNET_DATASTORE_Iterator) (void *cls, | |||
304 | * (or rather, will already have been invoked) | 304 | * (or rather, will already have been invoked) |
305 | */ | 305 | */ |
306 | struct GNUNET_DATASTORE_QueueEntry * | 306 | struct GNUNET_DATASTORE_QueueEntry * |
307 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, | 307 | GNUNET_DATASTORE_iterate_key (struct GNUNET_DATASTORE_Handle *h, |
308 | const GNUNET_HashCode * key, | 308 | const GNUNET_HashCode * key, |
309 | enum GNUNET_BLOCK_Type type, | 309 | enum GNUNET_BLOCK_Type type, |
310 | unsigned int queue_priority, | 310 | unsigned int queue_priority, |
311 | unsigned int max_queue_size, | 311 | unsigned int max_queue_size, |
312 | struct GNUNET_TIME_Relative timeout, | 312 | struct GNUNET_TIME_Relative timeout, |
313 | GNUNET_DATASTORE_Iterator iter, | 313 | GNUNET_DATASTORE_Iterator iter, |
314 | void *iter_cls); | 314 | void *iter_cls); |
315 | |||
316 | |||
317 | /** | ||
318 | * Get all zero-anonymity values from the datastore. | ||
319 | * | ||
320 | * @param h handle to the datastore | ||
321 | * @param queue_priority ranking of this request in the priority queue | ||
322 | * @param max_queue_size at what queue size should this request be dropped | ||
323 | * (if other requests of higher priority are in the queue) | ||
324 | * @param timeout how long to wait at most for a response | ||
325 | * @param type allowed type for the operation (ANY for 'all types') | ||
326 | * @param iter function to call on a random value; it | ||
327 | * will be called once with a value (if available) | ||
328 | * and always once with a value of NULL at the end. | ||
329 | * @param iter_cls closure for iter | ||
330 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
331 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
332 | * (or rather, will already have been invoked) | ||
333 | */ | ||
334 | struct GNUNET_DATASTORE_QueueEntry * | ||
335 | GNUNET_DATASTORE_iterate_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | ||
336 | unsigned int queue_priority, | ||
337 | unsigned int max_queue_size, | ||
338 | struct GNUNET_TIME_Relative timeout, | ||
339 | enum GNUNET_BLOCK_Type type, | ||
340 | GNUNET_DATASTORE_Iterator iter, | ||
341 | void *iter_cls); | ||
315 | 342 | ||
316 | 343 | ||
317 | /** | 344 | /** |
318 | * Function called to trigger obtaining the next result | 345 | * Function called to trigger obtaining the next result |
319 | * from the datastore. | 346 | * from the datastore. ONLY applies for 'GNUNET_DATASTORE_iterate_*' |
347 | * calls, not for 'get' calls. FIXME: how much mixing of iterate | ||
348 | * calls with other operations can we permit!? Should we pass | ||
349 | * the 'QueueEntry' instead of the datastore handle here instead? | ||
320 | * | 350 | * |
321 | * @param h handle to the datastore | 351 | * @param h handle to the datastore |
322 | */ | 352 | */ |
323 | void | 353 | void |
324 | GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h); | 354 | GNUNET_DATASTORE_iterate_get_next (struct GNUNET_DATASTORE_Handle *h); |
325 | 355 | ||
326 | 356 | ||
327 | /** | 357 | /** |
@@ -353,32 +383,6 @@ GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, | |||
353 | void *iter_cls); | 383 | void *iter_cls); |
354 | 384 | ||
355 | 385 | ||
356 | /** | ||
357 | * Get a zero-anonymity value from the datastore. | ||
358 | * | ||
359 | * @param h handle to the datastore | ||
360 | * @param queue_priority ranking of this request in the priority queue | ||
361 | * @param max_queue_size at what queue size should this request be dropped | ||
362 | * (if other requests of higher priority are in the queue) | ||
363 | * @param timeout how long to wait at most for a response | ||
364 | * @param type allowed type for the operation | ||
365 | * @param iter function to call on a random value; it | ||
366 | * will be called once with a value (if available) | ||
367 | * and always once with a value of NULL. | ||
368 | * @param iter_cls closure for iter | ||
369 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
370 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
371 | * (or rather, will already have been invoked) | ||
372 | */ | ||
373 | struct GNUNET_DATASTORE_QueueEntry * | ||
374 | GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | ||
375 | unsigned int queue_priority, | ||
376 | unsigned int max_queue_size, | ||
377 | struct GNUNET_TIME_Relative timeout, | ||
378 | enum GNUNET_BLOCK_Type type, | ||
379 | GNUNET_DATASTORE_Iterator iter, | ||
380 | void *iter_cls); | ||
381 | |||
382 | 386 | ||
383 | /** | 387 | /** |
384 | * Cancel a datastore operation. The final callback from the | 388 | * Cancel a datastore operation. The final callback from the |