tracker r1639 - in branches/indexer-split: . src/trackerd



Author: mr
Date: Wed Jun 11 15:12:51 2008
New Revision: 1639
URL: http://svn.gnome.org/viewvc/tracker?rev=1639&view=rev

Log:
	* src/trackerd/tracker-crawler.c: Make sure we set the ignored
	file types each time the TrackerConfig object is set for the
	TrackerCrawler. This fixes the warning about TrackConfig not
	existing for tracker_config_get_no_index_file_types().

	* src/trackerd/tracker-main.c: Removed the initial sleep from the
	daemon, this is only meant for the indexer which implements the
	feature and this also means that we don't respond to dbus events
	in that interval.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/trackerd/tracker-crawler.c
   branches/indexer-split/src/trackerd/tracker-main.c

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	Wed Jun 11 15:12:51 2008
@@ -46,7 +46,7 @@
 	GAsyncQueue    *files;
 	guint           files_queue_handle_id;
 
-	GSList         *ignored_patterns;
+	GSList         *ignored_file_types;
 
 	GHashTable     *ignored_names;
 	GHashTable     *temp_black_list;
@@ -75,6 +75,8 @@
 					    const GValue   *value,
 					    GParamSpec     *pspec);
 
+static void set_ignored_file_types         (TrackerCrawler *crawler);
+
 #ifdef HAVE_HAL
 static void mount_point_added_cb           (TrackerHal     *hal,
 					    const gchar    *mount_point,
@@ -127,7 +129,6 @@
 {
 	TrackerCrawlerPriv *priv;
 	GPtrArray          *ptr_array;
-	GSList             *ignored_file_types;
 
 	object->priv = GET_PRIV (object);
 
@@ -136,22 +137,6 @@
 	/* Create async queue for handling file pushes to the indexer */
 	priv->files = g_async_queue_new ();
 
-	/* File types as configured to ignore, using pattern matching */
-	ignored_file_types = tracker_config_get_no_index_file_types (priv->config);
-
-	if (ignored_file_types) {
-		GPatternSpec *spec;
-		GSList       *patterns = NULL;
-		GSList       *l;
-		
-		for (l = ignored_file_types; l; l = l->next) {
-			spec = g_pattern_spec_new (l->data);
-			patterns = g_slist_prepend (patterns, spec);
-		}
-                
-		priv->ignored_patterns = g_slist_reverse (patterns);
-	}
-
 	/* Whole file names to ignore */
 	priv->ignored_names = g_hash_table_new (g_str_hash, g_str_equal);
 	g_hash_table_insert (priv->ignored_names, "po", NULL);
@@ -220,10 +205,10 @@
 	g_hash_table_unref (priv->temp_black_list); 
 	g_hash_table_unref (priv->ignored_names); 
 
-	g_slist_foreach (priv->ignored_patterns, 
+	g_slist_foreach (priv->ignored_file_types, 
 			 (GFunc) g_pattern_spec_free,
 			 NULL);
-	g_slist_free (priv->ignored_patterns);
+	g_slist_free (priv->ignored_file_types);
 
 	if (priv->files_queue_handle_id) {
 		g_source_remove (priv->files_queue_handle_id);	
@@ -293,7 +278,7 @@
 
 void
 tracker_crawler_set_config (TrackerCrawler *object,
-			    TrackerConfig *config)
+			    TrackerConfig  *config)
 {
 	TrackerCrawlerPriv *priv;
 
@@ -312,6 +297,9 @@
 
 	priv->config = config;
 
+	/* The ignored file types depend on the config */
+	set_ignored_file_types (object);
+
 	g_object_notify (G_OBJECT (object), "config");
 }
 
@@ -358,6 +346,36 @@
 /*
  * Functions
  */
+static void
+set_ignored_file_types (TrackerCrawler *crawler)
+{
+	TrackerCrawlerPriv *priv;
+	GPatternSpec       *spec;
+	GSList             *ignored_file_types;
+	GSList             *patterns = NULL;
+	GSList             *l;
+
+	priv = crawler->priv;
+
+	g_slist_foreach (priv->ignored_file_types, 
+			 (GFunc) g_pattern_spec_free,
+			 NULL);
+	g_slist_free (priv->ignored_file_types);
+
+	if (!priv->config) {
+		return;
+	}
+
+	/* File types as configured to ignore, using pattern matching */
+	ignored_file_types = tracker_config_get_no_index_file_types (priv->config);
+	
+	for (l = ignored_file_types; l; l = l->next) {
+		spec = g_pattern_spec_new (l->data);
+		patterns = g_slist_prepend (patterns, spec);
+	}
+        
+	priv->ignored_file_types = g_slist_reverse (patterns);
+}
 
 #ifdef HAVE_HAL
 
@@ -484,7 +502,7 @@
 	}
 
 	/* Test ignore types */
-	for (l = crawler->priv->ignored_patterns; l; l = l->next) {
+	for (l = crawler->priv->ignored_file_types; l; l = l->next) {
 		if (g_pattern_match_string (l->data, basename)) {
 			goto done;
 		}

Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-main.c	Wed Jun 11 15:12:51 2008
@@ -139,7 +139,6 @@
 static gboolean       low_memory;
 static gint           throttle = -1;
 static gint           verbosity = -1;
-static gint           initial_sleep = -1; 
 
 static GOptionEntry   entries[] = {
 	{ "exclude-dir", 'e', 0, 
@@ -173,10 +172,6 @@
 	  G_OPTION_ARG_NONE, &low_memory, 
 	  N_("Minimizes the use of memory but may slow indexing down"), 
 	  NULL },
-	{ "initial-sleep", 's', 0, 
-	  G_OPTION_ARG_INT, &initial_sleep, 
-	  N_("Initial sleep time, just before indexing, in seconds"), 
-	  NULL },
 	{ "language", 'l', 0, 
 	  G_OPTION_ARG_STRING, &language, 
 	  N_("Language to use for stemmer and stop words list "
@@ -791,10 +786,6 @@
 		tracker_config_set_verbosity (tracker->config, verbosity);
 	}
 
-	if (initial_sleep > -1) {
-		tracker_config_set_initial_sleep (tracker->config, initial_sleep);
-	}
-
 	/* Initialise other subsystems */
 	tracker_log_init (log_filename, tracker_config_get_verbosity (tracker->config));
 	g_print ("Starting log:\n  File:'%s'\n", log_filename);
@@ -843,37 +834,16 @@
 		return EXIT_FAILURE;
 	}
 
-	if (!tracker->readonly) {
-		tracker_process_files_init (tracker);
+	g_message ("Waiting for DBus requests...");
 
+	if (!tracker->readonly) {
 		if (tracker_config_get_enable_indexing (tracker->config)) {
-			gint initial_sleep;
-
-			initial_sleep = tracker_config_get_initial_sleep (tracker->config);
-			g_message ("Indexing enabled, sleeping for %d secs before starting...", 
-				   initial_sleep);
-			
-			while (initial_sleep > 0) {
-				g_usleep (G_USEC_PER_SEC);
-				
-				initial_sleep --;
-				
-				if (!tracker->is_running) {
-					break;
-				}
-			}
-			
 			/* Get files first */
 			tracker_crawler_start (tracker->crawler);
 
 			if (tracker->is_running) {
 				DBusGProxy *proxy;
 
-#if 0
-				g_message ("Indexing enabled, starting...");
-				tracker_dbus_indexer_start ();
-#endif
-
 				proxy = tracker_dbus_indexer_get_proxy ();
 				tracker_xesam_subscribe_indexer_updated (proxy);
 			}
@@ -882,8 +852,6 @@
 		}
 	}
 
-	g_message ("Waiting for DBus requests...");
-	
 	if (tracker->is_running) {
 		main_loop = g_main_loop_new (NULL, FALSE);
 		g_main_loop_run (main_loop);



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