[tracker/miner-priority-queues: 20/22] libtracker-miner: propagate priority throughout file insertions/updates in TrackerMinerFS
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-priority-queues: 20/22] libtracker-miner: propagate priority throughout file insertions/updates in TrackerMinerFS
- Date: Thu, 14 Jul 2011 13:17:09 +0000 (UTC)
commit 0c5d868f24bf9a8fde4b36859a6b4cfcaa03863b
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Jul 14 14:29:15 2011 +0200
libtracker-miner: propagate priority throughout file insertions/updates in TrackerMinerFS
src/libtracker-miner/tracker-miner-fs.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index d6b5941..49070bd 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -136,6 +136,7 @@ typedef struct {
GFile *file;
gchar *urn;
gchar *parent_urn;
+ gint priority;
GCancellable *cancellable;
TrackerSparqlBuilder *builder;
TrackerMiner *miner;
@@ -1679,6 +1680,7 @@ iri_cache_check_update (TrackerMinerFS *fs,
static UpdateProcessingTaskContext *
update_processing_task_context_new (TrackerMiner *miner,
+ gint priority,
const gchar *urn,
const gchar *parent_urn,
GCancellable *cancellable,
@@ -1690,6 +1692,7 @@ update_processing_task_context_new (TrackerMiner *miner,
ctxt->miner = miner;
ctxt->urn = g_strdup (urn);
ctxt->parent_urn = g_strdup (parent_urn);
+ ctxt->priority = priority;
if (cancellable) {
ctxt->cancellable = g_object_ref (cancellable);
@@ -1871,7 +1874,8 @@ item_add_or_update_cb (TrackerMinerFS *fs,
static gboolean
item_add_or_update (TrackerMinerFS *fs,
- GFile *file)
+ GFile *file,
+ gint priority)
{
TrackerMinerFSPrivate *priv;
TrackerSparqlBuilder *sparql;
@@ -1896,6 +1900,7 @@ item_add_or_update (TrackerMinerFS *fs,
/* Create task and add it to the pool as a WAIT task (we need to extract
* the file metadata and such) */
ctxt = update_processing_task_context_new (TRACKER_MINER (fs),
+ priority,
urn,
fs->priv->current_iri_cache_parent_urn,
cancellable,
@@ -2230,7 +2235,7 @@ item_move (TrackerMinerFS *fs,
G_PRIORITY_DEFAULT);
retval = TRUE;
} else {
- retval = item_add_or_update (fs, file);
+ retval = item_add_or_update (fs, file, G_PRIORITY_DEFAULT);
}
g_free (source_uri);
@@ -2476,7 +2481,8 @@ should_wait (TrackerMinerFS *fs,
static QueueState
item_queue_get_next_file (TrackerMinerFS *fs,
GFile **file,
- GFile **source_file)
+ GFile **source_file,
+ gint *priority_out)
{
ItemMovedData *data;
GFile *queue_file;
@@ -2509,6 +2515,7 @@ item_queue_get_next_file (TrackerMinerFS *fs,
}
*file = queue_file;
+ *priority_out = priority;
return QUEUE_DELETED;
}
@@ -2589,6 +2596,7 @@ item_queue_get_next_file (TrackerMinerFS *fs,
}
*file = queue_file;
+ *priority_out = priority;
return QUEUE_CREATED;
}
@@ -2626,6 +2634,8 @@ item_queue_get_next_file (TrackerMinerFS *fs,
return QUEUE_WAIT;
}
+ *priority_out = priority;
+
return QUEUE_UPDATED;
}
@@ -2670,6 +2680,7 @@ item_queue_get_next_file (TrackerMinerFS *fs,
*file = g_object_ref (data->file);
*source_file = g_object_ref (data->source_file);
+ *priority_out = priority;
item_moved_data_free (data);
return QUEUE_MOVED;
}
@@ -2750,9 +2761,10 @@ item_queue_handlers_cb (gpointer user_data)
GTimeVal time_now;
static GTimeVal time_last = { 0 };
gboolean keep_processing = TRUE;
+ gint priority;
fs = user_data;
- queue = item_queue_get_next_file (fs, &file, &source_file);
+ queue = item_queue_get_next_file (fs, &file, &source_file, &priority);
if (queue == QUEUE_WAIT) {
/* Items are still being processed, and there is pending
@@ -2921,7 +2933,7 @@ item_queue_handlers_cb (gpointer user_data)
if (!parent ||
fs->priv->current_iri_cache_parent_urn ||
file_is_crawl_directory (fs, file)) {
- keep_processing = item_add_or_update (fs, file);
+ keep_processing = item_add_or_update (fs, file, priority);
} else {
TrackerPriorityQueue *item_queue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]