[tracker/urho-sync] Playing the journal on restore
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/urho-sync] Playing the journal on restore
- Date: Thu, 20 Aug 2009 13:36:16 +0000 (UTC)
commit 0bdb823b6b13081ff88a98c0e9bc0bb62d655e24
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Aug 20 15:09:38 2009 +0200
Playing the journal on restore
src/libtracker-data/tracker-data-backup.c | 17 +++++++++++++----
src/tracker-store/tracker-backup.c | 7 +++++++
src/tracker-store/tracker-store.c | 14 ++++++++++++++
src/tracker-store/tracker-store.h | 2 ++
4 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 715f4da..65bd255 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -169,6 +169,17 @@ tracker_data_backup_save (GFile *destination,
}
}
+
+static void
+on_restore_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ tracker_db_manager_reconnect ();
+
+ on_meta_copied (source_object, res, user_data);
+}
+
static void
on_journald_copied (GObject *source_object,
GAsyncResult *res,
@@ -187,7 +198,7 @@ on_journald_copied (GObject *source_object,
G_FILE_COPY_OVERWRITE,
G_PRIORITY_HIGH,
NULL, NULL, NULL,
- on_meta_copied,
+ on_restore_done,
info);
}
@@ -212,7 +223,7 @@ restore_copy_procedure (BackupSaveInfo *info)
G_FILE_COPY_OVERWRITE,
G_PRIORITY_HIGH,
NULL, NULL, NULL,
- on_meta_copied,
+ on_restore_done,
info);
}
@@ -240,6 +251,4 @@ tracker_data_backup_restore (GFile *backup,
info->file = tracker_db_backup_file (NULL, TRACKER_DB_BACKUP_META_FILENAME);
restore_copy_procedure (info);
-
- tracker_db_manager_reconnect ();
}
diff --git a/src/tracker-store/tracker-backup.c b/src/tracker-store/tracker-backup.c
index 7fb005a..4430e4e 100644
--- a/src/tracker-store/tracker-backup.c
+++ b/src/tracker-store/tracker-backup.c
@@ -35,6 +35,7 @@
typedef struct {
DBusGMethodInvocation *context;
guint request_id;
+ gboolean play_journal;
} TrackerDBusMethodInfo;
G_DEFINE_TYPE (TrackerBackup, tracker_backup, G_TYPE_OBJECT)
@@ -74,6 +75,10 @@ backup_callback (GError *error, gpointer user_data)
return;
}
+ if (info->play_journal) {
+ tracker_store_play_journal ();
+ }
+
dbus_g_method_return (info->context);
tracker_dbus_request_success (info->request_id);
@@ -103,6 +108,7 @@ tracker_backup_save (TrackerBackup *object,
info->request_id = request_id;
info->context = context;
+ info->play_journal = FALSE;
tracker_data_backup_save (destination, journal,
backup_callback,
@@ -136,6 +142,7 @@ tracker_backup_restore (TrackerBackup *object,
info->request_id = request_id;
info->context = context;
+ info->play_journal = TRUE;
tracker_data_backup_restore (destination, journal,
backup_callback,
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 984f197..421c132 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -283,6 +283,20 @@ sync_idle_destroy (gpointer user_data)
}
void
+tracker_store_play_journal (void)
+{
+ gchar *lines;
+
+ lines = tracker_db_journal_get_content ();
+
+ if (lines) {
+ tracker_store_sparql_update (lines, NULL);
+ tracker_db_journal_truncate ();
+ g_free (lines);
+ }
+}
+
+void
tracker_store_init (gboolean load_journal)
{
TrackerStorePrivate *private;
diff --git a/src/tracker-store/tracker-store.h b/src/tracker-store/tracker-store.h
index 114c92c..5affc21 100644
--- a/src/tracker-store/tracker-store.h
+++ b/src/tracker-store/tracker-store.h
@@ -63,6 +63,8 @@ TrackerDBResultSet*
guint tracker_store_get_queue_size (void);
+void tracker_store_play_journal (void);
+
G_END_DECLS
#endif /* __TRACKER_STORE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]