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



Author: mr
Date: Wed Jul 23 11:52:30 2008
New Revision: 1913
URL: http://svn.gnome.org/viewvc/tracker?rev=1913&view=rev

Log:
	* src/trackerd/tracker-crawler.c:
	* src/trackerd/tracker-monitor.c: Code clean ups.

	* src/trackerd/tracker-processor.c: Improved efficiency of the get
	queue function we use in each timeout to send files to the indexer.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/trackerd/tracker-crawler.c
   branches/indexer-split/src/trackerd/tracker-monitor.c
   branches/indexer-split/src/trackerd/tracker-processor.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 Jul 23 11:52:30 2008
@@ -96,11 +96,11 @@
 	GFile          *parent;
 } EnumeratorData;
 
-static void crawler_finalize        (GObject         *object);
-static void file_enumerate_next     (GFileEnumerator *enumerator,
-				     EnumeratorData  *ed);
-static void file_enumerate_children (TrackerCrawler  *crawler,
-				     GFile           *file);
+static void tracker_crawler_finalize (GObject         *object);
+static void file_enumerate_next      (GFileEnumerator *enumerator,
+				      EnumeratorData  *ed);
+static void file_enumerate_children  (TrackerCrawler  *crawler,
+				      GFile           *file);
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
@@ -113,7 +113,7 @@
 
 	object_class = G_OBJECT_CLASS (klass);
 
-	object_class->finalize = crawler_finalize;
+	object_class->finalize = tracker_crawler_finalize;
 
 	signals[PROCESSING_DIRECTORY] =
 		g_signal_new ("processing-directory",
@@ -169,7 +169,7 @@
 }
 
 static void
-crawler_finalize (GObject *object)
+tracker_crawler_finalize (GObject *object)
 {
 	TrackerCrawlerPrivate *priv;
 

Modified: branches/indexer-split/src/trackerd/tracker-monitor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-monitor.c	(original)
+++ branches/indexer-split/src/trackerd/tracker-monitor.c	Wed Jul 23 11:52:30 2008
@@ -475,7 +475,6 @@
 						 NULL,
 						 &error);
 
-	
 	if (error) {
 		g_warning ("Could not add monitor for path:'%s', %s", 
 			   path, 

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	Wed Jul 23 11:52:30 2008
@@ -291,37 +291,30 @@
 }
 
 static GQueue *
-get_next_queue_with_data (GHashTable  *hash_table,
-			  gchar      **module_name_p)
+get_next_queue_with_data (GList       *modules,
+			  GHashTable  *hash_table,
+			  gchar      **module_name)
 {
+	GQueue *found_queue;
 	GQueue *queue;
-	GList  *all_modules, *l;
-	gchar  *module_name;
+	GList  *l;
 
-	if (module_name_p) {
-		*module_name_p = NULL;
+	if (module_name) {
+		*module_name = NULL;
 	}
 
-	all_modules = g_hash_table_get_keys (hash_table);
-	
-	for (l = all_modules, queue = NULL; l && !queue; l = l->next) {
-		module_name = l->data;
-		queue = g_hash_table_lookup (hash_table, module_name);
+	for (l = modules, found_queue = NULL; l && !found_queue; l = l->next) {
+		queue = g_hash_table_lookup (hash_table, l->data);
 
 		if (g_queue_get_length (queue) > 0) {
-			if (module_name_p) {
-				*module_name_p = module_name;
+			if (module_name) {
+				*module_name = l->data;
+				found_queue = queue;
 			}
-
-			continue;
 		}
-
-		queue = NULL;
 	}
 	
-	g_list_free (all_modules);
-
-	return queue;
+	return found_queue;
 }
 
 static void
@@ -419,9 +412,11 @@
 	}
 
 	/* Process the deleted items first */
-	queue = get_next_queue_with_data (priv->items_deleted_queues, &module_name);
+	queue = get_next_queue_with_data (priv->modules,
+					  priv->items_deleted_queues, 
+					  &module_name);
 
-	if (queue && g_queue_get_length (queue) > 0) {
+	if (queue) {
 		files = tracker_dbus_queue_gfile_to_strv (queue, ITEMS_QUEUE_PROCESS_MAX);
 		
 		g_message ("Queue for module:'%s' deleted items processed, sending first %d to the indexer", 
@@ -442,9 +437,11 @@
 	}
 
 	/* Process the created items first */
-	queue = get_next_queue_with_data (priv->items_created_queues, &module_name);
+	queue = get_next_queue_with_data (priv->modules,
+					  priv->items_created_queues, 
+					  &module_name);
 
-	if (queue && g_queue_get_length (queue) > 0) {
+	if (queue) {
 		files = tracker_dbus_queue_gfile_to_strv (queue, ITEMS_QUEUE_PROCESS_MAX);
 		
 		g_message ("Queue for module:'%s' created items processed, sending first %d to the indexer", 
@@ -465,9 +462,11 @@
 	}
 
 	/* Process the updated items first */
-	queue = get_next_queue_with_data (priv->items_updated_queues, &module_name);
+	queue = get_next_queue_with_data (priv->modules,
+					  priv->items_updated_queues, 
+					  &module_name);
 
-	if (queue && g_queue_get_length (queue) > 0) {
+	if (queue) {
 		files = tracker_dbus_queue_gfile_to_strv (queue, ITEMS_QUEUE_PROCESS_MAX);
 		
 		g_message ("Queue for module:'%s' updated items processed, sending first %d to the indexer", 



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