adding lifetime limits on migration content
authorChristian Grothoff <christian@grothoff.org>
Mon, 17 Jan 2011 14:14:33 +0000 (14:14 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 17 Jan 2011 14:14:33 +0000 (14:14 +0000)
TODO
contrib/defaults.conf
src/fs/fs_test_lib.c
src/fs/gnunet-service-fs.c

diff --git a/TODO b/TODO
index ba98e6d9e563aa4ad34bf19e87f1ac602541eef7..83ee0b839564379c7d49e45acac2f694bf2391c0 100644 (file)
--- a/TODO
+++ b/TODO
     + 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:
index 9b083ac3bce95b8495be1ec2e02022e5be2bcc5b..621230c73b8aa0375f9a06ce355a432500ecb488 100644 (file)
@@ -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
 
index f24a11e822122bbc95744678859178d7e058f5fa..e63c5d596f454e8c58aa4706734a6a1e0c756e65 100644 (file)
@@ -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,
index c8271ed8efc3d64e4e5fad91ead4ee3541ff3a03..deaa042892772f921bae4ce8112571c2fdc47736 100644 (file)
  */
 #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 !=