[tracker/miner-fs-rename-directory-to-hidden-name] libtracker-miner: in created events, only check existence for directories found during crawling
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-rename-directory-to-hidden-name] libtracker-miner: in created events, only check existence for directories found during crawling
- Date: Tue, 14 Dec 2010 12:11:10 +0000 (UTC)
commit f44ddf800d8e6c8df9b2bce9187f785a5830534c
Author: Aleksander Morgado <aleksander lanedo com>
Date: Tue Dec 14 13:10:40 2010 +0100
libtracker-miner: in created events, only check existence for directories found during crawling
src/libtracker-miner/tracker-miner-fs.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index ba68b81..4db3178 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -117,6 +117,7 @@ struct _TrackerMinerFSPrivate {
GQuark quark_ignore_file;
GQuark quark_attribute_updated;
+ GQuark quark_check_existence;
GList *config_directories;
@@ -620,6 +621,7 @@ tracker_miner_fs_init (TrackerMinerFS *object)
object);
priv->quark_ignore_file = g_quark_from_static_string ("tracker-ignore-file");
+ priv->quark_check_existence = g_quark_from_static_string ("tracker-check-existence");
priv->quark_attribute_updated = g_quark_from_static_string ("tracker-attribute-updated");
priv->iri_cache = g_hash_table_new_full (g_file_hash,
@@ -2512,15 +2514,24 @@ item_queue_handlers_cb (gpointer user_data)
keep_processing = item_remove (fs, file);
break;
case QUEUE_CREATED:
- /* Avoid adding items that already exist, when processing
- * a CREATED task (as those generated when crawling) */
- if (!item_query_exists (fs, file, NULL, NULL)) {
- keep_processing = item_add_or_update (fs, file);
+ /* Check existence before processing, if requested to do so. */
+ if (g_object_get_qdata (G_OBJECT (file),
+ fs->private->quark_check_existence)) {
+ /* Clear the qdata */
+ g_object_set_qdata (G_OBJECT (file),
+ fs->private->quark_check_existence,
+ GINT_TO_POINTER (FALSE));
+ /* Avoid adding items that already exist, when processing
+ * a CREATED task (as those generated when crawling) */
+ if (!item_query_exists (fs, file, NULL, NULL)) {
+ keep_processing = item_add_or_update (fs, file);
+ break;
+ }
+ /* If already in store, skip processing the CREATED task */
+ keep_processing = TRUE;
break;
}
- /* If already in store, skip processing the CREATED task */
- keep_processing = TRUE;
- break;
+ /* Else, fall down and treat as QUEUE_UPDATED */
case QUEUE_UPDATED:
keep_processing = item_add_or_update (fs, file);
break;
@@ -3278,6 +3289,11 @@ crawler_check_directory_contents_cb (TrackerCrawler *crawler,
* the finished sig?
*/
if (add_monitor) {
+ /* Set quark so that before trying to add the item we first
+ * check for its existence. */
+ g_object_set_qdata (G_OBJECT (parent),
+ fs->private->quark_check_existence,
+ GINT_TO_POINTER (TRUE));
/* Before adding the monitor, start notifying the store
* about the new directory, so that if any file event comes
* afterwards, the directory is already in store. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]