[tracker/wip/carlosg/last-api-changes: 1/3] libtracker-sparql: Drop priority argument from sync functions



commit 9c9baf31dc1564e6e107a723b24fe0063dd2f861
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jun 18 19:16:35 2020 +0200

    libtracker-sparql: Drop priority argument from sync functions

 .../libtracker-sparql/examples/writeonly-example.c     |  1 -
 docs/reference/libtracker-sparql/migrating-2to3.xml    |  8 ++++++++
 src/libtracker-bus/tracker-bus.vala                    | 10 +++++-----
 src/libtracker-direct/tracker-direct.c                 |  2 --
 .../libtracker-sparql-intermediate-c.vapi              |  4 ++--
 src/libtracker-sparql/tracker-connection.c             |  6 ------
 src/libtracker-sparql/tracker-connection.h             |  2 --
 src/libtracker-sparql/tracker-private.h                |  2 --
 src/tracker/tracker-import.c                           |  2 +-
 src/tracker/tracker-sparql.c                           |  2 +-
 tests/libtracker-fts/tracker-fts-test.c                |  2 +-
 tests/libtracker-sparql/tracker-fd-test.c              | 18 +++++++++---------
 utils/mtp/mtp-dummy.c                                  |  1 -
 utils/trackertestutils/storehelper.py                  |  2 +-
 14 files changed, 28 insertions(+), 34 deletions(-)
---
diff --git a/docs/reference/libtracker-sparql/examples/writeonly-example.c 
b/docs/reference/libtracker-sparql/examples/writeonly-example.c
index eb52ac316..ed7fc0084 100644
--- a/docs/reference/libtracker-sparql/examples/writeonly-example.c
+++ b/docs/reference/libtracker-sparql/examples/writeonly-example.c
@@ -28,7 +28,6 @@ int main (int argc, const char **argv)
   /* Run a synchronous update query */
   tracker_sparql_connection_update (connection,
                                     query,
-                                    G_PRIORITY_DEFAULT,
                                     NULL,
                                     &error);
   if (error) {
diff --git a/docs/reference/libtracker-sparql/migrating-2to3.xml 
b/docs/reference/libtracker-sparql/migrating-2to3.xml
index f357ba484..b8f106f02 100644
--- a/docs/reference/libtracker-sparql/migrating-2to3.xml
+++ b/docs/reference/libtracker-sparql/migrating-2to3.xml
@@ -190,4 +190,12 @@ SELECT ?url ?tag {
       Use a dedicated DBus TrackerSparqlConnection to the specific domain.
     </para>
   </section>
+  <section>
+    <title>No priority argument on SPARQL updates</title>
+    <para>
+      All TrackerSparqlConnection updates API has been dropped the priority
+      argument. Updates are processed sequentially, and asynchronous tasks
+      are handled by the main loop with the default priority.
+    </para>
+  </section>
 </chapter>
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index d3139e5db..e01408f50 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -136,13 +136,13 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
                bus.send_message_with_reply.begin (message, DBusSendMessageFlags.NONE, int.MAX, null, 
cancellable, callback);
        }
 
-       public override void update (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? 
cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, DBusError {
+       public override void update (string sparql, Cancellable? cancellable = null) throws Sparql.Error, 
GLib.Error, GLib.IOError, DBusError {
                // use separate main context for sync operation
                var context = new MainContext ();
                var loop = new MainLoop (context, false);
                context.push_thread_default ();
                AsyncResult async_res = null;
-               update_async.begin (sparql, priority, cancellable, (o, res) => {
+               update_async.begin (sparql, GLib.Priority.DEFAULT, cancellable, (o, res) => {
                        async_res = res;
                        loop.quit ();
                });
@@ -159,7 +159,7 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
                // send D-Bus request
                AsyncResult dbus_res = null;
                bool sent_update = false;
-               send_update (priority <= GLib.Priority.DEFAULT ? "Update" : "BatchUpdate", input, 
cancellable, (o, res) => {
+               send_update ("Update", input, cancellable, (o, res) => {
                        dbus_res = res;
                        if (sent_update) {
                                update_async.callback ();
@@ -220,13 +220,13 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
                 return true;
        }
 
-       public override GLib.Variant? update_blank (string sparql, int priority = GLib.Priority.DEFAULT, 
Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, DBusError {
+       public override GLib.Variant? update_blank (string sparql, Cancellable? cancellable = null) throws 
Sparql.Error, GLib.Error, GLib.IOError, DBusError {
                // use separate main context for sync operation
                var context = new MainContext ();
                var loop = new MainLoop (context, false);
                context.push_thread_default ();
                AsyncResult async_res = null;
-               update_blank_async.begin (sparql, priority, cancellable, (o, res) => {
+               update_blank_async.begin (sparql, GLib.Priority.DEFAULT, cancellable, (o, res) => {
                        async_res = res;
                        loop.quit ();
                });
diff --git a/src/libtracker-direct/tracker-direct.c b/src/libtracker-direct/tracker-direct.c
index ad12c7726..38e48323c 100644
--- a/src/libtracker-direct/tracker-direct.c
+++ b/src/libtracker-direct/tracker-direct.c
@@ -711,7 +711,6 @@ tracker_direct_connection_query_statement (TrackerSparqlConnection  *self,
 static void
 tracker_direct_connection_update (TrackerSparqlConnection  *self,
                                   const gchar              *sparql,
-                                  gint                      priority,
                                   GCancellable             *cancellable,
                                   GError                  **error)
 {
@@ -807,7 +806,6 @@ tracker_direct_connection_update_array_finish (TrackerSparqlConnection  *self,
 static GVariant *
 tracker_direct_connection_update_blank (TrackerSparqlConnection  *self,
                                         const gchar              *sparql,
-                                        gint                      priority,
                                         GCancellable             *cancellable,
                                         GError                  **error)
 {
diff --git a/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi 
b/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi
index 5be0f543a..aca920da9 100644
--- a/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi
+++ b/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi
@@ -72,10 +72,10 @@ namespace Tracker {
                public abstract Cursor query (string sparql, GLib.Cancellable? cancellable = null) throws 
Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
                public async abstract Cursor query_async (string sparql, GLib.Cancellable? cancellable = 
null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
 
-               public virtual void update (string sparql, int priority = GLib.Priority.DEFAULT, 
GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
+               public virtual void update (string sparql, GLib.Cancellable? cancellable = null) throws 
Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
                public async virtual void update_async (string sparql, int priority = GLib.Priority.DEFAULT, 
GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
                public async virtual bool update_array_async (string[] sparql, int priority = 
GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, 
GLib.DBusError;
-               public virtual GLib.Variant? update_blank (string sparql, int priority = 
GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, 
GLib.DBusError;
+               public virtual GLib.Variant? update_blank (string sparql, GLib.Cancellable? cancellable = 
null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
                public async virtual GLib.Variant? update_blank_async (string sparql, int priority = 
GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, 
GLib.DBusError;
 
                public virtual NamespaceManager? get_namespace_manager ();
diff --git a/src/libtracker-sparql/tracker-connection.c b/src/libtracker-sparql/tracker-connection.c
index 523a4338e..a17bd5851 100644
--- a/src/libtracker-sparql/tracker-connection.c
+++ b/src/libtracker-sparql/tracker-connection.c
@@ -245,7 +245,6 @@ tracker_sparql_connection_query_finish (TrackerSparqlConnection  *connection,
  * tracker_sparql_connection_update:
  * @connection: a #TrackerSparqlConnection
  * @sparql: string containing the SPARQL update query
- * @priority: the priority for the operation
  * @cancellable: a #GCancellable used to cancel the operation
  * @error: #GError for error reporting.
  *
@@ -259,7 +258,6 @@ tracker_sparql_connection_query_finish (TrackerSparqlConnection  *connection,
 void
 tracker_sparql_connection_update (TrackerSparqlConnection  *connection,
                                   const gchar              *sparql,
-                                  gint                      priority,
                                   GCancellable             *cancellable,
                                   GError                  **error)
 {
@@ -270,7 +268,6 @@ tracker_sparql_connection_update (TrackerSparqlConnection  *connection,
 
        return TRACKER_SPARQL_CONNECTION_GET_CLASS (connection)->update (connection,
                                                                         sparql,
-                                                                        priority,
                                                                         cancellable,
                                                                         error);
 }
@@ -426,7 +423,6 @@ tracker_sparql_connection_update_array_finish (TrackerSparqlConnection  *connect
  * tracker_sparql_connection_update_blank:
  * @connection: a #TrackerSparqlConnection
  * @sparql: string containing the SPARQL update query
- * @priority: the priority for the operation
  * @cancellable: a #GCancellable used to cancel the operation
  * @error: #GError for error reporting.
  *
@@ -443,7 +439,6 @@ tracker_sparql_connection_update_array_finish (TrackerSparqlConnection  *connect
 GVariant *
 tracker_sparql_connection_update_blank (TrackerSparqlConnection  *connection,
                                         const gchar              *sparql,
-                                        gint                      priority,
                                         GCancellable             *cancellable,
                                         GError                  **error)
 {
@@ -454,7 +449,6 @@ tracker_sparql_connection_update_blank (TrackerSparqlConnection  *connection,
 
        return TRACKER_SPARQL_CONNECTION_GET_CLASS (connection)->update_blank (connection,
                                                                               sparql,
-                                                                              priority,
                                                                               cancellable,
                                                                               error);
 }
diff --git a/src/libtracker-sparql/tracker-connection.h b/src/libtracker-sparql/tracker-connection.h
index 2406a4625..553220600 100644
--- a/src/libtracker-sparql/tracker-connection.h
+++ b/src/libtracker-sparql/tracker-connection.h
@@ -164,7 +164,6 @@ TrackerSparqlCursor * tracker_sparql_connection_query_finish (TrackerSparqlConne
 TRACKER_AVAILABLE_IN_ALL
 void tracker_sparql_connection_update (TrackerSparqlConnection  *connection,
                                        const gchar              *sparql,
-                                       gint                      priority,
                                        GCancellable             *cancellable,
                                        GError                  **error);
 TRACKER_AVAILABLE_IN_ALL
@@ -193,7 +192,6 @@ gboolean tracker_sparql_connection_update_array_finish (TrackerSparqlConnection
 TRACKER_AVAILABLE_IN_ALL
 GVariant * tracker_sparql_connection_update_blank (TrackerSparqlConnection  *connection,
                                                    const gchar              *sparql,
-                                                   gint                      priority,
                                                    GCancellable             *cancellable,
                                                    GError                  **error);
 TRACKER_AVAILABLE_IN_ALL
diff --git a/src/libtracker-sparql/tracker-private.h b/src/libtracker-sparql/tracker-private.h
index 66265c072..54e86fbea 100644
--- a/src/libtracker-sparql/tracker-private.h
+++ b/src/libtracker-sparql/tracker-private.h
@@ -42,7 +42,6 @@ struct _TrackerSparqlConnectionClass
                                                 GError                  **error);
         void (* update) (TrackerSparqlConnection  *connection,
                          const gchar              *sparql,
-                         gint                      priority,
                          GCancellable             *cancellable,
                          GError                  **error);
         void (* update_async) (TrackerSparqlConnection *connection,
@@ -66,7 +65,6 @@ struct _TrackerSparqlConnectionClass
                                           GError                  **error);
         GVariant* (* update_blank) (TrackerSparqlConnection  *connection,
                                     const gchar              *sparql,
-                                    gint                      priority,
                                     GCancellable             *cancellable,
                                     GError                  **error);
         void (* update_blank_async) (TrackerSparqlConnection *connection,
diff --git a/src/tracker/tracker-import.c b/src/tracker/tracker-import.c
index 525d63d86..47409f249 100644
--- a/src/tracker/tracker-import.c
+++ b/src/tracker/tracker-import.c
@@ -110,7 +110,7 @@ import_run (void)
                uri = g_file_get_uri (file);
                update = g_strdup_printf ("LOAD <%s>", uri);
 
-               tracker_sparql_connection_update (connection, update, 0, NULL, &error);
+               tracker_sparql_connection_update (connection, update, NULL, &error);
 
                if (error) {
                        g_printerr ("%s, %s\n",
diff --git a/src/tracker/tracker-sparql.c b/src/tracker/tracker-sparql.c
index ed51640d6..60c4f41fc 100644
--- a/src/tracker/tracker-sparql.c
+++ b/src/tracker/tracker-sparql.c
@@ -1431,7 +1431,7 @@ sparql_run (void)
 
        if (query) {
                if (G_UNLIKELY (update)) {
-                       tracker_sparql_connection_update (connection, query, 0, NULL, &error);
+                       tracker_sparql_connection_update (connection, query, NULL, &error);
 
                        if (error) {
                                g_printerr ("%s, %s\n",
diff --git a/tests/libtracker-fts/tracker-fts-test.c b/tests/libtracker-fts/tracker-fts-test.c
index 44c73de87..584609bff 100644
--- a/tests/libtracker-fts/tracker-fts-test.c
+++ b/tests/libtracker-fts/tracker-fts-test.c
@@ -88,7 +88,7 @@ test_sparql_query (gconstpointer test_data)
        g_file_get_contents (update_filename, &update, NULL, &error);
        g_assert_no_error (error);
 
-       tracker_sparql_connection_update (conn, update, G_PRIORITY_DEFAULT, NULL, &error);
+       tracker_sparql_connection_update (conn, update, NULL, &error);
        g_assert_no_error (error);
 
        g_free (update_filename);
diff --git a/tests/libtracker-sparql/tracker-fd-test.c b/tests/libtracker-sparql/tracker-fd-test.c
index 408600f15..941288ad6 100644
--- a/tests/libtracker-sparql/tracker-fd-test.c
+++ b/tests/libtracker-sparql/tracker-fd-test.c
@@ -50,7 +50,7 @@ delete_test_data (DataFixture   *fixture,
                                   "<urn:testdata4> a rdfs:Resource ."
                                   "}";
 
-       tracker_sparql_connection_update (connection, delete_query, 0, NULL, &error);
+       tracker_sparql_connection_update (connection, delete_query, NULL, &error);
        g_assert_no_error (error);
 }
 
@@ -76,7 +76,7 @@ insert_test_data (DataFixture   *fixture,
                                        "    <urn:testdata4> a nmm:Photo ; nao:identifier \"%s\" ."
                                        "}", longName);
 
-       tracker_sparql_connection_update (connection, filled_query, 0, NULL, &error);
+       tracker_sparql_connection_update (connection, filled_query, NULL, &error);
        g_assert_no_error (error);
 
        g_free (filled_query);
@@ -298,7 +298,7 @@ test_tracker_sparql_update_fast_small (DataFixture  *fixture,
        GError *error = NULL;
        const gchar *query = "INSERT { _:x a nfo:Image }";
 
-       tracker_sparql_connection_update (connection, query, 0, NULL, &error);
+       tracker_sparql_connection_update (connection, query, NULL, &error);
 
        g_assert_no_error (error);
 }
@@ -317,7 +317,7 @@ test_tracker_sparql_update_fast_large (DataFixture  *fixture,
 
        query = g_strdup_printf ("INSERT { _:x a nfo:Image; nao:identifier \"%s\" }", lots);
 
-       tracker_sparql_connection_update (connection, query, 0, NULL, &error);
+       tracker_sparql_connection_update (connection, query, NULL, &error);
 
        g_free (lots);
        g_free (query);
@@ -384,7 +384,7 @@ test_tracker_sparql_update_fast_error (DataFixture  *fixture,
        GError *error = NULL;
        const gchar *query = "blork blork blork";
 
-       tracker_sparql_connection_update (connection, query, 0, NULL, &error);
+       tracker_sparql_connection_update (connection, query, NULL, &error);
 
        g_assert (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
        g_error_free (error);
@@ -398,7 +398,7 @@ test_tracker_sparql_update_blank_fast_small (DataFixture  *fixture,
        const gchar *query = "INSERT { _:x a nfo:Image }";
        GVariant *results;
 
-       results = tracker_sparql_connection_update_blank (connection, query, 0, NULL, &error);
+       results = tracker_sparql_connection_update_blank (connection, query, NULL, &error);
 
        g_assert_no_error (error);
        g_assert (results);
@@ -421,7 +421,7 @@ test_tracker_sparql_update_blank_fast_large (DataFixture  *fixture,
 
        query = g_strdup_printf ("INSERT { _:x a nfo:Image; nao:identifier \"%s\" }", lots);
 
-       results = tracker_sparql_connection_update_blank (connection, query, 0, NULL, &error);
+       results = tracker_sparql_connection_update_blank (connection, query, NULL, &error);
 
        g_free (lots);
        g_free (query);
@@ -440,7 +440,7 @@ test_tracker_sparql_update_blank_fast_error (DataFixture  *fixture,
        const gchar *query = "blork blork blork";
        GVariant *results;
 
-       results = tracker_sparql_connection_update_blank (connection, query, 0, NULL, &error);
+       results = tracker_sparql_connection_update_blank (connection, query, NULL, &error);
 
        g_assert (error != NULL && error->domain == TRACKER_SPARQL_ERROR);
        g_assert (!results);
@@ -456,7 +456,7 @@ test_tracker_sparql_update_blank_fast_no_blanks (DataFixture  *fixture,
        const gchar *query = "INSERT { <urn:not_blank> a nfo:Image }";
        GVariant *results;
 
-       results = tracker_sparql_connection_update_blank (connection, query, 0, NULL, &error);
+       results = tracker_sparql_connection_update_blank (connection, query, NULL, &error);
 
        /* FIXME: Properly test once we get update_blank implemented */
 
diff --git a/utils/mtp/mtp-dummy.c b/utils/mtp/mtp-dummy.c
index 500ad8506..ee826bd60 100644
--- a/utils/mtp/mtp-dummy.c
+++ b/utils/mtp/mtp-dummy.c
@@ -149,7 +149,6 @@ update_store (const gchar *sparql)
        /* Run a synchronous update query */
        tracker_sparql_connection_update (connection,
                                          sparql,
-                                         G_PRIORITY_DEFAULT,
                                          NULL,
                                          &error);
 
diff --git a/utils/trackertestutils/storehelper.py b/utils/trackertestutils/storehelper.py
index 7baffa2d8..aa665ff65 100644
--- a/utils/trackertestutils/storehelper.py
+++ b/utils/trackertestutils/storehelper.py
@@ -475,7 +475,7 @@ class StoreHelper():
         return result
 
     def update(self, update_sparql):
-        self.conn.update(update_sparql, 0, None)
+        self.conn.update(update_sparql, None)
 
     def count_instances(self, ontology_class):
         QUERY = """


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