gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1826 - in GNUnet/src: applications/fs/fsui applications/fs


From: grothoff
Subject: [GNUnet-SVN] r1826 - in GNUnet/src: applications/fs/fsui applications/fs/module applications/fs/tools applications/sqstore_sqlite include
Date: Sun, 21 Aug 2005 15:21:25 -0700 (PDT)

Author: grothoff
Date: 2005-08-21 15:21:22 -0700 (Sun, 21 Aug 2005)
New Revision: 1826

Modified:
   GNUnet/src/applications/fs/fsui/upload.c
   GNUnet/src/applications/fs/module/ondemand.c
   GNUnet/src/applications/fs/tools/gnunet-insert.c
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
   GNUnet/src/include/gnunet_fsui_lib.h
Log:
changing default LE policy for directory contents

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2005-08-21 22:06:35 UTC (rev 
1825)
+++ GNUnet/src/applications/fs/fsui/upload.c    2005-08-21 22:21:22 UTC (rev 
1826)
@@ -30,6 +30,8 @@
 #include "gnunet_fsui_lib.h"
 #include "fsui.h"
 
+#define DEBUG_UPLOAD NO
+
 /**
  * Data used to keep track of the files in the
  * current directory.
@@ -60,6 +62,7 @@
   FSUI_Context * ctx;
   cron_t start_time;
   DirTrack * dir;
+  int individualKeywords;
 } UploadThreadClosure;
 
 /**
@@ -276,18 +279,20 @@
         0);
   }
   if (ret == OK) {
-    ECRS_addToMetaData(meta,
-                      EXTRACTOR_FILENAME,
-                      filename);
-    keywordUri = ECRS_metaDataToUri(meta);
-    if (keywordUri != NULL) {
-      ECRS_addToKeyspace(keywordUri,
-                        utc->anonymityLevel,
-                        utc->priority,
-                        utc->expiration,
-                        uri,
-                        meta); 
-      ECRS_freeUri(keywordUri);
+    if (utc->individualKeywords) {
+      ECRS_addToMetaData(meta,
+                        EXTRACTOR_FILENAME,
+                        filename);
+      keywordUri = ECRS_metaDataToUri(meta);
+      if (keywordUri != NULL) {
+       ECRS_addToKeyspace(keywordUri,
+                          utc->anonymityLevel,
+                          utc->priority,
+                          utc->expiration,
+                          uri,
+                          meta);       
+       ECRS_freeUri(keywordUri);
+      }
     }
     if (utc->globalUri != NULL)
       ECRS_addToKeyspace(utc->globalUri,
@@ -295,7 +300,7 @@
                         utc->priority,
                         utc->expiration,
                         uri,
-                        meta); 
+                        meta);     
     if (utc->dir != NULL) {
       GROW(utc->dir->fis,
           utc->dir->fiCount,
@@ -421,8 +426,10 @@
                         EXTRACTOR_FILENAME,
                         inboundFN);
     }
+#if DEBUG_UPLOAD
     LOG(LOG_DEBUG,
        "Adding URI to keyspace.\n");
+#endif
     keywordUri = ECRS_metaDataToUri(utc->meta);
     if (keywordUri != NULL) {
       ECRS_addToKeyspace(keywordUri,
@@ -518,6 +525,7 @@
   utc->uri = ECRS_dupUri(keyUri);
   utc->meta = ECRS_dupMetaData(md);
   utc->doIndex = doIndex;
+  utc->individualKeywords = NO;
   tl = MALLOC(sizeof(FSUI_ThreadList));
   utc->tl = tl;
   tl->isDone = NO;
@@ -556,6 +564,7 @@
                   const char * dirname,
                   unsigned int anonymityLevel,
                   int doIndex,
+                  int individualKeywords,
                   const struct ECRS_MetaData * directoryMetaData,
                   const struct ECRS_URI * globalURI,
                   const struct ECRS_URI * topURI) {
@@ -564,6 +573,7 @@
   char * config;
 
   utc = MALLOC(sizeof(UploadThreadClosure));
+  utc->individualKeywords = individualKeywords;
   utc->ctx = ctx;
   utc->isRecursive = YES;
   utc->anonymityLevel = anonymityLevel;

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2005-08-21 22:06:35 UTC 
(rev 1825)
+++ GNUnet/src/applications/fs/module/ondemand.c        2005-08-21 22:21:22 UTC 
(rev 1826)
@@ -29,6 +29,8 @@
 #include "ecrs_core.h"
 #include "ondemand.h"
 
+#define DEBUG_ONDEMAND NO
+
 #define TRACK_INDEXED_FILES NO
 #define TRACKFILE "indexed_requests.txt"
 
@@ -190,10 +192,13 @@
   int ret;
   OnDemandBlock odb;
   HashCode512 key;
-  EncName enc;
   struct stat sbuf;
   char * fn;
+#if DEBUG_ONDEMAND
+  EncName enc;
+#endif
 
+
   if (size <= sizeof(DBlock)) {
     BREAK();
     return SYSERR;
@@ -209,9 +214,11 @@
     int fd;
 
     /* not sym-linked, write content to offset! */   
+#if DEBUG_ONDEMAND
     LOG(LOG_DEBUG,
        "Storing on-demand encoded data in `%s'.\n",
        fn);
+#endif
     fd = fileopen(fn,
 #ifdef O_LARGEFILE
                  O_LARGEFILE |
@@ -270,11 +277,13 @@
   }
 #endif
 
+#if DEBUG_ONDEMAND
   IFLOG(LOG_DEBUG,
        hash2enc(&key, &enc));
   LOG(LOG_DEBUG,
       "Storing on-demand content for query `%s'\n",
       &enc);
+#endif
 
   ret = datastore->get(&key,
                       ONDEMAND_BLOCK,
@@ -311,7 +320,9 @@
                        const Datastore_Value * dbv,
                        const HashCode512 * query) {
   struct adJ * job;
+#if DEBUG_ONDEMAND
   EncName enc;
+#endif
 
   job = MALLOC(sizeof(struct adJ));
   job->datastore = datastore;
@@ -320,11 +331,13 @@
   memcpy(job->dbv,
         dbv,
         ntohl(dbv->size));
+#if DEBUG_ONDEMAND
   hash2enc(query,
           &enc);
   LOG(LOG_DEBUG,
       _("Indexed file disappeared, deleting block for query `%s'\n"),
       &enc);
+#endif
   /* schedule for "immediate" execution */
   addCronJob((CronJob) &asyncDelJob,
             0, 
@@ -532,17 +545,21 @@
        (0 != memcmp(&value[1],
                    &comp[1],
                    ntohl(value->size) - sizeof(Datastore_Value))) ) {
+#if DEBUG_ONDEMAND
     LOG(LOG_DEBUG,
        "`%s' found value that does not match (%u, %u).\n",
        __FUNCTION__,
        ntohl(comp->size),
        ntohl(value->size));
+#endif
     return OK;
   }
   *comp = *value; /* make copy! */
+#if DEBUG_ONDEMAND
   LOG(LOG_DEBUG,
       "`%s' found value that matches.\n",
       __FUNCTION__);
+#endif
   return SYSERR;
 }
 
@@ -572,9 +589,11 @@
   char unavail_key[256];
 
   fn = getOnDemandFile(fileId);
+#if DEBUG_ONDEMAND
   LOG(LOG_DEBUG,
       "Removing on-demand encoded data stored in `%s'.\n",
       fn);
+#endif
   fd = fileopen(fn,
 #ifdef O_LARGEFILE
            O_RDONLY | O_LARGEFILE,

Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c    2005-08-21 22:06:35 UTC 
(rev 1825)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c    2005-08-21 22:21:22 UTC 
(rev 1826)
@@ -208,6 +208,8 @@
     { 'C', "copy", NULL,
       gettext_noop("even if gnunetd is running on the local machine, force the"
                   " creation of a copy instead of making a link to the GNUnet 
share directory") },
+    { 'd', "direct", NULL,
+      gettext_noop("use libextractor to add additional direct references to 
directory entries") },
     { 'e', "extract", NULL,
       gettext_noop("print list of extracted keywords that would be used, but 
do not perform upload") },
     HELP_HELP,
@@ -275,6 +277,7 @@
       LONG_DEFAULT_OPTIONS,
       { "anonymity",     1, 0, 'a' },
       { "copy",          0, 0, 'C' },
+      { "direct",        0, 0, 'd' },
       { "extract",       0, 0, 'e' },
       { "interval",      1, 0, 'i' },
       { "key",           1, 0, 'k' },
@@ -323,6 +326,11 @@
                                         "DISABLE-SYMLINKING",
                                         "YES"));
       break;
+    case 'd':
+      FREENONNULL(setConfigurationString("FS",
+                                        "DIRECT-KEYWORDS",
+                                        "YES"));
+      break;
     case 'e':
       printAndReturn = YES;
       break;
@@ -682,6 +690,9 @@
                         getConfigurationInt("FS",
                                             "ANONYMITY-SEND"),
                         doIndex,
+                        testConfigurationString("FS",
+                                                "DIRECT-KEYWORDS",
+                                                "YES"),
                         meta,
                         gloURI,
                         topURI);

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2005-08-21 22:06:35 UTC 
(rev 1825)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2005-08-21 22:21:22 UTC 
(rev 1826)
@@ -909,9 +909,9 @@
   sqlite3_exec(dbh->dbf, "CREATE INDEX idx_expire ON gn070 (expire)",
               NULL, NULL, NULL);
   sqlite3_exec(dbh->dbf, "CREATE INDEX idx_comb1 ON gn070 (prio,expire,hash)",
-         NULL, NULL, NULL);
+              NULL, NULL, NULL);
   sqlite3_exec(dbh->dbf, "CREATE INDEX idx_comb2 ON gn070 (expire,prio,hash)",
-         NULL, NULL, NULL);
+              NULL, NULL, NULL);
 
   if ( (sq_prepare("SELECT COUNT(*) FROM gn070 WHERE hash=?",
                   &dbh->countContent) != SQLITE_OK) ||

Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h        2005-08-21 22:06:35 UTC (rev 
1825)
+++ GNUnet/src/include/gnunet_fsui_lib.h        2005-08-21 22:21:22 UTC (rev 
1826)
@@ -580,6 +580,7 @@
                   const char * dirname,
                   unsigned int anonymityLevel,
                   int doIndex,
+                  int individualKeywords,
                   const struct ECRS_MetaData * directoryMetaData,
                   const struct ECRS_URI * globalURI,
                   const struct ECRS_URI * topURI); /* upload.c */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]