Commit cd8b7756 authored by Philip Van Hoof's avatar Philip Van Hoof Committed by Martyn Russell

libtracker-sparql, -bus: multi-insert: Provide API skeleton

parent 1fa2d975
......@@ -8,7 +8,7 @@ test -z "$srcdir" && srcdir=.
PKG_NAME="tracker"
REQUIRED_AUTOMAKE_VERSION=1.11
REQUIRED_VALA_VERSION=0.9.4
REQUIRED_VALA_VERSION=0.9.5
(test -f $srcdir/configure.ac \
&& test -f $srcdir/README) || {
......
......@@ -395,6 +395,17 @@ tracker_bus_fd_sparql_update_async (DBusGConnection *connection,
}
}
void
tracker_bus_fd_sparql_update_array_async (DBusGConnection *connection,
const char **queries,
guint queries_len,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
// todo
}
void
tracker_bus_fd_sparql_update_finish (GAsyncResult *res,
GError **error)
......@@ -404,6 +415,7 @@ tracker_bus_fd_sparql_update_finish (GAsyncResult *res,
g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
GVariant *
tracker_bus_fd_sparql_update_blank_finish (GAsyncResult *res,
GError **error)
......@@ -529,6 +541,18 @@ tracker_bus_fd_sparql_batch_update_async (DBusGConnection *connection,
}
}
void
tracker_bus_fd_sparql_batch_update_array_async (DBusGConnection *connection,
const char **queries,
guint queries_len,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
// todo
}
void
tracker_bus_fd_sparql_batch_update_finish (GAsyncResult *res,
GError **error)
......@@ -537,3 +561,21 @@ tracker_bus_fd_sparql_batch_update_finish (GAsyncResult *res,
g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
GPtrArray*
tracker_bus_fd_sparql_update_array_finish (GAsyncResult *res)
{
g_return_if_fail (res != NULL);
// todo: check if ref is needed here
return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
}
GPtrArray*
tracker_bus_fd_sparql_batch_update_array_finish (GAsyncResult *res)
{
g_return_if_fail (res != NULL);
// todo: check if ref is needed here
return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
}
......@@ -23,35 +23,50 @@
G_BEGIN_DECLS
void tracker_bus_fd_sparql_update (DBusGConnection *connection,
const char *query,
GError **error);
void tracker_bus_fd_sparql_update_async (DBusGConnection *connection,
const char *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * tracker_bus_fd_sparql_update_blank (DBusGConnection *connection,
const gchar *query,
GError **error);
void tracker_bus_fd_sparql_update_blank_async (DBusGConnection *connection,
const gchar *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void tracker_bus_fd_sparql_batch_update (DBusGConnection *connection,
const char *query,
GError **error);
void tracker_bus_fd_sparql_batch_update_async (DBusGConnection *connection,
const char *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void tracker_bus_fd_sparql_update_finish (GAsyncResult *res,
GError **error);
GVariant * tracker_bus_fd_sparql_update_blank_finish (GAsyncResult *res,
GError **error);
void tracker_bus_fd_sparql_batch_update_finish (GAsyncResult *res,
GError **error);
void tracker_bus_fd_sparql_update (DBusGConnection *connection,
const char *query,
GError **error);
void tracker_bus_fd_sparql_update_async (DBusGConnection *connection,
const char *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void tracker_bus_fd_sparql_update_array_async (DBusGConnection *connection,
const char **queries,
guint queries_len,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GVariant * tracker_bus_fd_sparql_update_blank (DBusGConnection *connection,
const gchar *query,
GError **error);
void tracker_bus_fd_sparql_update_blank_async (DBusGConnection *connection,
const gchar *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void tracker_bus_fd_sparql_batch_update (DBusGConnection *connection,
const char *query,
GError **error);
void tracker_bus_fd_sparql_batch_update_async (DBusGConnection *connection,
const char *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void tracker_bus_fd_sparql_batch_update_array_async (DBusGConnection *connection,
const char **queries,
guint queries_len,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void tracker_bus_fd_sparql_update_finish (GAsyncResult *res,
GError **error);
GVariant * tracker_bus_fd_sparql_update_blank_finish (GAsyncResult *res,
GError **error);
void tracker_bus_fd_sparql_batch_update_finish (GAsyncResult *res,
GError **error);
GPtrArray* tracker_bus_fd_sparql_update_array_finish (GAsyncResult *res);
GPtrArray* tracker_bus_fd_sparql_batch_update_array_finish (GAsyncResult *res);
G_END_DECLS
......@@ -29,3 +29,8 @@ public extern async void tracker_bus_fd_sparql_update_async (DBus.Connection con
public extern async GLib.Variant tracker_bus_fd_sparql_update_blank_async (DBus.Connection connection, string query, GLib.Cancellable? cancellable = null) throws Tracker.Sparql.Error, DBus.Error, GLib.IOError;
[CCode (cheader_filename = "tracker-bus-fd-update.h")]
public extern async void tracker_bus_fd_sparql_batch_update_async (DBus.Connection connection, string query, GLib.Cancellable? cancellable = null) throws Tracker.Sparql.Error, DBus.Error, GLib.IOError;
[CCode (cheader_filename = "tracker-bus-fd-update.h")]
public extern async GLib.PtrArray? tracker_bus_fd_sparql_update_array_async (DBus.Connection connection, string query[], GLib.Cancellable? cancellable = null);
[CCode (cheader_filename = "tracker-bus-fd-update.h")]
public extern async GLib.PtrArray? tracker_bus_fd_sparql_batch_update_array_async (DBus.Connection connection, string[] query, GLib.Cancellable? cancellable = null);
......@@ -107,6 +107,18 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
}
}
public async override GLib.PtrArray? update_array_async (string[] sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) {
try {
if (priority >= GLib.Priority.DEFAULT) {
return yield tracker_bus_fd_sparql_update_array_async (connection, sparql, cancellable);
} else {
return yield tracker_bus_fd_sparql_batch_update_array_async (connection, sparql, cancellable);
}
} catch (DBus.Error e) {
critical (e.message);
}
}
public override GLib.Variant? update_blank (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error, IOError {
try {
GLib.Variant res = null;
......
......@@ -135,6 +135,11 @@ class Tracker.Sparql.Backend : Connection {
yield bus.update_async (sparql, priority, cancellable);
}
public async override GLib.PtrArray? update_array_async (string[] sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null)
requires (bus != null) {
return yield bus.update_array_async (sparql, priority, cancellable);
}
public async override GLib.Variant? update_blank_async (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error, IOError
requires (bus != null) {
debug ("%s(priority:%d): '%s'", Log.METHOD, priority, sparql);
......
......@@ -426,6 +426,12 @@ public abstract class Tracker.Sparql.Connection : Object {
warning ("Interface 'update_async' not implemented");
}
/* Private API */
public async virtual GLib.PtrArray? update_array_async (string[] sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) {
warning ("Interface 'update_array_async' not implemented");
return null;
}
/**
* tracker_sparql_connection_update_blank:
* @self: a #TrackerSparqlConnection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment