tracker r2078 - in branches/indexer-split: . data/modules src/libtracker-common src/trackerd



Author: mr
Date: Mon Aug 18 10:04:33 2008
New Revision: 2078
URL: http://svn.gnome.org/viewvc/tracker?rev=2078&view=rev

Log:
	* data/modules/files.module: Remove $HOME from the files module.
	It is not needed since it is in the user config already and it
	means users would have to change two places, IF they could change
	/usr/share at all anyway.

	* src/libtracker-common/tracker-utils.c: (tracker_throttle): If
	throttle is 0, don't return, always have a minimum of 5 for
	throttle added to whatever the config throttle value is. If we
	don't want to throttle, don't call the throttle function.

	* src/trackerd/tracker-crawler.c: (file_enumerate_children),
	(prune_none_existing_paths), (tracker_crawler_start):
	* src/trackerd/tracker-processor.c:
	(process_module_files_add_legacy_options):  Make sure that the
	legacy config option WatchDirectoryRoots ALSO crawls the file
	system, not just adds monitors. Plus check that we don't try to
	recurse non-existing paths when we start for paths NOT in the
	module config. Module config paths were already checked.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/data/modules/files.module
   branches/indexer-split/src/libtracker-common/tracker-utils.c
   branches/indexer-split/src/trackerd/tracker-crawler.c
   branches/indexer-split/src/trackerd/tracker-processor.c

Modified: branches/indexer-split/data/modules/files.module
==============================================================================
--- branches/indexer-split/data/modules/files.module	(original)
+++ branches/indexer-split/data/modules/files.module	Mon Aug 18 10:04:33 2008
@@ -4,7 +4,7 @@
 
 [Monitors]
 Directories=
-RecurseDirectories=$HOME;
+RecurseDirectories=
 
 [Ignored]
 Directories=po;CVS;.svn;.git

Modified: branches/indexer-split/src/libtracker-common/tracker-utils.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-utils.c	(original)
+++ branches/indexer-split/src/libtracker-common/tracker-utils.c	Mon Aug 18 10:04:33 2008
@@ -227,12 +227,11 @@
 
 	g_return_if_fail (TRACKER_IS_CONFIG (config));
 
-        throttle = tracker_config_get_throttle (config);
-
-        if (throttle < 1) {
-                return;
-        }
-
+	/* Get the throttle, add 5 (minimum value) so we don't do
+	 * nothing and then multiply it by the factor given
+	 */
+        throttle  = tracker_config_get_throttle (config);
+	throttle += 5;
         throttle *= multiplier;
 
         if (throttle > 0) {

Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c	Mon Aug 18 10:04:33 2008
@@ -673,6 +673,49 @@
 					 crawler);
 }
 
+static void
+prune_none_existing_paths (TrackerCrawler *crawler)
+{
+	TrackerCrawlerPrivate *priv;
+
+	priv = crawler->private;
+
+	if (priv->recurse_paths) {
+		GSList   *new_list;
+		GSList   *l;
+		GFile    *file;
+		gchar    *path;
+		gboolean  exists;
+
+		new_list = NULL;
+
+		/* Check the currently set recurse paths are real */
+		for (l = priv->recurse_paths; l; l = l->next) {
+			path = l->data;
+			
+			/* Check location exists before we do anything */
+			file = g_file_new_for_path (path);
+			exists = g_file_query_exists (file, NULL);
+			
+			if (exists) {
+				g_message ("  Directory:'%s' added to list to crawl (recursively)",
+					   path);
+				new_list = g_slist_prepend (new_list, g_strdup (path));
+			} else {
+				g_message ("  Directory:'%s' does not exist",
+					   path);
+			}
+
+			g_object_unref (file);
+		}
+		
+		new_list = g_slist_reverse (new_list);
+		g_slist_foreach (priv->recurse_paths, (GFunc) g_free, NULL);
+		g_slist_free (priv->recurse_paths);
+		priv->recurse_paths = new_list;
+	}
+}
+
 gboolean
 tracker_crawler_start (TrackerCrawler *crawler)
 {
@@ -693,6 +736,8 @@
 	g_message ("Crawling directories for module:'%s'",
 		   crawler->private->module_name);
 
+	prune_none_existing_paths (crawler);
+
 	if (priv->use_module_paths) {
 		recurse_directories =
 			tracker_module_config_get_monitor_recurse_directories (priv->module_name);

Modified: branches/indexer-split/src/trackerd/tracker-processor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-processor.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-processor.c	Mon Aug 18 10:04:33 2008
@@ -729,18 +729,23 @@
 process_module_files_add_legacy_options (TrackerProcessor *processor) 
 {
 	TrackerCrawler *crawler;
-	GSList         *roots;
+	GSList         *watch_roots;
+	GSList         *crawl_roots;
 	GSList         *l;
 	const gchar    *module_name = "files";
 
 	crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
 
+	watch_roots = tracker_config_get_watch_directory_roots (processor->private->config);
+	crawl_roots = tracker_config_get_crawl_directory_roots (processor->private->config);
+
 	/* This module get special treatment to make sure legacy
 	 * options are supported.
 	 */
+
+	/* Add monitors, from WatchDirectoryRoots config key */
 	g_message ("  User monitors being added:");
-	roots = tracker_config_get_watch_directory_roots (processor->private->config);
-	for (l = roots; l; l = l->next) {
+	for (l = watch_roots; l; l = l->next) {
 		GFile *file;
 		
 		g_message ("    %s", (gchar*) l->data);
@@ -750,19 +755,29 @@
 		g_object_unref (file);
 	}
 
-	if (g_slist_length (roots) == 0) {
+	if (g_slist_length (watch_roots) == 0) {
 		g_message ("    NONE");
 	}
 	
+	/* Add crawls, from WatchDirectoryRoots and
+	 * CrawlDirectoryRoots config keys. 
+	 */
 	g_message ("  User crawls being added:");
-	roots = tracker_config_get_crawl_directory_roots (processor->private->config);
-	for (l = roots; l; l = l->next) {
+
+	for (l = watch_roots; l; l = l->next) {
+		g_message ("    %s", (gchar*) l->data);
+		
+		tracker_crawler_add_path (crawler, l->data);		
+	}
+
+	for (l = crawl_roots; l; l = l->next) {
 		g_message ("    %s", (gchar*) l->data);
 		
 		tracker_crawler_add_path (crawler, l->data);		
 	}
 
-	if (g_slist_length (roots) == 0) {
+	if (g_slist_length (watch_roots) == 0 && 
+	    g_slist_length (crawl_roots) == 0) {
 		g_message ("    NONE");
 	}
 }



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