From 480dc321e78214299ed9eb6718e833752a90082c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 17 Jan 2011 14:14:33 +0000 Subject: [PATCH] adding lifetime limits on migration content --- TODO | 5 ----- contrib/defaults.conf | 3 +++ src/fs/fs_test_lib.c | 6 ++++-- src/fs/gnunet-service-fs.c | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index ba98e6d9e..83ee0b839 100644 --- a/TODO +++ b/TODO @@ -15,11 +15,6 @@ + insert + download + search - - exclude content that will "soon" expire from migration - - make migration data rate & datastore IO-rate configurable - - exclude certain peers as targets (based on hash values) in each - iteration => same peer can only be picked every n-th iteration - for the same content => fewer duplicate sending! * GNUNET-GTK: [CG] - figure out where in the GUI we should show active upload operations and allow aborts - handle events: diff --git a/contrib/defaults.conf b/contrib/defaults.conf index 9b083ac3b..621230c73 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf @@ -286,6 +286,9 @@ UNIXPATH = /tmp/gnunet-service-fs.sock # DISABLE_SOCKET_FORWARDING = NO # DEBUG = YES MAX_PENDING_REQUESTS = 65536 +# Maximum frequency we're allowed to poll the datastore +# for content for migration (can be used to reduce +# GNUnet's disk-IO rate) MIN_MIGRATION_DELAY = 1000 EXPECTED_NEIGHBOUR_COUNT = 128 diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index f24a11e82..e63c5d596 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c @@ -33,6 +33,8 @@ #define CONNECT_ATTEMPTS 4 +#define CONTENT_LIFETIME GNUNET_TIME_UNIT_HOURS + /** * Handle for a daemon started for testing FS. */ @@ -673,7 +675,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon, do_index, anonymity, 42 /* priority */, - GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS)); + GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME)); } else { @@ -687,7 +689,7 @@ GNUNET_FS_TEST_publish (struct GNUNET_FS_TestDaemon *daemon, do_index, anonymity, 42 /* priority */, - GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS)); + GNUNET_TIME_relative_to_absolute (CONTENT_LIFETIME)); } daemon->publish_context = GNUNET_FS_publish_start (daemon->fs, fi, diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index c8271ed8e..deaa04289 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -91,6 +91,15 @@ */ #define MAX_DHT_PUT_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) +/** + * How long must content remain valid for us to consider it for migration? + * If content will expire too soon, there is clearly no point in pushing + * it to other peers. This value gives the threshold for migration. Note + * that if this value is increased, the migration testcase may need to be + * adjusted as well (especially the CONTENT_LIFETIME in fs_test_lib.c). + */ +#define MIN_MIGRATION_CONTENT_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) + /** * Inverse of the probability that we will submit the same query * to the same peer again. If the same peer already got the query @@ -1283,6 +1292,13 @@ process_migration_content (void *cls, consider_migration_gathering (); return; } + if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value < + MIN_MIGRATION_CONTENT_LIFETIME.rel_value) + { + /* content will expire soon, don't bother */ + GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); + return; + } if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) { if (GNUNET_OK != -- 2.25.1