aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_datastore_plugin.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-03 20:00:42 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-03 20:00:42 +0000
commite8f35bb025c25839a52fb502e452393831e4e6f0 (patch)
tree7a056253bddc61b1e6a3258567e176af128c2b67 /src/include/gnunet_datastore_plugin.h
parent9f871785d57da57ba128ac2279fda1db1d9b8bfb (diff)
downloadgnunet-e8f35bb025c25839a52fb502e452393831e4e6f0.tar.gz
gnunet-e8f35bb025c25839a52fb502e452393831e4e6f0.zip
improving datastore API --- not working yet
Diffstat (limited to 'src/include/gnunet_datastore_plugin.h')
-rw-r--r--src/include/gnunet_datastore_plugin.h64
1 files changed, 28 insertions, 36 deletions
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h
index c981ceb1d..34a659163 100644
--- a/src/include/gnunet_datastore_plugin.h
+++ b/src/include/gnunet_datastore_plugin.h
@@ -162,7 +162,7 @@ typedef int (*PluginPut) (void *cls,
162 uint32_t anonymity, 162 uint32_t anonymity,
163 uint32_t replication, 163 uint32_t replication,
164 struct GNUNET_TIME_Absolute expiration, 164 struct GNUNET_TIME_Absolute expiration,
165 char **msg); 165 char **msg);
166 166
167 167
168/** 168/**
@@ -187,26 +187,25 @@ typedef int (*PluginPut) (void *cls,
187 * @param iter_cls closure for iter 187 * @param iter_cls closure for iter
188 */ 188 */
189typedef void (*PluginGet) (void *cls, 189typedef void (*PluginGet) (void *cls,
190 const GNUNET_HashCode * key, 190 const GNUNET_HashCode *key,
191 const GNUNET_HashCode * vhash, 191 const GNUNET_HashCode *vhash,
192 enum GNUNET_BLOCK_Type type, 192 enum GNUNET_BLOCK_Type type,
193 PluginIterator iter, void *iter_cls); 193 PluginIterator iter, void *iter_cls);
194 194
195 195
196 196
197/** 197/**
198 * Get a random item for replication. Returns a single, 198 * Get a random item (additional constraints may apply depending on
199 * not expired, random item 199 * the specific implementation). Calls 'iter' with all values ZERO or
200 * from those with the highest replication counters. The item's 200 * NULL if no item applies, otherwise 'iter' is called once and only
201 * replication counter is decremented by one IF it was positive before. 201 * once with an item, with the 'next_cls' argument being NULL.
202 * Call 'iter' with all values ZERO or NULL if the datastore is empty.
203 * 202 *
204 * @param cls closure 203 * @param cls closure
205 * @param iter function to call the value (once only). 204 * @param iter function to call the value (once only).
206 * @param iter_cls closure for iter 205 * @param iter_cls closure for iter
207 */ 206 */
208typedef void (*PluginReplicationGet) (void *cls, 207typedef void (*PluginRandomGet) (void *cls,
209 PluginIterator iter, void *iter_cls); 208 PluginIterator iter, void *iter_cls);
210 209
211 210
212/** 211/**
@@ -234,13 +233,16 @@ typedef void (*PluginReplicationGet) (void *cls,
234 */ 233 */
235typedef int (*PluginUpdate) (void *cls, 234typedef int (*PluginUpdate) (void *cls,
236 uint64_t uid, 235 uint64_t uid,
237 int delta, struct GNUNET_TIME_Absolute expire, 236 int delta,
237 struct GNUNET_TIME_Absolute expire,
238 char **msg); 238 char **msg);
239 239
240 240
241/** 241/**
242 * Select a subset of the items in the datastore and call 242 * Select a subset of the items in the datastore and call the given
243 * the given iterator for each of them. 243 * iterator for the first item; then allow getting more items by
244 * calling the 'next_request' callback with the given 'next_cls'
245 * argument passed to 'iter'.
244 * 246 *
245 * @param cls closure 247 * @param cls closure
246 * @param type entries of which type should be considered? 248 * @param type entries of which type should be considered?
@@ -258,6 +260,7 @@ typedef void (*PluginSelector) (void *cls,
258 PluginIterator iter, 260 PluginIterator iter,
259 void *iter_cls); 261 void *iter_cls);
260 262
263
261/** 264/**
262 * Drop database. 265 * Drop database.
263 * 266 *
@@ -307,9 +310,18 @@ struct GNUNET_DATASTORE_PluginFunctions
307 310
308 /** 311 /**
309 * Function to get a random item with high replication score from 312 * Function to get a random item with high replication score from
310 * the database, lowering the item's replication score. 313 * the database, lowering the item's replication score. Returns a
314 * single, not expired, random item from those with the highest
315 * replication counters. The item's replication counter is
316 * decremented by one IF it was positive before.
317 */
318 PluginRandomGet replication_get;
319
320 /**
321 * Function to get a random expired item or, if none are expired, one
322 * with a low priority.
311 */ 323 */
312 PluginReplicationGet replication_get; 324 PluginRandomGet expiration_get;
313 325
314 /** 326 /**
315 * Update the priority for a particular key in the datastore. If 327 * Update the priority for a particular key in the datastore. If
@@ -322,31 +334,11 @@ struct GNUNET_DATASTORE_PluginFunctions
322 PluginUpdate update; 334 PluginUpdate update;
323 335
324 /** 336 /**
325 * Iterate over the items in the datastore in ascending 337 * Iterate over content with anonymity level zero.
326 * order of priority.
327 */
328 PluginSelector iter_low_priority;
329
330 /**
331 * Iterate over content with anonymity zero.
332 */ 338 */
333 PluginSelector iter_zero_anonymity; 339 PluginSelector iter_zero_anonymity;
334 340
335 /** 341 /**
336 * Iterate over the items in the datastore in ascending order of
337 * expiration time.
338 */
339 PluginSelector iter_ascending_expiration;
340
341 /**
342 * Iterate over the items in the datastore in migration
343 * order. Call the given function on the next item only
344 * (and then signal 'end' with a second call). This is
345 * a significant difference from all the other iterators!
346 */
347 PluginSelector iter_migration_order;
348
349 /**
350 * Iterate over all the items in the datastore 342 * Iterate over all the items in the datastore
351 * as fast as possible in a single transaction 343 * as fast as possible in a single transaction
352 * (can lock datastore while this happens, focus 344 * (can lock datastore while this happens, focus