aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-03 13:47:56 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-03 13:47:56 +0000
commit8c23a185ee8d3c16c5552668dced851f82986041 (patch)
tree83f59d2190ffadcdc5643ba36578b2c6766b0e42 /src/datastore
parent1888cd7da7ae5e2c32faf66d3bef47ac7d225b35 (diff)
downloadgnunet-8c23a185ee8d3c16c5552668dced851f82986041.tar.gz
gnunet-8c23a185ee8d3c16c5552668dced851f82986041.zip
changing datastore API to support replication level --- not fully implemented --- and adding GNUNET_FS_BlockOptions struct to replace prio/anonymity/expiration+replication args
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/datastore_api.c20
-rw-r--r--src/datastore/perf_datastore_api.c12
-rw-r--r--src/datastore/test_datastore_api.c5
-rw-r--r--src/datastore/test_datastore_api_management.c3
4 files changed, 25 insertions, 15 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index cf6a2cc8e..344a70842 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -792,6 +792,7 @@ process_status_message (void *cls,
792 * @param type type of the content 792 * @param type type of the content
793 * @param priority priority of the content 793 * @param priority priority of the content
794 * @param anonymity anonymity-level for the content 794 * @param anonymity anonymity-level for the content
795 * @param replication how often should the content be replicated to other peers?
795 * @param expiration expiration time for the content 796 * @param expiration expiration time for the content
796 * @param queue_priority ranking of this request in the priority queue 797 * @param queue_priority ranking of this request in the priority queue
797 * @param max_queue_size at what queue size should this request be dropped 798 * @param max_queue_size at what queue size should this request be dropped
@@ -812,6 +813,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
812 enum GNUNET_BLOCK_Type type, 813 enum GNUNET_BLOCK_Type type,
813 uint32_t priority, 814 uint32_t priority,
814 uint32_t anonymity, 815 uint32_t anonymity,
816 uint32_t replication,
815 struct GNUNET_TIME_Absolute expiration, 817 struct GNUNET_TIME_Absolute expiration,
816 unsigned int queue_priority, 818 unsigned int queue_priority,
817 unsigned int max_queue_size, 819 unsigned int max_queue_size,
@@ -1274,7 +1276,11 @@ process_result_message (void *cls,
1274 1276
1275 1277
1276/** 1278/**
1277 * Get a random value from the datastore. 1279 * Get a random value from the datastore for content replication.
1280 * Returns a single, random value among those with the highest
1281 * replication score, lowering positive replication scores by one for
1282 * the chosen value (if only content with a replication score exists,
1283 * a random value is returned and replication scores are not changed).
1278 * 1284 *
1279 * @param h handle to the datastore 1285 * @param h handle to the datastore
1280 * @param queue_priority ranking of this request in the priority queue 1286 * @param queue_priority ranking of this request in the priority queue
@@ -1290,12 +1296,12 @@ process_result_message (void *cls,
1290 * (or rather, will already have been invoked) 1296 * (or rather, will already have been invoked)
1291 */ 1297 */
1292struct GNUNET_DATASTORE_QueueEntry * 1298struct GNUNET_DATASTORE_QueueEntry *
1293GNUNET_DATASTORE_get_random (struct GNUNET_DATASTORE_Handle *h, 1299GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h,
1294 unsigned int queue_priority, 1300 unsigned int queue_priority,
1295 unsigned int max_queue_size, 1301 unsigned int max_queue_size,
1296 struct GNUNET_TIME_Relative timeout, 1302 struct GNUNET_TIME_Relative timeout,
1297 GNUNET_DATASTORE_Iterator iter, 1303 GNUNET_DATASTORE_Iterator iter,
1298 void *iter_cls) 1304 void *iter_cls)
1299{ 1305{
1300 struct GNUNET_DATASTORE_QueueEntry *qe; 1306 struct GNUNET_DATASTORE_QueueEntry *qe;
1301 struct GNUNET_MessageHeader *m; 1307 struct GNUNET_MessageHeader *m;
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index de9a8b236..00d91b4c7 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -269,7 +269,7 @@ run_continuation (void *cls,
269 data, 269 data,
270 i+1, 270 i+1,
271 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100), 271 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100),
272 i, 272 i, 0,
273 GNUNET_TIME_relative_to_absolute 273 GNUNET_TIME_relative_to_absolute
274 (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 274 (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
275 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), 275 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000))),
@@ -279,10 +279,10 @@ run_continuation (void *cls,
279 break; 279 break;
280 case RP_CUT: 280 case RP_CUT:
281 /* trim down below MAX_SIZE again */ 281 /* trim down below MAX_SIZE again */
282 GNUNET_DATASTORE_get_random (datastore, 282 GNUNET_DATASTORE_get_for_replication (datastore,
283 1, 1, TIMEOUT, 283 1, 1, TIMEOUT,
284 &delete_value, 284 &delete_value,
285 crc); 285 crc);
286 break; 286 break;
287 case RP_REPORT: 287 case RP_REPORT:
288 printf ( 288 printf (
@@ -355,7 +355,7 @@ run (void *cls,
355 GNUNET_DATASTORE_put (datastore, 0, 355 GNUNET_DATASTORE_put (datastore, 0,
356 &zkey, 4, "TEST", 356 &zkey, 4, "TEST",
357 GNUNET_BLOCK_TYPE_TEST, 357 GNUNET_BLOCK_TYPE_TEST,
358 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS), 358 0, 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
359 0, 1, GNUNET_TIME_UNIT_MINUTES, 359 0, 1, GNUNET_TIME_UNIT_MINUTES,
360 &run_tests, crc)) 360 &run_tests, crc))
361 { 361 {
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index d8e4b7b34..965f05687 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -402,6 +402,7 @@ run_continuation (void *cls,
402 get_type (crc->i), 402 get_type (crc->i),
403 get_priority (crc->i), 403 get_priority (crc->i),
404 get_anonymity (crc->i), 404 get_anonymity (crc->i),
405 0,
405 get_expiration (crc->i), 406 get_expiration (crc->i),
406 1, 1, TIMEOUT, 407 1, 1, TIMEOUT,
407 &check_success, 408 &check_success,
@@ -502,6 +503,7 @@ run_continuation (void *cls,
502 get_type (42), 503 get_type (42),
503 get_priority (42), 504 get_priority (42),
504 get_anonymity (42), 505 get_anonymity (42),
506 0,
505 get_expiration (42), 507 get_expiration (42),
506 1, 1, TIMEOUT, 508 1, 1, TIMEOUT,
507 &check_success, 509 &check_success,
@@ -517,6 +519,7 @@ run_continuation (void *cls,
517 get_type (42), 519 get_type (42),
518 get_priority (43), 520 get_priority (43),
519 get_anonymity (43), 521 get_anonymity (43),
522 0,
520 get_expiration (43), 523 get_expiration (43),
521 1, 1, TIMEOUT, 524 1, 1, TIMEOUT,
522 &check_success, 525 &check_success,
@@ -613,7 +616,7 @@ run (void *cls,
613 GNUNET_DATASTORE_put (datastore, 0, 616 GNUNET_DATASTORE_put (datastore, 0,
614 &zkey, 4, "TEST", 617 &zkey, 4, "TEST",
615 GNUNET_BLOCK_TYPE_TEST, 618 GNUNET_BLOCK_TYPE_TEST,
616 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS), 619 0, 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
617 0, 1, GNUNET_TIME_UNIT_MINUTES, 620 0, 1, GNUNET_TIME_UNIT_MINUTES,
618 &run_tests, crc)) 621 &run_tests, crc))
619 { 622 {
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index 2873caa02..50a426af6 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -231,6 +231,7 @@ run_continuation (void *cls,
231 get_type (crc->i), 231 get_type (crc->i),
232 get_priority (crc->i), 232 get_priority (crc->i),
233 get_anonymity (crc->i), 233 get_anonymity (crc->i),
234 0,
234 get_expiration (crc->i), 235 get_expiration (crc->i),
235 1, 1, TIMEOUT, 236 1, 1, TIMEOUT,
236 &check_success, 237 &check_success,
@@ -327,7 +328,7 @@ run (void *cls,
327 GNUNET_DATASTORE_put (datastore, 0, 328 GNUNET_DATASTORE_put (datastore, 0,
328 &zkey, 4, "TEST", 329 &zkey, 4, "TEST",
329 GNUNET_BLOCK_TYPE_TEST, 330 GNUNET_BLOCK_TYPE_TEST,
330 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS), 331 0, 0, 0, GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS),
331 0, 1, GNUNET_TIME_UNIT_MINUTES, 332 0, 1, GNUNET_TIME_UNIT_MINUTES,
332 &run_tests, crc)) 333 &run_tests, crc))
333 { 334 {