aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/test_datastore_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-24 20:17:39 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-24 20:17:39 +0000
commit3140154d46212e08e0d73ed891a66213a6813075 (patch)
tree018a55a3899207664b388fcf47a679ca54ca6fbf /src/datastore/test_datastore_api.c
parentd5fd881c2a044474b54ddf03b6ab8be8d2b75927 (diff)
downloadgnunet-3140154d46212e08e0d73ed891a66213a6813075.tar.gz
gnunet-3140154d46212e08e0d73ed891a66213a6813075.zip
refactoring datastore API to use MQ API, also fixing misc. bugs in new mysql backend
Diffstat (limited to 'src/datastore/test_datastore_api.c')
-rw-r--r--src/datastore/test_datastore_api.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 7d4565de6..6ebfee01e 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -412,7 +412,7 @@ run_continuation (void *cls)
412 GNUNET_DATASTORE_put (datastore, 0, &crc->key, get_size (crc->i), 412 GNUNET_DATASTORE_put (datastore, 0, &crc->key, get_size (crc->i),
413 get_data (crc->i), get_type (crc->i), 413 get_data (crc->i), get_type (crc->i),
414 get_priority (crc->i), get_anonymity (crc->i), 0, 414 get_priority (crc->i), get_anonymity (crc->i), 0,
415 get_expiration (crc->i), 1, 1, TIMEOUT, 415 get_expiration (crc->i), 1, 1,
416 &check_success, crc); 416 &check_success, crc);
417 crc->i++; 417 crc->i++;
418 if (crc->i == ITERATIONS) 418 if (crc->i == ITERATIONS)
@@ -423,10 +423,17 @@ run_continuation (void *cls)
423 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 423 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
424 "Executing GET number %u\n", 424 "Executing GET number %u\n",
425 crc->i); 425 crc->i);
426 GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); 426 GNUNET_CRYPTO_hash (&crc->i,
427 GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key, 427 sizeof (int),
428 get_type (crc->i), 1, 1, TIMEOUT, 428 &crc->key);
429 &check_value, crc); 429 GNUNET_DATASTORE_get_key (datastore,
430 crc->offset,
431 &crc->key,
432 get_type (crc->i),
433 1,
434 1,
435 &check_value,
436 crc);
430 break; 437 break;
431 case RP_DEL: 438 case RP_DEL:
432 crc->i--; 439 crc->i--;
@@ -436,9 +443,14 @@ run_continuation (void *cls)
436 crc->data = NULL; 443 crc->data = NULL;
437 GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); 444 GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
438 GNUNET_assert (NULL != 445 GNUNET_assert (NULL !=
439 GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key, 446 GNUNET_DATASTORE_get_key (datastore,
440 get_type (crc->i), 1, 1, TIMEOUT, 447 crc->offset,
441 &delete_value, crc)); 448 &crc->key,
449 get_type (crc->i),
450 1,
451 1,
452 &delete_value,
453 crc));
442 break; 454 break;
443 case RP_DO_DEL: 455 case RP_DO_DEL:
444 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 456 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -455,7 +467,7 @@ run_continuation (void *cls)
455 } 467 }
456 GNUNET_assert (NULL != 468 GNUNET_assert (NULL !=
457 GNUNET_DATASTORE_remove (datastore, &crc->key, crc->size, 469 GNUNET_DATASTORE_remove (datastore, &crc->key, crc->size,
458 crc->data, 1, 1, TIMEOUT, 470 crc->data, 1, 1,
459 &check_success, crc)); 471 &check_success, crc));
460 break; 472 break;
461 case RP_DELVALIDATE: 473 case RP_DELVALIDATE:
@@ -466,7 +478,7 @@ run_continuation (void *cls)
466 GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key); 478 GNUNET_CRYPTO_hash (&crc->i, sizeof (int), &crc->key);
467 GNUNET_assert (NULL != 479 GNUNET_assert (NULL !=
468 GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key, 480 GNUNET_DATASTORE_get_key (datastore, crc->offset, &crc->key,
469 get_type (crc->i), 1, 1, TIMEOUT, 481 get_type (crc->i), 1, 1,
470 &check_nothing, crc)); 482 &check_nothing, crc));
471 break; 483 break;
472 case RP_RESERVE: 484 case RP_RESERVE:
@@ -479,7 +491,7 @@ run_continuation (void *cls)
479 GNUNET_DATASTORE_put (datastore, crc->rid, &crc->key, get_size (42), 491 GNUNET_DATASTORE_put (datastore, crc->rid, &crc->key, get_size (42),
480 get_data (42), get_type (42), get_priority (42), 492 get_data (42), get_type (42), get_priority (42),
481 get_anonymity (42), 0, get_expiration (42), 1, 1, 493 get_anonymity (42), 0, get_expiration (42), 1, 1,
482 TIMEOUT, &check_success, crc); 494 &check_success, crc);
483 break; 495 break;
484 case RP_PUT_MULTIPLE_NEXT: 496 case RP_PUT_MULTIPLE_NEXT:
485 crc->phase = RP_GET_MULTIPLE; 497 crc->phase = RP_GET_MULTIPLE;
@@ -493,7 +505,6 @@ run_continuation (void *cls)
493 0, 505 0,
494 get_expiration (43), 506 get_expiration (43),
495 1, 1, 507 1, 1,
496 TIMEOUT,
497 &check_success, crc); 508 &check_success, crc);
498 break; 509 break;
499 case RP_GET_MULTIPLE: 510 case RP_GET_MULTIPLE:
@@ -502,7 +513,6 @@ run_continuation (void *cls)
502 crc->offset, 513 crc->offset,
503 &crc->key, 514 &crc->key,
504 get_type (42), 1, 1, 515 get_type (42), 1, 1,
505 TIMEOUT,
506 &check_multiple, crc)); 516 &check_multiple, crc));
507 break; 517 break;
508 case RP_GET_MULTIPLE_NEXT: 518 case RP_GET_MULTIPLE_NEXT:
@@ -512,7 +522,6 @@ run_continuation (void *cls)
512 &crc->key, 522 &crc->key,
513 get_type (42), 523 get_type (42),
514 1, 1, 524 1, 1,
515 TIMEOUT,
516 &check_multiple, crc)); 525 &check_multiple, crc));
517 break; 526 break;
518 case RP_UPDATE: 527 case RP_UPDATE:
@@ -521,7 +530,7 @@ run_continuation (void *cls)
521 GNUNET_DATASTORE_update (datastore, 530 GNUNET_DATASTORE_update (datastore,
522 crc->uid, 100, 531 crc->uid, 100,
523 get_expiration (42), 1, 532 get_expiration (42), 1,
524 1, TIMEOUT, 533 1,
525 &check_success, crc); 534 &check_success, crc);
526 break; 535 break;
527 case RP_UPDATE_VALIDATE: 536 case RP_UPDATE_VALIDATE:
@@ -531,7 +540,6 @@ run_continuation (void *cls)
531 &crc->key, 540 &crc->key,
532 get_type (42), 541 get_type (42),
533 1, 1, 542 1, 1,
534 TIMEOUT,
535 &check_update, crc)); 543 &check_update, crc));
536 break; 544 break;
537 case RP_DONE: 545 case RP_DONE:
@@ -631,7 +639,6 @@ run (void *cls,
631 GNUNET_TIME_relative_to_absolute 639 GNUNET_TIME_relative_to_absolute
632 (GNUNET_TIME_UNIT_SECONDS), 640 (GNUNET_TIME_UNIT_SECONDS),
633 0, 1, 641 0, 1,
634 TIMEOUT,
635 &run_tests, crc)) 642 &run_tests, crc))
636 { 643 {
637 FPRINTF (stderr, 644 FPRINTF (stderr,