unindex on failure, location URI support
authorChristian Grothoff <christian@grothoff.org>
Sat, 10 Jul 2010 14:30:47 +0000 (14:30 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 10 Jul 2010 14:30:47 +0000 (14:30 +0000)
TODO
src/fs/fs_download.c
src/fs/fs_publish.c
src/fs/gnunet-service-fs.c

diff --git a/TODO b/TODO
index 1188de845a6cf94d7a8c6d5fef3418a566b25bbc..bd22ce3b62b0d4047656ae9710b0b2b253bec336 100644 (file)
--- a/TODO
+++ b/TODO
   - implement performance tests
 * FS: [CG]
   - trust: do not charge when "idle" / load considerations (migration, routing)
-  - unindex on index failure
   - listing of learned namespaces
   - artificial delays
   - active reply route caching design & implementation of service; gap extension!
   - utilize in-line files in meta data always (including in search results or
     when download is triggered manually and for probes); currently the data is
     only used when users do a general 'recursive' download
-  - location URIs (publish, search, download)
   - non-anonymous FS service (needs DHT)
     + DHT integration for search
     + CS-DHT-functions (DHT-put of LOC)
index 53bad312697178afa9ee1ef449b5f07156a12106..f1897e65f815eeaaa7666d4a596163cba2a021a7 100644 (file)
@@ -23,7 +23,6 @@
  * @author Christian Grothoff
  *
  * TODO:
- * - location URI suppport (can wait, easy)
  * - different priority for scheduling probe downloads?
  * - check if iblocks can be computed from existing blocks (can wait, hard)
  */
index bd5a9ebd6e574f16b98e928c65b766ebcd9a45f0..a195383456e001c687ca6615f2696ec4136b2e1b 100644 (file)
  * @see http://gnunet.org/encoding
  * @author Krista Bennett
  * @author Christian Grothoff
- *
- * TODO:
- * - indexing cleanup: unindex on failure (can wait)
- * - datastore reservation support (optimization)
- * - location URIs (publish with anonymity-level zero)
  */
 
 #include "platform.h"
@@ -172,6 +167,15 @@ ds_put_cont (void *cls,
       pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL;
       pi.value.publish.specifics.error.message = pcc->p->emsg;
       pcc->p->client_info = GNUNET_FS_publish_make_status_ (&pi, pcc->sc, pcc->p, 0);
+      if ( (pcc->p->is_directory == GNUNET_NO) &&
+          (pcc->p->filename != NULL) &&
+          (pcc->p->data.do_index == GNUNET_YES) )
+       {
+         /* run unindex to clean up */
+         GNUNET_FS_unindex_start (pcc->sc->h,
+                                  pcc->p->filename,
+                                  NULL);
+       }          
     }
   if (NULL != pcc->cont)
     pcc->sc->upload_task 
@@ -226,6 +230,16 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p,
   pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL;
   pi.value.publish.specifics.error.message =emsg;
   p->client_info = GNUNET_FS_publish_make_status_ (&pi, sc, p, 0);
+  if ( (p->is_directory == GNUNET_NO) &&
+       (p->filename != NULL) &&
+       (p->data.do_index == GNUNET_YES) )
+    {
+      /* run unindex to clean up */
+      GNUNET_FS_unindex_start (pc->h,
+                              p->filename,
+                              NULL);
+    }     
+  
 }
 
 
@@ -883,6 +897,7 @@ GNUNET_FS_publish_main_ (void *cls,
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_ProgressInfo pi;
   struct GNUNET_FS_FileInformation *p;
+  struct GNUNET_FS_Uri *loc;
   char *fn;
 
   pc->upload_task = GNUNET_SCHEDULER_NO_TASK;  
@@ -954,6 +969,15 @@ GNUNET_FS_publish_main_ (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "File upload complete, now publishing KSK blocks.\n");
 #endif
+      if (0 == p->anonymity)
+       {
+         /* zero anonymity, box CHK URI in LOC URI */
+         loc = GNUNET_FS_uri_loc_create (p->chk_uri,
+                                         pc->h->cfg,
+                                         p->expirationTime);
+         GNUNET_FS_uri_destroy (p->chk_uri);
+         p->chk_uri = loc;
+       }
       GNUNET_FS_publish_sync_ (pc);
       /* upload of "p" complete, publish KBlocks! */
       if (p->keywords != NULL)
index b3f14896bcdb20c414328066d62f6ab7ba295b5b..2157ff5f5e40174e5d84621c980094f5cb3deed3 100644 (file)
@@ -2213,6 +2213,9 @@ target_peer_select_cb (void *cls,
   /* 3e) include peer proximity */
   score -= (2.0 * (GNUNET_CRYPTO_hash_distance_u32 (key,
                                                    &pr->query)) / (double) UINT32_MAX);
+  /* 4) super-bonus for being the known target */
+  if (pr->target_pid == cp->pid)
+    score += 100.0;
   /* store best-fit in closure */
 #if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,