tracker r1458 - in branches/indexer-split: . src/libtracker-common src/libtracker-db src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1458 - in branches/indexer-split: . src/libtracker-common src/libtracker-db src/trackerd
- Date: Tue, 20 May 2008 11:11:31 +0000 (UTC)
Author: mr
Date: Tue May 20 11:11:31 2008
New Revision: 1458
URL: http://svn.gnome.org/viewvc/tracker?rev=1458&view=rev
Log:
* src/libtracker-db/Makefile.am:
* src/trackerd/Makefile.am: Make sure we define the G_LOG_DOMAIN
correctly.
* src/trackerd/tracker-main.[ch]: Moved the file_change_queue out
of the Tracker struct and into tracker-db.c since that's the only
place it is used.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-common/tracker-log.c
branches/indexer-split/src/libtracker-common/tracker-log.h
branches/indexer-split/src/libtracker-common/tracker-nfs-lock.c
branches/indexer-split/src/libtracker-common/tracker-nfs-lock.h
branches/indexer-split/src/libtracker-db/Makefile.am
branches/indexer-split/src/trackerd/Makefile.am
branches/indexer-split/src/trackerd/tracker-db-manager.c
branches/indexer-split/src/trackerd/tracker-db-manager.h
branches/indexer-split/src/trackerd/tracker-db.c
branches/indexer-split/src/trackerd/tracker-db.h
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-main.h
branches/indexer-split/src/trackerd/tracker-ontology.c
branches/indexer-split/src/trackerd/tracker-ontology.h
Modified: branches/indexer-split/src/libtracker-common/tracker-log.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-log.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-log.c Tue May 20 11:11:31 2008
@@ -36,7 +36,6 @@
typedef struct {
GMutex *mutex;
- gchar *domain;
gchar *filename;
gint verbosity;
gboolean abort_on_error;
@@ -116,11 +115,9 @@
}
void
-tracker_log_init (const gchar *domain,
- const gchar *filename,
+tracker_log_init (const gchar *filename,
gint verbosity)
{
- g_return_if_fail (domain != NULL);
g_return_if_fail (filename != NULL);
if (log != NULL) {
@@ -129,7 +126,6 @@
}
log = g_new0 (TrackerLog, 1);
- log->domain = g_strdup (domain);
log->filename = g_strdup (filename);
log->mutex = g_mutex_new ();
log->verbosity = verbosity;
@@ -139,7 +135,7 @@
}
void
-tracker_log_term (void)
+tracker_log_shutdown (void)
{
g_return_if_fail (log != NULL);
@@ -147,7 +143,6 @@
log_handler_id = 0;
g_mutex_free (log->mutex);
- g_free (log->domain);
g_free (log->filename);
g_free (log);
Modified: branches/indexer-split/src/libtracker-common/tracker-log.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-log.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-log.h Tue May 20 11:11:31 2008
@@ -26,10 +26,9 @@
G_BEGIN_DECLS
-void tracker_log_init (const gchar *domain,
- const char *filename,
- gint verbosity);
-void tracker_log_term (void);
+void tracker_log_init (const char *filename,
+ gint verbosity);
+void tracker_log_shutdown (void);
G_END_DECLS
Modified: branches/indexer-split/src/libtracker-common/tracker-nfs-lock.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-nfs-lock.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-nfs-lock.c Tue May 20 11:11:31 2008
@@ -169,7 +169,7 @@
}
void
-tracker_nfs_lock_term (void)
+tracker_nfs_lock_shutdown (void)
{
if (!is_initialized ()) {
return;
Modified: branches/indexer-split/src/libtracker-common/tracker-nfs-lock.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-nfs-lock.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-nfs-lock.h Tue May 20 11:11:31 2008
@@ -26,10 +26,10 @@
G_BEGIN_DECLS
-void tracker_nfs_lock_init (const gchar *root_dir, gboolean nfs);
-gboolean tracker_nfs_lock_obtain (void);
-void tracker_nfs_lock_release (void);
-void tracker_nfs_lock_term (void);
+void tracker_nfs_lock_init (const gchar *root_dir, gboolean nfs);
+void tracker_nfs_lock_shutdown (void);
+gboolean tracker_nfs_lock_obtain (void);
+void tracker_nfs_lock_release (void);
G_END_DECLS
Modified: branches/indexer-split/src/libtracker-db/Makefile.am
==============================================================================
--- branches/indexer-split/src/libtracker-db/Makefile.am (original)
+++ branches/indexer-split/src/libtracker-db/Makefile.am Tue May 20 11:11:31 2008
@@ -4,7 +4,7 @@
$(GMIME_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(QDBM_CFLAGS) \
- -DG_LOG_DOMAIN=\"Ttracker\" \
+ -DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src
noinst_LTLIBRARIES = libtracker-db.la
Modified: branches/indexer-split/src/trackerd/Makefile.am
==============================================================================
--- branches/indexer-split/src/trackerd/Makefile.am (original)
+++ branches/indexer-split/src/trackerd/Makefile.am Tue May 20 11:11:31 2008
@@ -1,9 +1,10 @@
INCLUDES = \
- -g \
+ -g \
-DSHAREDIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-DMAIL_MODULES_DIR=\""$(libdir)"/tracker/mail-modules\" \
+ -DG_LOG_DOMAIN=\"Tracker\" \
$(GLIB2_CFLAGS) \
$(GMODULE_CFLAGS) \
$(PANGO_CFLAGS) \
Modified: branches/indexer-split/src/trackerd/tracker-db-manager.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db-manager.c (original)
+++ branches/indexer-split/src/trackerd/tracker-db-manager.c Tue May 20 11:11:31 2008
@@ -184,6 +184,28 @@
}
}
+void
+tracker_db_manager_shutdown (void)
+{
+ gint dbs, i;
+
+ if (!initialized) {
+ return;
+ }
+
+ initialized = FALSE;
+
+ dbs = sizeof (tracker_db_definitions) /sizeof (TrackerDBDefinition);
+
+ for (i = 0; i < dbs; i++) {
+ if (tracker_db_definitions[i].abs_filename) {
+ g_free (tracker_db_definitions[i].abs_filename);
+ }
+ }
+
+ g_free (services_dir);
+ g_free (sql_dir);
+}
const gchar *
tracker_db_manager_get_file (TrackerDatabase db)
@@ -234,25 +256,3 @@
return tracker_dbs[db]->name;
}
-void
-tracker_db_manager_term ()
-{
- gint dbs, i;
-
- if (!initialized) {
- return;
- }
-
- initialized = FALSE;
-
- dbs = sizeof (tracker_db_definitions) /sizeof (TrackerDBDefinition);
-
- for (i = 0; i < dbs; i++) {
- if (tracker_db_definitions[i].abs_filename) {
- g_free (tracker_db_definitions[i].abs_filename);
- }
- }
-
- g_free (services_dir);
- g_free (sql_dir);
-}
Modified: branches/indexer-split/src/trackerd/tracker-db-manager.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db-manager.h (original)
+++ branches/indexer-split/src/trackerd/tracker-db-manager.h Tue May 20 11:11:31 2008
@@ -40,6 +40,7 @@
void tracker_db_manager_init (const gchar *data_dir,
const gchar *user_data_dir,
const gchar *sys_tmp_root_dir);
+void tracker_db_manager_shutdown (void);
const gchar *tracker_db_manager_get_file (TrackerDatabase db);
gboolean tracker_db_manager_file_exists (TrackerDatabase db);
@@ -50,8 +51,6 @@
gboolean tracker_db_manager_get_add_functions (TrackerDatabase db);
const gchar *tracker_db_manager_get_name (TrackerDatabase db);
-void tracker_db_manager_term (void);
-
G_END_DECLS
#endif /* __TRACKER_DB_MANAGER_H__ */
Modified: branches/indexer-split/src/trackerd/tracker-db.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.c (original)
+++ branches/indexer-split/src/trackerd/tracker-db.c Tue May 20 11:11:31 2008
@@ -53,6 +53,8 @@
GHashTable *table;
} DatabaseAction;
+GQueue *file_change_queue;
+
static void
free_metadata_list (GSList *list)
{
@@ -590,7 +592,7 @@
gint *current = (gint *)user_data;
if ((*current - change->first_change_time) > MAX_DURATION) {
- g_queue_remove_all (tracker->file_change_queue, data);
+ g_queue_remove_all (file_change_queue, data);
tracker_db_file_change_free (&change);
}
}
@@ -626,7 +628,7 @@
TrackerDBFileChange *change;
gint count;
- head = g_queue_peek_head_link (tracker->file_change_queue);
+ head = g_queue_peek_head_link (file_change_queue);
g_message ("File Change queue is:");
count = 1;
@@ -642,6 +644,13 @@
}
static void
+free_file_change_queue (gpointer data, gpointer user_data)
+{
+ TrackerDBFileChange *change = (TrackerDBFileChange *) data;
+ tracker_db_file_change_free (&change);
+}
+
+static void
index_blacklist_file (char *uri)
{
TrackerDBFileInfo *info;
@@ -689,18 +698,13 @@
TrackerDBFileChange *change;
time_t current;
- if (!tracker->file_change_queue) {
- /* init queue */
- tracker->file_change_queue = g_queue_new ();
- }
-
current = time (NULL);
/* remove items which are very old */
- g_queue_foreach (tracker->file_change_queue,
+ g_queue_foreach (file_change_queue,
refresh_file_change_queue, ¤t);
- find = g_queue_find_custom (tracker->file_change_queue, uri, uri_comp);
+ find = g_queue_find_custom (file_change_queue, uri, uri_comp);
if (!find) {
/* not found, add to in the queue */
@@ -708,18 +712,18 @@
change->uri = g_strdup (uri);
change->first_change_time = current;
change->num_of_change = 1;
- if (g_queue_get_length (tracker->file_change_queue) == STACK_SIZE) {
- TrackerDBFileChange *tmp = g_queue_pop_head (tracker->file_change_queue);
+ if (g_queue_get_length (file_change_queue) == STACK_SIZE) {
+ TrackerDBFileChange *tmp = g_queue_pop_head (file_change_queue);
tracker_db_file_change_free (&tmp);
}
- g_queue_insert_sorted (tracker->file_change_queue, change,
+ g_queue_insert_sorted (file_change_queue, change,
file_change_sort_comp, NULL);
print_file_change_queue ();
return FALSE;
} else {
change = (TrackerDBFileChange *) find->data;
(change->num_of_change)++;
- g_queue_sort (tracker->file_change_queue,
+ g_queue_sort (file_change_queue,
file_change_sort_comp, NULL);
if (change->num_of_change < MAX_CHANGE_TIMES) {
print_file_change_queue ();
@@ -738,7 +742,7 @@
g_timeout_add_seconds (BLACK_LIST_SECONDS, (GSourceFunc) index_black_list, NULL);
}
- g_queue_remove_all (tracker->file_change_queue, change);
+ g_queue_remove_all (file_change_queue, change);
tracker_db_file_change_free (&change);
return TRUE;
@@ -1330,3 +1334,26 @@
(*change)->uri = NULL;
*change = NULL;
}
+
+void
+tracker_db_init (void)
+{
+ if (file_change_queue) {
+ return;
+ }
+
+ file_change_queue = g_queue_new ();
+}
+
+void
+tracker_db_shutdown (void)
+{
+ if (!file_change_queue) {
+ return;
+ }
+
+ g_queue_foreach (file_change_queue,
+ free_file_change_queue, NULL);
+ g_queue_free (file_change_queue);
+ file_change_queue = NULL;
+}
Modified: branches/indexer-split/src/trackerd/tracker-db.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.h (original)
+++ branches/indexer-split/src/trackerd/tracker-db.h Tue May 20 11:11:31 2008
@@ -38,6 +38,8 @@
gint num_of_change;
} TrackerDBFileChange;
+void tracker_db_init (void);
+void tracker_db_shutdown (void);
gboolean tracker_db_is_file_up_to_date (DBConnection *db_con,
const gchar *uri,
guint32 *id);
Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c (original)
+++ branches/indexer-split/src/trackerd/tracker-main.c Tue May 20 11:11:31 2008
@@ -219,13 +219,6 @@
}
static void
-free_file_change_queue (gpointer data, gpointer user_data)
-{
- TrackerDBFileChange *change = (TrackerDBFileChange *) data;
- tracker_db_file_change_free (&change);
-}
-
-static void
reset_blacklist_file (gchar *uri)
{
gchar *dirname;
@@ -939,8 +932,7 @@
}
/* Initialise other subsystems */
- tracker_log_init (G_LOG_DOMAIN,
- log_filename,
+ tracker_log_init (log_filename,
tracker_config_get_verbosity (tracker->config));
g_message ("Starting log");
@@ -951,6 +943,7 @@
tracker_nfs_lock_init (tracker->root_dir,
tracker_config_get_nfs_locking (tracker->config));
+ tracker_db_init ();
tracker_db_manager_init (tracker->data_dir,
tracker->user_data_dir,
tracker->sys_tmp_root_dir);
@@ -1041,14 +1034,6 @@
g_slist_foreach (l, (GFunc) reset_blacklist_file, NULL);
g_slist_free (l);
- /* Remove file change queue */
- if (tracker->file_change_queue) {
- g_queue_foreach (tracker->file_change_queue,
- free_file_change_queue, NULL);
- g_queue_free (tracker->file_change_queue);
- tracker->file_change_queue = NULL;
- }
-
/* Set kill timeout */
g_timeout_add_full (G_PRIORITY_LOW, 20000, shutdown_timeout_cb, NULL, NULL);
@@ -1065,12 +1050,13 @@
tracker_email_shutdown ();
tracker_dbus_shutdown ();
- tracker_ontology_term ();
+ tracker_ontology_shutdown ();
tracker_cache_shutdown ();
tracker_xesam_shutdown ();
- tracker_db_manager_term ();
- tracker_nfs_lock_term ();
- tracker_log_term ();
+ tracker_db_shutdown ();
+ tracker_db_manager_shutdown ();
+ tracker_nfs_lock_shutdown ();
+ tracker_log_shutdown ();
if (tracker->language) {
g_object_unref (tracker->language);
Modified: branches/indexer-split/src/trackerd/tracker-main.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.h (original)
+++ branches/indexer-split/src/trackerd/tracker-main.h Tue May 20 11:11:31 2008
@@ -101,7 +101,6 @@
gint email_service_max;
/* Queue for recorad file changes */
- GQueue *file_change_queue;
gboolean black_list_timer_active;
/* Progress info for merges */
Modified: branches/indexer-split/src/trackerd/tracker-ontology.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-ontology.c (original)
+++ branches/indexer-split/src/trackerd/tracker-ontology.c Tue May 20 11:11:31 2008
@@ -132,7 +132,7 @@
}
void
-tracker_ontology_term (void)
+tracker_ontology_shutdown (void)
{
g_hash_table_remove_all (service_directory_table);
g_hash_table_remove_all (service_id_table);
Modified: branches/indexer-split/src/trackerd/tracker-ontology.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-ontology.h (original)
+++ branches/indexer-split/src/trackerd/tracker-ontology.h Tue May 20 11:11:31 2008
@@ -30,7 +30,7 @@
G_BEGIN_DECLS
void tracker_ontology_init (void);
-void tracker_ontology_term (void);
+void tracker_ontology_shutdown (void);
void tracker_ontology_add_service_type (TrackerService *service,
GSList *mimes,
GSList *mime_prefixes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]