tracker r2154 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2154 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer
- Date: Tue, 26 Aug 2008 13:01:11 +0000 (UTC)
Author: pvanhoof
Date: Tue Aug 26 13:01:11 2008
New Revision: 2154
URL: http://svn.gnome.org/viewvc/tracker?rev=2154&view=rev
Log:
2008-08-26 Philip Van Hoof <philip codeminded be>
* src/tracker-indexer/tracker-indexer.c
* src/libtracker-db/tracker-db-index.h
* src/libtracker-db/tracker-db-index.c: Making flushing the index more
responsive
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-db/tracker-db-index.c
branches/indexer-split/src/libtracker-db/tracker-db-index.h
branches/indexer-split/src/tracker-indexer/tracker-indexer.c
Modified: branches/indexer-split/src/libtracker-db/tracker-db-index.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-index.c (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-index.c Tue Aug 26 13:01:11 2008
@@ -51,6 +51,7 @@
guint reload : 1;
guint readonly : 1;
+ guint in_pause : 1;
/* From the indexer */
GHashTable *cache;
@@ -694,7 +695,7 @@
}
static gboolean
-cache_flush_foreach (gpointer key,
+cache_flush_item (gpointer key,
gpointer value,
gpointer user_data)
{
@@ -821,6 +822,24 @@
return retval;
}
+void
+tracker_db_index_set_paused (TrackerDBIndex *index, gboolean paused)
+{
+ TrackerDBIndexPrivate *priv;
+
+ priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
+
+ if (!priv->in_pause && paused) {
+ priv->in_pause = paused;
+ tracker_db_index_close (index);
+ } else if (priv->in_pause && !paused) {
+ priv->in_pause = paused;
+ tracker_db_index_open (index);
+ }
+}
+
+
+
guint
tracker_db_index_flush (TrackerDBIndex *index)
{
@@ -831,21 +850,26 @@
priv = TRACKER_DB_INDEX_GET_PRIVATE (index);
-
if (!priv->index) {
g_debug ("Index was not open for flush, waiting...");
-
return 0;
}
size = g_hash_table_size (priv->cache);
if (size > 0) {
+ GHashTableIter iter;
+ gpointer key, value;
+
g_debug ("Flushing index with %d items in cache", size);
- g_hash_table_foreach_remove (priv->cache,
- cache_flush_foreach,
- priv->index);
+ g_hash_table_iter_init (&iter, priv->cache);
+
+ while (g_hash_table_iter_next (&iter, &key, &value) && !priv->in_pause) {
+ if (cache_flush_item (key, value, priv->index))
+ g_hash_table_iter_remove (&iter);
+ g_main_context_iteration (NULL, FALSE);
+ }
}
Modified: branches/indexer-split/src/libtracker-db/tracker-db-index.h
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-index.h (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-index.h Tue Aug 26 13:01:11 2008
@@ -66,6 +66,9 @@
gboolean tracker_db_index_get_reload (TrackerDBIndex *index);
gboolean tracker_db_index_get_readonly (TrackerDBIndex *index);
+void tracker_db_index_set_paused (TrackerDBIndex *index,
+ gboolean paused);
+
/* Open/Close/Flush */
gboolean tracker_db_index_open (TrackerDBIndex *index);
gboolean tracker_db_index_close (TrackerDBIndex *index);
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c Tue Aug 26 13:01:11 2008
@@ -1817,8 +1817,8 @@
indexer->private->idle_id = 0;
indexer->private->is_paused = TRUE;
- tracker_db_index_close (indexer->private->file_index);
- tracker_db_index_close (indexer->private->email_index);
+ tracker_db_index_set_paused (indexer->private->file_index, TRUE);
+ tracker_db_index_set_paused (indexer->private->email_index, TRUE);
g_signal_emit (indexer, signals[PAUSED], 0);
} else {
check_disk_space_start (indexer);
@@ -1827,8 +1827,8 @@
indexer->private->is_paused = FALSE;
indexer->private->idle_id = g_idle_add (process_func, indexer);
- tracker_db_index_open (indexer->private->file_index);
- tracker_db_index_open (indexer->private->email_index);
+ tracker_db_index_set_paused (indexer->private->file_index, FALSE);
+ tracker_db_index_set_paused (indexer->private->email_index, FALSE);
g_signal_emit (indexer, signals[CONTINUED], 0);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]