[tracker/volume-cleanup-conf] tracker-miner-fs: New volume cleanup threshold configuration



commit bcd7b1be1f17db22595303d1d9db7859da2e14ed
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Wed Jul 7 11:36:03 2010 +0200

    tracker-miner-fs: New volume cleanup threshold configuration

 src/miners/fs/tracker-config.c |   26 ++++++++++++++++++++++++--
 src/miners/fs/tracker-config.h |    3 +++
 2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/miners/fs/tracker-config.c b/src/miners/fs/tracker-config.c
index 9ba2700..4a05f8f 100644
--- a/src/miners/fs/tracker-config.c
+++ b/src/miners/fs/tracker-config.c
@@ -38,6 +38,7 @@
 #define GROUP_MONITORS                           "Monitors"
 #define GROUP_INDEXING                           "Indexing"
 #define GROUP_CRAWLING                           "Crawling"
+#define GROUP_VOLUME_CLEANUP                     "VolumeCleanup"
 
 /* Default values */
 #define DEFAULT_VERBOSITY                        0
@@ -52,6 +53,7 @@
 #define DEFAULT_INDEX_ON_BATTERY_FIRST_TIME      TRUE
 #define DEFAULT_LOW_DISK_SPACE_LIMIT             1        /* 0->100 / -1 */
 #define DEFAULT_CRAWLING_INTERVAL                0        /* 0->365 / -1 */
+#define DEFAULT_VOLUME_CLEANUP_THRESHOLD         3        /* 3->GMAXINT / -1 */
 
 typedef struct {
 	/* General */
@@ -79,6 +81,9 @@ typedef struct {
 	GSList   *ignored_files;
 	gint	  crawling_interval;
 
+	/* Stale volume cleanup */
+	gint      volume_cleanup_threshold;
+
 	/* Convenience data */
 	GSList   *ignored_directory_patterns;
 	GSList   *ignored_directory_paths;
@@ -135,7 +140,10 @@ enum {
 	PROP_IGNORED_DIRECTORIES,
 	PROP_IGNORED_DIRECTORIES_WITH_CONTENT,
 	PROP_IGNORED_FILES,
-	PROP_CRAWLING_INTERVAL
+	PROP_CRAWLING_INTERVAL,
+
+	/* Volume cleanup */
+	PROP_VOLUME_CLEANUP_THRESHOLD,
 };
 
 static ObjectToKeyFile conversions[] = {
@@ -158,7 +166,8 @@ static ObjectToKeyFile conversions[] = {
 	{ G_TYPE_POINTER, "ignored-directories",              GROUP_INDEXING, "IgnoredDirectories"        },
 	{ G_TYPE_POINTER, "ignored-directories-with-content", GROUP_INDEXING, "IgnoredDirectoriesWithContent" },
 	{ G_TYPE_POINTER, "ignored-files",                    GROUP_INDEXING, "IgnoredFiles"              },
-	{ G_TYPE_INT,	  "crawling-interval",		      GROUP_INDEXING, "CrawlingInterval"	  }
+	{ G_TYPE_INT,	  "crawling-interval",		      GROUP_INDEXING, "CrawlingInterval"	  }.
+	{ G_TYPE_INT,     "volume-cleanup-threshold",        GROUP_VOLUME_CLEANUP, "Threshold"           }
 };
 
 G_DEFINE_TYPE (TrackerConfig, tracker_config, TRACKER_TYPE_CONFIG_FILE);
@@ -326,6 +335,19 @@ tracker_config_class_init (TrackerConfigClass *klass)
 	                                                   DEFAULT_CRAWLING_INTERVAL,
 	                                                   G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
+	/* Volume cleanup */
+	g_object_class_install_property (object_class,
+                                         PROP_VOLUME_CLEANUP_THRESHOLD,
+	                                 g_param_spec_int ("volume-cleanup-threshold",
+	                                                   "Volume cleanup threshold",
+                                                           " Number of days before stale volumes not mounted are cleaned up in the store."
+                                                           " If set to 0, cleanup always runs at startup, if -1 cleanup is"
+                                                           " disabled entirely. Maximum is 365.",
+	                                                   -1,
+	                                                   365,
+	                                                   DEFAULT_VOLUME_CLEANUP_THRESHOLD,
+	                                                   G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
 	g_type_class_add_private (object_class, sizeof (TrackerConfigPrivate));
 }
 
diff --git a/src/miners/fs/tracker-config.h b/src/miners/fs/tracker-config.h
index 6599c51..4c7bfaa 100644
--- a/src/miners/fs/tracker-config.h
+++ b/src/miners/fs/tracker-config.h
@@ -71,6 +71,7 @@ GSList *       tracker_config_get_ignored_directories              (TrackerConfi
 GSList *       tracker_config_get_ignored_directories_with_content (TrackerConfig *config);
 GSList *       tracker_config_get_ignored_files                    (TrackerConfig *config);
 gint           tracker_config_get_crawling_interval                (TrackerConfig *config);
+gint           tracker_config_get_volume_cleanup_threshold         (TrackerConfig *config);
 
 void           tracker_config_set_verbosity                        (TrackerConfig *config,
                                                                     gint           value);
@@ -108,6 +109,8 @@ void           tracker_config_set_ignored_files                    (TrackerConfi
                                                                     GSList        *files);
 void           tracker_config_set_crawling_interval                (TrackerConfig *config,
                                                                     gint           interval);
+void           tracker_config_set_volume_cleanup_threshold         (TrackerConfig *config,
+                                                                    gint           ndays);
 
 /*
  * Convenience functions:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]