[tracker/dbus-fd-experiment-gio: 17/41] Steroids client: Add BatchSparqlUpdate
- From: Adrien Bustany <abustany src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/dbus-fd-experiment-gio: 17/41] Steroids client: Add BatchSparqlUpdate
- Date: Thu, 10 Jun 2010 22:53:38 +0000 (UTC)
commit abbc9d75212d48eaeb7e9d677b3efd681321ec00
Author: Adrien Bustany <abustany gnome org>
Date: Thu Jun 3 13:24:07 2010 -0400
Steroids client: Add BatchSparqlUpdate
src/libtracker-client/tracker.c | 51 ++++++++++++++++++++++++++++++++++----
src/libtracker-client/tracker.h | 3 ++
2 files changed, 48 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-client/tracker.c b/src/libtracker-client/tracker.c
index a457fca..e6cd37a 100644
--- a/src/libtracker-client/tracker.c
+++ b/src/libtracker-client/tracker.c
@@ -169,6 +169,13 @@ struct TrackerResultIterator {
#endif
};
+#ifdef HAVE_DBUS_FD_PASSING
+typedef enum {
+ TRACKER_UPDATE,
+ TRACKER_UPDATE_BLANK,
+ TRACKER_UPDATE_BATCH
+} TrackerUpdateType;
+#endif
static gboolean is_service_available (void);
static void client_finalize (GObject *object);
@@ -876,12 +883,14 @@ end_of_results:
}
static DBusMessage*
-sparql_update_blank_fast (TrackerClient *client,
- const gchar *query,
- GError **error)
+sparql_update_fast (TrackerClient *client,
+ const gchar *query,
+ TrackerUpdateType type,
+ GError **error)
{
TrackerClientPrivate *private;
DBusConnection *connection;
+ gchar *dbus_method;
DBusMessage *message;
DBusMessageIter iter;
DBusMessage *reply;
@@ -909,10 +918,24 @@ sparql_update_blank_fast (TrackerClient *client,
dbus_error_init (&dbus_error);
+ switch (type) {
+ case TRACKER_UPDATE:
+ dbus_method = "Update";
+ break;
+ case TRACKER_UPDATE_BLANK:
+ dbus_method = "UpdateBlank";
+ break;
+ case TRACKER_UPDATE_BATCH:
+ dbus_method = "BatchUpdate";
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
message = dbus_message_new_method_call (TRACKER_STEROIDS_SERVICE,
TRACKER_STEROIDS_PATH,
TRACKER_STEROIDS_INTERFACE,
- "UpdateBlank");
+ dbus_method);
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_UNIX_FD, &pipefd[0]);
dbus_connection_send_with_reply (connection,
@@ -1770,7 +1793,7 @@ tracker_resources_sparql_update_fast (TrackerClient *client,
{
DBusMessage *reply;
- reply = sparql_update_blank_fast (client, query, error);
+ reply = sparql_update_fast (client, query, TRACKER_UPDATE, error);
if (!reply) {
return;
@@ -1811,7 +1834,7 @@ tracker_resources_sparql_update_blank_fast (TrackerClient *client,
DBusMessageIter iter, subiter, subsubiter;
GPtrArray *result;
- reply = sparql_update_blank_fast (client, query, error);
+ reply = sparql_update_fast (client, query, TRACKER_UPDATE_BLANK, error);
if (!reply) {
return NULL;
@@ -1880,6 +1903,22 @@ tracker_resources_batch_sparql_update (TrackerClient *client,
error);
}
+void
+tracker_resources_batch_sparql_update_fast (TrackerClient *client,
+ const gchar *query,
+ GError **error)
+{
+ DBusMessage *reply;
+
+ reply = sparql_update_fast (client, query, TRACKER_UPDATE_BATCH, error);
+
+ if (!reply) {
+ return;
+ }
+
+ dbus_message_unref (reply);
+}
+
/**
* tracker_resources_batch_commit:
* @client: a #TrackerClient.
diff --git a/src/libtracker-client/tracker.h b/src/libtracker-client/tracker.h
index 12dff2c..0ae85d0 100644
--- a/src/libtracker-client/tracker.h
+++ b/src/libtracker-client/tracker.h
@@ -158,6 +158,9 @@ GPtrArray * tracker_resources_sparql_update_blank_fast (TrackerClient
void tracker_resources_batch_sparql_update (TrackerClient *client,
const gchar *query,
GError **error);
+void tracker_resources_batch_sparql_update_fast (TrackerClient *client,
+ const gchar *query,
+ GError **error);
void tracker_resources_batch_commit (TrackerClient *client,
GError **error);
/* Asynchronous API */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]