diff options
Diffstat (limited to 'src/include/gnunet_datastore_service.h')
-rw-r--r-- | src/include/gnunet_datastore_service.h | 84 |
1 files changed, 63 insertions, 21 deletions
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index bf18860a6..6f16dad22 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -80,7 +80,9 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
80 | * operation. | 80 | * operation. |
81 | * | 81 | * |
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 | ||
85 | * GNUNET_YES on success | ||
84 | * @param msg NULL on success, otherwise an error message | 86 | * @param msg NULL on success, otherwise an error message |
85 | */ | 87 | */ |
86 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | 88 | typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, |
@@ -96,18 +98,23 @@ typedef void (*GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, | |||
96 | * @param h handle to the datastore | 98 | * @param h handle to the datastore |
97 | * @param amount how much space (in bytes) should be reserved (for content only) | 99 | * @param amount how much space (in bytes) should be reserved (for content only) |
98 | * @param entries how many entries will be created (to calculate per-entry overhead) | 100 | * @param entries how many entries will be created (to calculate per-entry overhead) |
101 | * @param queue_priority ranking of this request in the priority queue | ||
102 | * @param max_queue_size at what queue size should this request be dropped | ||
103 | * (if other requests of higher priority are in the queue) | ||
104 | * @param timeout how long to wait at most for a response (or before dying in queue) | ||
99 | * @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 |
100 | * a positive reservation value if space could be reserved. | 106 | * a positive reservation value if space could be reserved. |
101 | * @param cont_cls closure for cont | 107 | * @param cont_cls closure for cont |
102 | * @param timeout how long to wait at most for a response | ||
103 | */ | 108 | */ |
104 | void | 109 | void |
105 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | 110 | GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, |
106 | uint64_t amount, | 111 | uint64_t amount, |
107 | uint32_t entries, | 112 | uint32_t entries, |
113 | unsigned int queue_priority, | ||
114 | unsigned int max_queue_size, | ||
115 | struct GNUNET_TIME_Relative timeout, | ||
108 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 116 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
109 | void *cont_cls, | 117 | void *cont_cls); |
110 | struct GNUNET_TIME_Relative timeout); | ||
111 | 118 | ||
112 | 119 | ||
113 | /** | 120 | /** |
@@ -125,6 +132,9 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
125 | * @param priority priority of the content | 132 | * @param priority priority of the content |
126 | * @param anonymity anonymity-level for the content | 133 | * @param anonymity anonymity-level for the content |
127 | * @param expiration expiration time for the content | 134 | * @param expiration expiration time for the content |
135 | * @param queue_priority ranking of this request in the priority queue | ||
136 | * @param max_queue_size at what queue size should this request be dropped | ||
137 | * (if other requests of higher priority are in the queue) | ||
128 | * @param timeout timeout for the operation | 138 | * @param timeout timeout for the operation |
129 | * @param cont continuation to call when done | 139 | * @param cont continuation to call when done |
130 | * @param cont_cls closure for cont | 140 | * @param cont_cls closure for cont |
@@ -139,6 +149,8 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
139 | uint32_t priority, | 149 | uint32_t priority, |
140 | uint32_t anonymity, | 150 | uint32_t anonymity, |
141 | struct GNUNET_TIME_Absolute expiration, | 151 | struct GNUNET_TIME_Absolute expiration, |
152 | unsigned int queue_priority, | ||
153 | unsigned int max_queue_size, | ||
142 | struct GNUNET_TIME_Relative timeout, | 154 | struct GNUNET_TIME_Relative timeout, |
143 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 155 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
144 | void *cont_cls); | 156 | void *cont_cls); |
@@ -152,16 +164,24 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, | |||
152 | * @param h handle to the datastore | 164 | * @param h handle to the datastore |
153 | * @param rid reservation ID (value of "success" in original continuation | 165 | * @param rid reservation ID (value of "success" in original continuation |
154 | * from the "reserve" function). | 166 | * from the "reserve" function). |
167 | * @param queue_priority ranking of this request in the priority queue | ||
168 | * @param max_queue_size at what queue size should this request be dropped | ||
169 | * (if other requests of higher priority are in the queue) | ||
170 | * @param queue_priority ranking of this request in the priority queue | ||
171 | * @param max_queue_size at what queue size should this request be dropped | ||
172 | * (if other requests of higher priority are in the queue) | ||
173 | * @param timeout how long to wait at most for a response | ||
155 | * @param cont continuation to call when done | 174 | * @param cont continuation to call when done |
156 | * @param cont_cls closure for cont | 175 | * @param cont_cls closure for cont |
157 | * @param timeout how long to wait at most for a response | ||
158 | */ | 176 | */ |
159 | void | 177 | void |
160 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | 178 | GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, |
161 | int rid, | 179 | int rid, |
180 | unsigned int queue_priority, | ||
181 | unsigned int max_queue_size, | ||
182 | struct GNUNET_TIME_Relative timeout, | ||
162 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 183 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
163 | void *cont_cls, | 184 | void *cont_cls); |
164 | struct GNUNET_TIME_Relative timeout); | ||
165 | 185 | ||
166 | 186 | ||
167 | /** | 187 | /** |
@@ -171,18 +191,23 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
171 | * @param uid identifier for the value | 191 | * @param uid identifier for the value |
172 | * @param priority how much to increase the priority of the value | 192 | * @param priority how much to increase the priority of the value |
173 | * @param expiration new expiration value should be MAX of existing and this argument | 193 | * @param expiration new expiration value should be MAX of existing and this argument |
194 | * @param queue_priority ranking of this request in the priority queue | ||
195 | * @param max_queue_size at what queue size should this request be dropped | ||
196 | * (if other requests of higher priority are in the queue) | ||
197 | * @param timeout how long to wait at most for a response | ||
174 | * @param cont continuation to call when done | 198 | * @param cont continuation to call when done |
175 | * @param cont_cls closure for cont | 199 | * @param cont_cls closure for cont |
176 | * @param timeout how long to wait at most for a response | ||
177 | */ | 200 | */ |
178 | void | 201 | void |
179 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | 202 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, |
180 | unsigned long long uid, | 203 | unsigned long long uid, |
181 | uint32_t priority, | 204 | uint32_t priority, |
182 | struct GNUNET_TIME_Absolute expiration, | 205 | struct GNUNET_TIME_Absolute expiration, |
206 | unsigned int queue_priority, | ||
207 | unsigned int max_queue_size, | ||
208 | struct GNUNET_TIME_Relative timeout, | ||
183 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 209 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
184 | void *cont_cls, | 210 | void *cont_cls); |
185 | struct GNUNET_TIME_Relative timeout); | ||
186 | 211 | ||
187 | 212 | ||
188 | /** | 213 | /** |
@@ -220,18 +245,23 @@ typedef void (*GNUNET_DATASTORE_Iterator) (void *cls, | |||
220 | * @param h handle to the datastore | 245 | * @param h handle to the datastore |
221 | * @param key maybe NULL (to match all entries) | 246 | * @param key maybe NULL (to match all entries) |
222 | * @param type desired type, 0 for any | 247 | * @param type desired type, 0 for any |
248 | * @param queue_priority ranking of this request in the priority queue | ||
249 | * @param max_queue_size at what queue size should this request be dropped | ||
250 | * (if other requests of higher priority are in the queue) | ||
251 | * @param timeout how long to wait at most for a response | ||
223 | * @param iter function to call on each matching value; | 252 | * @param iter function to call on each matching value; |
224 | * will be called once with a NULL value at the end | 253 | * will be called once with a NULL value at the end |
225 | * @param iter_cls closure for iter | 254 | * @param iter_cls closure for iter |
226 | * @param timeout how long to wait at most for a response | ||
227 | */ | 255 | */ |
228 | void | 256 | void |
229 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, | 257 | GNUNET_DATASTORE_get (struct GNUNET_DATASTORE_Handle *h, |
230 | const GNUNET_HashCode * key, | 258 | const GNUNET_HashCode * key, |
231 | enum GNUNET_BLOCK_Type type, | 259 | enum GNUNET_BLOCK_Type type, |
260 | unsigned int queue_priority, | ||
261 | unsigned int max_queue_size, | ||
262 | struct GNUNET_TIME_Relative timeout, | ||
232 | GNUNET_DATASTORE_Iterator iter, | 263 | GNUNET_DATASTORE_Iterator iter, |
233 | void *iter_cls, | 264 | void *iter_cls); |
234 | struct GNUNET_TIME_Relative timeout); | ||
235 | 265 | ||
236 | 266 | ||
237 | /** | 267 | /** |
@@ -251,16 +281,22 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h, | |||
251 | * Get a random value from the datastore. | 281 | * Get a random value from the datastore. |
252 | * | 282 | * |
253 | * @param h handle to the datastore | 283 | * @param h handle to the datastore |
284 | * @param queue_priority ranking of this request in the priority queue | ||
285 | * @param max_queue_size at what queue size should this request be dropped | ||
286 | * (if other requests of higher priority are in the queue) | ||
287 | * @param timeout how long to wait at most for a response | ||
254 | * @param iter function to call on a random value; it | 288 | * @param iter function to call on a random value; it |
255 | * will be called once with a value (if available) | 289 | * will be called once with a value (if available) |
256 | * and always once with a value of NULL. | 290 | * and always once with a value of NULL. |
257 | * @param iter_cls closure for iter | 291 | * @param iter_cls closure for iter |
258 | * @param timeout how long to wait at most for a response | ||
259 | */ | 292 | */ |
260 | void | 293 | void |
261 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | 294 | GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, |
262 | GNUNET_DATASTORE_Iterator iter, void *iter_cls, | 295 | unsigned int queue_priority, |
263 | struct GNUNET_TIME_Relative timeout); | 296 | unsigned int max_queue_size, |
297 | struct GNUNET_TIME_Relative timeout, | ||
298 | GNUNET_DATASTORE_Iterator iter, | ||
299 | void *iter_cls); | ||
264 | 300 | ||
265 | 301 | ||
266 | /** | 302 | /** |
@@ -274,17 +310,23 @@ GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, | |||
274 | * @param key key for the value | 310 | * @param key key for the value |
275 | * @param size number of bytes in data | 311 | * @param size number of bytes in data |
276 | * @param data content stored | 312 | * @param data content stored |
313 | * @param queue_priority ranking of this request in the priority queue | ||
314 | * @param max_queue_size at what queue size should this request be dropped | ||
315 | * (if other requests of higher priority are in the queue) | ||
316 | * @param timeout how long to wait at most for a response | ||
277 | * @param cont continuation to call when done | 317 | * @param cont continuation to call when done |
278 | * @param cont_cls closure for cont | 318 | * @param cont_cls closure for cont |
279 | * @param timeout how long to wait at most for a response | ||
280 | */ | 319 | */ |
281 | void | 320 | void |
282 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | 321 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, |
283 | const GNUNET_HashCode *key, | 322 | const GNUNET_HashCode *key, |
284 | uint32_t size, const void *data, | 323 | uint32_t size, |
324 | const void *data, | ||
325 | unsigned int queue_priority, | ||
326 | unsigned int max_queue_size, | ||
327 | struct GNUNET_TIME_Relative timeout, | ||
285 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 328 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
286 | void *cont_cls, | 329 | void *cont_cls); |
287 | struct GNUNET_TIME_Relative timeout); | ||
288 | 330 | ||
289 | 331 | ||
290 | #if 0 /* keep Emacsens' auto-indent happy */ | 332 | #if 0 /* keep Emacsens' auto-indent happy */ |