[tracker/rss-enclosures] libtracker-client: Do not expose fast versions as separate API



commit 2385d21b34d97c255d05340cb6d6e8480587f39c
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jun 15 13:42:16 2010 +0200

    libtracker-client: Do not expose fast versions as separate API
    
    This currently breaks the update benchmark as the client cannot disable
    FD passing anymore.

 examples/tracker-steroids/benchmark-update.c       |    3 +-
 .../steroids-sparql-update-async.c                 |    2 +-
 src/libtracker-client/tracker.c                    |  178 ++++++++++----------
 src/libtracker-client/tracker.h                    |   21 ---
 src/libtracker-miner/tracker-miner-object.c        |    8 +-
 tests/tracker-steroids/tracker-test.c              |   16 +-
 6 files changed, 104 insertions(+), 124 deletions(-)
---
diff --git a/examples/tracker-steroids/benchmark-update.c b/examples/tracker-steroids/benchmark-update.c
index c673bc3..f8d84ff 100644
--- a/examples/tracker-steroids/benchmark-update.c
+++ b/examples/tracker-steroids/benchmark-update.c
@@ -57,6 +57,7 @@ main (int argc, char **argv)
 	timer = g_timer_new ();
 
 	for (i = 0; i < N_TRIES; i++) {
+		/* FIXME disable FD passing */
 		tracker_resources_sparql_update (client, query, &error);
 
 		if (error) {
@@ -72,7 +73,7 @@ main (int argc, char **argv)
 	g_timer_start (timer);
 
 	for (i = 0; i < N_TRIES; i++) {
-		tracker_resources_sparql_update_fast (client, query, &error);
+		tracker_resources_sparql_update (client, query, &error);
 
 		if (error) {
 			g_critical ("Query error: %s", error->message);
diff --git a/examples/tracker-steroids/steroids-sparql-update-async.c b/examples/tracker-steroids/steroids-sparql-update-async.c
index 008cf66..2c1994f 100644
--- a/examples/tracker-steroids/steroids-sparql-update-async.c
+++ b/examples/tracker-steroids/steroids-sparql-update-async.c
@@ -86,7 +86,7 @@ main (int argc, char **argv) {
 
 	client = tracker_client_new (0, 0);
 
-	if (tracker_resources_sparql_update_blank_fast_async (client, query, query_cb, NULL) == 0) {
+	if (tracker_resources_sparql_update_blank_async (client, query, query_cb, NULL) == 0) {
 		g_critical ("error running update");
 		return 1;
 	}
diff --git a/src/libtracker-client/tracker.c b/src/libtracker-client/tracker.c
index 06f3ca0..f4b8460 100644
--- a/src/libtracker-client/tracker.c
+++ b/src/libtracker-client/tracker.c
@@ -1942,6 +1942,23 @@ tracker_result_iterator_value (TrackerResultIterator *iterator,
 #endif
 }
 
+static void
+tracker_resources_sparql_update_compat (TrackerClient  *client,
+                                        const gchar    *query,
+                                        GError        **error)
+{
+	TrackerClientPrivate *private;
+
+	g_return_if_fail (TRACKER_IS_CLIENT (client));
+	g_return_if_fail (query != NULL);
+
+	private = TRACKER_CLIENT_GET_PRIVATE (client);
+
+	org_freedesktop_Tracker1_Resources_sparql_update (private->proxy_resources,
+	                                                  query,
+	                                                  error);
+}
+
 /**
  * tracker_resources_sparql_update:
  * @client: a #TrackerClient.
@@ -1963,23 +1980,6 @@ tracker_resources_sparql_update (TrackerClient  *client,
                                  const gchar    *query,
                                  GError        **error)
 {
-	TrackerClientPrivate *private;
-
-	g_return_if_fail (TRACKER_IS_CLIENT (client));
-	g_return_if_fail (query != NULL);
-
-	private = TRACKER_CLIENT_GET_PRIVATE (client);
-
-	org_freedesktop_Tracker1_Resources_sparql_update (private->proxy_resources,
-	                                                  query,
-	                                                  error);
-}
-
-void
-tracker_resources_sparql_update_fast (TrackerClient  *client,
-                                      const gchar    *query,
-                                      GError        **error)
-{
 #ifdef HAVE_DBUS_FD_PASSING
 	DBusMessage *reply;
 
@@ -1991,14 +1991,14 @@ tracker_resources_sparql_update_fast (TrackerClient  *client,
 
 	dbus_message_unref (reply);
 #else
-	tracker_resources_sparql_update (client, query, error);
+	tracker_resources_sparql_update_compat (client, query, error);
 #endif
 }
 
-GPtrArray *
-tracker_resources_sparql_update_blank (TrackerClient  *client,
-                                       const gchar    *query,
-                                       GError        **error)
+static GPtrArray*
+tracker_resources_sparql_update_blank_compat (TrackerClient  *client,
+                                              const gchar    *query,
+                                              GError        **error)
 {
 	TrackerClientPrivate *private;
 	GPtrArray *result;
@@ -2018,10 +2018,10 @@ tracker_resources_sparql_update_blank (TrackerClient  *client,
 	return result;
 }
 
-GPtrArray*
-tracker_resources_sparql_update_blank_fast (TrackerClient  *client,
-                                            const gchar    *query,
-                                            GError        **error)
+GPtrArray *
+tracker_resources_sparql_update_blank (TrackerClient  *client,
+                                       const gchar    *query,
+                                       GError        **error)
 {
 #ifdef HAVE_DBUS_FD_PASSING
 	DBusMessage *reply;
@@ -2066,10 +2066,27 @@ tracker_resources_sparql_update_blank_fast (TrackerClient  *client,
 
 	return result;
 #else
-	return tracker_resources_sparql_update_blank (client, query, error);
+	return tracker_resources_sparql_update_blank_compat (client, query, error);
 #endif
 }
 
+static void
+tracker_resources_batch_sparql_update_compat (TrackerClient  *client,
+                                              const gchar    *query,
+                                              GError        **error)
+{
+	TrackerClientPrivate *private;
+
+	g_return_if_fail (TRACKER_IS_CLIENT (client));
+	g_return_if_fail (query != NULL);
+
+	private = TRACKER_CLIENT_GET_PRIVATE (client);
+
+	org_freedesktop_Tracker1_Resources_batch_sparql_update (private->proxy_resources,
+	                                                        query,
+	                                                        error);
+}
+
 /**
  * tracker_resources_batch_sparql_update:
  * @client: a #TrackerClient.
@@ -2088,23 +2105,6 @@ tracker_resources_batch_sparql_update (TrackerClient  *client,
                                        const gchar    *query,
                                        GError        **error)
 {
-	TrackerClientPrivate *private;
-
-	g_return_if_fail (TRACKER_IS_CLIENT (client));
-	g_return_if_fail (query != NULL);
-
-	private = TRACKER_CLIENT_GET_PRIVATE (client);
-
-	org_freedesktop_Tracker1_Resources_batch_sparql_update (private->proxy_resources,
-	                                                        query,
-	                                                        error);
-}
-
-void
-tracker_resources_batch_sparql_update_fast (TrackerClient  *client,
-                                            const gchar    *query,
-                                            GError        **error)
-{
 #ifdef HAVE_DBUS_FD_PASSING
 	DBusMessage *reply;
 
@@ -2116,7 +2116,7 @@ tracker_resources_batch_sparql_update_fast (TrackerClient  *client,
 
 	dbus_message_unref (reply);
 #else
-	tracker_resources_batch_sparql_update (client, query, error);
+	tracker_resources_batch_sparql_update_compat (client, query, error);
 #endif
 }
 
@@ -2366,11 +2366,11 @@ tracker_resources_sparql_query_iterate_async (TrackerClient         *client,
  *
  * Since: 0.8
  **/
-guint
-tracker_resources_sparql_update_async (TrackerClient    *client,
-                                       const gchar      *query,
-                                       TrackerReplyVoid  callback,
-                                       gpointer          user_data)
+static guint
+tracker_resources_sparql_update_compat_async (TrackerClient    *client,
+                                              const gchar      *query,
+                                              TrackerReplyVoid  callback,
+                                              gpointer          user_data)
 {
 	TrackerClientPrivate *private;
 	CallbackVoid *cb;
@@ -2398,10 +2398,10 @@ tracker_resources_sparql_update_async (TrackerClient    *client,
 }
 
 guint
-tracker_resources_sparql_update_fast_async (TrackerClient    *client,
-                                            const gchar      *query,
-                                            TrackerReplyVoid  callback,
-                                            gpointer          user_data)
+tracker_resources_sparql_update_async (TrackerClient    *client,
+                                       const gchar      *query,
+                                       TrackerReplyVoid  callback,
+                                       gpointer          user_data)
 {
 #ifdef HAVE_DBUS_FD_PASSING
 	FastAsyncData *data;
@@ -2429,15 +2429,15 @@ tracker_resources_sparql_update_fast_async (TrackerClient    *client,
 
 	return 42;
 #else
-	return tracker_resources_sparql_update_async (client, query, callback, user_data);
+	return tracker_resources_sparql_update_compat_async (client, query, callback, user_data);
 #endif
 }
 
-guint
-tracker_resources_sparql_update_blank_async (TrackerClient         *client,
-                                             const gchar           *query,
-                                             TrackerReplyGPtrArray  callback,
-                                             gpointer               user_data)
+static guint
+tracker_resources_sparql_update_blank_compat_async (TrackerClient         *client,
+                                                    const gchar           *query,
+                                                    TrackerReplyGPtrArray  callback,
+                                                    gpointer               user_data)
 {
 	TrackerClientPrivate *private;
 	CallbackGPtrArray *cb;
@@ -2465,10 +2465,10 @@ tracker_resources_sparql_update_blank_async (TrackerClient         *client,
 }
 
 guint
-tracker_resources_sparql_update_blank_fast_async (TrackerClient         *client,
-                                                  const gchar           *query,
-                                                  TrackerReplyGPtrArray  callback,
-                                                  gpointer               user_data)
+tracker_resources_sparql_update_blank_async (TrackerClient         *client,
+                                             const gchar           *query,
+                                             TrackerReplyGPtrArray  callback,
+                                             gpointer               user_data)
 {
 #ifdef HAVE_DBUS_FD_PASSING
 	FastAsyncData *data;
@@ -2496,29 +2496,15 @@ tracker_resources_sparql_update_blank_fast_async (TrackerClient         *client,
 
 	return 42;
 #else
-	return tracker_resources_sparql_update_blank_async (client, query, callback, user_data);
+	return tracker_resources_sparql_update_blank_compat_async (client, query, callback, user_data);
 #endif
 }
 
-/**
- * tracker_resources_batch_sparql_update_async:
- * @client: a #TrackerClient.
- * @query: a string representing SPARQL.
- * @callback: function to be called when the batch update has been performed.
- * @user_data: user data to pass to @callback.
- *
- * Updates the database using SPARQL. see tracker_resources_batch_sparql_update().
- *
- * Returns: A #guint representing the operation ID. See
- * tracker_cancel_call(). In the event of failure, 0 is returned.
- *
- * Since: 0.8
- **/
-guint
-tracker_resources_batch_sparql_update_async (TrackerClient    *client,
-                                             const gchar      *query,
-                                             TrackerReplyVoid  callback,
-                                             gpointer          user_data)
+static guint
+tracker_resources_batch_sparql_update_compat_async (TrackerClient    *client,
+                                                    const gchar      *query,
+                                                    TrackerReplyVoid  callback,
+                                                    gpointer          user_data)
 {
 	TrackerClientPrivate *private;
 	CallbackVoid *cb;
@@ -2545,11 +2531,25 @@ tracker_resources_batch_sparql_update_async (TrackerClient    *client,
 	return cb->id;
 }
 
+/**
+ * tracker_resources_batch_sparql_update_async:
+ * @client: a #TrackerClient.
+ * @query: a string representing SPARQL.
+ * @callback: function to be called when the batch update has been performed.
+ * @user_data: user data to pass to @callback.
+ *
+ * Updates the database using SPARQL. see tracker_resources_batch_sparql_update().
+ *
+ * Returns: A #guint representing the operation ID. See
+ * tracker_cancel_call(). In the event of failure, 0 is returned.
+ *
+ * Since: 0.8
+ **/
 guint
-tracker_resources_batch_sparql_update_fast_async (TrackerClient    *client,
-                                                  const gchar      *query,
-                                                  TrackerReplyVoid  callback,
-                                                  gpointer          user_data)
+tracker_resources_batch_sparql_update_async (TrackerClient    *client,
+                                             const gchar      *query,
+                                             TrackerReplyVoid  callback,
+                                             gpointer          user_data)
 {
 #ifdef HAVE_DBUS_FD_PASSING
 	FastAsyncData *data;
@@ -2577,7 +2577,7 @@ tracker_resources_batch_sparql_update_fast_async (TrackerClient    *client,
 
 	return 42;
 #else
-	return tracker_resources_batch_sparql_update_async (client, query, callback, user_data);
+	return tracker_resources_batch_sparql_update_compat_async (client, query, callback, user_data);
 #endif
 }
 
diff --git a/src/libtracker-client/tracker.h b/src/libtracker-client/tracker.h
index 47d7b85..79b4fa9 100644
--- a/src/libtracker-client/tracker.h
+++ b/src/libtracker-client/tracker.h
@@ -152,21 +152,12 @@ const gchar *  tracker_result_iterator_value               (TrackerResultIterato
 void           tracker_resources_sparql_update             (TrackerClient          *client,
                                                             const gchar            *query,
                                                             GError                **error);
-void           tracker_resources_sparql_update_fast        (TrackerClient          *client,
-                                                            const gchar            *query,
-                                                            GError                **error);
 GPtrArray *    tracker_resources_sparql_update_blank       (TrackerClient          *client,
                                                             const gchar            *query,
                                                             GError                **error);
-GPtrArray *    tracker_resources_sparql_update_blank_fast  (TrackerClient          *client,
-                                                            const gchar            *query,
-                                                            GError                **error);
 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 */
@@ -189,26 +180,14 @@ guint          tracker_resources_sparql_update_async       (TrackerClient
                                                             const gchar            *query,
                                                             TrackerReplyVoid        callback,
                                                             gpointer                user_data);
-guint          tracker_resources_sparql_update_fast_async  (TrackerClient          *client,
-                                                            const gchar            *query,
-                                                            TrackerReplyVoid        callback,
-                                                            gpointer                user_data);
 guint          tracker_resources_sparql_update_blank_async (TrackerClient          *client,
                                                             const gchar            *query,
                                                             TrackerReplyGPtrArray   callback,
                                                             gpointer                user_data);
-guint     tracker_resources_sparql_update_blank_fast_async (TrackerClient          *client,
-                                                            const gchar            *query,
-                                                            TrackerReplyGPtrArray   callback,
-                                                            gpointer                user_data);
 guint          tracker_resources_batch_sparql_update_async (TrackerClient          *client,
                                                             const gchar            *query,
                                                             TrackerReplyVoid        callback,
                                                             gpointer                user_data);
-guint     tracker_resources_batch_sparql_update_fast_async (TrackerClient          *client,
-                                                            const gchar            *query,
-                                                            TrackerReplyVoid        callback,
-                                                            gpointer                user_data);
 guint          tracker_resources_batch_commit_async        (TrackerClient          *client,
                                                             TrackerReplyVoid        callback,
                                                             gpointer                user_data);
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 66e8571..e389288 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -792,10 +792,10 @@ tracker_miner_execute_update (TrackerMiner        *miner,
 	                            user_data,
 	                            tracker_miner_execute_sparql);
 
-	data->id = tracker_resources_sparql_update_fast_async (miner->private->client,
-	                                                       sparql,
-	                                                       sparql_update_cb,
-	                                                       data);
+	data->id = tracker_resources_sparql_update_async (miner->private->client,
+	                                                  sparql,
+	                                                  sparql_update_cb,
+	                                                  data);
 }
 
 /**
diff --git a/tests/tracker-steroids/tracker-test.c b/tests/tracker-steroids/tracker-test.c
index 7fd9926..6f7b6bb 100644
--- a/tests/tracker-steroids/tracker-test.c
+++ b/tests/tracker-steroids/tracker-test.c
@@ -298,7 +298,7 @@ test_tracker_sparql_update_fast_small ()
 	GError *error = NULL;
 	const gchar *query = "INSERT { _:x a nmo:Message }";
 
-	tracker_resources_sparql_update_fast (client, query, &error);
+	tracker_resources_sparql_update (client, query, &error);
 
 	g_assert (!error);
 
@@ -319,7 +319,7 @@ test_tracker_sparql_update_fast_large ()
 
 	query = g_strdup_printf (query_template, lotsOfA);
 
-	tracker_resources_sparql_update_fast (client, query, &error);
+	tracker_resources_sparql_update (client, query, &error);
 
 	g_free (lotsOfA);
 	g_free (query);
@@ -335,7 +335,7 @@ test_tracker_sparql_update_fast_error ()
 	GError *error = NULL;
 	const gchar *query = "blork blork blork";
 
-	tracker_resources_sparql_update_fast (client, query, &error);
+	tracker_resources_sparql_update (client, query, &error);
 
 	g_assert (error);
 
@@ -349,7 +349,7 @@ test_tracker_sparql_update_blank_fast_small ()
 	const gchar *query = "INSERT { _:x a nmo:Message }";
 	GPtrArray *results;
 
-	results = tracker_resources_sparql_update_blank_fast (client, query, &error);
+	results = tracker_resources_sparql_update_blank (client, query, &error);
 
 	g_assert (!error);
 	g_assert (results);
@@ -374,7 +374,7 @@ test_tracker_sparql_update_blank_fast_large ()
 
 	query = g_strdup_printf (query_template, lotsOfA);
 
-	results = tracker_resources_sparql_update_blank_fast (client, query, &error);
+	results = tracker_resources_sparql_update_blank (client, query, &error);
 
 	g_free (lotsOfA);
 	g_free (query);
@@ -394,7 +394,7 @@ test_tracker_sparql_update_blank_fast_error ()
 	const gchar *query = "blork blork blork";
 	GPtrArray *results;
 
-	results = tracker_resources_sparql_update_blank_fast (client, query, &error);
+	results = tracker_resources_sparql_update_blank (client, query, &error);
 
 	g_assert (error);
 	g_assert (!results);
@@ -409,7 +409,7 @@ test_tracker_sparql_update_blank_fast_no_blanks ()
 	const gchar *query = "INSERT { <urn:not_blank> a nmo:Message }";
 	GPtrArray *results;
 
-	results = tracker_resources_sparql_update_blank_fast (client, query, &error);
+	results = tracker_resources_sparql_update_blank (client, query, &error);
 
 	g_assert (!error);
 	g_assert (results);
@@ -425,7 +425,7 @@ test_tracker_batch_sparql_update_fast ()
 	GError *error = NULL;
 	const gchar *query = "INSERT { _:x a nmo:Message }";
 
-	tracker_resources_batch_sparql_update_fast (client, query, &error);
+	tracker_resources_batch_sparql_update (client, query, &error);
 
 	g_assert (!error);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]