[tracker/split-add-or-update] libtracker-miner: if CREATED event is received from the monitor, force IRI cache update
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/split-add-or-update] libtracker-miner: if CREATED event is received from the monitor, force IRI cache update
- Date: Mon, 30 Aug 2010 10:07:33 +0000 (UTC)
commit 3357a90edd7084b17c5abc422dc231b9bb6e66b6
Author: Aleksander Morgado <aleksander lanedo com>
Date: Mon Aug 30 12:06:58 2010 +0200
libtracker-miner: if CREATED event is received from the monitor, force IRI cache update
src/libtracker-miner/tracker-miner-fs.c | 32 +++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index a9f27d0..a593885 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1517,7 +1517,8 @@ item_add_or_update_cb (TrackerMinerFS *fs,
static gboolean
item_add_or_update (TrackerMinerFS *fs,
- GFile *file)
+ GFile *file,
+ gboolean force_cache_update)
{
TrackerMinerFSPrivate *priv;
TrackerSparqlBuilder *sparql;
@@ -1538,7 +1539,8 @@ item_add_or_update (TrackerMinerFS *fs,
parent = g_file_get_parent (file);
if (parent) {
- if (!fs->private->current_iri_cache_parent ||
+ if (force_cache_update ||
+ !fs->private->current_iri_cache_parent ||
!g_file_equal (parent, fs->private->current_iri_cache_parent)) {
/* Cache the URN for the new current parent, processing
* order guarantees that all contents for a folder are
@@ -1592,6 +1594,26 @@ item_add_or_update (TrackerMinerFS *fs,
}
static gboolean
+item_add (TrackerMinerFS *fs,
+ GFile *file)
+{
+ /* We force cache update when new item creations, so that we try to
+ * avoid duplicates if the item was already created in the store by
+ * an external application */
+ return item_add_or_update (fs, file, TRUE);
+}
+
+static gboolean
+item_update (TrackerMinerFS *fs,
+ GFile *file)
+{
+ /* When getting UPDATE events, don't force cache updates, just follow
+ * the standard rules. */
+ return item_add_or_update (fs, file, FALSE);
+}
+
+
+static gboolean
item_remove (TrackerMinerFS *fs,
GFile *file)
{
@@ -1887,7 +1909,7 @@ item_move (TrackerMinerFS *fs,
tracker_miner_fs_directory_add_internal (fs, file);
retval = TRUE;
} else {
- retval = item_add_or_update (fs, file);
+ retval = item_add (fs, file);
}
g_free (source_uri);
@@ -2373,8 +2395,10 @@ item_queue_handlers_cb (gpointer user_data)
keep_processing = item_remove (fs, file);
break;
case QUEUE_CREATED:
+ keep_processing = item_add (fs, file);
+ break;
case QUEUE_UPDATED:
- keep_processing = item_add_or_update (fs, file);
+ keep_processing = item_update (fs, file);
break;
case QUEUE_IGNORE_NEXT_UPDATE:
keep_processing = item_ignore_next_update (fs, file, source_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]