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



commit 4cc5682ad5c0401c68e98273252f242ddee267e1
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 64117a1..66754fd 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -4446,21 +4446,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;
@@ -4486,7 +4489,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);
 	}
@@ -4495,21 +4498,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;
@@ -4532,13 +4559,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]