[tracker/binary-log-2: 41/42] tracker-store: Add Sync D-Bus method
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/binary-log-2: 41/42] tracker-store: Add Sync D-Bus method
- Date: Mon, 11 Jan 2010 18:32:53 +0000 (UTC)
commit 93828aa80be5e433e405bfdc3e6688b14294db86
Author: Jürg Billeter <j bitron ch>
Date: Fri Jan 8 17:24:18 2010 +0100
tracker-store: Add Sync D-Bus method
Sync will fsync the journal.
data/dbus/tracker-resources.xml | 5 +++++
src/libtracker-data/tracker-data-update.c | 6 ++++++
src/libtracker-data/tracker-data-update.h | 2 ++
src/tracker-store/tracker-resources.c | 19 +++++++++++++++++++
src/tracker-store/tracker-resources.h | 3 +++
5 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/data/dbus/tracker-resources.xml b/data/dbus/tracker-resources.xml
index df08272..0de4185 100644
--- a/data/dbus/tracker-resources.xml
+++ b/data/dbus/tracker-resources.xml
@@ -32,6 +32,11 @@
<arg type="aaa{ss}" name="result" direction="out" />
</method>
+ <!-- sync data to disk -->
+ <method name="Sync">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ </method>
+
<!-- SPARQL Update as part of a batch, use this method when sending a
possibly large amount of updates to improve performance, may delay
database commit until receiving BatchCommit -->
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 4e05812..1ac2936 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2199,3 +2199,9 @@ tracker_data_update_sparql_blank (const gchar *update,
return blank_nodes;
}
+void
+tracker_data_sync (void)
+{
+ tracker_db_journal_fsync ();
+}
+
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 2d81341..8e847c1 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -86,6 +86,8 @@ tracker_data_update_sparql_blank (const gchar *update,
GError **error);
void tracker_data_update_buffer_flush (GError **error);
+void tracker_data_sync (void);
+
/* Volume handling */
void tracker_data_update_enable_volume (const gchar *udi,
const gchar *mount_path);
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index 4cd564c..ef9d081 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -315,6 +315,25 @@ tracker_resources_sparql_update_blank (TrackerResources *self,
tracker_dbus_request_success (request_id);
}
+void
+tracker_resources_sync (TrackerResources *self,
+ DBusGMethodInvocation *context,
+ GError **error)
+{
+ guint request_id;
+
+ request_id = tracker_dbus_get_next_request_id ();
+
+ tracker_dbus_request_new (request_id,
+ "D-Bus request for sync");
+
+ tracker_data_sync ();
+
+ dbus_g_method_return (context);
+
+ tracker_dbus_request_success (request_id);
+}
+
static void
batch_update_callback (GError *error, gpointer user_data)
{
diff --git a/src/tracker-store/tracker-resources.h b/src/tracker-store/tracker-resources.h
index 9e634b7..11a4ec5 100644
--- a/src/tracker-store/tracker-resources.h
+++ b/src/tracker-store/tracker-resources.h
@@ -74,6 +74,9 @@ void tracker_resources_sparql_update_blank (TrackerResources
const gchar *update,
DBusGMethodInvocation *context,
GError **error);
+void tracker_resources_sync (TrackerResources *object,
+ DBusGMethodInvocation *context,
+ GError **error);
void tracker_resources_batch_sparql_update (TrackerResources *object,
const gchar *update,
DBusGMethodInvocation *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]