[tracker/no-mtime-checks-on-start: 2/11] libtracker-miner: Add APIs to the existing properties for mtime-checking
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/no-mtime-checks-on-start: 2/11] libtracker-miner: Add APIs to the existing properties for mtime-checking
- Date: Thu, 3 Feb 2011 14:20:59 +0000 (UTC)
commit 9c292d16eadfdabc63e0a267701b98c9d655d467
Author: Martyn Russell <martyn lanedo com>
Date: Tue Feb 1 14:26:14 2011 +0000
libtracker-miner: Add APIs to the existing properties for mtime-checking
Also add an API to know if there are items in our processing queues
waiting so we know if shutting down the miner object was done when we
were idle or not.
src/libtracker-miner/tracker-miner-fs.c | 73 +++++++++++++++++++++++++++++++
src/libtracker-miner/tracker-miner-fs.h | 5 ++
2 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 9e9dff5..8a6b604 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -4500,6 +4500,55 @@ tracker_miner_fs_force_recheck (TrackerMinerFS *fs)
crawl_directories_start (fs);
}
+/**
+ * tracker_miner_fs_set_mtime_checking:
+ * @fs: a #TrackerMinerFS
+ * @mtime_checking: a #gboolean
+ *
+ * Tells the miner-fs that during the crawling phase, directory mtime
+ * checks should or shouldn't be performed against the database to
+ * make sure we have the most up to date version of the file being
+ * checked at the time. Setting this to #FALSE can dramatically
+ * improve the start up the crawling of the @fs.
+ *
+ * The down side is that using this consistently means that some files
+ * on the disk may be out of date with files in the database.
+ *
+ * The main purpose of this function is for systems where a @fs is
+ * running the entire time and where it is very unlikely that a file
+ * could be changed outside between startup and shutdown of the
+ * process using this API.
+ *
+ * The default if not set directly is that @mtime_checking is #TRUE.
+ *
+ * Since: 0.10
+ **/
+void
+tracker_miner_fs_set_mtime_checking (TrackerMinerFS *fs,
+ gboolean mtime_checking)
+{
+ g_return_if_fail (TRACKER_IS_MINER_FS (fs));
+
+ fs->private->mtime_checking = mtime_checking;
+}
+
+/**
+ * tracker_miner_fs_get_mtime_checking:
+ * @fs: a #TrackerMinerFS
+ *
+ * Returns: #TRUE if mtime checks for directories against the database
+ * are done when @fs crawls the file system, otherwise #FALSE.
+ *
+ * Since: 0.10
+ **/
+gboolean
+tracker_miner_fs_get_mtime_checking (TrackerMinerFS *fs)
+{
+ g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), FALSE);
+
+ return fs->private->mtime_checking;
+}
+
void
tracker_miner_fs_set_initial_crawling (TrackerMinerFS *fs,
gboolean do_initial_crawling)
@@ -4518,6 +4567,30 @@ tracker_miner_fs_get_initial_crawling (TrackerMinerFS *fs)
}
/**
+ * tracker_miner_fs_has_items_to_process:
+ * @fs: a #TrackerMinerFS
+ *
+ * Returns: #TRUE if there are items to process in the internal
+ * queues, otherwise #FALSE.
+ *
+ * Since: 0.10
+ **/
+gboolean
+tracker_miner_fs_has_items_to_process (TrackerMinerFS *fs)
+{
+ g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), FALSE);
+
+ if (g_queue_get_length (fs->private->items_deleted) > 0 ||
+ g_queue_get_length (fs->private->items_created) > 0 ||
+ g_queue_get_length (fs->private->items_updated) > 0 ||
+ g_queue_get_length (fs->private->items_moved) > 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
* tracker_miner_fs_add_directory_without_parent:
* @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 2fb6415..aa0803e 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -134,10 +134,15 @@ gchar *tracker_miner_fs_query_urn (TrackerMinerFS *fs,
GFile *file);
void tracker_miner_fs_force_recheck (TrackerMinerFS *fs);
+void tracker_miner_fs_set_mtime_checking (TrackerMinerFS *fs,
+ gboolean check_mtimes);
void tracker_miner_fs_set_initial_crawling (TrackerMinerFS *fs,
gboolean do_initial_crawling);
+gboolean tracker_miner_fs_get_mtime_checking (TrackerMinerFS *fs);
gboolean tracker_miner_fs_get_initial_crawling (TrackerMinerFS *fs);
+gboolean tracker_miner_fs_has_items_to_process (TrackerMinerFS *fs);
+
void tracker_miner_fs_add_directory_without_parent (TrackerMinerFS *fs,
GFile *file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]