[tracker/wip/miner-priority-queues: 10/19] tracker-miner-fs: Add tracker_miner_fs_check_*_with_priority()



commit 218879476bf87677076336fa2e92520b3fc4ccf7
Author: Carlos Garnacho <carlos lanedo com>
Date:   Mon Jul 4 15:31:11 2011 +0200

    tracker-miner-fs: Add tracker_miner_fs_check_*_with_priority()
    
    These functions allow scheduling tasks at a different priority.

 src/libtracker-miner/tracker-miner-fs.c |   79 +++++++++++++++++++++++++------
 src/libtracker-miner/tracker-miner-fs.h |    8 +++
 2 files changed, 72 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index e7e698a..c6f5991 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -4479,21 +4479,24 @@ check_file_parents (TrackerMinerFS *fs,
 }
 
 /**
- * tracker_miner_fs_check_file:
+ * tracker_miner_fs_check_file_with_priority:
  * @fs: a #TrackerMinerFS
  * @file: #GFile for the file to check
+ * @priority: the priority of the check task
  * @check_parents: whether to check parents and eligibility or not
  *
- * Tells the filesystem miner to check and index a file,
- * this file must be part of the usual crawling directories
- * of #TrackerMinerFS. See tracker_miner_fs_directory_add().
+ * Tells the filesystem miner to check and index a file at
+ * a given priority, this file must be part of the usual
+ * crawling directories of #TrackerMinerFS. See
+ * tracker_miner_fs_directory_add().
  *
  * Since: 0.10
  **/
 void
-tracker_miner_fs_check_file (TrackerMinerFS *fs,
-                             GFile          *file,
-                             gboolean        check_parents)
+tracker_miner_fs_check_file_with_priority (TrackerMinerFS *fs,
+                                           GFile          *file,
+                                           gint            priority,
+                                           gboolean        check_parents)
 {
 	gboolean should_process = TRUE;
 	gchar *path;
@@ -4519,7 +4522,7 @@ tracker_miner_fs_check_file (TrackerMinerFS *fs,
 		trace_eq_push_tail ("UPDATED", file, "Requested by application");
 		tracker_priority_queue_add (fs->priv->items_updated,
 		                            g_object_ref (file),
-		                            G_PRIORITY_DEFAULT);
+		                            priority);
 
 		item_queue_handlers_set_up (fs);
 	}
@@ -4528,21 +4531,45 @@ tracker_miner_fs_check_file (TrackerMinerFS *fs,
 }
 
 /**
- * tracker_miner_fs_check_directory:
+ * tracker_miner_fs_check_file:
  * @fs: a #TrackerMinerFS
- * @file: #GFile for the directory to check
+ * @file: #GFile for the file to check
  * @check_parents: whether to check parents and eligibility or not
  *
- * Tells the filesystem miner to check and index a directory,
+ * Tells the filesystem miner to check and index a file,
  * this file must be part of the usual crawling directories
  * of #TrackerMinerFS. See tracker_miner_fs_directory_add().
  *
  * Since: 0.10
  **/
 void
-tracker_miner_fs_check_directory (TrackerMinerFS *fs,
-                                  GFile          *file,
-                                  gboolean        check_parents)
+tracker_miner_fs_check_file (TrackerMinerFS *fs,
+                             GFile          *file,
+                             gboolean        check_parents)
+{
+	tracker_miner_fs_check_file_with_priority (fs, file,
+	                                           G_PRIORITY_DEFAULT,
+	                                           check_parents);
+}
+
+/**
+ * tracker_miner_fs_check_directory_with_priority:
+ * @fs: a #TrackerMinerFS
+ * @file: #GFile for the directory to check
+ * @priority: the priority of the check task
+ * @check_parents: whether to check parents and eligibility or not
+ *
+ * Tells the filesystem miner to check and index a directory at
+ * a given priority, this file must be part of the usual crawling
+ * directories of #TrackerMinerFS. See tracker_miner_fs_directory_add().
+ *
+ * Since: 0.10
+ **/
+void
+tracker_miner_fs_check_directory_with_priority (TrackerMinerFS *fs,
+                                                GFile          *file,
+                                                gint            priority,
+                                                gboolean        check_parents)
 {
 	gboolean should_process = TRUE;
 	gchar *path;
@@ -4565,13 +4592,35 @@ tracker_miner_fs_check_directory (TrackerMinerFS *fs,
 			return;
 		}
 
-		tracker_miner_fs_directory_add_internal (fs, file, G_PRIORITY_DEFAULT);
+		tracker_miner_fs_directory_add_internal (fs, file, priority);
 	}
 
 	g_free (path);
 }
 
 /**
+ * tracker_miner_fs_check_directory:
+ * @fs: a #TrackerMinerFS
+ * @file: #GFile for the directory to check
+ * @check_parents: whether to check parents and eligibility or not
+ *
+ * Tells the filesystem miner to check and index a directory,
+ * this file must be part of the usual crawling directories
+ * of #TrackerMinerFS. See tracker_miner_fs_directory_add().
+ *
+ * Since: 0.10
+ **/
+void
+tracker_miner_fs_check_directory (TrackerMinerFS *fs,
+                                  GFile          *file,
+                                  gboolean        check_parents)
+{
+	tracker_miner_fs_check_directory_with_priority (fs, file,
+	                                                G_PRIORITY_DEFAULT,
+	                                                check_parents);
+}
+
+/**
  * tracker_miner_fs_file_notify:
  * @fs: a #TrackerMinerFS
  * @file: a #GFile
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index f5f1b7c..90db0a0 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -114,6 +114,14 @@ gboolean              tracker_miner_fs_directory_remove     (TrackerMinerFS *fs,
                                                              GFile          *file);
 gboolean              tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs,
                                                               GFile          *file);
+void                  tracker_miner_fs_check_file_with_priority (TrackerMinerFS *fs,
+                                                                 GFile          *file,
+                                                                 gint            priority,
+                                                                 gboolean        check_parents);
+void                  tracker_miner_fs_check_directory_with_priority (TrackerMinerFS *fs,
+                                                                      GFile          *file,
+	                                                              gint            priority,
+                                                                      gboolean        check_parents);
 void                  tracker_miner_fs_check_file           (TrackerMinerFS *fs,
                                                              GFile          *file,
                                                              gboolean        check_parents);



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