aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_datastore_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-26 18:19:15 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-26 18:19:15 +0000
commit27ed8fcbc85a361864948edb517d47804c2b5a56 (patch)
tree01626713ea5b2ead4691f13eb66a1574b1c0c7fd /src/include/gnunet_datastore_service.h
parentb6c71d97d2a4bb3cb0e0e0ac1cd2a4e145748cc6 (diff)
downloadgnunet-27ed8fcbc85a361864948edb517d47804c2b5a56.tar.gz
gnunet-27ed8fcbc85a361864948edb517d47804c2b5a56.zip
datastore and fs fixes from Easter
Diffstat (limited to 'src/include/gnunet_datastore_service.h')
-rw-r--r--src/include/gnunet_datastore_service.h109
1 files changed, 50 insertions, 59 deletions
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h
index 53d04e517..c563e5cc9 100644
--- a/src/include/gnunet_datastore_service.h
+++ b/src/include/gnunet_datastore_service.h
@@ -262,7 +262,7 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
262 262
263 263
264/** 264/**
265 * An iterator over a set of items stored in the datastore. 265 * Process a datum that was stored in the datastore.
266 * 266 *
267 * @param cls closure 267 * @param cls closure
268 * @param key key for the content 268 * @param key key for the content
@@ -275,87 +275,79 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
275 * @param uid unique identifier for the datum; 275 * @param uid unique identifier for the datum;
276 * maybe 0 if no unique identifier is available 276 * maybe 0 if no unique identifier is available
277 */ 277 */
278typedef void (*GNUNET_DATASTORE_Iterator) (void *cls, 278typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
279 const GNUNET_HashCode * key, 279 const GNUNET_HashCode * key,
280 size_t size, 280 size_t size,
281 const void *data, 281 const void *data,
282 enum GNUNET_BLOCK_Type type, 282 enum GNUNET_BLOCK_Type type,
283 uint32_t priority, 283 uint32_t priority,
284 uint32_t anonymity, 284 uint32_t anonymity,
285 struct GNUNET_TIME_Absolute 285 struct GNUNET_TIME_Absolute
286 expiration, uint64_t uid); 286 expiration, uint64_t uid);
287 287
288 288
289/** 289/**
290 * Iterate over the results for a particular key 290 * Get a result for a particular key from the datastore. The processor
291 * in the datastore. The iterator will only be called 291 * will only be called once.
292 * once initially; if the first call did contain a
293 * result, further results can be obtained by calling
294 * "GNUNET_DATASTORE_iterate_get_next" with the given argument.
295 * 292 *
296 * @param h handle to the datastore 293 * @param h handle to the datastore
294 * @param offset offset of the result (mod #num-results); set to
295 * a random 64-bit value initially; then increment by
296 * one each time; detect that all results have been found by uid
297 * being again the first uid ever returned.
297 * @param key maybe NULL (to match all entries) 298 * @param key maybe NULL (to match all entries)
298 * @param type desired type, 0 for any 299 * @param type desired type, 0 for any
299 * @param queue_priority ranking of this request in the priority queue 300 * @param queue_priority ranking of this request in the priority queue
300 * @param max_queue_size at what queue size should this request be dropped 301 * @param max_queue_size at what queue size should this request be dropped
301 * (if other requests of higher priority are in the queue) 302 * (if other requests of higher priority are in the queue)
302 * @param timeout how long to wait at most for a response 303 * @param timeout how long to wait at most for a response
303 * @param iter function to call on each matching value; 304 * @param proc function to call on each matching value;
304 * will be called once with a NULL value at the end 305 * will be called once with a NULL value at the end
305 * @param iter_cls closure for iter 306 * @param proc_cls closure for proc
306 * @return NULL if the entry was not queued, otherwise a handle that can be used to 307 * @return NULL if the entry was not queued, otherwise a handle that can be used to
307 * cancel; note that even if NULL is returned, the callback will be invoked 308 * cancel
308 * (or rather, will already have been invoked)
309 */ 309 */
310struct GNUNET_DATASTORE_QueueEntry * 310struct GNUNET_DATASTORE_QueueEntry *
311GNUNET_DATASTORE_iterate_key (struct GNUNET_DATASTORE_Handle *h, 311GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h,
312 const GNUNET_HashCode * key, 312 uint64_t offset,
313 enum GNUNET_BLOCK_Type type, 313 const GNUNET_HashCode * key,
314 unsigned int queue_priority, 314 enum GNUNET_BLOCK_Type type,
315 unsigned int max_queue_size, 315 unsigned int queue_priority,
316 struct GNUNET_TIME_Relative timeout, 316 unsigned int max_queue_size,
317 GNUNET_DATASTORE_Iterator iter, 317 struct GNUNET_TIME_Relative timeout,
318 void *iter_cls); 318 GNUNET_DATASTORE_DatumProcessor proc,
319 void *proc_cls);
319 320
320 321
321/** 322/**
322 * Get all zero-anonymity values from the datastore. 323 * Get a single zero-anonymity value from the datastore.
323 * 324 *
324 * @param h handle to the datastore 325 * @param h handle to the datastore
326 * @param offset offset of the result (mod #num-results); set to
327 * a random 64-bit value initially; then increment by
328 * one each time; detect that all results have been found by uid
329 * being again the first uid ever returned.
325 * @param queue_priority ranking of this request in the priority queue 330 * @param queue_priority ranking of this request in the priority queue
326 * @param max_queue_size at what queue size should this request be dropped 331 * @param max_queue_size at what queue size should this request be dropped
327 * (if other requests of higher priority are in the queue) 332 * (if other requests of higher priority are in the queue)
328 * @param timeout how long to wait at most for a response 333 * @param timeout how long to wait at most for a response
329 * @param type allowed type for the operation (never zero) 334 * @param type allowed type for the operation (never zero)
330 * @param iter function to call on a random value; it 335 * @param proc function to call on a random value; it
331 * will be called once with a value (if available) 336 * will be called once with a value (if available)
332 * and always once with a value of NULL at the end. 337 * or with NULL if none value exists.
333 * @param iter_cls closure for iter 338 * @param proc_cls closure for proc
334 * @return NULL if the entry was not queued, otherwise a handle that can be used to 339 * @return NULL if the entry was not queued, otherwise a handle that can be used to
335 * cancel; note that even if NULL is returned, the callback will be invoked 340 * cancel
336 * (or rather, will already have been invoked)
337 */ 341 */
338struct GNUNET_DATASTORE_QueueEntry * 342struct GNUNET_DATASTORE_QueueEntry *
339GNUNET_DATASTORE_iterate_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, 343GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h,
340 unsigned int queue_priority, 344 uint64_t offset,
341 unsigned int max_queue_size, 345 unsigned int queue_priority,
342 struct GNUNET_TIME_Relative timeout, 346 unsigned int max_queue_size,
343 enum GNUNET_BLOCK_Type type, 347 struct GNUNET_TIME_Relative timeout,
344 GNUNET_DATASTORE_Iterator iter, 348 enum GNUNET_BLOCK_Type type,
345 void *iter_cls); 349 GNUNET_DATASTORE_DatumProcessor proc,
346 350 void *proc_cls);
347
348/**
349 * Function called to trigger obtaining the next result
350 * from the datastore. ONLY applies for 'GNUNET_DATASTORE_iterate_*'
351 * calls, not for 'get' calls. FIXME: how much mixing of iterate
352 * calls with other operations can we permit!? Should we pass
353 * the 'QueueEntry' instead of the datastore handle here instead?
354 *
355 * @param h handle to the datastore
356 */
357void
358GNUNET_DATASTORE_iterate_get_next (struct GNUNET_DATASTORE_Handle *h);
359 351
360 352
361/** 353/**
@@ -370,21 +362,20 @@ GNUNET_DATASTORE_iterate_get_next (struct GNUNET_DATASTORE_Handle *h);
370 * @param max_queue_size at what queue size should this request be dropped 362 * @param max_queue_size at what queue size should this request be dropped
371 * (if other requests of higher priority are in the queue) 363 * (if other requests of higher priority are in the queue)
372 * @param timeout how long to wait at most for a response 364 * @param timeout how long to wait at most for a response
373 * @param iter function to call on a random value; it 365 * @param proc function to call on a random value; it
374 * will be called once with a value (if available) 366 * will be called once with a value (if available)
375 * and always once with a value of NULL. 367 * and always once with a value of NULL.
376 * @param iter_cls closure for iter 368 * @param proc_cls closure for proc
377 * @return NULL if the entry was not queued, otherwise a handle that can be used to 369 * @return NULL if the entry was not queued, otherwise a handle that can be used to
378 * cancel; note that even if NULL is returned, the callback will be invoked 370 * cancel
379 * (or rather, will already have been invoked)
380 */ 371 */
381struct GNUNET_DATASTORE_QueueEntry * 372struct GNUNET_DATASTORE_QueueEntry *
382GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, 373GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h,
383 unsigned int queue_priority, 374 unsigned int queue_priority,
384 unsigned int max_queue_size, 375 unsigned int max_queue_size,
385 struct GNUNET_TIME_Relative timeout, 376 struct GNUNET_TIME_Relative timeout,
386 GNUNET_DATASTORE_Iterator iter, 377 GNUNET_DATASTORE_DatumProcessor proc,
387 void *iter_cls); 378 void *proc_cls);
388 379
389 380
390 381