[tracker/miner-fs-refactor: 3/3] tracker-miner-fs: Avoid the need of pool_limit variable
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-refactor: 3/3] tracker-miner-fs: Avoid the need of pool_limit variable
- Date: Wed, 13 Oct 2010 17:15:39 +0000 (UTC)
commit 667d2c0a5b48384e85d75e888946cac18fd2014a
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Oct 13 19:14:48 2010 +0200
tracker-miner-fs: Avoid the need of pool_limit variable
.../tracker-miner-fs-processing-pool.c | 6 ++++++
.../tracker-miner-fs-processing-pool.h | 11 ++++++-----
src/libtracker-miner/tracker-miner-fs.c | 14 ++++++++------
3 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.c b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
index ec18915..a78599b 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.c
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.c
@@ -172,6 +172,12 @@ processing_pool_set_limit (ProcessingPool *pool,
pool->limit = limit;
}
+guint
+processing_pool_get_limit (ProcessingPool *pool)
+{
+ return pool->limit;
+}
+
ProcessingTask *
processing_pool_find_task (ProcessingPool *pool,
GFile *file,
diff --git a/src/libtracker-miner/tracker-miner-fs-processing-pool.h b/src/libtracker-miner/tracker-miner-fs-processing-pool.h
index 979ab96..ab2275a 100644
--- a/src/libtracker-miner/tracker-miner-fs-processing-pool.h
+++ b/src/libtracker-miner/tracker-miner-fs-processing-pool.h
@@ -52,6 +52,7 @@ ProcessingPool *processing_pool_new (TrackerSparqlConnection *connecti
void processing_pool_free (ProcessingPool *pool);
void processing_pool_set_limit (ProcessingPool *pool,
guint limit);
+guint processing_pool_get_limit (ProcessingPool *pool);
ProcessingTask *processing_pool_find_task (ProcessingPool *pool,
GFile *file,
gboolean path_search);
@@ -65,12 +66,12 @@ gboolean processing_pool_process_task (ProcessingPool *pool,
ProcessingPoolTaskFinishedCallback finished_handler,
gpointer user_data);
-guint processing_pool_get_task_count (ProcessingPool *pool);
-ProcessingTask *processing_pool_get_last_wait (ProcessingPool *pool);
+guint processing_pool_get_task_count (ProcessingPool *pool);
+ProcessingTask *processing_pool_get_last_wait (ProcessingPool *pool);
-void processing_pool_foreach (ProcessingPool *pool,
- GFunc func,
- gpointer user_data);
+void processing_pool_foreach (ProcessingPool *pool,
+ GFunc func,
+ gpointer user_data);
G_END_DECLS
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index f8dcfca..687b5a9 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -39,6 +39,9 @@
/* If defined will print contents of populated mtime cache while running */
#undef PRINT_MTIME_CACHE_CONTENTS
+/* Default processing pool limit to be set */
+#define DEFAULT_POOL_LIMIT 1
+
/**
* SECTION:tracker-miner-fs
* @short_description: Abstract base class for filesystem miners
@@ -127,7 +130,6 @@ struct _TrackerMinerFSPrivate {
gdouble throttle;
ProcessingPool *processing_pool;
- guint pool_limit;
/* URI mtime cache */
GFile *current_mtime_cache_parent;
@@ -322,7 +324,7 @@ tracker_miner_fs_class_init (TrackerMinerFSClass *klass)
g_param_spec_uint ("process-pool-limit",
"Processing pool limit",
"Number of files that can be concurrently processed",
- 1, G_MAXUINT, 1,
+ 1, G_MAXUINT, DEFAULT_POOL_LIMIT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_MTIME_CHECKING,
@@ -565,7 +567,7 @@ tracker_miner_fs_init (TrackerMinerFS *object)
/* Create processing pool */
priv->processing_pool = processing_pool_new (tracker_miner_get_connection (TRACKER_MINER (object)),
- priv->pool_limit);
+ DEFAULT_POOL_LIMIT);
/* Set up the crawlers now we have config and hal */
priv->crawler = tracker_crawler_new ();
@@ -711,9 +713,8 @@ fs_set_property (GObject *object,
g_value_get_double (value));
break;
case PROP_POOL_LIMIT:
- fs->private->pool_limit = g_value_get_uint (value);
processing_pool_set_limit (fs->private->processing_pool,
- fs->private->pool_limit);
+ g_value_get_uint (value));
break;
case PROP_MTIME_CHECKING:
fs->private->mtime_checking = g_value_get_boolean (value);
@@ -742,7 +743,8 @@ fs_get_property (GObject *object,
g_value_set_double (value, fs->private->throttle);
break;
case PROP_POOL_LIMIT:
- g_value_set_uint (value, fs->private->pool_limit);
+ g_value_set_uint (value,
+ processing_pool_get_limit (fs->private->processing_pool));
break;
case PROP_MTIME_CHECKING:
g_value_set_boolean (value, fs->private->mtime_checking);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]