diff options
author | David Barksdale <amatus@amat.us> | 2017-04-16 12:39:43 -0500 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2017-04-16 12:42:34 -0500 |
commit | 4907330f51ffd48af1f7bac6f43c7c7f78c37818 (patch) | |
tree | a2cd65dbb24ea5caeda1fff2521f935dd7ea6256 /src/include/gnunet_datastore_plugin.h | |
parent | cacd64d8635201459e59bf2cd8a2ea8fd0699b84 (diff) | |
download | gnunet-4907330f51ffd48af1f7bac6f43c7c7f78c37818.tar.gz gnunet-4907330f51ffd48af1f7bac6f43c7c7f78c37818.zip |
[datastore] Combine put and update plugin APIs
This resolves issue #4965.
Diffstat (limited to 'src/include/gnunet_datastore_plugin.h')
-rw-r--r-- | src/include/gnunet_datastore_plugin.h | 75 |
1 files changed, 13 insertions, 62 deletions
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h index 516ba525c..28c8241b1 100644 --- a/src/include/gnunet_datastore_plugin.h +++ b/src/include/gnunet_datastore_plugin.h | |||
@@ -134,7 +134,8 @@ typedef void | |||
134 | * @param cls closure | 134 | * @param cls closure |
135 | * @param key key for the item stored | 135 | * @param key key for the item stored |
136 | * @param size size of the item stored | 136 | * @param size size of the item stored |
137 | * @param status #GNUNET_OK or #GNUNET_SYSERROR | 137 | * @param status #GNUNET_OK if inserted, #GNUNET_NO if updated, |
138 | * or #GNUNET_SYSERROR if error | ||
138 | * @param msg error message on error | 139 | * @param msg error message on error |
139 | */ | 140 | */ |
140 | typedef void | 141 | typedef void |
@@ -152,6 +153,7 @@ typedef void | |||
152 | * | 153 | * |
153 | * @param cls closure | 154 | * @param cls closure |
154 | * @param key key for the item | 155 | * @param key key for the item |
156 | * @param absent true if the key was not found in the bloom filter | ||
155 | * @param size number of bytes in @a data | 157 | * @param size number of bytes in @a data |
156 | * @param data content stored | 158 | * @param data content stored |
157 | * @param type type of the content | 159 | * @param type type of the content |
@@ -165,15 +167,16 @@ typedef void | |||
165 | typedef void | 167 | typedef void |
166 | (*PluginPut) (void *cls, | 168 | (*PluginPut) (void *cls, |
167 | const struct GNUNET_HashCode *key, | 169 | const struct GNUNET_HashCode *key, |
168 | uint32_t size, | 170 | bool absent, |
169 | const void *data, | 171 | uint32_t size, |
170 | enum GNUNET_BLOCK_Type type, | 172 | const void *data, |
171 | uint32_t priority, | 173 | enum GNUNET_BLOCK_Type type, |
172 | uint32_t anonymity, | 174 | uint32_t priority, |
173 | uint32_t replication, | 175 | uint32_t anonymity, |
174 | struct GNUNET_TIME_Absolute expiration, | 176 | uint32_t replication, |
175 | PluginPutCont cont, | 177 | struct GNUNET_TIME_Absolute expiration, |
176 | void *cont_cls); | 178 | PluginPutCont cont, |
179 | void *cont_cls); | ||
177 | 180 | ||
178 | 181 | ||
179 | /** | 182 | /** |
@@ -248,48 +251,6 @@ typedef void | |||
248 | 251 | ||
249 | 252 | ||
250 | /** | 253 | /** |
251 | * Update continuation. | ||
252 | * | ||
253 | * @param cls closure | ||
254 | * @param status #GNUNET_OK or #GNUNET_SYSERR | ||
255 | * @param msg error message on error | ||
256 | */ | ||
257 | typedef void | ||
258 | (*PluginUpdateCont) (void *cls, | ||
259 | int status, | ||
260 | const char *msg); | ||
261 | |||
262 | |||
263 | /** | ||
264 | * Update the priority, replication and expiration for a particular | ||
265 | * unique ID in the datastore. If the expiration time in value is | ||
266 | * different than the time found in the datastore, the higher value | ||
267 | * should be kept. The specified priority and replication is added | ||
268 | * to the existing value. | ||
269 | * | ||
270 | * @param cls closure | ||
271 | * @param uid unique identifier of the datum | ||
272 | * @param priority by how much should the priority | ||
273 | * change? | ||
274 | * @param replication by how much should the replication | ||
275 | * change? | ||
276 | * @param expire new expiration time should be the | ||
277 | * MAX of any existing expiration time and | ||
278 | * this value | ||
279 | * @param cont continuation called with success or failure status | ||
280 | * @param cons_cls continuation closure | ||
281 | */ | ||
282 | typedef void | ||
283 | (*PluginUpdate) (void *cls, | ||
284 | uint64_t uid, | ||
285 | uint32_t priority, | ||
286 | uint32_t replication, | ||
287 | struct GNUNET_TIME_Absolute expire, | ||
288 | PluginUpdateCont cont, | ||
289 | void *cont_cls); | ||
290 | |||
291 | |||
292 | /** | ||
293 | * Select a single item from the datastore (among those applicable). | 254 | * Select a single item from the datastore (among those applicable). |
294 | * | 255 | * |
295 | * @param cls closure | 256 | * @param cls closure |
@@ -342,16 +303,6 @@ struct GNUNET_DATASTORE_PluginFunctions | |||
342 | PluginPut put; | 303 | PluginPut put; |
343 | 304 | ||
344 | /** | 305 | /** |
345 | * Update the priority for a particular key in the datastore. If | ||
346 | * the expiration time in value is different than the time found in | ||
347 | * the datastore, the higher value should be kept. For the | ||
348 | * anonymity level, the lower value is to be used. The specified | ||
349 | * priority should be added to the existing priority, ignoring the | ||
350 | * priority in value. | ||
351 | */ | ||
352 | PluginUpdate update; | ||
353 | |||
354 | /** | ||
355 | * Get a particular datum matching a given hash from the datastore. | 306 | * Get a particular datum matching a given hash from the datastore. |
356 | */ | 307 | */ |
357 | PluginGetKey get_key; | 308 | PluginGetKey get_key; |