tracker r2771 - in trunk: . src/tracker-indexer src/tracker-indexer/modules
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2771 - in trunk: . src/tracker-indexer src/tracker-indexer/modules
- Date: Wed, 7 Jan 2009 17:20:40 +0000 (UTC)
Author: carlosg
Date: Wed Jan 7 17:20:40 2009
New Revision: 2771
URL: http://svn.gnome.org/viewvc/tracker?rev=2771&view=rev
Log:
2009-01-07 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/modules/evolution-imap-db.[ch]: Implement
get_count() taking into account all folders.
* src/tracker-indexer/tracker-module-iteratable.c
(tracker_module_iteratable_get_count): Return by default 1 element.
* src/tracker-indexer/tracker-indexer.c: Modified to keep track of the
number of processed/indexed elements, not just files. This also
improves feedback in the status signal (not treating the whole mbox as
one file, etc...)
Modified:
trunk/ChangeLog
trunk/src/tracker-indexer/modules/evolution-imap-db.c
trunk/src/tracker-indexer/modules/evolution-imap-db.h
trunk/src/tracker-indexer/tracker-indexer.c
trunk/src/tracker-indexer/tracker-module-iteratable.c
Modified: trunk/src/tracker-indexer/modules/evolution-imap-db.c
==============================================================================
--- trunk/src/tracker-indexer/modules/evolution-imap-db.c (original)
+++ trunk/src/tracker-indexer/modules/evolution-imap-db.c Wed Jan 7 17:20:40 2009
@@ -348,7 +348,7 @@
g_free (path);
sqlite3_prepare_v2 (self->db,
- "select folder_name from folders",
+ "select folder_name, saved_count from folders",
-1, &stmt, NULL);
do {
@@ -361,6 +361,7 @@
if (folder[0] != '.') {
self->folders = g_list_prepend (self->folders, g_strdup (folder));
+ self->total_n_messages += sqlite3_column_int (stmt, 1);
}
}
} while (result != SQLITE_DONE);
@@ -921,7 +922,7 @@
self = TRACKER_EVOLUTION_IMAP_DB_FILE (iteratable);
- return self->n_messages;
+ return self->total_n_messages;
}
void
Modified: trunk/src/tracker-indexer/modules/evolution-imap-db.h
==============================================================================
--- trunk/src/tracker-indexer/modules/evolution-imap-db.h (original)
+++ trunk/src/tracker-indexer/modules/evolution-imap-db.h Wed Jan 7 17:20:40 2009
@@ -55,6 +55,8 @@
GList *folders;
GList *current_folder;
+ guint total_n_messages;
+
guint n_messages;
guint cur_message;
gchar *cur_message_uid;
Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c (original)
+++ trunk/src/tracker-indexer/tracker-indexer.c Wed Jan 7 17:20:40 2009
@@ -142,9 +142,9 @@
guint signal_status_id;
guint flush_id;
- guint files_processed;
- guint files_indexed;
+ guint items_indexed;
guint items_processed;
+ guint subelements_processed;
gboolean in_transaction;
gboolean in_process;
@@ -281,8 +281,6 @@
tracker_db_interface_end_transaction (indexer->private->file_contents);
tracker_db_interface_end_transaction (indexer->private->cache);
- indexer->private->files_indexed += indexer->private->files_processed;
- indexer->private->files_processed = 0;
indexer->private->in_transaction = FALSE;
g_debug ("Transaction commit");
@@ -292,26 +290,36 @@
signal_status (TrackerIndexer *indexer,
const gchar *why)
{
- gdouble seconds_elapsed;
- guint files_remaining;
+ PathInfo *path;
+ gdouble seconds_elapsed;
+ guint items_remaining;
- files_remaining = g_queue_get_length (indexer->private->file_queue);
+ items_remaining = g_queue_get_length (indexer->private->file_queue);
seconds_elapsed = g_timer_elapsed (indexer->private->timer, NULL);
- if (indexer->private->files_indexed > 0 &&
- files_remaining > 0) {
+ if ((path = g_queue_peek_head (indexer->private->file_queue)) != NULL) {
+ if (TRACKER_IS_MODULE_ITERATABLE (path->module_file)) {
+ guint count;
+
+ count = tracker_module_iteratable_get_count (TRACKER_MODULE_ITERATABLE (path->module_file));
+ items_remaining += count - indexer->private->subelements_processed;
+ }
+ }
+
+ if (indexer->private->items_indexed > 0 &&
+ items_remaining > 0) {
gchar *str1;
gchar *str2;
str1 = tracker_seconds_estimate_to_string (seconds_elapsed,
TRUE,
- indexer->private->files_indexed,
- files_remaining);
+ indexer->private->items_indexed,
+ items_remaining);
str2 = tracker_seconds_to_string (seconds_elapsed, TRUE);
g_message ("Indexed %d/%d, module:'%s', %s left, %s elapsed (%s)",
- indexer->private->files_indexed,
- indexer->private->files_indexed + files_remaining,
+ indexer->private->items_indexed,
+ indexer->private->items_indexed + items_remaining,
g_quark_to_string (indexer->private->current_module),
str1,
str2,
@@ -324,8 +332,8 @@
g_signal_emit (indexer, signals[STATUS], 0,
seconds_elapsed,
g_quark_to_string (indexer->private->current_module),
- indexer->private->files_indexed,
- files_remaining);
+ indexer->private->items_indexed,
+ items_remaining);
}
static gboolean
@@ -343,6 +351,7 @@
tracker_db_index_flush (indexer->private->email_index);
signal_status (indexer, "flush");
+ indexer->private->items_indexed += indexer->private->items_processed;
indexer->private->items_processed = 0;
state_unset_flags (indexer, TRACKER_INDEXER_STATE_FLUSHING);
@@ -710,15 +719,15 @@
/* Print out how long it took us */
str = tracker_seconds_to_string (seconds_elapsed, FALSE);
- g_message ("Indexer finished in %s, %d files indexed in total",
+ g_message ("Indexer finished in %s, %d items indexed in total",
str,
- indexer->private->files_indexed);
+ indexer->private->items_indexed);
g_free (str);
/* Finally signal done */
g_signal_emit (indexer, signals[FINISHED], 0,
seconds_elapsed,
- indexer->private->files_indexed,
+ indexer->private->items_indexed,
interrupted);
}
@@ -2297,6 +2306,7 @@
}
}
+ indexer->private->subelements_processed++;
indexer->private->items_processed++;
g_free (dirname);
@@ -2432,7 +2442,7 @@
if ((path = g_queue_peek_head (indexer->private->file_queue)) != NULL) {
/* Process file */
if (process_file (indexer, path)) {
- indexer->private->files_processed++;
+ indexer->private->subelements_processed = 0;
path = g_queue_pop_head (indexer->private->file_queue);
path_info_free (path);
}
Modified: trunk/src/tracker-indexer/tracker-module-iteratable.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-module-iteratable.c (original)
+++ trunk/src/tracker-indexer/tracker-module-iteratable.c Wed Jan 7 17:20:40 2009
@@ -66,5 +66,5 @@
return TRACKER_MODULE_ITERATABLE_GET_IFACE (iteratable)->get_count (iteratable);
}
- return 0;
+ return 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]