[tracker/experiment-miner-extractor-ipc] Experimental



commit bad860a971eb44287db6337986c1b428867f9e7a
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Feb 23 15:12:20 2011 +0100

    Experimental

 src/libtracker-miner/tracker-miner-fs.c    |   24 +++++++++++++++++++++
 src/libtracker-miner/tracker-miner-fs.h    |    3 ++
 src/miners/fs/tracker-main.c               |    8 +++---
 src/miners/fs/tracker-miner-applications.c |    1 -
 src/miners/fs/tracker-miner-files.c        |   32 ++++++++++++++-------------
 src/miners/fs/tracker-miner-files.h        |    1 -
 6 files changed, 48 insertions(+), 21 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index aca9f7b..42319d7 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2655,6 +2655,8 @@ item_queue_handlers_cb (gpointer user_data)
 		tracker_processing_pool_buffer_flush (fs->private->processing_pool,
 		                                      "Queue handlers WAIT");
 
+		tracker_miner_fs_flush_wait (fs);
+
 		return FALSE;
 	}
 
@@ -2759,6 +2761,8 @@ item_queue_handlers_cb (gpointer user_data)
 		tracker_processing_pool_buffer_flush (fs->private->processing_pool,
 		                                      "Queue handlers NONE");
 
+		tracker_miner_fs_flush_wait (fs);
+
 		tracker_thumbnailer_send ();
 		/* No more files left to process */
 		keep_processing = FALSE;
@@ -4183,6 +4187,26 @@ check_file_parents (TrackerMinerFS *fs,
 }
 
 /**
+ * tracker_miner_fs_flush_wait:
+ * @fs: a #TrackerMinerFS
+ *
+ * Flushes the items that are queued and that we are waiting on
+ *
+ * Since: 0.10.1
+ **/
+void
+tracker_miner_fs_flush_wait (TrackerMinerFS *fs)
+{
+	void (*m_flush) (TrackerMinerFS *fs);
+
+	m_flush = TRACKER_MINER_FS_GET_CLASS (fs)->flush_wait;
+
+	if (m_flush) {
+		m_flush (fs);
+	}
+}
+
+/**
  * tracker_miner_fs_check_file:
  * @fs: a #TrackerMinerFS
  * @file: #GFile for the file to check
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index aa0803e..f840fa9 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -104,6 +104,8 @@ typedef struct {
 	                                       GFile                *file,
 	                                       TrackerSparqlBuilder *builder,
 	                                       GCancellable         *cancellable);
+	void     (* flush_wait)               (TrackerMinerFS       *fs);
+
 } TrackerMinerFSClass;
 
 GType                 tracker_miner_fs_get_type             (void) G_GNUC_CONST;
@@ -133,6 +135,7 @@ G_CONST_RETURN gchar *tracker_miner_fs_get_parent_urn       (TrackerMinerFS *fs,
 gchar                *tracker_miner_fs_query_urn            (TrackerMinerFS *fs,
                                                              GFile          *file);
 void                  tracker_miner_fs_force_recheck        (TrackerMinerFS *fs);
+void                  tracker_miner_fs_flush_wait           (TrackerMinerFS *fs);
 
 void                  tracker_miner_fs_set_mtime_checking   (TrackerMinerFS *fs,
                                                              gboolean        check_mtimes);
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 18a70e5..f0e07f8 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -667,7 +667,7 @@ main (gint argc, gchar *argv[])
 	}
 
 	/* Create miner for applications */
-	miner_applications = tracker_miner_applications_new (&error);
+/*	miner_applications = tracker_miner_applications_new (&error);
 	if (!miner_applications) {
 		g_critical ("Couldn't create new Applications miner: '%s'",
 		            error ? error->message : "unknown error");
@@ -681,11 +681,11 @@ main (gint argc, gchar *argv[])
 	tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner_applications), do_mtime_checking);
 	g_signal_connect (miner_applications, "finished",
 	                  G_CALLBACK (miner_finished_cb),
-	                  NULL);
+	                  NULL);*/
 
 	/* Setup miners, applications first in list */
 	miners = g_slist_prepend (miners, miner_files);
-	miners = g_slist_prepend (miners, miner_applications);
+	//miners = g_slist_prepend (miners, miner_applications);
 
 	tracker_thumbnailer_init ();
 
@@ -703,7 +703,7 @@ main (gint argc, gchar *argv[])
 	 * 3. At least one of the miners is PAUSED.
 	 */
 	if (!tracker_miner_fs_has_items_to_process (TRACKER_MINER_FS (miner_files)) &&
-	    !tracker_miner_is_paused (miner_applications) &&
+//	    !tracker_miner_is_paused (miner_applications) &&
 	    !tracker_miner_is_paused (miner_files)) {
 		tracker_db_manager_set_need_mtime_check (FALSE);
 	}
diff --git a/src/miners/fs/tracker-miner-applications.c b/src/miners/fs/tracker-miner-applications.c
index e3e015e..96f9a8e 100644
--- a/src/miners/fs/tracker-miner-applications.c
+++ b/src/miners/fs/tracker-miner-applications.c
@@ -57,7 +57,6 @@ static gboolean miner_applications_monitor_directory       (TrackerMinerFS
                                                             GFile                *file);
 static void     miner_applications_finalize                (GObject              *object);
 
-
 static GQuark miner_applications_error_quark = 0;
 
 typedef struct ProcessApplicationData ProcessApplicationData;
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 5fbb4e4..56ccf39 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -255,6 +255,8 @@ static void        miner_files_add_removable_or_optical_directory (TrackerMinerF
                                                                    const gchar       *mount_path,
                                                                    const gchar       *uuid);
 
+static void        miner_files_flush_wait                         (TrackerMinerFS *miner);
+
 static GInitableIface* miner_files_initable_parent_iface;
 
 G_DEFINE_TYPE_WITH_CODE (TrackerMinerFiles, tracker_miner_files, TRACKER_TYPE_MINER_FS,
@@ -279,6 +281,7 @@ tracker_miner_files_class_init (TrackerMinerFilesClass *klass)
 	miner_fs_class->process_file_attributes = miner_files_process_file_attributes;
 	miner_fs_class->ignore_next_update_file = miner_files_ignore_next_update_file;
 	miner_fs_class->finished = miner_files_finished;
+	miner_fs_class->flush_wait = miner_files_flush_wait;
 
 	g_object_class_install_property (object_class,
 	                                 PROP_CONFIG,
@@ -2352,8 +2355,10 @@ flush_extract_queue_shared (TrackerMinerFiles *miner)
 	GPtrArray *queue = miner->private->extract_queue;
 	GDBusConnection *connection = miner->private->connection;
 
-	/* TODO: turn this loop into a single array request */
-	//g_warning ("\n\n\n%d items\n\n\n", queue->len);
+	if (!queue || queue->len == 0) {
+		return;
+	}
+
 	for (i = 0; i < queue->len; i++) {
 		ExtractQueueItem *item = g_ptr_array_index (queue, i);
 
@@ -2383,10 +2388,10 @@ flush_extract_queue_destroy (gpointer user_data)
 	g_object_unref (miner);
 }
 
-void
-tracker_miner_files_flush_extract_queue (TrackerMinerFiles *miner)
+static void
+miner_files_flush_wait (TrackerMinerFS *miner)
 {
-	flush_extract_queue_shared (miner);
+	flush_extract_queue_shared (TRACKER_MINER_FILES (miner));
 }
 
 static void
@@ -2413,19 +2418,16 @@ get_metadata_fast_queue_async (TrackerMinerFiles *miner,
 	g_ptr_array_add (miner->private->extract_queue, item);
 
 	if (miner->private->extract_queue->len > 5) {
-//		flush_extract_queue_shared (miner);
+		flush_extract_queue_shared (miner);
 	} else {
-//		if (!miner->private->extract_queue_id) {
-//			/* Automatic flush each second */
-//			miner->private->extract_queue_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 10,
-//			                                                               flush_extract_queue_idle,
-//			                                                               g_object_ref (miner),
-//			                                                               flush_extract_queue_destroy);
+		if (!miner->private->extract_queue_id) {
+			/* Automatic flush each second */
+			miner->private->extract_queue_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 10,
+			                                                               flush_extract_queue_idle,
+			                                                               g_object_ref (miner),
+			                                                               flush_extract_queue_destroy);
 		}
 	}
-
-	// fake one here
-	//tracker_miner_fs_file_notify (miner, user_data->file, NULL);
 }
 
 static void
diff --git a/src/miners/fs/tracker-miner-files.h b/src/miners/fs/tracker-miner-files.h
index 280f7fb..da95384 100644
--- a/src/miners/fs/tracker-miner-files.h
+++ b/src/miners/fs/tracker-miner-files.h
@@ -66,7 +66,6 @@ gboolean      tracker_miner_files_check_directory_contents (GFile             *p
 gboolean      tracker_miner_files_monitor_directory        (GFile             *file,
                                                             gboolean           enable_monitors,
                                                             GSList            *directories_to_check);
-void          tracker_miner_files_flush_extract_queue      (TrackerMinerFiles *miner);
 
 G_END_DECLS
 



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