[tracker/tracker-store: 36/36] Merge branch 'master' into tracker-store
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-store: 36/36] Merge branch 'master' into tracker-store
- Date: Tue, 23 Jun 2009 05:52:01 -0400 (EDT)
commit 9ab08671e30dc5cfd9bd68c6604e5c70de566632
Merge: bc1b338... 383c79a...
Author: Jürg Billeter <j bitron ch>
Date: Tue Jun 23 11:44:15 2009 +0200
Merge branch 'master' into tracker-store
configure.ac | 34 +
data/ontologies/33-nfo.ontology | 30 +-
data/ontologies/35-ncal.ontology | 1 -
data/ontologies/40-mlo.description | 10 +
data/ontologies/40-mlo.ontology | 101 +++
data/ontologies/Makefile.am | 1 +
po/sv.po | 380 ++++----
src/libtracker-common/Makefile.am | 33 +-
src/libtracker-common/tracker-file-utils.c | 40 +
src/libtracker-common/tracker-file-utils.h | 3 +
src/libtracker-common/tracker-os-dependant-unix.c | 126 +++-
src/libtracker-common/tracker-power-devicekit.c | 217 +++++
src/libtracker-common/tracker-statement-list.c | 13 +
src/libtracker-common/tracker-statement-list.h | 4 +
src/libtracker-common/tracker-status.c | 99 ++-
src/libtracker-common/tracker-status.h | 3 +
src/libtracker-db/tracker-db-manager.c | 14 +-
src/libtracker-db/tracker-db-manager.h | 2 +-
src/tracker-extract/tracker-extract-mp3.c | 41 +-
src/tracker-extract/tracker-extract-msoffice.c | 4 +-
src/tracker-extract/tracker-extract-oasis.c | 2 +-
src/tracker-extract/tracker-extract-pdf.c | 2 +-
src/tracker-extract/tracker-extract-playlist.c | 49 +-
src/tracker-extract/tracker-extract-ps.c | 2 +-
src/tracker-extract/tracker-iptc.c | 16 +-
src/tracker-extract/tracker-main.c | 4 +-
src/tracker-indexer/tracker-crawler.c | 33 +-
src/tracker-indexer/tracker-indexer.c | 45 +-
src/tracker-indexer/tracker-monitor.c | 13 +-
src/tracker-indexer/tracker-processor.c | 957 ++++++++++++---------
src/tracker-store/tracker-backup.c | 27 +-
src/tracker-store/tracker-daemon.c | 5 +-
src/tracker-store/tracker-main.c | 194 +++--
src/tracker-utils/tracker-processes.c | 5 +-
utils/services/data-validator.c | 6 +-
utils/services/ttl_html.c | 6 +-
36 files changed, 1733 insertions(+), 789 deletions(-)
---
diff --cc po/sv.po
index be6a988,13b683e..27c9c42
--- a/po/sv.po
+++ b/po/sv.po
@@@ -725,15 -721,15 +721,15 @@@ msgstr "E-post:
msgid "Control and monitor the Tracker search and indexing service"
msgstr "Styr och övervaka sök- och indexeringstjänsten Tracker"
- #: ../src/tracker-extract/tracker-main.c:81
- #: ../src/tracker-indexer/tracker-main.c:85
- #: ../src/tracker-store/tracker-main.c:138
+ #: ../src/tracker-extract/tracker-main.c:82
+ #: ../src/tracker-indexer/tracker-main.c:84
-#: ../src/trackerd/tracker-main.c:150
++#: ../src/tracker-store/tracker-main.c:150
msgid "Displays version information"
msgstr "Visar versionsinformation"
- #: ../src/tracker-extract/tracker-main.c:85
- #: ../src/tracker-indexer/tracker-main.c:89
- #: ../src/tracker-store/tracker-main.c:142
+ #: ../src/tracker-extract/tracker-main.c:86
+ #: ../src/tracker-indexer/tracker-main.c:88
-#: ../src/trackerd/tracker-main.c:154
++#: ../src/tracker-store/tracker-main.c:154
msgid "Logging, 0 = errors only, 1 = minimal, 2 = detailed and 3 = debug (default = 0)"
msgstr "Loggning, 0 = endast fel, 1 = minimalt, 2 = detaljerat samt 3 = felsökning (standard = 0)"
@@@ -1752,46 -1752,46 +1752,46 @@@ msgstr "Kunde inte söka i taggar
msgid "NOTE: Limit was reached, there are more items in the database not listed here"
msgstr "OBSERVERA: Gräns nåddes, det finns fler objekt i databasen som inte listas här"
- #: ../src/tracker-store/tracker-main.c:147
-#: ../src/trackerd/tracker-main.c:159
++#: ../src/tracker-store/tracker-main.c:159
msgid "Seconds to wait before starting any crawling or indexing (default = 45)"
msgstr "Sekunder att vänta innan en insamling eller indexering (standard = 45)"
- #: ../src/tracker-store/tracker-main.c:151
-#: ../src/trackerd/tracker-main.c:163
++#: ../src/tracker-store/tracker-main.c:163
msgid "Minimizes the use of memory but may slow indexing down"
msgstr "Minimerar minnesanvändningen men kan göra indexeringen långsammare"
- #: ../src/tracker-store/tracker-main.c:155
-#: ../src/trackerd/tracker-main.c:167
++#: ../src/tracker-store/tracker-main.c:167
msgid "Directories to exclude for file change monitoring (you can do -e <path> -e <path>)"
msgstr "Kataloger att undanta för filändringsövervakning (du kan använda -e <sökväg> -e <sökväg>)"
- #: ../src/tracker-store/tracker-main.c:159
-#: ../src/trackerd/tracker-main.c:171
++#: ../src/tracker-store/tracker-main.c:171
msgid "Directories to include for file change monitoring (you can do -i <path> -i <path>)"
msgstr "Kataloger att inkludera för filändringsövervakning (du kan använda -i <sökväg> -i <sökväg>)"
- #: ../src/tracker-store/tracker-main.c:163
-#: ../src/trackerd/tracker-main.c:175
++#: ../src/tracker-store/tracker-main.c:175
msgid "Directories to crawl to index files (you can do -c <path> -c <path>)"
msgstr "Kataloger att genomsöka för indexering (du kan använda -c <sökväg> -c <sökväg>)"
- #: ../src/tracker-store/tracker-main.c:167
-#: ../src/trackerd/tracker-main.c:179
++#: ../src/tracker-store/tracker-main.c:179
msgid "Disable modules from being processed (you can do -d <module> -d <module>)"
msgstr "Inaktivera moduler från att behandlas (du kan använda -d <modul> -d <modul>)"
- #: ../src/tracker-store/tracker-main.c:173
-#: ../src/trackerd/tracker-main.c:185
++#: ../src/tracker-store/tracker-main.c:185
msgid "Force a re-index of all content"
msgstr "Tvinga igenom en omindexering av samtligt innehåll"
- #: ../src/tracker-store/tracker-main.c:177
-#: ../src/trackerd/tracker-main.c:189
++#: ../src/tracker-store/tracker-main.c:189
msgid "Disable any indexing and monitoring"
msgstr "Inaktivera all indexering eller övervakning"
- #: ../src/tracker-store/tracker-main.c:180
-#: ../src/trackerd/tracker-main.c:192
++#: ../src/tracker-store/tracker-main.c:192
msgid "Language to use for stemmer and stop words (ISO 639-1 2 characters code)"
msgstr "Språk att använda för bildande av ordstam och stoppord (tvåbokstavskod enligt ISO 639-1)"
#. Translators: this messagge will apper immediately after the
#. * usage string - Usage: COMMAND <THIS_MESSAGE>
#.
- #: ../src/tracker-store/tracker-main.c:857
-#: ../src/trackerd/tracker-main.c:967
++#: ../src/tracker-store/tracker-main.c:967
msgid "- start the tracker daemon"
msgstr "- starta tracker-demonen"
diff --cc src/libtracker-common/Makefile.am
index 7f28133,8cac867..521ec20
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@@ -25,21 -27,33 +27,36 @@@ els
os_sources = tracker-os-dependant-unix.c
endif
+ # For storage, we need HAL, tracker isn't yet ported to DeviceKit-disks
if HAVE_HAL
- hal_sources = \
- tracker-power-hal.c \
- tracker-storage-hal.c
- hal_headers = \
- tracker-power.h \
+ storage_headers = \
tracker-storage.h
+ storage_sources = \
+ tracker-storage-hal.c
+ endif
+
+ # Prefer DeviceKit-power for the power data if it's available, else fall back to HAL
+ if HAVE_DEVKIT_POWER
+ power_headers = \
+ tracker-power.h
+ power_sources = \
+ tracker-power-devicekit.c
+ else
+ if HAVE_HAL
+ power_headers = \
+ tracker-power.h
+ power_sources = \
+ tracker-power-hal.c
+ endif
endif
-libtracker_common_la_SOURCES = \
+libtracker_common_la_VALASOURCES = \
+ tracker-sparql-builder.vala
+
+libtracker_common_la_SOURCES = \
$(os_sources) \
- $(hal_sources) \
+ $(power_sources) \
+ $(storage_sources) \
tracker-class.c \
tracker-config.c \
tracker-dbus.c \
@@@ -59,12 -72,11 +76,13 @@@
tracker-type-utils.c \
tracker-utils.c \
tracker-thumbnailer.c \
- tracker-albumart.c
+ tracker-albumart.c \
+ libtracker-common.vala.stamp \
+ $(libtracker_common_la_VALASOURCES:.vala=.c)
noinst_HEADERS = \
- $(hal_headers) \
+ $(power_headers) \
+ $(storage_headers) \
tracker-dbus.h \
tracker-ioprio.h \
tracker-log.h \
diff --cc src/libtracker-common/tracker-status.c
index 2e65ca2,bc4f3fb..191b39d
--- a/src/libtracker-common/tracker-status.c
+++ b/src/libtracker-common/tracker-status.c
@@@ -180,10 -304,10 +181,12 @@@ disk_space_check (void
return FALSE;
}
+ g_free (data_dir);
+
if (((long long) st.f_bavail * 100 / st.f_blocks) <= limit) {
- g_message ("Disk space is low");
+ g_message ("WARNING: Available disk space is below configured "
+ "threshold for acceptable working (%d%%)",
+ limit);
return TRUE;
}
@@@ -1043,6 -1226,5 +1093,5 @@@ tracker_status_set_is_paused_for_dbus (
private->is_paused_for_dbus = value;
/* Set indexer state and our state to paused or not */
- indexer_recheck (TRUE, TRUE, emit);
+ indexer_recheck (TRUE, emit);
}
-
diff --cc src/libtracker-db/tracker-db-manager.c
index 6d3e020,4b5ead0..0c6bd84
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@@ -1202,19 -1209,12 +1209,20 @@@ tracker_db_manager_init (TrackerDBManag
initialized = TRUE;
- resources_iface = tracker_db_manager_get_db_interfaces (4,
- TRACKER_DB_METADATA,
- TRACKER_DB_FULLTEXT,
- TRACKER_DB_CONTENTS,
- TRACKER_DB_COMMON);
+ if (flags & TRACKER_DB_MANAGER_READONLY) {
+ resources_iface = tracker_db_manager_get_db_interfaces_ro (4,
+ TRACKER_DB_METADATA,
+ TRACKER_DB_FULLTEXT,
+ TRACKER_DB_CONTENTS,
+ TRACKER_DB_COMMON);
+ } else {
+ resources_iface = tracker_db_manager_get_db_interfaces (4,
+ TRACKER_DB_METADATA,
+ TRACKER_DB_FULLTEXT,
+ TRACKER_DB_CONTENTS,
+ TRACKER_DB_COMMON);
+ }
+ return TRUE;
}
void
diff --cc src/tracker-indexer/tracker-indexer.c
index db77add,ef505ad..74cc86a
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@@ -134,13 -137,9 +134,13 @@@ struct TrackerIndexerPrivate
TrackerConfig *config;
TrackerLanguage *language;
- TrackerPower *hal_power;
- TrackerStorage *hal_storage;
+ TrackerPower *power;
+ TrackerStorage *storage;
+ TrackerProcessor *processor;
+
+ TrackerClient *client;
+
GTimer *timer;
GVolumeMonitor *volume_monitor;
@@@ -568,18 -618,13 +568,21 @@@ tracker_indexer_finalize (GObject *obje
notify_on_battery_cb,
TRACKER_INDEXER (object));
- g_object_unref (priv->hal_power);
- g_object_unref (priv->hal_storage);
+ g_object_unref (priv->power);
+ #endif /* HAVE_HAL || HAVE_DEVKIT_POWER */
+
+ #ifdef HAVE_HAL
+ g_object_unref (priv->storage);
#endif /* HAVE_HAL */
+ if (priv->processor) {
+ g_object_unref (priv->processor);
+ }
+
+ if (priv->client) {
+ tracker_disconnect (priv->client);
+ }
+
g_object_unref (priv->language);
g_object_unref (priv->config);
@@@ -917,33 -969,19 +920,35 @@@ tracker_indexer_init (TrackerIndexer *i
priv->modules_queue = g_queue_new ();
priv->config = tracker_config_new ();
+ priv->client = tracker_connect (TRUE);
+
#ifdef HAVE_HAL
- priv->hal_power = tracker_power_new ();
- priv->hal_storage = tracker_storage_new ();
+ priv->storage = tracker_storage_new ();
+ #endif /* HAVE_HAL */
- g_signal_connect (priv->hal_power, "notify::on-battery",
+ #ifdef HAVE_HAL || HAVE_DEVKIT_POWER
+ priv->power = tracker_power_new ();
+ g_signal_connect (priv->power, "notify::on-battery",
G_CALLBACK (notify_on_battery_cb),
indexer);
set_up_throttle (indexer);
- #endif /* HAVE_HAL */
+ #endif /* HAVE_HAL || HAVE_DEVKIT_POWER */
- tracker_status_init (priv->config, priv->hal_power);
++ tracker_status_init (priv->config, priv->power);
+
+ /* Set our status as running, if this is FALSE, threads stop
+ * doing what they do and shutdown.
+ */
+ tracker_status_set_is_ready (TRUE);
+
+ /* We set the state here because it is not set in the
+ * processor otherwise.
+ */
+ tracker_status_set_and_signal (TRACKER_STATUS_IDLE);
+
- priv->processor = tracker_processor_new (priv->config, priv->hal_storage, indexer);
++ priv->processor = tracker_processor_new (priv->config, priv->storage, indexer);
+
priv->language = tracker_language_new (priv->config);
priv->db_dir = g_build_filename (g_get_user_cache_dir (),
@@@ -1257,31 -1332,10 +1262,31 @@@ item_move (TrackerIndexer *indexer
return res;
}
- update_file_uri_recursively (source_uri, uri);
+ sparql = g_string_new ("");
+
+ g_string_append_printf (sparql,
+ "DELETE { <%s> nfo:fileName ?o } WHERE { <%s> nfo:fileName ?o }",
+ source_uri, source_uri);
+
+ g_string_append (sparql, " INSERT {");
+
+ file_info = g_file_query_info (info->file,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL, NULL);
+
+ escaped_filename = g_strescape (g_file_info_get_display_name (file_info), NULL);
+
+ g_string_append_printf (sparql, " <%s> nfo:fileName \"%s\" .", source_uri, escaped_filename);
+
+ update_file_uri_recursively (indexer, sparql, source_uri, uri);
+
+ g_string_append (sparql, " }");
+
+ tracker_resources_batch_sparql_update (indexer->private->client, sparql->str, NULL);
#ifdef HAVE_HAL
- if (tracker_storage_uri_is_on_removable_device (indexer->private->hal_storage,
+ if (tracker_storage_uri_is_on_removable_device (indexer->private->storage,
source_uri,
&mount_point,
NULL) ) {
diff --cc src/tracker-indexer/tracker-processor.c
index 195ddeb,eb8633c..293516d
--- a/src/tracker-indexer/tracker-processor.c
+++ b/src/tracker-indexer/tracker-processor.c
@@@ -105,71 -128,67 +126,77 @@@ enum
LAST_SIGNAL
};
- static void tracker_processor_finalize (GObject *object);
- static void crawler_destroy_notify (gpointer data);
- static void item_queue_destroy_notify (gpointer data);
- static void process_module_next (TrackerProcessor *processor);
- static void indexer_status_cb (TrackerIndexer *indexer,
- gdouble seconds_elapsed,
- const gchar *current_module_name,
- guint items_processed,
- guint items_indexed,
- guint items_remaining,
- gpointer user_data);
- static void indexer_finished_cb (TrackerIndexer *indexer,
- gdouble seconds_elapsed,
- guint items_processed,
- guint items_indexed,
- gboolean interrupted,
- gpointer user_data);
- static void monitor_item_created_cb (TrackerMonitor *monitor,
- const gchar *module_name,
- GFile *file,
- gboolean is_directory,
- gpointer user_data);
- static void monitor_item_updated_cb (TrackerMonitor *monitor,
- const gchar *module_name,
- GFile *file,
- gboolean is_directory,
- gpointer user_data);
- static void monitor_item_deleted_cb (TrackerMonitor *monitor,
- const gchar *module_name,
- GFile *file,
- gboolean is_directory,
- gpointer user_data);
- static void monitor_item_moved_cb (TrackerMonitor *monitor,
- const gchar *module_name,
- GFile *file,
- GFile *other_file,
- gboolean is_directory,
- gboolean is_source_monitored,
- gpointer user_data);
- static void crawler_processing_file_cb (TrackerCrawler *crawler,
- const gchar *module_name,
- GFile *file,
- gpointer user_data);
- static void crawler_processing_directory_cb (TrackerCrawler *crawler,
- const gchar *module_name,
- GFile *file,
- gpointer user_data);
- static void crawler_finished_cb (TrackerCrawler *crawler,
- const gchar *module_name,
- guint directories_found,
- guint directories_ignored,
- guint files_found,
- guint files_ignored,
- gpointer user_data);
-
+ static void tracker_processor_finalize (GObject *object);
+ static void crawler_destroy_notify (gpointer data);
+ static void item_queue_destroy_notify (gpointer data);
+ static void process_module_next (TrackerProcessor *processor);
+ static void process_modules_stop (TrackerProcessor *processor);
+ static void process_device_next (TrackerProcessor *processor);
+ static void process_devices_stop (TrackerProcessor *processor);
+ static void process_check_completely_finished (TrackerProcessor *processor);
+ static void process_next (TrackerProcessor *processor);
-static void indexer_status_cb (DBusGProxy *proxy,
++static void indexer_status_cb (TrackerIndexer *indexer,
+ gdouble seconds_elapsed,
+ const gchar *current_module_name,
+ guint items_processed,
+ guint items_indexed,
+ guint items_remaining,
+ gpointer user_data);
-static void indexer_started_cb (DBusGProxy *proxy,
++static void indexer_started_cb (TrackerIndexer *indexer,
+ gpointer user_data);
-static void indexer_finished_cb (DBusGProxy *proxy,
++static void indexer_finished_cb (TrackerIndexer *indexer,
+ gdouble seconds_elapsed,
+ guint items_processed,
+ guint items_indexed,
+ gboolean interrupted,
+ gpointer user_data);
+ static void monitor_item_created_cb (TrackerMonitor *monitor,
+ const gchar *module_name,
+ GFile *file,
+ gboolean is_directory,
+ gpointer user_data);
+ static void monitor_item_updated_cb (TrackerMonitor *monitor,
+ const gchar *module_name,
+ GFile *file,
+ gboolean is_directory,
+ gpointer user_data);
+ static void monitor_item_deleted_cb (TrackerMonitor *monitor,
+ const gchar *module_name,
+ GFile *file,
+ gboolean is_directory,
+ gpointer user_data);
+ static void monitor_item_moved_cb (TrackerMonitor *monitor,
+ const gchar *module_name,
+ GFile *file,
+ GFile *other_file,
+ gboolean is_directory,
+ gboolean is_source_monitored,
+ gpointer user_data);
+ static void crawler_processing_file_cb (TrackerCrawler *crawler,
+ const gchar *module_name,
+ GFile *file,
+ gpointer user_data);
+ static void crawler_processing_directory_cb (TrackerCrawler *crawler,
+ const gchar *module_name,
+ GFile *file,
+ gpointer user_data);
+ static void crawler_finished_cb (TrackerCrawler *crawler,
+ const gchar *module_name,
+ guint directories_found,
+ guint directories_ignored,
+ guint files_found,
+ guint files_ignored,
+ gpointer user_data);
+#ifdef HAVE_HAL
- static void mount_point_added_cb (TrackerStorage *hal,
- const gchar *volume_uuid,
- const gchar *mount_point,
- gpointer user_data);
- static void mount_point_removed_cb (TrackerStorage *hal,
- const gchar *volume_uuid,
- const gchar *mount_point,
- gpointer user_data);
++static void mount_point_added_cb (TrackerStorage *hal,
++ const gchar *volume_uuid,
++ const gchar *mount_point,
++ gpointer user_data);
++static void mount_point_removed_cb (TrackerStorage *hal,
++ const gchar *volume_uuid,
++ const gchar *mount_point,
++ gpointer user_data);
+#endif /* HAVE_HAL */
static guint signals[LAST_SIGNAL] = { 0, };
@@@ -296,12 -315,16 +323,15 @@@ tracker_processor_finalize (GObject *ob
g_list_free (priv->modules);
- dbus_g_proxy_disconnect_signal (priv->indexer_proxy, "Started",
- G_CALLBACK (indexer_started_cb),
- NULL);
- dbus_g_proxy_disconnect_signal (priv->indexer_proxy, "Finished",
- G_CALLBACK (indexer_finished_cb),
- NULL);
- dbus_g_proxy_disconnect_signal (priv->indexer_proxy, "Status",
- G_CALLBACK (indexer_status_cb),
- NULL);
- g_object_unref (priv->indexer_proxy);
+ g_signal_handlers_disconnect_by_func (priv->indexer,
++ G_CALLBACK (indexer_started_cb),
++ NULL);
++ g_signal_handlers_disconnect_by_func (priv->indexer,
+ G_CALLBACK (indexer_finished_cb),
+ NULL);
+ g_signal_handlers_disconnect_by_func (priv->indexer,
+ G_CALLBACK (indexer_status_cb),
+ NULL);
g_signal_handlers_disconnect_by_func (priv->monitor,
G_CALLBACK (monitor_item_deleted_cb),
@@@ -329,13 -347,6 +354,13 @@@
}
if (priv->hal) {
+ g_signal_handlers_disconnect_by_func (priv->hal,
- mount_point_added_cb,
- object);
++ mount_point_added_cb,
++ object);
+ g_signal_handlers_disconnect_by_func (priv->hal,
- mount_point_removed_cb,
- object);
++ mount_point_removed_cb,
++ object);
+
g_object_unref (priv->hal);
}
#endif /* HAVE_HAL */
@@@ -517,10 -528,87 +542,8 @@@ item_queue_destroy_notify (gpointer dat
}
static void
-item_queue_readd_items (GQueue *queue,
- GStrv strv)
+item_queue_processed_cb (TrackerProcessor *processor)
{
- g_debug ("Sent!");
-
- if (queue) {
- GStrv p;
- gint i;
-
- for (p = strv, i = 0; *p; p++, i++) {
- g_queue_push_nth (queue, g_file_new_for_path (*p), i);
- }
- }
-}
-
-static guint
-item_queue_count_all (TrackerProcessor *processor)
-{
- GList *l;
- guint items = 0;
-
- for (l = processor->private->modules; l; l = l->next) {
- GQueue *q;
-
- q = g_hash_table_lookup (processor->private->items_created_queues, l->data);
- items += g_queue_get_length (q);
-
- q = g_hash_table_lookup (processor->private->items_updated_queues, l->data);
- items += g_queue_get_length (q);
-
- q = g_hash_table_lookup (processor->private->items_deleted_queues, l->data);
- items += g_queue_get_length (q);
-
- q = g_hash_table_lookup (processor->private->items_moved_queues, l->data);
- items += g_queue_get_length (q);
- }
-
- return items;
-}
-
-static void
-item_queue_processed_cb (DBusGProxy *proxy,
- GError *error,
- gpointer user_data)
-{
- TrackerProcessor *processor;
-
- processor = user_data;
-
- if (error) {
- GQueue *queue;
-
- g_message ("Items could not be processed by the indexer, %s",
- error->message);
- g_error_free (error);
-
- /* Put files back into queue */
- switch (processor->private->sent_type) {
- case SENT_TYPE_CREATED:
- queue = g_hash_table_lookup (processor->private->items_created_queues,
- processor->private->sent_module_name);
- break;
- case SENT_TYPE_UPDATED:
- queue = g_hash_table_lookup (processor->private->items_updated_queues,
- processor->private->sent_module_name);
- break;
- case SENT_TYPE_DELETED:
- queue = g_hash_table_lookup (processor->private->items_deleted_queues,
- processor->private->sent_module_name);
- break;
- case SENT_TYPE_MOVED:
- queue = g_hash_table_lookup (processor->private->items_moved_queues,
- processor->private->sent_module_name);
- break;
- case SENT_TYPE_NONE:
- default:
- queue = NULL;
- break;
- }
-
- item_queue_readd_items (queue, processor->private->sent_items);
- }
-
g_strfreev (processor->private->sent_items);
/* Reset for next batch to be sent */
@@@ -687,10 -822,26 +753,10 @@@ item_queue_handlers_set_up (TrackerProc
return;
}
- if (!tracker_status_get_is_initial_check ()) {
- guint count;
-
- /* Get items left to handle */
- count = item_queue_count_all (processor);
-
- if (count <= ITEMS_QUEUE_PROCESS_QUICK_COUNT) {
- g_message ("Only %d items queued currently, setting up quick handler",
- count);
- processor->private->item_queues_handler_id =
- g_idle_add (item_queue_handlers_cb,
- processor);
- return;
- }
- }
-
processor->private->item_queues_handler_id =
g_timeout_add_seconds (ITEMS_QUEUE_PROCESS_INTERVAL,
- item_queue_handlers_cb,
- processor);
+ item_queue_handlers_cb,
+ processor);
}
static gboolean
@@@ -988,32 -1026,327 +941,322 @@@ process_module_next (TrackerProcessor *
/* If we have no further modules to iterate */
if (!processor->private->current_module) {
- processor->private->iterated_modules = TRUE;
+ process_modules_stop (processor);
+ process_next (processor);
+ return;
+ }
- /* Handle removable media */
- module_name = "files";
- is_removable_media = TRUE;
+ process_module (processor, processor->private->current_module->data);
+ }
- /* Only if the module is not disabled. Otherwise we
- * get into a recursive loop. Also we make sure that
- * we haven't already handled all removable devices
- * already.
+ static void
+ process_device (TrackerProcessor *processor,
+ const gchar *device_root)
+ {
+ TrackerCrawler *crawler;
+ GFile *file;
+ const gchar *module_name = "files";
+
+ g_message ("Processing device with root:'%s'", device_root);
+
+ if (process_module_is_disabled (processor, module_name)) {
+ process_device_next (processor);
+ return;
+ }
+
+ /* Here we set up legacy .cfg options like watch roots */
+ tracker_status_set_and_signal (TRACKER_STATUS_WATCHING);
+
+ /* Gets all files and directories */
+ tracker_status_set_and_signal (TRACKER_STATUS_PENDING);
+
+ crawler = g_hash_table_lookup (processor->private->crawlers, module_name);
+
+ tracker_crawler_use_module_paths (crawler, FALSE);
+ tracker_crawler_special_paths_clear (crawler);
+
+ if (path_should_be_ignored_for_media (processor, device_root)) {
+ g_message (" Ignored due to config");
+ process_device_next (processor);
+ return;
+ }
+
+ file = g_file_new_for_path (device_root);
+ tracker_monitor_add (processor->private->monitor, module_name, file);
+ g_object_unref (file);
+
+ tracker_crawler_special_paths_add (crawler, device_root);
+
+ if (!tracker_crawler_start (crawler)) {
+ process_device_next (processor);
+ }
+ }
+
+ static void
+ process_device_next (TrackerProcessor *processor)
+ {
+ if (tracker_status_get_is_readonly ()) {
+ /* Block any request to process
+ * modules if indexing is not enabled
*/
+ return;
+ }
+
+ /* Don't recursively iterate the devices */
+ if (!processor->private->current_device) {
+ if (!processor->private->finished_devices) {
+ processor->private->current_device = processor->private->devices;
+ }
+ } else {
+ GList *l;
+
+ l = processor->private->current_device;
+
+ /* Now free that device so we don't recrawl it */
+ if (l) {
+ g_free (l->data);
+
+ processor->private->current_device =
+ processor->private->devices =
+ g_list_delete_link (processor->private->devices, l);
+ }
+ }
+
+ /* If we have no further devices to iterate */
+ if (!processor->private->current_device) {
+ process_devices_stop (processor);
+ process_next (processor);
+ return;
+ }
+
+ process_device (processor, processor->private->current_device->data);
+ }
+
+ static void
+ process_modules_start (TrackerProcessor *processor)
+ {
+ g_message ("Processor has started iterating %d modules",
+ g_list_length (processor->private->modules));
+
+ if (processor->private->timer) {
+ g_timer_destroy (processor->private->timer);
+ }
+
+ processor->private->timer = g_timer_new ();
+
+ processor->private->finished_modules = FALSE;
+
+ processor->private->directories_found = 0;
+ processor->private->directories_ignored = 0;
+ processor->private->files_found = 0;
+ processor->private->files_ignored = 0;
+
+ process_module_next (processor);
+ }
+
+ static void
+ process_modules_stop (TrackerProcessor *processor)
+ {
+ if (processor->private->finished_modules) {
+ return;
+ }
+
+ g_message ("--------------------------------------------------");
+ g_message ("Processor has %s iterating modules",
+ processor->private->interrupted ? "been stopped while" : "finished");
+
+ processor->private->finished_modules = TRUE;
+
+ if (processor->private->interrupted) {
+ TrackerCrawler *crawler;
+
+ crawler = g_hash_table_lookup (processor->private->crawlers,
+ processor->private->current_module->data);
+ if (crawler) {
+ tracker_crawler_stop (crawler);
+ }
+
+ if (processor->private->timer) {
+ g_timer_destroy (processor->private->timer);
+ processor->private->timer = NULL;
+ }
+ } else {
+ gdouble elapsed;
+
+ if (processor->private->timer) {
+ g_timer_stop (processor->private->timer);
+ elapsed = g_timer_elapsed (processor->private->timer, NULL);
+ } else {
+ elapsed = 0;
+ }
- if (process_module_is_disabled (processor, module_name) ||
- (g_list_length (processor->private->removable_devices) <=
- g_list_length (processor->private->removable_devices_completed))) {
- processor->private->interrupted = FALSE;
- tracker_processor_stop (processor);
- return;
+ g_message ("Module time taken : %4.4f seconds",
+ elapsed);
+ g_message ("Module directories: %d (%d ignored)",
+ processor->private->directories_found,
+ processor->private->directories_ignored);
+ g_message ("Module files : %d (%d ignored)",
+ processor->private->files_found,
+ processor->private->files_ignored);
+ }
+
+ g_message ("--------------------------------------------------\n");
+ }
+
+ static void
+ process_devices_start (TrackerProcessor *processor)
+ {
+ g_message ("Processor has started iterating %d devices",
+ g_list_length (processor->private->devices));
+
+ if (processor->private->timer) {
+ g_timer_destroy (processor->private->timer);
+ }
+
+ processor->private->timer = g_timer_new ();
+
+ processor->private->finished_devices = FALSE;
+
+ processor->private->directories_found = 0;
+ processor->private->directories_ignored = 0;
+ processor->private->files_found = 0;
+ processor->private->files_ignored = 0;
+
+ process_device_next (processor);
+ }
+
+ static void
+ process_devices_stop (TrackerProcessor *processor)
+ {
+ if (processor->private->finished_devices) {
+ return;
+ }
+
+ g_message ("--------------------------------------------------");
+ g_message ("Processor has %s iterating devices",
+ processor->private->interrupted ? "been stopped while" : "finished");
+
+ processor->private->finished_devices = TRUE;
+
+ if (processor->private->interrupted) {
+ TrackerCrawler *crawler;
+
+ crawler = g_hash_table_lookup (processor->private->crawlers, "files");
+ if (crawler) {
+ tracker_crawler_stop (crawler);
+ }
+
+ if (processor->private->timer) {
+ g_timer_destroy (processor->private->timer);
+ processor->private->timer = NULL;
}
} else {
- module_name = processor->private->current_module->data;
- is_removable_media = FALSE;
+ gdouble elapsed;
+
+ if (processor->private->timer) {
+ g_timer_stop (processor->private->timer);
+ elapsed = g_timer_elapsed (processor->private->timer, NULL);
+ } else {
+ elapsed = 0;
+ }
+
+ g_message ("Device time taken : %4.4f seconds",
+ elapsed);
+ g_message ("Device directories: %d (%d ignored)",
+ processor->private->directories_found,
+ processor->private->directories_ignored);
+ g_message ("Device files : %d (%d ignored)",
+ processor->private->files_found,
+ processor->private->files_ignored);
+ }
+
+ g_message ("--------------------------------------------------\n");
+ }
+
+ static void
+ process_continue (TrackerProcessor *processor)
+ {
+ if (!processor->private->finished_modules) {
+ process_module_next (processor);
+ return;
}
- /* Set up new crawler for new module */
- process_module (processor, module_name, is_removable_media);
+ if (!processor->private->finished_devices) {
+ process_device_next (processor);
+ return;
+ }
+
+ /* Nothing to do */
+ }
+
+ static void
+ process_next (TrackerProcessor *processor)
+ {
+ if (!processor->private->finished_modules) {
+ process_modules_start (processor);
+ return;
+ }
+
+ if (!processor->private->finished_devices) {
+ process_devices_start (processor);
+ return;
+ }
+
+ /* Only do this the first time, otherwise the results are
+ * likely to be inaccurate. Devices can be added or removed so
+ * we can't assume stats are correct.
+ */
+ if (tracker_status_get_is_initial_check ()) {
+ g_message ("--------------------------------------------------");
+ g_message ("Total directories : %d (%d ignored)",
+ processor->private->total_directories_found,
+ processor->private->total_directories_ignored);
+ g_message ("Total files : %d (%d ignored)",
+ processor->private->total_files_found,
+ processor->private->total_files_ignored);
+ g_message ("Total monitors : %d",
+ tracker_monitor_get_count (processor->private->monitor, NULL));
+ g_message ("--------------------------------------------------\n");
+ }
+
+ /* Now we have finished crawling, we enable monitor events */
+ g_message ("Enabling monitor events");
+ tracker_monitor_set_enabled (processor->private->monitor, TRUE);
+
+ /* Now we set the state to IDLE, the reason we do this, is it
+ * allows us to either return to an idle state if there was
+ * nothing to do, OR it allows us to start handling the
+ * queues of files we just crawled. The queue handler won't
+ * send files to the indexer while we are PENDING or WATCHING.
+ */
+ tracker_status_set_and_signal (TRACKER_STATUS_IDLE);
+ }
+
+ static void
+ process_finish (TrackerProcessor *processor)
+ {
+ /* Optimize DBs */
+ tracker_status_set_and_signal (TRACKER_STATUS_OPTIMIZING);
+ tracker_db_manager_optimize ();
+
+ /* All done */
+ tracker_status_set_and_signal (TRACKER_STATUS_IDLE);
-
- /* Signal to the applet we are finished */
- g_signal_emit_by_name (tracker_dbus_get_object (TRACKER_TYPE_DAEMON),
- "index-finished",
- processor->private->indexer_seconds_elapsed);
-
++
+ /* Set our internal state */
+ tracker_status_set_is_initial_check (FALSE);
+
+ g_signal_emit (processor, signals[FINISHED], 0);
+ }
+
+ static void
+ process_check_completely_finished (TrackerProcessor *processor)
+ {
+ if (!processor->private->finished_sending ||
+ !processor->private->finished_indexer) {
+ return;
+ }
+
+ process_finish (processor);
}
static void
@@@ -1062,22 -1415,43 +1305,33 @@@ indexer_status_cb (TrackerIndexer *inde
}
static void
-indexer_started_cb (DBusGProxy *proxy,
++indexer_started_cb (TrackerIndexer *indexer,
+ gpointer user_data)
+ {
+ TrackerProcessor *processor;
+
+ processor = user_data;
+
+ processor->private->finished_indexer = FALSE;
+ }
+
+ static void
-indexer_finished_cb (DBusGProxy *proxy,
- gdouble seconds_elapsed,
- guint items_processed,
- guint items_indexed,
- gboolean interrupted,
- gpointer user_data)
+indexer_finished_cb (TrackerIndexer *indexer,
+ gdouble seconds_elapsed,
+ guint items_processed,
+ guint items_indexed,
+ gboolean interrupted,
+ gpointer user_data)
{
TrackerProcessor *processor;
gchar *str;
processor = user_data;
- processor->private->items_done = items_processed;
- processor->private->items_remaining = 0;
- processor->private->seconds_elapsed = seconds_elapsed;
+ processor->private->indexer_items_done = items_processed;
+ processor->private->indexer_items_remaining = 0;
+ processor->private->indexer_seconds_elapsed = seconds_elapsed;
- /* Signal to any applications */
- g_signal_emit_by_name (tracker_dbus_get_object (TRACKER_TYPE_DAEMON),
- "index-progress",
- "", /* Service */
- "", /* Path */
- items_processed,
- 0,
- items_processed,
- seconds_elapsed);
-
/* Message to the console about state */
str = tracker_seconds_to_string (seconds_elapsed, FALSE);
@@@ -1412,19 -1764,17 +1644,19 @@@ normalize_mount_point (const gchar *mou
}
}
-void
-tracker_processor_mount_point_added (TrackerProcessor *processor,
- const gchar *udi,
- const gchar *mount_point)
+static void
- mount_point_added_cb (TrackerStorage *hal,
- const gchar *udi,
- const gchar *mount_point,
- gpointer user_data)
++mount_point_added_cb (TrackerStorage *hal,
++ const gchar *udi,
++ const gchar *mount_point,
++ gpointer user_data)
{
+ TrackerProcessor *processor;
TrackerProcessorPrivate *priv;
TrackerStatus status;
- GList *l;
gchar *mp;
- g_return_if_fail (TRACKER_IS_PROCESSOR (processor));
+ processor = user_data;
+
priv = processor->private;
status = tracker_status_get ();
@@@ -1461,19 -1802,18 +1684,20 @@@
}
}
-void
-tracker_processor_mount_point_removed (TrackerProcessor *processor,
- const gchar *udi,
- const gchar *mount_point)
+static void
- mount_point_removed_cb (TrackerStorage *hal,
- const gchar *udi,
- const gchar *mount_point,
- gpointer user_data)
++mount_point_removed_cb (TrackerStorage *hal,
++ const gchar *udi,
++ const gchar *mount_point,
++ gpointer user_data)
{
+ TrackerProcessor *processor;
TrackerProcessorPrivate *priv;
GFile *file;
GList *l;
gchar *mp;
- g_return_if_fail (TRACKER_IS_PROCESSOR (processor));
+ processor = user_data;
+
priv = processor->private;
mp = normalize_mount_point (mount_point);
@@@ -1542,16 -1867,7 +1753,14 @@@ tracker_processor_new (TrackerConfig *
/* Set up hal */
priv->hal = g_object_ref (hal);
- priv->removable_devices = tracker_storage_get_removable_device_roots (priv->hal);
- priv->removable_devices_current = priv->removable_devices;
- priv->removable_devices_completed = NULL;
+ priv->devices = tracker_storage_get_removable_device_roots (priv->hal);
+
+ g_signal_connect (priv->hal, "mount-point-added",
- G_CALLBACK (mount_point_added_cb),
- processor);
++ G_CALLBACK (mount_point_added_cb),
++ processor);
+ g_signal_connect (priv->hal, "mount-point-removed",
- G_CALLBACK (mount_point_removed_cb),
- processor);
++ G_CALLBACK (mount_point_removed_cb),
++ processor);
#endif /* HAVE_HAL */
/* Set up the crawlers now we have config and hal */
@@@ -1592,16 -1908,24 +1801,19 @@@
G_CALLBACK (monitor_item_moved_cb),
processor);
- /* Set up the indexer proxy and signalling to know when we are
+ /* Set up the indexer and signalling to know when we are
* finished.
*/
- proxy = tracker_dbus_indexer_get_proxy ();
- priv->indexer_proxy = g_object_ref (proxy);
-
- dbus_g_proxy_connect_signal (proxy, "Status",
- G_CALLBACK (indexer_status_cb),
- processor,
- NULL);
- dbus_g_proxy_connect_signal (proxy, "Started",
- G_CALLBACK (indexer_started_cb),
- processor,
- NULL);
- dbus_g_proxy_connect_signal (proxy, "Finished",
- G_CALLBACK (indexer_finished_cb),
- processor,
- NULL);
+
+ g_signal_connect (priv->indexer, "status",
+ G_CALLBACK (indexer_status_cb),
+ processor);
++ g_signal_connect (priv->indexer, "started",
++ G_CALLBACK (indexer_started_cb),
++ processor);
+ g_signal_connect (priv->indexer, "finished",
+ G_CALLBACK (indexer_finished_cb),
+ processor);
return processor;
}
diff --cc src/tracker-store/tracker-backup.c
index aae97b0,65d4bb2..62497dc
--- a/src/tracker-store/tracker-backup.c
+++ b/src/tracker-store/tracker-backup.c
@@@ -22,14 -22,15 +22,15 @@@
#include <glib-object.h>
#include <glib/gstdio.h>
+
#include <libtracker-common/tracker-dbus.h>
++#include <libtracker-common/tracker-status.h>
#include <libtracker-data/tracker-data-backup.h>
#include "tracker-dbus.h"
#include "tracker-indexer-client.h"
#include "tracker-backup.h"
-#include "tracker-status.h"
-
G_DEFINE_TYPE (TrackerBackup, tracker_backup, G_TYPE_OBJECT)
static void
diff --cc src/tracker-store/tracker-main.c
index 5c23125,18b257d..c6fbc7a
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@@ -317,10 -347,71 +342,41 @@@ mount_point_update_free (MountPointUpda
return;
}
- g_message ("Indexer now knows about UDI state:");
- g_message (" %s", (gchar*) user_data);
+ g_free (mpu->mount_point);
+ g_free (mpu->udi);
- g_free (user_data);
+ g_slice_free (MountPointUpdate, mpu);
+ }
+
+ static void
+ mount_point_set (MountPointUpdate *mpu)
+ {
- TrackerMainPrivate *private;
-
+ g_message ("Indexer has now set the state for the volume with UDI:");
+ g_message (" %s", mpu->udi);
-
- /* Merging: tracker-0.6 appears to have code here that we don't
- *
- * About "mount_points_up"
- */
-
- private = g_static_private_get (&private_key);
-
- /* Make sure we crawl any new mount points or stop crawling
- * any mount points. We do it this way instead of listening
- * for the same HAL signals in the processor because the
- * processor checks state and at the time, we are PAUSED which
- * causes us state machine problems.
- *
- * This is the easiest way to do it.
- */
-
- if (!mpu->no_crawling) {
- if (mpu->was_added) {
- tracker_processor_mount_point_added (private->processor,
- mpu->udi,
- mpu->mount_point);
- } else {
- tracker_processor_mount_point_removed (private->processor,
- mpu->udi,
- mpu->mount_point);
- }
- }
+ }
+
+ static void
+ mount_point_set_cb (DBusGProxy *proxy,
+ GError *error,
+ gpointer user_data)
+ {
+ MountPointUpdate *mpu;
+
+ mpu = user_data;
+
+ if (error) {
+ g_critical ("Indexer couldn't set volume state for:'%s' in database, %s",
+ mpu->udi,
+ error ? error->message : "no error given");
+
+ g_error_free (error);
+
+ tracker_shutdown ();
+ } else {
+ mount_point_set (mpu);
+ }
+
+ mount_point_update_free (mpu);
}
static void
@@@ -723,35 -889,31 +812,31 @@@ set_up_mount_points (TrackerStorage *ha
}
g_list_free (roots);
- }
- static void
- set_up_mount_points (TrackerStorage *hal)
- {
- g_message ("Indexer is being notified to disable all volumes");
- org_freedesktop_Tracker_Indexer_volume_disable_all_async (tracker_dbus_indexer_get_proxy (),
- set_up_mount_points_cb,
- hal);
+ /* Merging: tracker-0.6 appears to have code here that we don't have
+ *
+ * About "mount_points_up" */
}
+
#endif /* HAVE_HAL */
-static gboolean
-start_cb (gpointer user_data)
+static GStrv
+tracker_daemon_get_notifiable_classes (void)
{
- TrackerMainPrivate *private;
+ TrackerDBResultSet *result_set;
+ GStrv classes_to_signal = NULL;
- if (!tracker_status_get_is_ready ()) {
- return FALSE;
- }
+ result_set = tracker_data_query_sparql ("SELECT ?class WHERE { ?class tracker:notify true }", NULL);
- private = g_static_private_get (&private_key);
+ if (result_set) {
+ guint count = 0;
- if (private->processor) {
- tracker_processor_start (private->processor);
+ classes_to_signal = tracker_dbus_query_result_to_strv (result_set, 0, &count);
+ g_object_unref (result_set);
}
- return FALSE;
+ return classes_to_signal;
}
gint
@@@ -959,9 -1122,27 +1046,13 @@@ main (gint argc, gchar *argv[]
set_up_mount_points (hal_storage);
#endif /* HAVE_HAL */
+ if (private->shutdown) {
+ goto shutdown;
+ }
+
- /*
- * Start public interfaces (DBus, push modules, etc)
- */
- private->processor = tracker_processor_new (config, hal_storage);
-
- if (force_reindex &&
- g_file_test (get_ttl_backup_filename (), G_FILE_TEST_EXISTS)) {
- g_debug ("Setting callback for crawling finish detection");
- g_signal_connect (private->processor, "finished",
- G_CALLBACK (processor_finished_cb),
- NULL);
- }
-
/* Make Tracker available for introspection */
if (!tracker_dbus_register_objects (config,
- language,
- private->processor)) {
+ language)) {
return EXIT_FAILURE;
}
@@@ -975,12 -1155,27 +1066,12 @@@
*/
tracker_status_set_is_ready (TRUE);
- if (!tracker_status_get_is_readonly ()) {
- gint seconds;
-
- seconds = tracker_config_get_initial_sleep (config);
-
- if (seconds > 0) {
- g_message ("Waiting %d seconds before starting",
- seconds);
- g_timeout_add_seconds (seconds, start_cb, NULL);
- } else {
- g_idle_add (start_cb, NULL);
- }
- } else {
- /* We set the state here because it is not set in the
- * processor otherwise.
- */
- g_message ("Running in read-only mode, not starting crawler/indexing");
- tracker_status_set_and_signal (TRACKER_STATUS_IDLE);
- }
+ /* We set the state here because it is not set in the
+ * processor otherwise.
+ */
+ tracker_status_set_and_signal (TRACKER_STATUS_IDLE);
- if (!private->shutdown && tracker_status_get_is_ready ()) {
+ if (!private->shutdown) {
private->main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (private->main_loop);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]