aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_datastore_plugin.h
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amat.us>2017-04-16 20:46:21 -0500
committerDavid Barksdale <amatus@amat.us>2017-04-16 20:49:27 -0500
commita58d36b8da7afa42410bac54f57d5f3b6b6c4391 (patch)
tree87b00f07dda6a5c28a9d65ef9c05044cab2336fd /src/include/gnunet_datastore_plugin.h
parent4907330f51ffd48af1f7bac6f43c7c7f78c37818 (diff)
downloadgnunet-a58d36b8da7afa42410bac54f57d5f3b6b6c4391.tar.gz
gnunet-a58d36b8da7afa42410bac54f57d5f3b6b6c4391.zip
[datastore] Create remove plugin API call
The only use of vhash in the get_key call was for removing, split that out into its own function. This simplifies the get_key call and removes the need for some indexes, speeding up insertion into the database.
Diffstat (limited to 'src/include/gnunet_datastore_plugin.h')
-rw-r--r--src/include/gnunet_datastore_plugin.h47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h
index 28c8241b1..36a3fbec2 100644
--- a/src/include/gnunet_datastore_plugin.h
+++ b/src/include/gnunet_datastore_plugin.h
@@ -212,11 +212,6 @@ typedef void
212 * @param next_uid return the result with lowest uid >= next_uid 212 * @param next_uid return the result with lowest uid >= next_uid
213 * @param random if true, return a random result instead of using next_uid 213 * @param random if true, return a random result instead of using next_uid
214 * @param key maybe NULL (to match all entries) 214 * @param key maybe NULL (to match all entries)
215 * @param vhash hash of the value, maybe NULL (to
216 * match all values that have the right key).
217 * Note that for DBlocks there is no difference
218 * betwen key and vhash, but for other blocks
219 * there may be!
220 * @param type entries of which type are relevant? 215 * @param type entries of which type are relevant?
221 * Use 0 for any type. 216 * Use 0 for any type.
222 * @param proc function to call on the matching value; 217 * @param proc function to call on the matching value;
@@ -228,13 +223,49 @@ typedef void
228 uint64_t next_uid, 223 uint64_t next_uid,
229 bool random, 224 bool random,
230 const struct GNUNET_HashCode *key, 225 const struct GNUNET_HashCode *key,
231 const struct GNUNET_HashCode *vhash,
232 enum GNUNET_BLOCK_Type type, 226 enum GNUNET_BLOCK_Type type,
233 PluginDatumProcessor proc, 227 PluginDatumProcessor proc,
234 void *proc_cls); 228 void *proc_cls);
235 229
236 230
237/** 231/**
232 * Remove continuation.
233 *
234 * @param cls closure
235 * @param key key for the content removed
236 * @param size number of bytes removed
237 * @param status #GNUNET_OK if removed, #GNUNET_NO if not found,
238 * or #GNUNET_SYSERROR if error
239 * @param msg error message on error
240 */
241typedef void
242(*PluginRemoveCont) (void *cls,
243 const struct GNUNET_HashCode *key,
244 uint32_t size,
245 int status,
246 const char *msg);
247
248
249/**
250 * Remove a particular key in the datastore.
251 *
252 * @param cls closure
253 * @param key key for the content
254 * @param size number of bytes in data
255 * @param data content stored
256 * @param cont continuation called with success or failure status
257 * @param cont_cls continuation closure for @a cont
258 */
259typedef void
260(*PluginRemoveKey) (void *cls,
261 const struct GNUNET_HashCode *key,
262 uint32_t size,
263 const void *data,
264 PluginRemoveCont cont,
265 void *cont_cls);
266
267
268/**
238 * Get a random item (additional constraints may apply depending on 269 * Get a random item (additional constraints may apply depending on
239 * the specific implementation). Calls @a proc with all values ZERO or 270 * the specific implementation). Calls @a proc with all values ZERO or
240 * NULL if no item applies, otherwise @a proc is called once and only 271 * NULL if no item applies, otherwise @a proc is called once and only
@@ -339,6 +370,10 @@ struct GNUNET_DATASTORE_PluginFunctions
339 */ 370 */
340 PluginGetKeys get_keys; 371 PluginGetKeys get_keys;
341 372
373 /**
374 * Function to remove an item from the database.
375 */
376 PluginRemoveKey remove_key;
342}; 377};
343 378
344#endif 379#endif