[tracker/miner-priority-queues-0.10: 19/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-0.10: 19/22] libtracker-miner: propagate priority throughout file insertions/updates in TrackerMinerFS
- Date: Thu, 21 Jul 2011 12:39:06 +0000 (UTC)
commit aa838fbd85c4884e20c09cdbb95906f8496e9404
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 46adb47..9ca23a5 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -135,6 +135,7 @@ typedef struct {
GFile *file;
gchar *urn;
gchar *parent_urn;
+ gint priority;
GCancellable *cancellable;
TrackerSparqlBuilder *builder;
TrackerMiner *miner;
@@ -1656,6 +1657,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,
@@ -1667,6 +1669,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);
@@ -1902,7 +1905,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;
@@ -1927,6 +1931,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,
@@ -2262,7 +2267,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);
@@ -2508,7 +2513,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;
@@ -2541,6 +2547,7 @@ item_queue_get_next_file (TrackerMinerFS *fs,
}
*file = queue_file;
+ *priority_out = priority;
return QUEUE_DELETED;
}
@@ -2621,6 +2628,7 @@ item_queue_get_next_file (TrackerMinerFS *fs,
}
*file = queue_file;
+ *priority_out = priority;
return QUEUE_CREATED;
}
@@ -2658,6 +2666,8 @@ item_queue_get_next_file (TrackerMinerFS *fs,
return QUEUE_WAIT;
}
+ *priority_out = priority;
+
return QUEUE_UPDATED;
}
@@ -2702,6 +2712,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;
}
@@ -2782,9 +2793,10 @@ item_queue_handlers_cb (gpointer user_data)
GTimeVal time_now;
static GTimeVal time_last = { 0 };
gboolean keep_processing = TRUE;
+ gint priority = 0;
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
@@ -2945,7 +2957,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]