aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_datastore_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_datastore_service.h')
-rw-r--r--src/include/gnunet_datastore_service.h254
1 files changed, 160 insertions, 94 deletions
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h
index 4671cfbda..58c730aba 100644
--- a/src/include/gnunet_datastore_service.h
+++ b/src/include/gnunet_datastore_service.h
@@ -75,8 +75,7 @@ struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (const struct
75 * @param h handle to the datastore 75 * @param h handle to the datastore
76 * @param drop set to GNUNET_YES to delete all data in datastore (!) 76 * @param drop set to GNUNET_YES to delete all data in datastore (!)
77 */ 77 */
78void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, 78void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, int drop);
79 int drop);
80 79
81 80
82/** 81/**
@@ -89,9 +88,9 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h,
89 * GNUNET_YES (or other positive value) on success 88 * GNUNET_YES (or other positive value) on success
90 * @param msg NULL on success, otherwise an error message 89 * @param msg NULL on success, otherwise an error message
91 */ 90 */
92typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, 91typedef void (*GNUNET_DATASTORE_ContinuationWithStatus) (void *cls,
93 int32_t success, 92 int32_t success,
94 const char *msg); 93 const char *msg);
95 94
96 95
97/** 96/**
@@ -113,15 +112,21 @@ typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls,
113 * cancel; note that even if NULL is returned, the callback will be invoked 112 * cancel; note that even if NULL is returned, the callback will be invoked
114 * (or rather, will already have been invoked) 113 * (or rather, will already have been invoked)
115 */ 114 */
116struct GNUNET_DATASTORE_QueueEntry * 115struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_reserve (struct
117GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, 116 GNUNET_DATASTORE_Handle
118 uint64_t amount, 117 *h,
119 uint32_t entries, 118 uint64_t amount,
120 unsigned int queue_priority, 119 uint32_t entries,
121 unsigned int max_queue_size, 120 unsigned int
122 struct GNUNET_TIME_Relative timeout, 121 queue_priority,
123 GNUNET_DATASTORE_ContinuationWithStatus cont, 122 unsigned int
124 void *cont_cls); 123 max_queue_size,
124 struct
125 GNUNET_TIME_Relative
126 timeout,
127 GNUNET_DATASTORE_ContinuationWithStatus
128 cont,
129 void *cont_cls);
125 130
126 131
127/** 132/**
@@ -150,22 +155,29 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
150 * cancel; note that even if NULL is returned, the callback will be invoked 155 * cancel; note that even if NULL is returned, the callback will be invoked
151 * (or rather, will already have been invoked) 156 * (or rather, will already have been invoked)
152 */ 157 */
153struct GNUNET_DATASTORE_QueueEntry * 158struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_put (struct
154GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, 159 GNUNET_DATASTORE_Handle
155 uint32_t rid, 160 *h, uint32_t rid,
156 const GNUNET_HashCode * key, 161 const GNUNET_HashCode
157 size_t size, 162 * key, size_t size,
158 const void *data, 163 const void *data,
159 enum GNUNET_BLOCK_Type type, 164 enum GNUNET_BLOCK_Type
160 uint32_t priority, 165 type,
161 uint32_t anonymity, 166 uint32_t priority,
162 uint32_t replication, 167 uint32_t anonymity,
163 struct GNUNET_TIME_Absolute expiration, 168 uint32_t replication,
164 unsigned int queue_priority, 169 struct
165 unsigned int max_queue_size, 170 GNUNET_TIME_Absolute
166 struct GNUNET_TIME_Relative timeout, 171 expiration,
167 GNUNET_DATASTORE_ContinuationWithStatus cont, 172 unsigned int
168 void *cont_cls); 173 queue_priority,
174 unsigned int
175 max_queue_size,
176 struct
177 GNUNET_TIME_Relative
178 timeout,
179 GNUNET_DATASTORE_ContinuationWithStatus
180 cont, void *cont_cls);
169 181
170 182
171/** 183/**
@@ -189,14 +201,24 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
189 * cancel; note that even if NULL is returned, the callback will be invoked 201 * cancel; note that even if NULL is returned, the callback will be invoked
190 * (or rather, will already have been invoked) 202 * (or rather, will already have been invoked)
191 */ 203 */
192struct GNUNET_DATASTORE_QueueEntry * 204struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_release_reserve (struct
193GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, 205 GNUNET_DATASTORE_Handle
194 uint32_t rid, 206 *h,
195 unsigned int queue_priority, 207 uint32_t
196 unsigned int max_queue_size, 208 rid,
197 struct GNUNET_TIME_Relative timeout, 209 unsigned
198 GNUNET_DATASTORE_ContinuationWithStatus cont, 210 int
199 void *cont_cls); 211 queue_priority,
212 unsigned
213 int
214 max_queue_size,
215 struct
216 GNUNET_TIME_Relative
217 timeout,
218 GNUNET_DATASTORE_ContinuationWithStatus
219 cont,
220 void
221 *cont_cls);
200 222
201 223
202/** 224/**
@@ -216,16 +238,23 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h,
216 * cancel; note that even if NULL is returned, the callback will be invoked 238 * cancel; note that even if NULL is returned, the callback will be invoked
217 * (or rather, will already have been invoked) 239 * (or rather, will already have been invoked)
218 */ 240 */
219struct GNUNET_DATASTORE_QueueEntry * 241struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_update (struct
220GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, 242 GNUNET_DATASTORE_Handle
221 uint64_t uid, 243 *h, uint64_t uid,
222 uint32_t priority, 244 uint32_t priority,
223 struct GNUNET_TIME_Absolute expiration, 245 struct
224 unsigned int queue_priority, 246 GNUNET_TIME_Absolute
225 unsigned int max_queue_size, 247 expiration,
226 struct GNUNET_TIME_Relative timeout, 248 unsigned int
227 GNUNET_DATASTORE_ContinuationWithStatus cont, 249 queue_priority,
228 void *cont_cls); 250 unsigned int
251 max_queue_size,
252 struct
253 GNUNET_TIME_Relative
254 timeout,
255 GNUNET_DATASTORE_ContinuationWithStatus
256 cont,
257 void *cont_cls);
229 258
230 259
231/** 260/**
@@ -249,16 +278,23 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h,
249 * cancel; note that even if NULL is returned, the callback will be invoked 278 * cancel; note that even if NULL is returned, the callback will be invoked
250 * (or rather, will already have been invoked) 279 * (or rather, will already have been invoked)
251 */ 280 */
252struct GNUNET_DATASTORE_QueueEntry * 281struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_remove (struct
253GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, 282 GNUNET_DATASTORE_Handle
254 const GNUNET_HashCode *key, 283 *h,
255 size_t size, 284 const
256 const void *data, 285 GNUNET_HashCode *
257 unsigned int queue_priority, 286 key, size_t size,
258 unsigned int max_queue_size, 287 const void *data,
259 struct GNUNET_TIME_Relative timeout, 288 unsigned int
260 GNUNET_DATASTORE_ContinuationWithStatus cont, 289 queue_priority,
261 void *cont_cls); 290 unsigned int
291 max_queue_size,
292 struct
293 GNUNET_TIME_Relative
294 timeout,
295 GNUNET_DATASTORE_ContinuationWithStatus
296 cont,
297 void *cont_cls);
262 298
263 299
264/** 300/**
@@ -276,14 +312,14 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
276 * maybe 0 if no unique identifier is available 312 * maybe 0 if no unique identifier is available
277 */ 313 */
278typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, 314typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
279 const GNUNET_HashCode * key, 315 const GNUNET_HashCode * key,
280 size_t size, 316 size_t size,
281 const void *data, 317 const void *data,
282 enum GNUNET_BLOCK_Type type, 318 enum GNUNET_BLOCK_Type type,
283 uint32_t priority, 319 uint32_t priority,
284 uint32_t anonymity, 320 uint32_t anonymity,
285 struct GNUNET_TIME_Absolute 321 struct GNUNET_TIME_Absolute
286 expiration, uint64_t uid); 322 expiration, uint64_t uid);
287 323
288 324
289/** 325/**
@@ -307,16 +343,26 @@ typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
307 * @return NULL if the entry was not queued, otherwise a handle that can be used to 343 * @return NULL if the entry was not queued, otherwise a handle that can be used to
308 * cancel 344 * cancel
309 */ 345 */
310struct GNUNET_DATASTORE_QueueEntry * 346struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_get_key (struct
311GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, 347 GNUNET_DATASTORE_Handle
312 uint64_t offset, 348 *h,
313 const GNUNET_HashCode * key, 349 uint64_t offset,
314 enum GNUNET_BLOCK_Type type, 350 const
315 unsigned int queue_priority, 351 GNUNET_HashCode *
316 unsigned int max_queue_size, 352 key,
317 struct GNUNET_TIME_Relative timeout, 353 enum
318 GNUNET_DATASTORE_DatumProcessor proc, 354 GNUNET_BLOCK_Type
319 void *proc_cls); 355 type,
356 unsigned int
357 queue_priority,
358 unsigned int
359 max_queue_size,
360 struct
361 GNUNET_TIME_Relative
362 timeout,
363 GNUNET_DATASTORE_DatumProcessor
364 proc,
365 void *proc_cls);
320 366
321 367
322/** 368/**
@@ -343,15 +389,27 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h,
343 * @return NULL if the entry was not queued, otherwise a handle that can be used to 389 * @return NULL if the entry was not queued, otherwise a handle that can be used to
344 * cancel 390 * cancel
345 */ 391 */
346struct GNUNET_DATASTORE_QueueEntry * 392struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_get_zero_anonymity (struct
347GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, 393 GNUNET_DATASTORE_Handle
348 uint64_t offset, 394 *h,
349 unsigned int queue_priority, 395 uint64_t
350 unsigned int max_queue_size, 396 offset,
351 struct GNUNET_TIME_Relative timeout, 397 unsigned
352 enum GNUNET_BLOCK_Type type, 398 int
353 GNUNET_DATASTORE_DatumProcessor proc, 399 queue_priority,
354 void *proc_cls); 400 unsigned
401 int
402 max_queue_size,
403 struct
404 GNUNET_TIME_Relative
405 timeout,
406 enum
407 GNUNET_BLOCK_Type
408 type,
409 GNUNET_DATASTORE_DatumProcessor
410 proc,
411 void
412 *proc_cls);
355 413
356 414
357/** 415/**
@@ -373,13 +431,22 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h,
373 * @return NULL if the entry was not queued, otherwise a handle that can be used to 431 * @return NULL if the entry was not queued, otherwise a handle that can be used to
374 * cancel 432 * cancel
375 */ 433 */
376struct GNUNET_DATASTORE_QueueEntry * 434struct GNUNET_DATASTORE_QueueEntry *GNUNET_DATASTORE_get_for_replication (struct
377GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, 435 GNUNET_DATASTORE_Handle
378 unsigned int queue_priority, 436 *h,
379 unsigned int max_queue_size, 437 unsigned
380 struct GNUNET_TIME_Relative timeout, 438 int
381 GNUNET_DATASTORE_DatumProcessor proc, 439 queue_priority,
382 void *proc_cls); 440 unsigned
441 int
442 max_queue_size,
443 struct
444 GNUNET_TIME_Relative
445 timeout,
446 GNUNET_DATASTORE_DatumProcessor
447 proc,
448 void
449 *proc_cls);
383 450
384 451
385 452
@@ -389,8 +456,7 @@ GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h,
389 * 456 *
390 * @param qe operation to cancel 457 * @param qe operation to cancel
391 */ 458 */
392void 459void GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe);
393GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe);
394 460
395 461
396#if 0 /* keep Emacsens' auto-indent happy */ 462#if 0 /* keep Emacsens' auto-indent happy */