[tracker/miner-fs-refactor: 63/74] libtracker-miner: Remove miner_fs->priv->config_directories
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-refactor: 63/74] libtracker-miner: Remove miner_fs->priv->config_directories
- Date: Tue, 4 Oct 2011 10:55:45 +0000 (UTC)
commit 1ae6333121d60b5f2ead30a83d4b20d597dddf61
Author: Carlos Garnacho <carlos lanedo com>
Date: Mon Oct 3 14:55:19 2011 +0200
libtracker-miner: Remove miner_fs->priv->config_directories
This is replaced by TrackerIndexingTree and TrackerDirectoryFlags
src/libtracker-miner/tracker-miner-fs.c | 163 +++----------------------------
1 files changed, 12 insertions(+), 151 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 7aefb69..01dbb19 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -124,12 +124,6 @@ typedef struct {
} ItemWritebackData;
typedef struct {
- GFile *file;
- guint recurse : 1;
- guint ref_count : 7;
-} DirectoryData;
-
-typedef struct {
GFile *file;
gchar *urn;
gchar *parent_urn;
@@ -185,8 +179,6 @@ struct _TrackerMinerFSPrivate {
GQuark quark_attribute_updated;
GQuark quark_directory_found_crawling;
- GList *config_directories;
-
GTimer *timer;
guint item_queues_handler_id;
@@ -203,8 +195,6 @@ struct _TrackerMinerFSPrivate {
TrackerSparqlBuffer *sparql_buffer;
guint sparql_buffer_limit;
- GList *dirs_without_parent;
-
TrackerIndexingTree *indexing_tree;
/* Config directories where we should force mtime checking, regardless of
@@ -295,10 +285,6 @@ static void miner_paused (TrackerMiner
static void miner_resumed (TrackerMiner *miner);
static void miner_ignore_next_update (TrackerMiner *miner,
const GStrv subjects);
-static DirectoryData *directory_data_new (GFile *file,
- gboolean recurse);
-static DirectoryData *directory_data_ref (DirectoryData *dd);
-static void directory_data_unref (DirectoryData *dd);
static ItemMovedData *item_moved_data_new (GFile *file,
GFile *source_file);
static void item_moved_data_free (ItemMovedData *data);
@@ -757,7 +743,6 @@ tracker_miner_fs_init (TrackerMinerFS *object)
priv->mtime_checking = TRUE;
priv->initial_crawling = TRUE;
- priv->dirs_without_parent = NULL;
}
static gboolean
@@ -806,11 +791,6 @@ fs_finalize (GObject *object)
tracker_file_notifier_stop (priv->file_notifier);
g_object_unref (priv->file_notifier);
- if (priv->config_directories) {
- g_list_foreach (priv->config_directories, (GFunc) directory_data_unref, NULL);
- g_list_free (priv->config_directories);
- }
-
if (priv->forced_mtime_check_directories) {
g_list_foreach (priv->forced_mtime_check_directories, (GFunc) g_object_unref, NULL);
g_list_free (priv->forced_mtime_check_directories);
@@ -853,9 +833,6 @@ fs_finalize (GObject *object)
NULL);
tracker_priority_queue_unref (priv->items_writeback);
- g_list_foreach (priv->dirs_without_parent, (GFunc) g_object_unref, NULL);
- g_list_free (priv->dirs_without_parent);
-
g_hash_table_unref (priv->items_ignore_next_update);
g_object_unref (priv->indexing_tree);
@@ -1039,44 +1016,6 @@ miner_ignore_next_update (TrackerMiner *miner, const GStrv urls)
item_queue_handlers_set_up (fs);
}
-
-static DirectoryData *
-directory_data_new (GFile *file,
- gboolean recurse)
-{
- DirectoryData *dd;
-
- dd = g_slice_new (DirectoryData);
-
- dd->file = g_object_ref (file);
- dd->recurse = recurse;
- dd->ref_count = 1;
-
- return dd;
-}
-
-static DirectoryData *
-directory_data_ref (DirectoryData *dd)
-{
- dd->ref_count++;
- return dd;
-}
-
-static void
-directory_data_unref (DirectoryData *dd)
-{
- if (!dd) {
- return;
- }
-
- dd->ref_count--;
-
- if (dd->ref_count == 0) {
- g_object_unref (dd->file);
- g_slice_free (DirectoryData, dd);
- }
-}
-
static void
process_print_stats (TrackerMinerFS *fs)
{
@@ -1336,65 +1275,6 @@ item_query_exists (TrackerMinerFS *miner,
return result;
}
-static gboolean
-file_is_crawl_directory (TrackerMinerFS *fs,
- GFile *file)
-{
- GList *dirs;
-
- /* Check whether file is a crawl directory itself */
- dirs = fs->priv->config_directories;
-
- while (dirs) {
- DirectoryData *data;
-
- data = dirs->data;
- dirs = dirs->next;
-
- if (g_file_equal (data->file, file)) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-directory_contains_file (DirectoryData *dir_data,
- GFile *file)
-{
-
- if (g_file_equal (file, dir_data->file) ||
- (dir_data->recurse &&
- g_file_has_prefix (file, dir_data->file))) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static DirectoryData *
-find_config_directory (TrackerMinerFS *fs,
- GFile *file)
-{
- GList *dirs;
-
- dirs = fs->priv->config_directories;
-
- while (dirs) {
- DirectoryData *data;
-
- data = dirs->data;
- dirs = dirs->next;
-
- if (directory_contains_file (data, file)) {
- return data;
- }
- }
-
- return NULL;
-}
-
static UpdateProcessingTaskContext *
update_processing_task_context_new (TrackerMiner *miner,
gint priority,
@@ -2559,7 +2439,7 @@ item_queue_handlers_cb (gpointer user_data)
if (!parent ||
tracker_file_notifier_get_file_iri (fs->priv->file_notifier, parent) ||
- file_is_crawl_directory (fs, file)) {
+ tracker_indexing_tree_file_is_root (fs->priv->indexing_tree, file)) {
keep_processing = item_add_or_update (fs, file, priority,
(queue == QUEUE_CREATED));
} else {
@@ -3092,28 +2972,6 @@ should_recurse_for_directory (TrackerMinerFS *fs,
return (flags & TRACKER_DIRECTORY_FLAG_RECURSE) != 0;
}
-static gboolean
-directory_equals_or_contains (gconstpointer a,
- gconstpointer b)
-{
- DirectoryData *dda = (DirectoryData *) a;
- DirectoryData *ddb = (DirectoryData *) b;
-
- return directory_contains_file (dda, ddb->file);
-}
-
-
-/* Returns 0 if 'a' and 'b' point to the same directory, OR if
- * 'b' is contained inside directory 'a' and 'a' is recursively
- * indexed. */
-static gint
-directory_compare_cb (gconstpointer a,
- gconstpointer b)
-{
- return directory_equals_or_contains (a, b) ? 0 : -1;
-}
-
-
/* This function is for internal use, adds the file to the processing
* queue with the same directory settings than the corresponding
* config directory.
@@ -3161,6 +3019,7 @@ tracker_miner_fs_directory_add (TrackerMinerFS *fs,
GFile *file,
gboolean recurse)
{
+#if 0
DirectoryData *dir_data;
g_return_if_fail (TRACKER_IS_MINER_FS (fs));
@@ -3177,7 +3036,6 @@ tracker_miner_fs_directory_add (TrackerMinerFS *fs,
directory_data_ref (dir_data));
}
-#if 0
/* If not already in the list to process, add it */
if (tracker_priority_queue_find (fs->priv->directories,
NULL,
@@ -3255,7 +3113,6 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
TrackerMinerFSPrivate *priv;
gboolean return_val = FALSE;
GTimer *timer;
- GList *dirs;
g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
@@ -3277,6 +3134,7 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
g_debug (" Cancelled writeback pool tasks at %f\n",
g_timer_elapsed (timer, NULL));
+#if 0
dirs = fs->priv->config_directories;
while (dirs) {
@@ -3291,6 +3149,7 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
return_val = TRUE;
}
}
+#endif
/* Remove anything contained in the removed directory
* from all relevant processing queues.
@@ -3353,8 +3212,7 @@ static gboolean
check_file_parents (TrackerMinerFS *fs,
GFile *file)
{
- DirectoryData *data;
- GFile *parent;
+ GFile *parent, *root;
GList *parents = NULL, *p;
parent = g_file_get_parent (file);
@@ -3363,15 +3221,16 @@ check_file_parents (TrackerMinerFS *fs,
return FALSE;
}
- data = find_config_directory (fs, parent);
-
- if (!data) {
+ root = tracker_indexing_tree_get_root (fs->priv->indexing_tree,
+ parent, NULL);
+ if (!root) {
+ g_object_unref (parent);
return FALSE;
}
/* Add parent directories until we're past the config dir */
while (parent &&
- !g_file_has_prefix (data->file, parent)) {
+ !g_file_has_prefix (root, parent)) {
parents = g_list_prepend (parents, parent);
parent = g_file_get_parent (parent);
}
@@ -4062,6 +3921,7 @@ void
tracker_miner_fs_add_directory_without_parent (TrackerMinerFS *fs,
GFile *file)
{
+#if 0
GFile *parent;
GList *l;
@@ -4087,6 +3947,7 @@ tracker_miner_fs_add_directory_without_parent (TrackerMinerFS *fs,
/* We add the parent of the input file */
fs->priv->dirs_without_parent = g_list_prepend (fs->priv->dirs_without_parent,
parent);
+#endif
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]