Top | ![]() |
![]() |
![]() |
![]() |
enum | TrackerSparqlError |
struct | TrackerSparqlConnection |
enum | TrackerSparqlConnectionFlags |
TrackerSparqlConnection * tracker_sparql_connection_get (GCancellable *cancellable
,GError **error
);
This function is used to give the caller a connection to Tracker they can use for future requests. The best backend available to connect to Tracker is returned. These backends include direct-access (for read-only queries) and D-Bus (for both read and write queries).
You can use
When calling either tracker_sparql_connection_get()
, or the asynchronous
variants of these functions, a mutex is used to protect the loading of
backends against potential race conditions. For synchronous calls, this
function will always block if a previous connection get method has been
called.
All backends will call the D-Bus tracker-store API Wait()
to make sure
the store and databases are in the right state before any user based
requests can proceed. There may be a small delay during this call if the
databases weren't shutdown cleanly and need to be checked on start up. If
the journal needs to be replayed in such an event, the delay may be
substantial while data is restored as best as possible.
cancellable |
a GCancellable used to cancel the operation |
|
error |
GError for error reporting. |
Since: 0.10
TrackerSparqlConnection * tracker_sparql_connection_local_new (TrackerSparqlConnectionFlags flags
,GFile *store
,GFile *journal
,GFile *ontology
,GCancellable *cancellable
,GError **error
);
flags |
Flags to define connection behavior |
|
store |
Location for the database |
|
journal |
Location for the operation journal, or |
|
ontology |
Location of the ontology used for this connection, or |
|
cancellable |
A GCancellable |
|
error |
The error which occurred or |
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.
This database connection is considered entirely private to the calling process, if multiple processes use the same journal/cache locations, the results are unpredictable.
The journal
is used to rebuild the database in case of data corruption,
if NULL
is provided, the same location than store
will be assumed.
The caller is entirely free to define an ontology or reuse Nepomuk for
its purposes. For the former see the "Defining ontologies" section in
this library docs. For the latter pass a NULL
ontology
.
The ontology
argument may be a resource:/// URI, a directory location
must be provided, all children .ontology and .description files will
be read.
The store
and journal
arguments expect directories, and those are
assumed to be entirely private to Tracker.
Since: 2.0
TrackerSparqlConnection *
tracker_sparql_connection_remote_new (const gchar *uri_base
);
a new remote TrackerSparqlConnection. Call g_object_unref()
on the
object when no longer used.
Since: 1.12
void
tracker_sparql_connection_set_domain (const gchar *domain
);
Sets the domain (usually a DBus name or application ID) that
will be used on on the connection obtained by
tracker_sparql_connection_get()
. See the "Isolating tracker-store
clients" section in the docs for this library.
This function must be called before any tracker_sparql_connection_get()
calls happen.
Since: 2.0
gchar *
tracker_sparql_connection_get_domain (void
);
Gets the domain (usually a DBus name or application ID) that
will be used on on the connection obtained by
tracker_sparql_connection_get()
.
See tracker_sparql_connection_set_domain()
for more information.
Since: 2.0
GDBusConnection *
tracker_sparql_connection_get_dbus_connection
(void
);
Gets the D-Bus connection that is used to contact the Tracker services.
Since: 2.0
void
tracker_sparql_connection_set_dbus_connection
(GDBusConnection *dbus_connection
);
By default, a connection is opened to the session-wide Tracker services running on the D-Bus session bus. This function allows you to connect to Tracker services that are running on a different bus.
This function must be called before any tracker_sparql_connection_get()
calls happen.
See also: the TRACKER_IPC_BUS environment variable.
Since: 2.2
struct TrackerSparqlConnection { GObject parent_instance; TrackerSparqlConnectionPrivate * priv; };
The TrackerSparqlConnection object represents a connection with the Tracker store or databases depending on direct or non-direct requests.