aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/test_plugin_datastore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datastore/test_plugin_datastore.c')
-rw-r--r--src/datastore/test_plugin_datastore.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index 0c34a5f66..d460daed7 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -52,6 +52,7 @@ enum RunPhase
52 RP_ITER_ZERO, 52 RP_ITER_ZERO,
53 RP_REPL_GET, 53 RP_REPL_GET,
54 RP_EXPI_GET, 54 RP_EXPI_GET,
55 RP_REMOVE,
55 RP_DROP 56 RP_DROP
56}; 57};
57 58
@@ -153,7 +154,7 @@ do_put (struct CpsRunContext *crc)
153 /* most content is 32k */ 154 /* most content is 32k */
154 size = 32 * 1024; 155 size = 32 * 1024;
155 156
156 if (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0) /* but some of it is less! */ 157 if (0 != i && GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0) /* but some of it is less! */
157 size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024); 158 size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024);
158 size = size - (size & 7); /* always multiple of 8 */ 159 size = size - (size & 7); /* always multiple of 8 */
159 160
@@ -220,6 +221,25 @@ iterate_one_shot (void *cls,
220} 221}
221 222
222 223
224static void
225remove_continuation (void *cls,
226 const struct GNUNET_HashCode *key,
227 uint32_t size,
228 int status,
229 const char *msg)
230{
231 struct CpsRunContext *crc = cls;
232
233 GNUNET_assert (NULL != key);
234 GNUNET_assert (32768 == size);
235 GNUNET_assert (GNUNET_OK == status);
236 GNUNET_assert (NULL == msg);
237 crc->phase++;
238 GNUNET_SCHEDULER_add_now (&test,
239 crc);
240}
241
242
223/** 243/**
224 * Function called when the service shuts 244 * Function called when the service shuts
225 * down. Unloads our datastore plugin. 245 * down. Unloads our datastore plugin.
@@ -303,7 +323,6 @@ test (void *cls)
303 0, 323 0,
304 false, 324 false,
305 &key, 325 &key,
306 NULL,
307 GNUNET_BLOCK_TYPE_ANY, 326 GNUNET_BLOCK_TYPE_ANY,
308 &iterate_one_shot, 327 &iterate_one_shot,
309 crc); 328 crc);
@@ -324,6 +343,23 @@ test (void *cls)
324 case RP_EXPI_GET: 343 case RP_EXPI_GET:
325 crc->api->get_expiration (crc->api->cls, &iterate_one_shot, crc); 344 crc->api->get_expiration (crc->api->cls, &iterate_one_shot, crc);
326 break; 345 break;
346 case RP_REMOVE:
347 {
348 struct GNUNET_HashCode key;
349 uint32_t size = 32768;
350 char value[size];
351
352 gen_key (0, &key);
353 memset (value, 0, size);
354 value[0] = crc->i;
355 crc->api->remove_key (crc->api->cls,
356 &key,
357 size,
358 value,
359 &remove_continuation,
360 crc);
361 break;
362 }
327 case RP_DROP: 363 case RP_DROP:
328 crc->api->drop (crc->api->cls); 364 crc->api->drop (crc->api->cls);
329 GNUNET_SCHEDULER_add_now (&cleaning_task, crc); 365 GNUNET_SCHEDULER_add_now (&cleaning_task, crc);