[tracker/wip/carlosg/domain-ontologies: 27/124] libtracker-sparql: Add tracker_sparql_connection_local_new(_async) methods



commit 09735a4a078bd531f061807f9eb7ec2e8e4f043d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jun 3 00:37:13 2017 +0200

    libtracker-sparql: Add tracker_sparql_connection_local_new(_async) methods
    
    These calls make private sparql databases available to applications.

 src/libtracker-sparql-backend/tracker-backend.vala |   13 +++++++++
 src/libtracker-sparql/tracker-connection.vala      |   27 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-sparql-backend/tracker-backend.vala 
b/src/libtracker-sparql-backend/tracker-backend.vala
index 68eba33..4d176ab 100644
--- a/src/libtracker-sparql-backend/tracker-backend.vala
+++ b/src/libtracker-sparql-backend/tracker-backend.vala
@@ -420,3 +420,16 @@ public static Tracker.Sparql.Connection tracker_sparql_connection_get_direct (Ca
 public static Tracker.Sparql.Connection tracker_sparql_connection_remote_new (string url_base) {
        return new Tracker.Remote.Connection (url_base);
 }
+
+public static Tracker.Sparql.Connection tracker_sparql_connection_local_new (Tracker.Sparql.ConnectionFlags 
flags, File store, File? journal, File? ontology, Cancellable? cancellable = null) throws GLib.Error, 
Tracker.Sparql.Error, IOError {
+       var conn = new Tracker.Direct.Connection (flags, store, journal, ontology);
+       conn.init (cancellable);
+       return conn;
+}
+
+public static async Tracker.Sparql.Connection tracker_sparql_connection_local_new_async 
(Tracker.Sparql.ConnectionFlags flags, File store, File? journal, File? ontology, Cancellable? cancellable = 
null) throws GLib.Error, Tracker.Sparql.Error, IOError {
+       var conn = new Tracker.Direct.Connection (flags, store, journal, ontology);
+       conn.init_async.begin (Priority.DEFAULT, cancellable);
+       yield;
+       return conn;
+}
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
index b6e7fe9..d3565fd 100644
--- a/src/libtracker-sparql/tracker-connection.vala
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -74,6 +74,11 @@ public errordomain Tracker.Sparql.Error {
        UNSUPPORTED
 }
 
+public enum Tracker.Sparql.ConnectionFlags {
+       NONE     = 0,
+       READONLY = 1 << 0,
+}
+
 /**
  * TrackerSparqlConnection:
  *
@@ -221,6 +226,28 @@ public abstract class Tracker.Sparql.Connection : Object {
        public extern static new Connection remote_new (string uri_base);
 
        /**
+        * tracker_sparql_connection_local_new:
+        *
+        * Returns: a new local #TrackerSparqlConnection using the specified
+        * @cache/@journal locations, and the ontology specified in the @ontology
+        * directory. Call g_object_unref() on the object when no longer used.
+        *
+        * Since: 1.12
+        */
+       public extern static new Connection local_new (Tracker.Sparql.ConnectionFlags flags, File store, 
File? journal, File? ontology, Cancellable? cancellable = null) throws Sparql.Error, IOError;
+
+       /**
+        * tracker_sparql_connection_local_new_async:
+        *
+        * Returns: a new local #TrackerSparqlConnection using the specified
+        * @cache/@journal locations, and the ontology specified in the @ontology
+        * directory. Call g_object_unref() on the object when no longer used.
+        *
+        * Since: 1.12
+        */
+       public extern async static new Connection local_new_async (Tracker.Sparql.ConnectionFlags flags, File 
store, File? journal, File? ontology, Cancellable? cancellable = null) throws Sparql.Error, IOError;
+
+       /**
         * tracker_sparql_connection_query:
         * @self: a #TrackerSparqlConnection
         * @sparql: string containing the SPARQL query


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