[tracker: 22/24] tracker-store: Add Sync D-Bus method
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker: 22/24] tracker-store: Add Sync D-Bus method
- Date: Tue, 12 Jan 2010 17:39:36 +0000 (UTC)
commit 64985edc715f5e721d6e7f18fdfa2497743f86dc
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 | 20 ++++++++++++++++++++
src/tracker-store/tracker-resources.h | 3 +++
5 files changed, 36 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 d1c9643..54b6997 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -320,6 +320,26 @@ tracker_resources_sparql_update_blank (TrackerResources *self,
}
}
+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,
+ context,
+ "%s()",
+ __FUNCTION__);
+
+ tracker_data_sync ();
+
+ tracker_dbus_request_success (request_id, context);
+ dbus_g_method_return (context);
+}
+
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]