/* tracker-store.c generated by valac 0.12.0, the Vala compiler
 * generated from tracker-store.vala, do not modify */

/*
 * Copyright (C) 2009-2011, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Author: Philip Van Hoof <philip@codeminded.be>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libtracker-data/tracker-db-interface.h>
#include <libtracker-data/tracker-data-query.h>
#include <libtracker-data/tracker-data-update.h>
#include <libtracker-data/tracker-data-backup.h>
#include <libtracker-data/tracker-db-manager.h>
#include <libtracker-data/tracker-db-interface-sqlite.h>
#include <tracker-store/tracker-events.h>
#include <gobject/gvaluecollector.h>


#define TRACKER_TYPE_STORE (tracker_store_get_type ())
#define TRACKER_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_STORE, TrackerStore))
#define TRACKER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_STORE, TrackerStoreClass))
#define TRACKER_IS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_STORE))
#define TRACKER_IS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_STORE))
#define TRACKER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_STORE, TrackerStoreClass))

typedef struct _TrackerStore TrackerStore;
typedef struct _TrackerStoreClass TrackerStoreClass;
typedef struct _TrackerStorePrivate TrackerStorePrivate;

#define TRACKER_STORE_TYPE_PRIORITY (tracker_store_priority_get_type ())

#define TRACKER_STORE_TYPE_TASK_TYPE (tracker_store_task_type_get_type ())

#define TRACKER_STORE_TYPE_TASK (tracker_store_task_get_type ())
#define TRACKER_STORE_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_STORE_TYPE_TASK, TrackerStoreTask))
#define TRACKER_STORE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_STORE_TYPE_TASK, TrackerStoreTaskClass))
#define TRACKER_STORE_IS_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_STORE_TYPE_TASK))
#define TRACKER_STORE_IS_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_STORE_TYPE_TASK))
#define TRACKER_STORE_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_STORE_TYPE_TASK, TrackerStoreTaskClass))

typedef struct _TrackerStoreTask TrackerStoreTask;
typedef struct _TrackerStoreTaskClass TrackerStoreTaskClass;
#define _tracker_store_task_unref0(var) ((var == NULL) ? NULL : (var = (tracker_store_task_unref (var), NULL)))

#define TRACKER_STORE_TYPE_QUERY_TASK (tracker_store_query_task_get_type ())
#define TRACKER_STORE_QUERY_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_STORE_TYPE_QUERY_TASK, TrackerStoreQueryTask))
#define TRACKER_STORE_QUERY_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_STORE_TYPE_QUERY_TASK, TrackerStoreQueryTaskClass))
#define TRACKER_STORE_IS_QUERY_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_STORE_TYPE_QUERY_TASK))
#define TRACKER_STORE_IS_QUERY_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_STORE_TYPE_QUERY_TASK))
#define TRACKER_STORE_QUERY_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_STORE_TYPE_QUERY_TASK, TrackerStoreQueryTaskClass))

typedef struct _TrackerStoreQueryTask TrackerStoreQueryTask;
typedef struct _TrackerStoreQueryTaskClass TrackerStoreQueryTaskClass;
typedef struct _Block7Data Block7Data;
typedef struct _TrackerStoreTaskPrivate TrackerStoreTaskPrivate;
typedef struct _TrackerStoreQueryTaskPrivate TrackerStoreQueryTaskPrivate;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TRACKER_STORE_TYPE_UPDATE_TASK (tracker_store_update_task_get_type ())
#define TRACKER_STORE_UPDATE_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_STORE_TYPE_UPDATE_TASK, TrackerStoreUpdateTask))
#define TRACKER_STORE_UPDATE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_STORE_TYPE_UPDATE_TASK, TrackerStoreUpdateTaskClass))
#define TRACKER_STORE_IS_UPDATE_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_STORE_TYPE_UPDATE_TASK))
#define TRACKER_STORE_IS_UPDATE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_STORE_TYPE_UPDATE_TASK))
#define TRACKER_STORE_UPDATE_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_STORE_TYPE_UPDATE_TASK, TrackerStoreUpdateTaskClass))

typedef struct _TrackerStoreUpdateTask TrackerStoreUpdateTask;
typedef struct _TrackerStoreUpdateTaskClass TrackerStoreUpdateTaskClass;
typedef struct _TrackerStoreUpdateTaskPrivate TrackerStoreUpdateTaskPrivate;
typedef struct _Block8Data Block8Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

#define TRACKER_STORE_TYPE_TURTLE_TASK (tracker_store_turtle_task_get_type ())
#define TRACKER_STORE_TURTLE_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_STORE_TYPE_TURTLE_TASK, TrackerStoreTurtleTask))
#define TRACKER_STORE_TURTLE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_STORE_TYPE_TURTLE_TASK, TrackerStoreTurtleTaskClass))
#define TRACKER_STORE_IS_TURTLE_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_STORE_TYPE_TURTLE_TASK))
#define TRACKER_STORE_IS_TURTLE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_STORE_TYPE_TURTLE_TASK))
#define TRACKER_STORE_TURTLE_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_STORE_TYPE_TURTLE_TASK, TrackerStoreTurtleTaskClass))

typedef struct _TrackerStoreTurtleTask TrackerStoreTurtleTask;
typedef struct _TrackerStoreTurtleTaskClass TrackerStoreTurtleTaskClass;
typedef struct _TrackerStoreTurtleTaskPrivate TrackerStoreTurtleTaskPrivate;
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_queue_free0(var) ((var == NULL) ? NULL : (var = (g_queue_free (var), NULL)))
#define _g_thread_pool_free0(var) ((var == NULL) ? NULL : (var = (g_thread_pool_free (var, FALSE, TRUE), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _TrackerStoreSparqlQueryData TrackerStoreSparqlQueryData;
typedef struct _TrackerStoreSparqlUpdateData TrackerStoreSparqlUpdateData;
typedef struct _TrackerStoreSparqlUpdateBlankData TrackerStoreSparqlUpdateBlankData;
typedef struct _TrackerStoreQueueTurtleImportData TrackerStoreQueueTurtleImportData;
typedef struct _TrackerStorePauseData TrackerStorePauseData;
typedef struct _TrackerStoreParamSpecTask TrackerStoreParamSpecTask;
typedef struct _TrackerParamSpecStore TrackerParamSpecStore;

struct _TrackerStore {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TrackerStorePrivate * priv;
};

struct _TrackerStoreClass {
	GTypeClass parent_class;
	void (*finalize) (TrackerStore *self);
};

typedef enum  {
	TRACKER_STORE_PRIORITY_HIGH,
	TRACKER_STORE_PRIORITY_LOW,
	TRACKER_STORE_PRIORITY_TURTLE,
	TRACKER_STORE_PRIORITY_N_PRIORITIES
} TrackerStorePriority;

typedef enum  {
	TRACKER_STORE_TASK_TYPE_QUERY,
	TRACKER_STORE_TASK_TYPE_UPDATE,
	TRACKER_STORE_TASK_TYPE_UPDATE_BLANK,
	TRACKER_STORE_TASK_TYPE_TURTLE
} TrackerStoreTaskType;

struct _Block7Data {
	int _ref_count_;
	TrackerStoreQueryTask* query_task;
};

struct _TrackerStoreTask {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TrackerStoreTaskPrivate * priv;
	TrackerStoreTaskType type;
	gchar* client_id;
	GError* error;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
};

struct _TrackerStoreTaskClass {
	GTypeClass parent_class;
	void (*finalize) (TrackerStoreTask *self);
};

typedef void (*TrackerStoreSparqlQueryInThread) (TrackerDBCursor* cursor, void* user_data, GError** error);
struct _TrackerStoreQueryTask {
	TrackerStoreTask parent_instance;
	TrackerStoreQueryTaskPrivate * priv;
	gchar* query;
	GCancellable* cancellable;
	guint watchdog_id;
	TrackerStoreSparqlQueryInThread in_thread;
	gpointer in_thread_target;
	GDestroyNotify in_thread_target_destroy_notify;
};

struct _TrackerStoreQueryTaskClass {
	TrackerStoreTaskClass parent_class;
};

struct _TrackerStoreUpdateTask {
	TrackerStoreTask parent_instance;
	TrackerStoreUpdateTaskPrivate * priv;
	gchar* query;
	GVariant* blank_nodes;
	TrackerStorePriority priority;
};

struct _TrackerStoreUpdateTaskClass {
	TrackerStoreTaskClass parent_class;
};

struct _Block8Data {
	int _ref_count_;
	TrackerStoreTask* task;
};

struct _TrackerStoreTurtleTask {
	TrackerStoreTask parent_instance;
	TrackerStoreTurtleTaskPrivate * priv;
	gchar* path;
};

struct _TrackerStoreTurtleTaskClass {
	TrackerStoreTaskClass parent_class;
};

struct _TrackerStoreSparqlQueryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	gchar* sparql;
	TrackerStorePriority priority;
	TrackerStoreSparqlQueryInThread in_thread;
	gpointer in_thread_target;
	GDestroyNotify in_thread_target_destroy_notify;
	gchar* client_id;
	TrackerStoreQueryTask* _tmp0_;
	TrackerStoreQueryTask* task;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	TrackerStoreSparqlQueryInThread _tmp3_;
	gchar* _tmp4_;
	TrackerStoreTask* _tmp5_;
	GError* _tmp6_;
	GError * _inner_error_;
};

struct _TrackerStoreSparqlUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	gchar* sparql;
	TrackerStorePriority priority;
	gchar* client_id;
	TrackerStoreUpdateTask* _tmp0_;
	TrackerStoreUpdateTask* task;
	gchar* _tmp1_;
	gchar* _tmp2_;
	TrackerStoreTask* _tmp3_;
	GError* _tmp4_;
	GError * _inner_error_;
};

struct _TrackerStoreSparqlUpdateBlankData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	gchar* sparql;
	TrackerStorePriority priority;
	gchar* client_id;
	GVariant* result;
	TrackerStoreUpdateTask* _tmp0_;
	TrackerStoreUpdateTask* task;
	gchar* _tmp1_;
	gchar* _tmp2_;
	TrackerStoreTask* _tmp3_;
	GError* _tmp4_;
	GVariant* _tmp5_;
	GError * _inner_error_;
};

struct _TrackerStoreQueueTurtleImportData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	GFile* file;
	gchar* client_id;
	TrackerStoreTurtleTask* _tmp0_;
	TrackerStoreTurtleTask* task;
	gchar* _tmp1_;
	gchar* _tmp2_;
	TrackerStoreTask* _tmp3_;
	GError* _tmp4_;
	GError * _inner_error_;
};

struct _TrackerStorePauseData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	gboolean _tmp0_;
	gint _tmp1_;
	GThreadPool* _tmp2_;
	GThreadPool* _tmp3_;
	GError * e;
	GError * _inner_error_;
};

struct _TrackerStoreParamSpecTask {
	GParamSpec parent_instance;
};

struct _TrackerParamSpecStore {
	GParamSpec parent_instance;
};


static gpointer tracker_store_parent_class = NULL;
static GQueue* tracker_store_query_queues[3];
static GQueue* tracker_store_query_queues[3] = {0};
static GQueue* tracker_store_update_queues[3];
static GQueue* tracker_store_update_queues[3] = {0};
static gint tracker_store_n_queries_running;
static gint tracker_store_n_queries_running = 0;
static gboolean tracker_store_update_running;
static gboolean tracker_store_update_running = FALSE;
static GThreadPool* tracker_store_update_pool;
static GThreadPool* tracker_store_update_pool = NULL;
static GThreadPool* tracker_store_query_pool;
static GThreadPool* tracker_store_query_pool = NULL;
static GThreadPool* tracker_store_checkpoint_pool;
static GThreadPool* tracker_store_checkpoint_pool = NULL;
static GPtrArray* tracker_store_running_tasks;
static GPtrArray* tracker_store_running_tasks = NULL;
static gint tracker_store_max_task_time;
static gint tracker_store_max_task_time = 0;
static gboolean tracker_store_active;
static gboolean tracker_store_active = FALSE;
static GSourceFunc tracker_store_active_callback;
static gpointer tracker_store_active_callback_target;
static GDestroyNotify tracker_store_active_callback_target_destroy_notify;
static GSourceFunc tracker_store_active_callback = NULL;
static gpointer tracker_store_active_callback_target = NULL;
static GDestroyNotify tracker_store_active_callback_target_destroy_notify = NULL;
static gint tracker_store_checkpointing;
static gint tracker_store_checkpointing = 0;
static gpointer tracker_store_task_parent_class = NULL;
static gpointer tracker_store_query_task_parent_class = NULL;
static gpointer tracker_store_update_task_parent_class = NULL;
static gpointer tracker_store_turtle_task_parent_class = NULL;

gpointer tracker_store_ref (gpointer instance);
void tracker_store_unref (gpointer instance);
GParamSpec* tracker_param_spec_store (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void tracker_value_set_store (GValue* value, gpointer v_object);
void tracker_value_take_store (GValue* value, gpointer v_object);
gpointer tracker_value_get_store (const GValue* value);
GType tracker_store_get_type (void) G_GNUC_CONST;
enum  {
	TRACKER_STORE_DUMMY_PROPERTY
};
GType tracker_store_priority_get_type (void) G_GNUC_CONST;
static GType tracker_store_task_type_get_type (void) G_GNUC_UNUSED;
static gpointer tracker_store_task_ref (gpointer instance);
static void tracker_store_task_unref (gpointer instance);
static GParamSpec* tracker_store_param_spec_task (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED;
static void tracker_store_value_set_task (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static void tracker_store_value_take_task (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static gpointer tracker_store_value_get_task (const GValue* value) G_GNUC_UNUSED;
static GType tracker_store_task_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
#define TRACKER_STORE_MAX_CONCURRENT_QUERIES 2
#define TRACKER_STORE_MAX_TASK_TIME 30
static void tracker_store_sched (void);
static GType tracker_store_query_task_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (Block7Data* _data7_);
static gboolean _lambda0_ (Block7Data* _data7_);
static gboolean __lambda0__gsource_func (gpointer self);
static TrackerDataCommitType tracker_store_commit_type (TrackerStoreTask* task);
static GType tracker_store_update_task_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static gboolean tracker_store_task_finish_cb (TrackerStoreTask* task);
static void tracker_store_pool_dispatch_cb (TrackerStoreTask* task);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (Block8Data* _data8_);
static void tracker_store_wal_hook (gint n_pages);
static void _tracker_store_wal_hook_tracker_db_wal_callback (gint n_pages);
static GType tracker_store_turtle_task_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static gboolean _lambda1_ (Block8Data* _data8_);
static gboolean __lambda1__gsource_func (gpointer self);
void tracker_store_wal_checkpoint (void);
static void tracker_store_checkpoint_dispatch_cb (gboolean task);
void tracker_store_init (void);
static void _tracker_store_task_unref0_ (gpointer var);
static void _tracker_store_pool_dispatch_cb_gfunc (gconstpointer data, gpointer self);
static void _tracker_store_checkpoint_dispatch_cb_gfunc (gconstpointer data, gpointer self);
void tracker_store_shutdown (void);
static void tracker_store_sparql_query_data_free (gpointer _data);
void tracker_store_sparql_query (const gchar* sparql, TrackerStorePriority priority, TrackerStoreSparqlQueryInThread in_thread, void* in_thread_target, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
void tracker_store_sparql_query_finish (GAsyncResult* _res_, GError** error);
static gboolean tracker_store_sparql_query_co (TrackerStoreSparqlQueryData* data);
static TrackerStoreQueryTask* tracker_store_query_task_new (void);
static TrackerStoreQueryTask* tracker_store_query_task_construct (GType object_type);
static gboolean _tracker_store_sparql_query_co_gsource_func (gpointer self);
static void tracker_store_sparql_update_data_free (gpointer _data);
void tracker_store_sparql_update (const gchar* sparql, TrackerStorePriority priority, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
void tracker_store_sparql_update_finish (GAsyncResult* _res_, GError** error);
static gboolean tracker_store_sparql_update_co (TrackerStoreSparqlUpdateData* data);
static TrackerStoreUpdateTask* tracker_store_update_task_new (void);
static TrackerStoreUpdateTask* tracker_store_update_task_construct (GType object_type);
static gboolean _tracker_store_sparql_update_co_gsource_func (gpointer self);
static void tracker_store_sparql_update_blank_data_free (gpointer _data);
void tracker_store_sparql_update_blank (const gchar* sparql, TrackerStorePriority priority, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
GVariant* tracker_store_sparql_update_blank_finish (GAsyncResult* _res_, GError** error);
static gboolean tracker_store_sparql_update_blank_co (TrackerStoreSparqlUpdateBlankData* data);
static gboolean _tracker_store_sparql_update_blank_co_gsource_func (gpointer self);
static void tracker_store_queue_turtle_import_data_free (gpointer _data);
void tracker_store_queue_turtle_import (GFile* file, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
void tracker_store_queue_turtle_import_finish (GAsyncResult* _res_, GError** error);
static gboolean tracker_store_queue_turtle_import_co (TrackerStoreQueueTurtleImportData* data);
static TrackerStoreTurtleTask* tracker_store_turtle_task_new (void);
static TrackerStoreTurtleTask* tracker_store_turtle_task_construct (GType object_type);
static gboolean _tracker_store_queue_turtle_import_co_gsource_func (gpointer self);
guint tracker_store_get_queue_size (TrackerStore* self);
void tracker_store_unreg_batches (const gchar* client_id);
static void tracker_store_pause_data_free (gpointer _data);
void tracker_store_pause (GAsyncReadyCallback _callback_, gpointer _user_data_);
void tracker_store_pause_finish (GAsyncResult* _res_);
static gboolean tracker_store_pause_co (TrackerStorePauseData* data);
static gboolean _tracker_store_pause_co_gsource_func (gpointer self);
void tracker_store_resume (void);
TrackerStore* tracker_store_new (void);
TrackerStore* tracker_store_construct (GType object_type);
enum  {
	TRACKER_STORE_TASK_DUMMY_PROPERTY
};
static TrackerStoreTask* tracker_store_task_construct (GType object_type);
static void tracker_store_task_finalize (TrackerStoreTask* obj);
enum  {
	TRACKER_STORE_QUERY_TASK_DUMMY_PROPERTY
};
static void tracker_store_query_task_finalize (TrackerStoreTask* obj);
enum  {
	TRACKER_STORE_UPDATE_TASK_DUMMY_PROPERTY
};
static void tracker_store_update_task_finalize (TrackerStoreTask* obj);
enum  {
	TRACKER_STORE_TURTLE_TASK_DUMMY_PROPERTY
};
static void tracker_store_turtle_task_finalize (TrackerStoreTask* obj);
static void tracker_store_finalize (TrackerStore* obj);


GType tracker_store_priority_get_type (void) {
	static volatile gsize tracker_store_priority_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_priority_type_id__volatile)) {
		static const GEnumValue values[] = {{TRACKER_STORE_PRIORITY_HIGH, "TRACKER_STORE_PRIORITY_HIGH", "high"}, {TRACKER_STORE_PRIORITY_LOW, "TRACKER_STORE_PRIORITY_LOW", "low"}, {TRACKER_STORE_PRIORITY_TURTLE, "TRACKER_STORE_PRIORITY_TURTLE", "turtle"}, {TRACKER_STORE_PRIORITY_N_PRIORITIES, "TRACKER_STORE_PRIORITY_N_PRIORITIES", "n-priorities"}, {0, NULL, NULL}};
		GType tracker_store_priority_type_id;
		tracker_store_priority_type_id = g_enum_register_static ("TrackerStorePriority", values);
		g_once_init_leave (&tracker_store_priority_type_id__volatile, tracker_store_priority_type_id);
	}
	return tracker_store_priority_type_id__volatile;
}


static GType tracker_store_task_type_get_type (void) {
	static volatile gsize tracker_store_task_type_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_task_type_type_id__volatile)) {
		static const GEnumValue values[] = {{TRACKER_STORE_TASK_TYPE_QUERY, "TRACKER_STORE_TASK_TYPE_QUERY", "query"}, {TRACKER_STORE_TASK_TYPE_UPDATE, "TRACKER_STORE_TASK_TYPE_UPDATE", "update"}, {TRACKER_STORE_TASK_TYPE_UPDATE_BLANK, "TRACKER_STORE_TASK_TYPE_UPDATE_BLANK", "update-blank"}, {TRACKER_STORE_TASK_TYPE_TURTLE, "TRACKER_STORE_TASK_TYPE_TURTLE", "turtle"}, {0, NULL, NULL}};
		GType tracker_store_task_type_type_id;
		tracker_store_task_type_type_id = g_enum_register_static ("TrackerStoreTaskType", values);
		g_once_init_leave (&tracker_store_task_type_type_id__volatile, tracker_store_task_type_type_id);
	}
	return tracker_store_task_type_type_id__volatile;
}


static gpointer _tracker_store_task_ref0 (gpointer self) {
	return self ? tracker_store_task_ref (self) : NULL;
}


static Block7Data* block7_data_ref (Block7Data* _data7_) {
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}


static void block7_data_unref (Block7Data* _data7_) {
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		_tracker_store_task_unref0 (_data7_->query_task);
		g_slice_free (Block7Data, _data7_);
	}
}


static gboolean _lambda0_ (Block7Data* _data7_) {
	gboolean result = FALSE;
	g_cancellable_cancel (_data7_->query_task->cancellable);
	result = FALSE;
	return result;
}


static gboolean __lambda0__gsource_func (gpointer self) {
	gboolean result;
	result = _lambda0_ (self);
	return result;
}


static void tracker_store_sched (void) {
	TrackerStoreTask* task;
	GError * _inner_error_ = NULL;
	task = NULL;
	if (!tracker_store_active) {
		_tracker_store_task_unref0 (task);
		return;
	}
	while (TRUE) {
		TrackerStoreTask* _tmp2_;
		if (!(tracker_store_n_queries_running < TRACKER_STORE_MAX_CONCURRENT_QUERIES)) {
			break;
		}
		{
			gint i;
			i = 0;
			{
				gboolean _tmp0_;
				_tmp0_ = TRUE;
				while (TRUE) {
					gpointer _tmp1_ = NULL;
					if (!_tmp0_) {
						i++;
					}
					_tmp0_ = FALSE;
					if (!(i < TRACKER_STORE_PRIORITY_N_PRIORITIES)) {
						break;
					}
					_tmp1_ = g_queue_pop_head (tracker_store_query_queues[i]);
					_tracker_store_task_unref0 (task);
					task = (TrackerStoreTask*) _tmp1_;
					if (task != NULL) {
						break;
					}
				}
			}
		}
		if (task == NULL) {
			break;
		}
		_tmp2_ = _tracker_store_task_ref0 (task);
		g_ptr_array_add (tracker_store_running_tasks, _tmp2_);
		if (tracker_store_max_task_time != 0) {
			Block7Data* _data7_;
			TrackerStoreQueryTask* _tmp3_;
			guint _tmp4_;
			_data7_ = g_slice_new0 (Block7Data);
			_data7_->_ref_count_ = 1;
			_tmp3_ = _tracker_store_task_ref0 (TRACKER_STORE_QUERY_TASK (task));
			_data7_->query_task = _tmp3_;
			_tmp4_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) tracker_store_max_task_time, __lambda0__gsource_func, block7_data_ref (_data7_), block7_data_unref);
			_data7_->query_task->watchdog_id = _tmp4_;
			block7_data_unref (_data7_);
			_data7_ = NULL;
		}
		tracker_store_n_queries_running++;
		g_thread_pool_push (tracker_store_query_pool, task, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch18_g_error;
		}
		goto __finally18;
		__catch18_g_error:
		{
			GError * e;
			e = _inner_error_;
			_inner_error_ = NULL;
			_g_error_free0 (e);
		}
		__finally18:
		if (_inner_error_ != NULL) {
			_tracker_store_task_unref0 (task);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	if (!tracker_store_update_running) {
		{
			gint i;
			i = 0;
			{
				gboolean _tmp5_;
				_tmp5_ = TRUE;
				while (TRUE) {
					gpointer _tmp6_ = NULL;
					if (!_tmp5_) {
						i++;
					}
					_tmp5_ = FALSE;
					if (!(i < TRACKER_STORE_PRIORITY_N_PRIORITIES)) {
						break;
					}
					_tmp6_ = g_queue_pop_head (tracker_store_update_queues[i]);
					_tracker_store_task_unref0 (task);
					task = (TrackerStoreTask*) _tmp6_;
					if (task != NULL) {
						break;
					}
				}
			}
		}
		if (task != NULL) {
			tracker_store_update_running = TRUE;
			g_thread_pool_push (tracker_store_update_pool, task, &_inner_error_);
			if (_inner_error_ != NULL) {
				goto __catch19_g_error;
			}
			goto __finally19;
			__catch19_g_error:
			{
				GError * e;
				e = _inner_error_;
				_inner_error_ = NULL;
				_g_error_free0 (e);
			}
			__finally19:
			if (_inner_error_ != NULL) {
				_tracker_store_task_unref0 (task);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
		}
	}
	_tracker_store_task_unref0 (task);
}


static TrackerDataCommitType tracker_store_commit_type (TrackerStoreTask* task) {
	TrackerDataCommitType result = 0;
	g_return_val_if_fail (task != NULL, 0);
	switch (task->type) {
		case TRACKER_STORE_TASK_TYPE_UPDATE:
		case TRACKER_STORE_TASK_TYPE_UPDATE_BLANK:
		{
			if (TRACKER_STORE_UPDATE_TASK (task)->priority == TRACKER_STORE_PRIORITY_HIGH) {
				result = TRACKER_DATA_COMMIT_REGULAR;
				return result;
			} else {
				guint _tmp0_;
				_tmp0_ = g_queue_get_length (tracker_store_update_queues[TRACKER_STORE_PRIORITY_LOW]);
				if (_tmp0_ > 0) {
					result = TRACKER_DATA_COMMIT_BATCH;
					return result;
				} else {
					result = TRACKER_DATA_COMMIT_BATCH_LAST;
					return result;
				}
			}
		}
		case TRACKER_STORE_TASK_TYPE_TURTLE:
		{
			guint _tmp1_;
			_tmp1_ = g_queue_get_length (tracker_store_update_queues[TRACKER_STORE_PRIORITY_TURTLE]);
			if (_tmp1_ > 0) {
				result = TRACKER_DATA_COMMIT_BATCH;
				return result;
			} else {
				result = TRACKER_DATA_COMMIT_BATCH_LAST;
				return result;
			}
		}
		default:
		{
			g_warn_if_reached ();
			result = TRACKER_DATA_COMMIT_REGULAR;
			return result;
		}
	}
}


static gpointer _g_error_copy0 (gpointer self) {
	return self ? g_error_copy (self) : NULL;
}


static gboolean tracker_store_task_finish_cb (TrackerStoreTask* task) {
	gboolean result = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (task != NULL, FALSE);
	if (task->type == TRACKER_STORE_TASK_TYPE_QUERY) {
		TrackerStoreQueryTask* _tmp0_;
		TrackerStoreQueryTask* query_task;
		_tmp0_ = _tracker_store_task_ref0 (TRACKER_STORE_QUERY_TASK (task));
		query_task = _tmp0_;
		if (task->error == NULL) {
			g_cancellable_set_error_if_cancelled (query_task->cancellable, &_inner_error_);
			if (_inner_error_ != NULL) {
				goto __catch20_g_error;
			}
			goto __finally20;
			__catch20_g_error:
			{
				GError * e;
				GError* _tmp1_;
				e = _inner_error_;
				_inner_error_ = NULL;
				_tmp1_ = _g_error_copy0 (e);
				_g_error_free0 (task->error);
				task->error = _tmp1_;
				_g_error_free0 (e);
			}
			__finally20:
			if (_inner_error_ != NULL) {
				_tracker_store_task_unref0 (query_task);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return FALSE;
			}
		}
		task->callback (task->callback_target);
		_g_error_free0 (task->error);
		task->error = NULL;
		g_ptr_array_remove (tracker_store_running_tasks, task);
		tracker_store_n_queries_running--;
		_tracker_store_task_unref0 (query_task);
	} else {
		gboolean _tmp2_ = FALSE;
		if (task->type == TRACKER_STORE_TASK_TYPE_UPDATE) {
			_tmp2_ = TRUE;
		} else {
			_tmp2_ = task->type == TRACKER_STORE_TASK_TYPE_UPDATE_BLANK;
		}
		if (_tmp2_) {
			if (task->error == NULL) {
				TrackerDataCommitType _tmp3_;
				_tmp3_ = tracker_store_commit_type (task);
				tracker_data_notify_transaction (_tmp3_);
			}
			task->callback (task->callback_target);
			_g_error_free0 (task->error);
			task->error = NULL;
			tracker_store_update_running = FALSE;
		} else {
			if (task->type == TRACKER_STORE_TASK_TYPE_TURTLE) {
				if (task->error == NULL) {
					TrackerDataCommitType _tmp4_;
					_tmp4_ = tracker_store_commit_type (task);
					tracker_data_notify_transaction (_tmp4_);
				}
				task->callback (task->callback_target);
				_g_error_free0 (task->error);
				task->error = NULL;
				tracker_store_update_running = FALSE;
			}
		}
	}
	if (tracker_store_n_queries_running == 0) {
		_tmp6_ = !tracker_store_update_running;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		_tmp5_ = tracker_store_active_callback != NULL;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		tracker_store_active_callback (tracker_store_active_callback_target);
	}
	tracker_store_sched ();
	result = FALSE;
	return result;
}


static Block8Data* block8_data_ref (Block8Data* _data8_) {
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}


static void block8_data_unref (Block8Data* _data8_) {
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		_tracker_store_task_unref0 (_data8_->task);
		g_slice_free (Block8Data, _data8_);
	}
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _tracker_store_wal_hook_tracker_db_wal_callback (gint n_pages) {
	tracker_store_wal_hook (n_pages);
}


static gboolean _lambda1_ (Block8Data* _data8_) {
	gboolean result = FALSE;
	tracker_store_task_finish_cb (_data8_->task);
	result = FALSE;
	return result;
}


static gboolean __lambda1__gsource_func (gpointer self) {
	gboolean result;
	result = _lambda1_ (self);
	return result;
}


static void tracker_store_pool_dispatch_cb (TrackerStoreTask* task) {
	Block8Data* _data8_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (task != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->task = _tracker_store_task_ref0 (task);
	if (_data8_->task->type == TRACKER_STORE_TASK_TYPE_QUERY) {
		TrackerStoreQueryTask* _tmp0_;
		TrackerStoreQueryTask* query_task;
		TrackerDBCursor* _tmp1_ = NULL;
		TrackerDBCursor* cursor;
		_tmp0_ = _tracker_store_task_ref0 (TRACKER_STORE_QUERY_TASK (_data8_->task));
		query_task = _tmp0_;
		_tmp1_ = tracker_data_query_sparql_cursor (query_task->query, &_inner_error_);
		cursor = _tmp1_;
		if (_inner_error_ != NULL) {
			_tracker_store_task_unref0 (query_task);
			goto __catch21_g_error;
		}
		query_task->in_thread (cursor, query_task->in_thread_target, &_inner_error_);
		if (_inner_error_ != NULL) {
			_g_object_unref0 (cursor);
			_tracker_store_task_unref0 (query_task);
			goto __catch21_g_error;
		}
		_g_object_unref0 (cursor);
		_tracker_store_task_unref0 (query_task);
	} else {
		TrackerDBInterface* _tmp2_ = NULL;
		TrackerDBInterface* _tmp3_;
		TrackerDBInterface* iface;
		_tmp2_ = tracker_db_manager_get_db_interface ();
		_tmp3_ = _g_object_ref0 (_tmp2_);
		iface = _tmp3_;
		tracker_db_interface_sqlite_wal_hook (iface, _tracker_store_wal_hook_tracker_db_wal_callback);
		if (_data8_->task->type == TRACKER_STORE_TASK_TYPE_UPDATE) {
			TrackerStoreUpdateTask* _tmp4_;
			TrackerStoreUpdateTask* update_task;
			_tmp4_ = _tracker_store_task_ref0 (TRACKER_STORE_UPDATE_TASK (_data8_->task));
			update_task = _tmp4_;
			tracker_data_update_sparql (update_task->query, &_inner_error_);
			if (_inner_error_ != NULL) {
				_tracker_store_task_unref0 (update_task);
				_g_object_unref0 (iface);
				goto __catch21_g_error;
			}
			_tracker_store_task_unref0 (update_task);
		} else {
			if (_data8_->task->type == TRACKER_STORE_TASK_TYPE_UPDATE_BLANK) {
				TrackerStoreUpdateTask* _tmp5_;
				TrackerStoreUpdateTask* update_task;
				GVariant* _tmp6_ = NULL;
				GVariant* _tmp7_;
				_tmp5_ = _tracker_store_task_ref0 (TRACKER_STORE_UPDATE_TASK (_data8_->task));
				update_task = _tmp5_;
				_tmp6_ = tracker_data_update_sparql_blank (update_task->query, &_inner_error_);
				_tmp7_ = _tmp6_;
				if (_inner_error_ != NULL) {
					_tracker_store_task_unref0 (update_task);
					_g_object_unref0 (iface);
					goto __catch21_g_error;
				}
				_g_variant_unref0 (update_task->blank_nodes);
				update_task->blank_nodes = _tmp7_;
				_tracker_store_task_unref0 (update_task);
			} else {
				if (_data8_->task->type == TRACKER_STORE_TASK_TYPE_TURTLE) {
					TrackerStoreTurtleTask* _tmp8_;
					TrackerStoreTurtleTask* turtle_task;
					GFile* _tmp9_ = NULL;
					GFile* file;
					_tmp8_ = _tracker_store_task_ref0 (TRACKER_STORE_TURTLE_TASK (_data8_->task));
					turtle_task = _tmp8_;
					_tmp9_ = g_file_new_for_path (turtle_task->path);
					file = _tmp9_;
					tracker_events_freeze ();
					tracker_data_load_turtle_file (file, &_inner_error_);
					if (_inner_error_ != NULL) {
						goto __finally22;
					}
					__finally22:
					tracker_events_reset_pending ();
					if (_inner_error_ != NULL) {
						_g_object_unref0 (file);
						_tracker_store_task_unref0 (turtle_task);
						_g_object_unref0 (iface);
						goto __catch21_g_error;
					}
					_g_object_unref0 (file);
					_tracker_store_task_unref0 (turtle_task);
				}
			}
		}
		_g_object_unref0 (iface);
	}
	goto __finally21;
	__catch21_g_error:
	{
		GError * e;
		GError* _tmp10_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp10_ = _g_error_copy0 (e);
		_g_error_free0 (_data8_->task->error);
		_data8_->task->error = _tmp10_;
		_g_error_free0 (e);
	}
	__finally21:
	if (_inner_error_ != NULL) {
		block8_data_unref (_data8_);
		_data8_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda1__gsource_func, block8_data_ref (_data8_), block8_data_unref);
	block8_data_unref (_data8_);
	_data8_ = NULL;
}


void tracker_store_wal_checkpoint (void) {
	TrackerDBInterface* _tmp0_ = NULL;
	TrackerDBInterface* _tmp1_;
	TrackerDBInterface* iface;
	GError * _inner_error_ = NULL;
	g_debug ("Checkpointing database...");
	_tmp0_ = tracker_db_manager_get_db_interface ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	iface = _tmp1_;
	tracker_db_interface_execute_query (iface, &_inner_error_, "PRAGMA wal_checkpoint");
	if (_inner_error_ != NULL) {
		_g_object_unref0 (iface);
		goto __catch23_g_error;
	}
	g_debug ("Checkpointing complete...");
	_g_object_unref0 (iface);
	goto __finally23;
	__catch23_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_warning ("%s", e->message);
		_g_error_free0 (e);
	}
	__finally23:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void tracker_store_wal_hook (gint n_pages) {
	GError * _inner_error_ = NULL;
	g_debug ("WAL: %d pages", n_pages);
	if (n_pages >= 10000) {
		tracker_store_wal_checkpoint ();
	} else {
		if (n_pages >= 1000) {
			gboolean _tmp0_;
			_tmp0_ = g_atomic_int_compare_and_exchange (&tracker_store_checkpointing, 0, 1);
			if (_tmp0_) {
				g_thread_pool_push (tracker_store_checkpoint_pool, GINT_TO_POINTER (TRUE), &_inner_error_);
				if (_inner_error_ != NULL) {
					goto __catch24_g_error;
				}
				goto __finally24;
				__catch24_g_error:
				{
					GError * e;
					e = _inner_error_;
					_inner_error_ = NULL;
					g_warning ("%s", e->message);
					g_atomic_int_set (&tracker_store_checkpointing, 0);
					_g_error_free0 (e);
				}
				__finally24:
				if (_inner_error_ != NULL) {
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
					g_clear_error (&_inner_error_);
					return;
				}
			}
		}
	}
}


static void tracker_store_checkpoint_dispatch_cb (gboolean task) {
	tracker_store_wal_checkpoint ();
	g_atomic_int_set (&tracker_store_checkpointing, 0);
}


static void _tracker_store_task_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (tracker_store_task_unref (var), NULL));
}


static void _tracker_store_pool_dispatch_cb_gfunc (gconstpointer data, gpointer self) {
	tracker_store_pool_dispatch_cb (data);
}


static void _tracker_store_checkpoint_dispatch_cb_gfunc (gconstpointer data, gpointer self) {
	tracker_store_checkpoint_dispatch_cb (data);
}


void tracker_store_init (void) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* max_task_time_env;
	GPtrArray* _tmp3_ = NULL;
	GThreadPool* _tmp9_ = NULL;
	GThreadPool* _tmp10_;
	GThreadPool* _tmp11_ = NULL;
	GThreadPool* _tmp12_;
	GThreadPool* _tmp13_ = NULL;
	GThreadPool* _tmp14_;
	GError * _inner_error_ = NULL;
	_tmp0_ = g_getenv ("TRACKER_STORE_MAX_TASK_TIME");
	_tmp1_ = g_strdup (_tmp0_);
	max_task_time_env = _tmp1_;
	if (max_task_time_env != NULL) {
		gint _tmp2_;
		_tmp2_ = atoi (max_task_time_env);
		tracker_store_max_task_time = _tmp2_;
	} else {
		tracker_store_max_task_time = TRACKER_STORE_MAX_TASK_TIME;
	}
	_tmp3_ = g_ptr_array_new_with_free_func (_tracker_store_task_unref0_);
	_g_ptr_array_unref0 (tracker_store_running_tasks);
	tracker_store_running_tasks = _tmp3_;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp4_;
			_tmp4_ = TRUE;
			while (TRUE) {
				GQueue* _tmp5_ = NULL;
				GQueue* _tmp6_;
				GQueue* _tmp7_ = NULL;
				GQueue* _tmp8_;
				if (!_tmp4_) {
					i++;
				}
				_tmp4_ = FALSE;
				if (!(i < TRACKER_STORE_PRIORITY_N_PRIORITIES)) {
					break;
				}
				_tmp5_ = g_queue_new ();
				_tmp6_ = _tmp5_;
				_g_queue_free0 (tracker_store_query_queues[i]);
				tracker_store_query_queues[i] = _tmp6_;
				_tmp7_ = g_queue_new ();
				_tmp8_ = _tmp7_;
				_g_queue_free0 (tracker_store_update_queues[i]);
				tracker_store_update_queues[i] = _tmp8_;
			}
		}
	}
	_tmp9_ = g_thread_pool_new (_tracker_store_pool_dispatch_cb_gfunc, NULL, 1, TRUE, &_inner_error_);
	_tmp10_ = _tmp9_;
	if (_inner_error_ != NULL) {
		goto __catch25_g_error;
	}
	_g_thread_pool_free0 (tracker_store_update_pool);
	tracker_store_update_pool = _tmp10_;
	_tmp11_ = g_thread_pool_new (_tracker_store_pool_dispatch_cb_gfunc, NULL, TRACKER_STORE_MAX_CONCURRENT_QUERIES, TRUE, &_inner_error_);
	_tmp12_ = _tmp11_;
	if (_inner_error_ != NULL) {
		goto __catch25_g_error;
	}
	_g_thread_pool_free0 (tracker_store_query_pool);
	tracker_store_query_pool = _tmp12_;
	_tmp13_ = g_thread_pool_new (_tracker_store_checkpoint_dispatch_cb_gfunc, NULL, 1, TRUE, &_inner_error_);
	_tmp14_ = _tmp13_;
	if (_inner_error_ != NULL) {
		goto __catch25_g_error;
	}
	_g_thread_pool_free0 (tracker_store_checkpoint_pool);
	tracker_store_checkpoint_pool = _tmp14_;
	goto __finally25;
	__catch25_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_warning ("%s", e->message);
		_g_error_free0 (e);
	}
	__finally25:
	if (_inner_error_ != NULL) {
		_g_free0 (max_task_time_env);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	g_thread_pool_set_max_idle_time ((guint) (15 * 1000));
	g_thread_pool_set_max_unused_threads (2);
	_g_free0 (max_task_time_env);
}


void tracker_store_shutdown (void) {
	_g_thread_pool_free0 (tracker_store_query_pool);
	tracker_store_query_pool = NULL;
	_g_thread_pool_free0 (tracker_store_update_pool);
	tracker_store_update_pool = NULL;
	_g_thread_pool_free0 (tracker_store_checkpoint_pool);
	tracker_store_checkpoint_pool = NULL;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				GQueue* _tmp1_;
				GQueue* _tmp2_;
				if (!_tmp0_) {
					i++;
				}
				_tmp0_ = FALSE;
				if (!(i < TRACKER_STORE_PRIORITY_N_PRIORITIES)) {
					break;
				}
				_tmp1_ = NULL;
				_g_queue_free0 (tracker_store_query_queues[i]);
				tracker_store_query_queues[i] = _tmp1_;
				_tmp2_ = NULL;
				_g_queue_free0 (tracker_store_update_queues[i]);
				tracker_store_update_queues[i] = _tmp2_;
			}
		}
	}
}


static void tracker_store_sparql_query_data_free (gpointer _data) {
	TrackerStoreSparqlQueryData* data;
	data = _data;
	_g_free0 (data->sparql);
	_g_free0 (data->client_id);
	g_slice_free (TrackerStoreSparqlQueryData, data);
}


void tracker_store_sparql_query (const gchar* sparql, TrackerStorePriority priority, TrackerStoreSparqlQueryInThread in_thread, void* in_thread_target, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrackerStoreSparqlQueryData* _data_;
	_data_ = g_slice_new0 (TrackerStoreSparqlQueryData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, tracker_store_sparql_query);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_store_sparql_query_data_free);
	_data_->sparql = g_strdup (sparql);
	_data_->priority = priority;
	_data_->in_thread = in_thread;
	_data_->in_thread_target = in_thread_target;
	_data_->client_id = g_strdup (client_id);
	tracker_store_sparql_query_co (_data_);
}


void tracker_store_sparql_query_finish (GAsyncResult* _res_, GError** error) {
	TrackerStoreSparqlQueryData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean _tracker_store_sparql_query_co_gsource_func (gpointer self) {
	gboolean result;
	result = tracker_store_sparql_query_co (self);
	return result;
}


static gboolean tracker_store_sparql_query_co (TrackerStoreSparqlQueryData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = tracker_store_query_task_new ();
	data->task = data->_tmp0_;
	((TrackerStoreTask*) data->task)->type = TRACKER_STORE_TASK_TYPE_QUERY;
	data->_tmp1_ = g_strdup (data->sparql);
	_g_free0 (data->task->query);
	data->task->query = data->_tmp1_;
	data->_tmp2_ = NULL;
	data->_tmp2_ = g_cancellable_new ();
	_g_object_unref0 (data->task->cancellable);
	data->task->cancellable = data->_tmp2_;
	data->_tmp3_ = data->in_thread;
	(data->task->in_thread_target_destroy_notify == NULL) ? NULL : (data->task->in_thread_target_destroy_notify (data->task->in_thread_target), NULL);
	data->task->in_thread = NULL;
	data->task->in_thread_target = NULL;
	data->task->in_thread_target_destroy_notify = NULL;
	data->task->in_thread = data->_tmp3_;
	data->task->in_thread_target = data->in_thread_target;
	data->task->in_thread_target_destroy_notify = NULL;
	(((TrackerStoreTask*) data->task)->callback_target_destroy_notify == NULL) ? NULL : (((TrackerStoreTask*) data->task)->callback_target_destroy_notify (((TrackerStoreTask*) data->task)->callback_target), NULL);
	((TrackerStoreTask*) data->task)->callback = NULL;
	((TrackerStoreTask*) data->task)->callback_target = NULL;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	((TrackerStoreTask*) data->task)->callback = _tracker_store_sparql_query_co_gsource_func;
	((TrackerStoreTask*) data->task)->callback_target = data;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	data->_tmp4_ = g_strdup (data->client_id);
	_g_free0 (((TrackerStoreTask*) data->task)->client_id);
	((TrackerStoreTask*) data->task)->client_id = data->_tmp4_;
	data->_tmp5_ = _tracker_store_task_ref0 ((TrackerStoreTask*) data->task);
	g_queue_push_tail (tracker_store_query_queues[data->priority], data->_tmp5_);
	tracker_store_sched ();
	data->_state_ = 1;
	return FALSE;
	_state_1:
	;
	if (((TrackerStoreTask*) data->task)->error != NULL) {
		data->_tmp6_ = _g_error_copy0 (((TrackerStoreTask*) data->task)->error);
		data->_inner_error_ = data->_tmp6_;
		g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
		g_error_free (data->_inner_error_);
		_tracker_store_task_unref0 (data->task);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	_tracker_store_task_unref0 (data->task);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void tracker_store_sparql_update_data_free (gpointer _data) {
	TrackerStoreSparqlUpdateData* data;
	data = _data;
	_g_free0 (data->sparql);
	_g_free0 (data->client_id);
	g_slice_free (TrackerStoreSparqlUpdateData, data);
}


void tracker_store_sparql_update (const gchar* sparql, TrackerStorePriority priority, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrackerStoreSparqlUpdateData* _data_;
	_data_ = g_slice_new0 (TrackerStoreSparqlUpdateData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, tracker_store_sparql_update);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_store_sparql_update_data_free);
	_data_->sparql = g_strdup (sparql);
	_data_->priority = priority;
	_data_->client_id = g_strdup (client_id);
	tracker_store_sparql_update_co (_data_);
}


void tracker_store_sparql_update_finish (GAsyncResult* _res_, GError** error) {
	TrackerStoreSparqlUpdateData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean _tracker_store_sparql_update_co_gsource_func (gpointer self) {
	gboolean result;
	result = tracker_store_sparql_update_co (self);
	return result;
}


static gboolean tracker_store_sparql_update_co (TrackerStoreSparqlUpdateData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = tracker_store_update_task_new ();
	data->task = data->_tmp0_;
	((TrackerStoreTask*) data->task)->type = TRACKER_STORE_TASK_TYPE_UPDATE;
	data->_tmp1_ = g_strdup (data->sparql);
	_g_free0 (data->task->query);
	data->task->query = data->_tmp1_;
	data->task->priority = data->priority;
	(((TrackerStoreTask*) data->task)->callback_target_destroy_notify == NULL) ? NULL : (((TrackerStoreTask*) data->task)->callback_target_destroy_notify (((TrackerStoreTask*) data->task)->callback_target), NULL);
	((TrackerStoreTask*) data->task)->callback = NULL;
	((TrackerStoreTask*) data->task)->callback_target = NULL;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	((TrackerStoreTask*) data->task)->callback = _tracker_store_sparql_update_co_gsource_func;
	((TrackerStoreTask*) data->task)->callback_target = data;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	data->_tmp2_ = g_strdup (data->client_id);
	_g_free0 (((TrackerStoreTask*) data->task)->client_id);
	((TrackerStoreTask*) data->task)->client_id = data->_tmp2_;
	data->_tmp3_ = _tracker_store_task_ref0 ((TrackerStoreTask*) data->task);
	g_queue_push_tail (tracker_store_update_queues[data->priority], data->_tmp3_);
	tracker_store_sched ();
	data->_state_ = 1;
	return FALSE;
	_state_1:
	;
	if (((TrackerStoreTask*) data->task)->error != NULL) {
		data->_tmp4_ = _g_error_copy0 (((TrackerStoreTask*) data->task)->error);
		data->_inner_error_ = data->_tmp4_;
		g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
		g_error_free (data->_inner_error_);
		_tracker_store_task_unref0 (data->task);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	_tracker_store_task_unref0 (data->task);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void tracker_store_sparql_update_blank_data_free (gpointer _data) {
	TrackerStoreSparqlUpdateBlankData* data;
	data = _data;
	_g_free0 (data->sparql);
	_g_free0 (data->client_id);
	_g_variant_unref0 (data->result);
	g_slice_free (TrackerStoreSparqlUpdateBlankData, data);
}


void tracker_store_sparql_update_blank (const gchar* sparql, TrackerStorePriority priority, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrackerStoreSparqlUpdateBlankData* _data_;
	_data_ = g_slice_new0 (TrackerStoreSparqlUpdateBlankData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, tracker_store_sparql_update_blank);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_store_sparql_update_blank_data_free);
	_data_->sparql = g_strdup (sparql);
	_data_->priority = priority;
	_data_->client_id = g_strdup (client_id);
	tracker_store_sparql_update_blank_co (_data_);
}


GVariant* tracker_store_sparql_update_blank_finish (GAsyncResult* _res_, GError** error) {
	GVariant* result;
	TrackerStoreSparqlUpdateBlankData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static gboolean _tracker_store_sparql_update_blank_co_gsource_func (gpointer self) {
	gboolean result;
	result = tracker_store_sparql_update_blank_co (self);
	return result;
}


static gpointer _g_variant_ref0 (gpointer self) {
	return self ? g_variant_ref (self) : NULL;
}


static gboolean tracker_store_sparql_update_blank_co (TrackerStoreSparqlUpdateBlankData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = tracker_store_update_task_new ();
	data->task = data->_tmp0_;
	((TrackerStoreTask*) data->task)->type = TRACKER_STORE_TASK_TYPE_UPDATE_BLANK;
	data->_tmp1_ = g_strdup (data->sparql);
	_g_free0 (data->task->query);
	data->task->query = data->_tmp1_;
	data->task->priority = data->priority;
	(((TrackerStoreTask*) data->task)->callback_target_destroy_notify == NULL) ? NULL : (((TrackerStoreTask*) data->task)->callback_target_destroy_notify (((TrackerStoreTask*) data->task)->callback_target), NULL);
	((TrackerStoreTask*) data->task)->callback = NULL;
	((TrackerStoreTask*) data->task)->callback_target = NULL;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	((TrackerStoreTask*) data->task)->callback = _tracker_store_sparql_update_blank_co_gsource_func;
	((TrackerStoreTask*) data->task)->callback_target = data;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	data->_tmp2_ = g_strdup (data->client_id);
	_g_free0 (((TrackerStoreTask*) data->task)->client_id);
	((TrackerStoreTask*) data->task)->client_id = data->_tmp2_;
	data->_tmp3_ = _tracker_store_task_ref0 ((TrackerStoreTask*) data->task);
	g_queue_push_tail (tracker_store_update_queues[data->priority], data->_tmp3_);
	tracker_store_sched ();
	data->_state_ = 1;
	return FALSE;
	_state_1:
	;
	if (((TrackerStoreTask*) data->task)->error != NULL) {
		data->_tmp4_ = _g_error_copy0 (((TrackerStoreTask*) data->task)->error);
		data->_inner_error_ = data->_tmp4_;
		g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
		g_error_free (data->_inner_error_);
		_tracker_store_task_unref0 (data->task);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	data->_tmp5_ = _g_variant_ref0 (data->task->blank_nodes);
	data->result = data->_tmp5_;
	_tracker_store_task_unref0 (data->task);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
	_tracker_store_task_unref0 (data->task);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static void tracker_store_queue_turtle_import_data_free (gpointer _data) {
	TrackerStoreQueueTurtleImportData* data;
	data = _data;
	_g_object_unref0 (data->file);
	_g_free0 (data->client_id);
	g_slice_free (TrackerStoreQueueTurtleImportData, data);
}


void tracker_store_queue_turtle_import (GFile* file, const gchar* client_id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrackerStoreQueueTurtleImportData* _data_;
	_data_ = g_slice_new0 (TrackerStoreQueueTurtleImportData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, tracker_store_queue_turtle_import);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_store_queue_turtle_import_data_free);
	_data_->file = _g_object_ref0 (file);
	_data_->client_id = g_strdup (client_id);
	tracker_store_queue_turtle_import_co (_data_);
}


void tracker_store_queue_turtle_import_finish (GAsyncResult* _res_, GError** error) {
	TrackerStoreQueueTurtleImportData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean _tracker_store_queue_turtle_import_co_gsource_func (gpointer self) {
	gboolean result;
	result = tracker_store_queue_turtle_import_co (self);
	return result;
}


static gboolean tracker_store_queue_turtle_import_co (TrackerStoreQueueTurtleImportData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = NULL;
	data->_tmp0_ = tracker_store_turtle_task_new ();
	data->task = data->_tmp0_;
	((TrackerStoreTask*) data->task)->type = TRACKER_STORE_TASK_TYPE_TURTLE;
	data->_tmp1_ = NULL;
	data->_tmp1_ = g_file_get_path (data->file);
	_g_free0 (data->task->path);
	data->task->path = data->_tmp1_;
	(((TrackerStoreTask*) data->task)->callback_target_destroy_notify == NULL) ? NULL : (((TrackerStoreTask*) data->task)->callback_target_destroy_notify (((TrackerStoreTask*) data->task)->callback_target), NULL);
	((TrackerStoreTask*) data->task)->callback = NULL;
	((TrackerStoreTask*) data->task)->callback_target = NULL;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	((TrackerStoreTask*) data->task)->callback = _tracker_store_queue_turtle_import_co_gsource_func;
	((TrackerStoreTask*) data->task)->callback_target = data;
	((TrackerStoreTask*) data->task)->callback_target_destroy_notify = NULL;
	data->_tmp2_ = g_strdup (data->client_id);
	_g_free0 (((TrackerStoreTask*) data->task)->client_id);
	((TrackerStoreTask*) data->task)->client_id = data->_tmp2_;
	data->_tmp3_ = _tracker_store_task_ref0 ((TrackerStoreTask*) data->task);
	g_queue_push_tail (tracker_store_update_queues[TRACKER_STORE_PRIORITY_TURTLE], data->_tmp3_);
	tracker_store_sched ();
	data->_state_ = 1;
	return FALSE;
	_state_1:
	;
	if (((TrackerStoreTask*) data->task)->error != NULL) {
		data->_tmp4_ = _g_error_copy0 (((TrackerStoreTask*) data->task)->error);
		data->_inner_error_ = data->_tmp4_;
		g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
		g_error_free (data->_inner_error_);
		_tracker_store_task_unref0 (data->task);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	}
	_tracker_store_task_unref0 (data->task);
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


guint tracker_store_get_queue_size (TrackerStore* self) {
	guint result = 0U;
	guint _result_;
	g_return_val_if_fail (self != NULL, 0U);
	_result_ = (guint) 0;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				guint _tmp1_;
				guint _tmp2_;
				if (!_tmp0_) {
					i++;
				}
				_tmp0_ = FALSE;
				if (!(i < TRACKER_STORE_PRIORITY_N_PRIORITIES)) {
					break;
				}
				_tmp1_ = g_queue_get_length (tracker_store_query_queues[i]);
				_result_ = _result_ + _tmp1_;
				_tmp2_ = g_queue_get_length (tracker_store_update_queues[i]);
				_result_ = _result_ + _tmp2_;
			}
		}
	}
	result = _result_;
	return result;
}


static gint g_ptr_array_get_length (GPtrArray* self) {
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = (gint) self->len;
	return result;
}


static void g_ptr_array_set_length (GPtrArray* self, gint value) {
	g_return_if_fail (self != NULL);
	g_ptr_array_set_size (self, value);
}


void tracker_store_unreg_batches (const gchar* client_id) {
	GList* list = NULL;
	GList* cur = NULL;
	GQueue* queue = NULL;
	g_return_if_fail (client_id != NULL);
	{
		gint i;
		i = 0;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp1_;
				gconstpointer _tmp2_ = NULL;
				TrackerStoreTask* _tmp3_;
				TrackerStoreQueryTask* task;
				gboolean _tmp4_ = FALSE;
				gboolean _tmp5_ = FALSE;
				if (!_tmp0_) {
					i++;
				}
				_tmp0_ = FALSE;
				_tmp1_ = g_ptr_array_get_length (tracker_store_running_tasks);
				if (!(i < _tmp1_)) {
					break;
				}
				_tmp2_ = g_ptr_array_index (tracker_store_running_tasks, (guint) i);
				_tmp3_ = (TrackerStoreTask*) _tmp2_;
				task = TRACKER_STORE_IS_QUERY_TASK (_tmp3_) ? ((TrackerStoreQueryTask*) _tmp3_) : NULL;
				if (task != NULL) {
					_tmp5_ = g_strcmp0 (((TrackerStoreTask*) task)->client_id, client_id) == 0;
				} else {
					_tmp5_ = FALSE;
				}
				if (_tmp5_) {
					_tmp4_ = task->cancellable != NULL;
				} else {
					_tmp4_ = FALSE;
				}
				if (_tmp4_) {
					g_cancellable_cancel (task->cancellable);
				}
			}
		}
	}
	{
		gint i;
		i = 0;
		{
			gboolean _tmp6_;
			_tmp6_ = TRUE;
			while (TRUE) {
				if (!_tmp6_) {
					i++;
				}
				_tmp6_ = FALSE;
				if (!(i < TRACKER_STORE_PRIORITY_N_PRIORITIES)) {
					break;
				}
				queue = tracker_store_query_queues[i];
				list = queue->head;
				while (TRUE) {
					TrackerStoreTask* task;
					gboolean _tmp7_ = FALSE;
					if (!(list != NULL)) {
						break;
					}
					cur = list;
					list = list->next;
					task = (TrackerStoreTask*) cur->data;
					if (task != NULL) {
						_tmp7_ = g_strcmp0 (task->client_id, client_id) == 0;
					} else {
						_tmp7_ = FALSE;
					}
					if (_tmp7_) {
						GError* _tmp8_ = NULL;
						g_queue_delete_link (queue, cur);
						_tmp8_ = g_error_new_literal (G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Client disappeared");
						_g_error_free0 (task->error);
						task->error = _tmp8_;
						task->callback (task->callback_target);
					}
				}
				queue = tracker_store_update_queues[i];
				list = queue->head;
				while (TRUE) {
					TrackerStoreTask* task;
					gboolean _tmp9_ = FALSE;
					if (!(list != NULL)) {
						break;
					}
					cur = list;
					list = list->next;
					task = (TrackerStoreTask*) cur->data;
					if (task != NULL) {
						_tmp9_ = g_strcmp0 (task->client_id, client_id) == 0;
					} else {
						_tmp9_ = FALSE;
					}
					if (_tmp9_) {
						GError* _tmp10_ = NULL;
						g_queue_delete_link (queue, cur);
						_tmp10_ = g_error_new_literal (G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Client disappeared");
						_g_error_free0 (task->error);
						task->error = _tmp10_;
						task->callback (task->callback_target);
					}
				}
			}
		}
	}
	tracker_store_sched ();
}


static void tracker_store_pause_data_free (gpointer _data) {
	TrackerStorePauseData* data;
	data = _data;
	g_slice_free (TrackerStorePauseData, data);
}


void tracker_store_pause (GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrackerStorePauseData* _data_;
	_data_ = g_slice_new0 (TrackerStorePauseData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, tracker_store_pause);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_store_pause_data_free);
	tracker_store_pause_co (_data_);
}


void tracker_store_pause_finish (GAsyncResult* _res_) {
	TrackerStorePauseData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean _tracker_store_pause_co_gsource_func (gpointer self) {
	gboolean result;
	result = tracker_store_pause_co (self);
	return result;
}


static gboolean tracker_store_pause_co (TrackerStorePauseData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	tracker_store_active = FALSE;
	if (tracker_store_n_queries_running > 0) {
		data->_tmp0_ = TRUE;
	} else {
		data->_tmp0_ = tracker_store_update_running;
	}
	if (data->_tmp0_) {
		(tracker_store_active_callback_target_destroy_notify == NULL) ? NULL : (tracker_store_active_callback_target_destroy_notify (tracker_store_active_callback_target), NULL);
		tracker_store_active_callback = NULL;
		tracker_store_active_callback_target = NULL;
		tracker_store_active_callback_target_destroy_notify = NULL;
		tracker_store_active_callback = _tracker_store_pause_co_gsource_func;
		tracker_store_active_callback_target = data;
		tracker_store_active_callback_target_destroy_notify = NULL;
		data->_state_ = 1;
		return FALSE;
		_state_1:
		;
		(tracker_store_active_callback_target_destroy_notify == NULL) ? NULL : (tracker_store_active_callback_target_destroy_notify (tracker_store_active_callback_target), NULL);
		tracker_store_active_callback = NULL;
		tracker_store_active_callback_target = NULL;
		tracker_store_active_callback_target_destroy_notify = NULL;
		tracker_store_active_callback = NULL;
		tracker_store_active_callback_target = NULL;
		tracker_store_active_callback_target_destroy_notify = NULL;
	}
	data->_tmp1_ = g_atomic_int_get (&tracker_store_checkpointing);
	if (data->_tmp1_ != 0) {
		_g_thread_pool_free0 (tracker_store_checkpoint_pool);
		tracker_store_checkpoint_pool = NULL;
		data->_tmp2_ = NULL;
		data->_tmp2_ = g_thread_pool_new (_tracker_store_checkpoint_dispatch_cb_gfunc, NULL, 1, TRUE, &data->_inner_error_);
		data->_tmp3_ = data->_tmp2_;
		if (data->_inner_error_ != NULL) {
			goto __catch26_g_error;
		}
		_g_thread_pool_free0 (tracker_store_checkpoint_pool);
		tracker_store_checkpoint_pool = data->_tmp3_;
		goto __finally26;
		__catch26_g_error:
		{
			data->e = data->_inner_error_;
			data->_inner_error_ = NULL;
			g_warning ("%s", data->e->message);
			_g_error_free0 (data->e);
		}
		__finally26:
		if (data->_inner_error_ != NULL) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
			g_clear_error (&data->_inner_error_);
			return FALSE;
		}
	}
	if (tracker_store_active) {
		tracker_store_sched ();
	}
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


void tracker_store_resume (void) {
	tracker_store_active = TRUE;
	tracker_store_sched ();
}


TrackerStore* tracker_store_construct (GType object_type) {
	TrackerStore* self = NULL;
	self = (TrackerStore*) g_type_create_instance (object_type);
	return self;
}


TrackerStore* tracker_store_new (void) {
	return tracker_store_construct (TRACKER_TYPE_STORE);
}


static TrackerStoreTask* tracker_store_task_construct (GType object_type) {
	TrackerStoreTask* self = NULL;
	self = (TrackerStoreTask*) g_type_create_instance (object_type);
	return self;
}


static void tracker_store_value_task_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void tracker_store_value_task_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		tracker_store_task_unref (value->data[0].v_pointer);
	}
}


static void tracker_store_value_task_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = tracker_store_task_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer tracker_store_value_task_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* tracker_store_value_task_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		TrackerStoreTask* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = tracker_store_task_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* tracker_store_value_task_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	TrackerStoreTask** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = tracker_store_task_ref (value->data[0].v_pointer);
	}
	return NULL;
}


static GParamSpec* tracker_store_param_spec_task (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	TrackerStoreParamSpecTask* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TRACKER_STORE_TYPE_TASK), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


static gpointer tracker_store_value_get_task (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_STORE_TYPE_TASK), NULL);
	return value->data[0].v_pointer;
}


static void tracker_store_value_set_task (GValue* value, gpointer v_object) {
	TrackerStoreTask* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_STORE_TYPE_TASK));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_STORE_TYPE_TASK));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		tracker_store_task_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tracker_store_task_unref (old);
	}
}


static void tracker_store_value_take_task (GValue* value, gpointer v_object) {
	TrackerStoreTask* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_STORE_TYPE_TASK));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_STORE_TYPE_TASK));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tracker_store_task_unref (old);
	}
}


static void tracker_store_task_class_init (TrackerStoreTaskClass * klass) {
	tracker_store_task_parent_class = g_type_class_peek_parent (klass);
	TRACKER_STORE_TASK_CLASS (klass)->finalize = tracker_store_task_finalize;
}


static void tracker_store_task_instance_init (TrackerStoreTask * self) {
	self->ref_count = 1;
}


static void tracker_store_task_finalize (TrackerStoreTask* obj) {
	TrackerStoreTask * self;
	self = TRACKER_STORE_TASK (obj);
	_g_free0 (self->client_id);
	_g_error_free0 (self->error);
	(self->callback_target_destroy_notify == NULL) ? NULL : (self->callback_target_destroy_notify (self->callback_target), NULL);
	self->callback = NULL;
	self->callback_target = NULL;
	self->callback_target_destroy_notify = NULL;
}


static GType tracker_store_task_get_type (void) {
	static volatile gsize tracker_store_task_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_task_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { tracker_store_value_task_init, tracker_store_value_task_free_value, tracker_store_value_task_copy_value, tracker_store_value_task_peek_pointer, "p", tracker_store_value_task_collect_value, "p", tracker_store_value_task_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (TrackerStoreTaskClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_store_task_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStoreTask), 0, (GInstanceInitFunc) tracker_store_task_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType tracker_store_task_type_id;
		tracker_store_task_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TrackerStoreTask", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&tracker_store_task_type_id__volatile, tracker_store_task_type_id);
	}
	return tracker_store_task_type_id__volatile;
}


static gpointer tracker_store_task_ref (gpointer instance) {
	TrackerStoreTask* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


static void tracker_store_task_unref (gpointer instance) {
	TrackerStoreTask* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		TRACKER_STORE_TASK_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static TrackerStoreQueryTask* tracker_store_query_task_construct (GType object_type) {
	TrackerStoreQueryTask* self = NULL;
	self = (TrackerStoreQueryTask*) tracker_store_task_construct (object_type);
	return self;
}


static TrackerStoreQueryTask* tracker_store_query_task_new (void) {
	return tracker_store_query_task_construct (TRACKER_STORE_TYPE_QUERY_TASK);
}


static void tracker_store_query_task_class_init (TrackerStoreQueryTaskClass * klass) {
	tracker_store_query_task_parent_class = g_type_class_peek_parent (klass);
	TRACKER_STORE_TASK_CLASS (klass)->finalize = tracker_store_query_task_finalize;
}


static void tracker_store_query_task_instance_init (TrackerStoreQueryTask * self) {
}


static void tracker_store_query_task_finalize (TrackerStoreTask* obj) {
	TrackerStoreQueryTask * self;
	self = TRACKER_STORE_QUERY_TASK (obj);
	if (self->watchdog_id > 0) {
		g_source_remove (self->watchdog_id);
	}
	_g_free0 (self->query);
	_g_object_unref0 (self->cancellable);
	(self->in_thread_target_destroy_notify == NULL) ? NULL : (self->in_thread_target_destroy_notify (self->in_thread_target), NULL);
	self->in_thread = NULL;
	self->in_thread_target = NULL;
	self->in_thread_target_destroy_notify = NULL;
	TRACKER_STORE_TASK_CLASS (tracker_store_query_task_parent_class)->finalize (obj);
}


static GType tracker_store_query_task_get_type (void) {
	static volatile gsize tracker_store_query_task_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_query_task_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerStoreQueryTaskClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_store_query_task_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStoreQueryTask), 0, (GInstanceInitFunc) tracker_store_query_task_instance_init, NULL };
		GType tracker_store_query_task_type_id;
		tracker_store_query_task_type_id = g_type_register_static (TRACKER_STORE_TYPE_TASK, "TrackerStoreQueryTask", &g_define_type_info, 0);
		g_once_init_leave (&tracker_store_query_task_type_id__volatile, tracker_store_query_task_type_id);
	}
	return tracker_store_query_task_type_id__volatile;
}


static TrackerStoreUpdateTask* tracker_store_update_task_construct (GType object_type) {
	TrackerStoreUpdateTask* self = NULL;
	self = (TrackerStoreUpdateTask*) tracker_store_task_construct (object_type);
	return self;
}


static TrackerStoreUpdateTask* tracker_store_update_task_new (void) {
	return tracker_store_update_task_construct (TRACKER_STORE_TYPE_UPDATE_TASK);
}


static void tracker_store_update_task_class_init (TrackerStoreUpdateTaskClass * klass) {
	tracker_store_update_task_parent_class = g_type_class_peek_parent (klass);
	TRACKER_STORE_TASK_CLASS (klass)->finalize = tracker_store_update_task_finalize;
}


static void tracker_store_update_task_instance_init (TrackerStoreUpdateTask * self) {
}


static void tracker_store_update_task_finalize (TrackerStoreTask* obj) {
	TrackerStoreUpdateTask * self;
	self = TRACKER_STORE_UPDATE_TASK (obj);
	_g_free0 (self->query);
	_g_variant_unref0 (self->blank_nodes);
	TRACKER_STORE_TASK_CLASS (tracker_store_update_task_parent_class)->finalize (obj);
}


static GType tracker_store_update_task_get_type (void) {
	static volatile gsize tracker_store_update_task_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_update_task_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerStoreUpdateTaskClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_store_update_task_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStoreUpdateTask), 0, (GInstanceInitFunc) tracker_store_update_task_instance_init, NULL };
		GType tracker_store_update_task_type_id;
		tracker_store_update_task_type_id = g_type_register_static (TRACKER_STORE_TYPE_TASK, "TrackerStoreUpdateTask", &g_define_type_info, 0);
		g_once_init_leave (&tracker_store_update_task_type_id__volatile, tracker_store_update_task_type_id);
	}
	return tracker_store_update_task_type_id__volatile;
}


static TrackerStoreTurtleTask* tracker_store_turtle_task_construct (GType object_type) {
	TrackerStoreTurtleTask* self = NULL;
	self = (TrackerStoreTurtleTask*) tracker_store_task_construct (object_type);
	return self;
}


static TrackerStoreTurtleTask* tracker_store_turtle_task_new (void) {
	return tracker_store_turtle_task_construct (TRACKER_STORE_TYPE_TURTLE_TASK);
}


static void tracker_store_turtle_task_class_init (TrackerStoreTurtleTaskClass * klass) {
	tracker_store_turtle_task_parent_class = g_type_class_peek_parent (klass);
	TRACKER_STORE_TASK_CLASS (klass)->finalize = tracker_store_turtle_task_finalize;
}


static void tracker_store_turtle_task_instance_init (TrackerStoreTurtleTask * self) {
}


static void tracker_store_turtle_task_finalize (TrackerStoreTask* obj) {
	TrackerStoreTurtleTask * self;
	self = TRACKER_STORE_TURTLE_TASK (obj);
	_g_free0 (self->path);
	TRACKER_STORE_TASK_CLASS (tracker_store_turtle_task_parent_class)->finalize (obj);
}


static GType tracker_store_turtle_task_get_type (void) {
	static volatile gsize tracker_store_turtle_task_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_turtle_task_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerStoreTurtleTaskClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_store_turtle_task_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStoreTurtleTask), 0, (GInstanceInitFunc) tracker_store_turtle_task_instance_init, NULL };
		GType tracker_store_turtle_task_type_id;
		tracker_store_turtle_task_type_id = g_type_register_static (TRACKER_STORE_TYPE_TASK, "TrackerStoreTurtleTask", &g_define_type_info, 0);
		g_once_init_leave (&tracker_store_turtle_task_type_id__volatile, tracker_store_turtle_task_type_id);
	}
	return tracker_store_turtle_task_type_id__volatile;
}


static void tracker_value_store_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void tracker_value_store_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		tracker_store_unref (value->data[0].v_pointer);
	}
}


static void tracker_value_store_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = tracker_store_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer tracker_value_store_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* tracker_value_store_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		TrackerStore* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = tracker_store_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* tracker_value_store_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	TrackerStore** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = tracker_store_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* tracker_param_spec_store (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	TrackerParamSpecStore* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TRACKER_TYPE_STORE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer tracker_value_get_store (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_STORE), NULL);
	return value->data[0].v_pointer;
}


void tracker_value_set_store (GValue* value, gpointer v_object) {
	TrackerStore* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_STORE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_TYPE_STORE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		tracker_store_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tracker_store_unref (old);
	}
}


void tracker_value_take_store (GValue* value, gpointer v_object) {
	TrackerStore* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_STORE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_TYPE_STORE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tracker_store_unref (old);
	}
}


static void tracker_store_class_init (TrackerStoreClass * klass) {
	tracker_store_parent_class = g_type_class_peek_parent (klass);
	TRACKER_STORE_CLASS (klass)->finalize = tracker_store_finalize;
}


static void tracker_store_instance_init (TrackerStore * self) {
	self->ref_count = 1;
}


static void tracker_store_finalize (TrackerStore* obj) {
	TrackerStore * self;
	self = TRACKER_STORE (obj);
}


GType tracker_store_get_type (void) {
	static volatile gsize tracker_store_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_store_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { tracker_value_store_init, tracker_value_store_free_value, tracker_value_store_copy_value, tracker_value_store_peek_pointer, "p", tracker_value_store_collect_value, "p", tracker_value_store_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (TrackerStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStore), 0, (GInstanceInitFunc) tracker_store_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType tracker_store_type_id;
		tracker_store_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TrackerStore", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&tracker_store_type_id__volatile, tracker_store_type_id);
	}
	return tracker_store_type_id__volatile;
}


gpointer tracker_store_ref (gpointer instance) {
	TrackerStore* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void tracker_store_unref (gpointer instance) {
	TrackerStore* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		TRACKER_STORE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



