diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-13 13:43:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-13 13:43:35 +0000 |
commit | 5e6ff76c94890e47b51f8bd555437c0ee181e851 (patch) | |
tree | 6cc524b94fd92b4430f4e9512183aceb0007fec4 /src/include/gnunet_datastore_service.h | |
parent | baaedd4fdfb10fc28d9923be9e1d28663d621eca (diff) | |
download | gnunet-5e6ff76c94890e47b51f8bd555437c0ee181e851.tar.gz gnunet-5e6ff76c94890e47b51f8bd555437c0ee181e851.zip |
add cancellation
Diffstat (limited to 'src/include/gnunet_datastore_service.h')
-rw-r--r-- | src/include/gnunet_datastore_service.h | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index e2de185bd..9d3a4ceb0 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -105,8 +105,11 @@ typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | |||
105 | * @param cont continuation to call when done; "success" will be set to | 105 | * @param cont continuation to call when done; "success" will be set to |
106 | * a positive reservation value if space could be reserved. | 106 | * a positive reservation value if space could be reserved. |
107 | * @param cont_cls closure for cont | 107 | * @param cont_cls closure for cont |
108 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
109 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
110 | * (or rather, will already have been invoked) | ||
108 | */ | 111 | */ |
109 | void | 112 | struct GNUNET_DATASTORE_QueueEntry * |
110 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | 113 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, |
111 | uint64_t amount, | 114 | uint64_t amount, |
112 | uint32_t entries, | 115 | uint32_t entries, |
@@ -138,8 +141,11 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
138 | * @param timeout timeout for the operation | 141 | * @param timeout timeout for the operation |
139 | * @param cont continuation to call when done | 142 | * @param cont continuation to call when done |
140 | * @param cont_cls closure for cont | 143 | * @param cont_cls closure for cont |
144 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
145 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
146 | * (or rather, will already have been invoked) | ||
141 | */ | 147 | */ |
142 | void | 148 | struct GNUNET_DATASTORE_QueueEntry * |
143 | GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | 149 | GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, |
144 | int rid, | 150 | int rid, |
145 | const GNUNET_HashCode * key, | 151 | const GNUNET_HashCode * key, |
@@ -173,8 +179,11 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
173 | * @param timeout how long to wait at most for a response | 179 | * @param timeout how long to wait at most for a response |
174 | * @param cont continuation to call when done | 180 | * @param cont continuation to call when done |
175 | * @param cont_cls closure for cont | 181 | * @param cont_cls closure for cont |
182 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
183 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
184 | * (or rather, will already have been invoked) | ||
176 | */ | 185 | */ |
177 | void | 186 | struct GNUNET_DATASTORE_QueueEntry * |
178 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | 187 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, |
179 | int rid, | 188 | int rid, |
180 | unsigned int queue_priority, | 189 | unsigned int queue_priority, |
@@ -197,8 +206,11 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
197 | * @param timeout how long to wait at most for a response | 206 | * @param timeout how long to wait at most for a response |
198 | * @param cont continuation to call when done | 207 | * @param cont continuation to call when done |
199 | * @param cont_cls closure for cont | 208 | * @param cont_cls closure for cont |
209 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
210 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
211 | * (or rather, will already have been invoked) | ||
200 | */ | 212 | */ |
201 | void | 213 | struct GNUNET_DATASTORE_QueueEntry * |
202 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | 214 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, |
203 | unsigned long long uid, | 215 | unsigned long long uid, |
204 | uint32_t priority, | 216 | uint32_t priority, |
@@ -227,8 +239,11 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | |||
227 | * @param timeout how long to wait at most for a response | 239 | * @param timeout how long to wait at most for a response |
228 | * @param cont continuation to call when done | 240 | * @param cont continuation to call when done |
229 | * @param cont_cls closure for cont | 241 | * @param cont_cls closure for cont |
242 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
243 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
244 | * (or rather, will already have been invoked) | ||
230 | */ | 245 | */ |
231 | void | 246 | struct GNUNET_DATASTORE_QueueEntry * |
232 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | 247 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, |
233 | const GNUNET_HashCode *key, | 248 | const GNUNET_HashCode *key, |
234 | uint32_t size, | 249 | uint32_t size, |
@@ -282,8 +297,11 @@ typedef void (*GNUNET_DATASTORE_Iterator) (void *cls, | |||
282 | * @param iter function to call on each matching value; | 297 | * @param iter function to call on each matching value; |
283 | * will be called once with a NULL value at the end | 298 | * will be called once with a NULL value at the end |
284 | * @param iter_cls closure for iter | 299 | * @param iter_cls closure for iter |
300 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
301 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
302 | * (or rather, will already have been invoked) | ||
285 | */ | 303 | */ |
286 | void | 304 | struct GNUNET_DATASTORE_QueueEntry * |
287 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, | 305 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, |
288 | const GNUNET_HashCode * key, | 306 | const GNUNET_HashCode * key, |
289 | enum GNUNET_BLOCK_Type type, | 307 | enum GNUNET_BLOCK_Type type, |
@@ -319,8 +337,11 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h, | |||
319 | * will be called once with a value (if available) | 337 | * will be called once with a value (if available) |
320 | * and always once with a value of NULL. | 338 | * and always once with a value of NULL. |
321 | * @param iter_cls closure for iter | 339 | * @param iter_cls closure for iter |
340 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
341 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
342 | * (or rather, will already have been invoked) | ||
322 | */ | 343 | */ |
323 | void | 344 | struct GNUNET_DATASTORE_QueueEntry * |
324 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | 345 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, |
325 | unsigned int queue_priority, | 346 | unsigned int queue_priority, |
326 | unsigned int max_queue_size, | 347 | unsigned int max_queue_size, |
@@ -328,6 +349,14 @@ GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | |||
328 | GNUNET_DATASTORE_Iterator iter, | 349 | GNUNET_DATASTORE_Iterator iter, |
329 | void *iter_cls); | 350 | void *iter_cls); |
330 | 351 | ||
352 | /** | ||
353 | * Cancel a datastore operation. The final callback from the | ||
354 | * operation must not have been done yet. | ||
355 | * | ||
356 | * @param qe operation to cancel | ||
357 | */ | ||
358 | void | ||
359 | GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe); | ||
331 | 360 | ||
332 | 361 | ||
333 | #if 0 /* keep Emacsens' auto-indent happy */ | 362 | #if 0 /* keep Emacsens' auto-indent happy */ |