[tracker/wip/carlosg/bus-connection-methods: 12/12] libtracker-sparql: Implement update_resource(_async) in bus connections
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/bus-connection-methods: 12/12] libtracker-sparql: Implement update_resource(_async) in bus connections
- Date: Wed, 7 Apr 2021 09:24:24 +0000 (UTC)
commit 9aad47646d6365f4541d31c03524c92ee2c46491
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Apr 4 13:23:55 2021 +0200
libtracker-sparql: Implement update_resource(_async) in bus connections
Use batches underneath, holding the single operation.
src/libtracker-sparql/bus/tracker-bus.vala | 12 ++++++++++++
src/libtracker-sparql/tracker-sparql.vapi | 4 ++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-sparql/bus/tracker-bus.vala b/src/libtracker-sparql/bus/tracker-bus.vala
index a31b2df10..f61c6226f 100644
--- a/src/libtracker-sparql/bus/tracker-bus.vala
+++ b/src/libtracker-sparql/bus/tracker-bus.vala
@@ -342,6 +342,18 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
return reply.get_body ().get_child_value (0);
}
+ public override bool update_resource (string? graph, Resource resource, GLib.Cancellable? cancellable
= null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError {
+ var batch = this.create_batch ();
+ batch.add_resource (graph, resource);
+ return batch.execute (cancellable);
+ }
+
+ public async override bool update_resource_async (string? graph, Resource resource, GLib.Cancellable?
cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError {
+ var batch = this.create_batch ();
+ batch.add_resource (graph, resource);
+ return yield batch.execute_async (cancellable);
+ }
+
public override Tracker.Notifier? create_notifier () {
var notifier = (Tracker.Notifier) Object.new (typeof (Tracker.Notifier),
"connection", this,
diff --git a/src/libtracker-sparql/tracker-sparql.vapi b/src/libtracker-sparql/tracker-sparql.vapi
index cb02da3d8..389965873 100644
--- a/src/libtracker-sparql/tracker-sparql.vapi
+++ b/src/libtracker-sparql/tracker-sparql.vapi
@@ -84,8 +84,8 @@ namespace Tracker {
public async virtual bool update_array_async (string[] sparql, 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, GLib.Cancellable?
cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
- public virtual void update_resource (string? graph, Resource resource, GLib.Cancellable?
cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
- public async virtual void update_resource_async (string? graph, Resource resource,
GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
+ public virtual bool update_resource (string? graph, Resource resource, GLib.Cancellable?
cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
+ public async virtual bool update_resource_async (string? graph, Resource resource,
GLib.Cancellable? cancellable = null) throws Sparql.Error, GLib.Error, GLib.IOError, GLib.DBusError;
public virtual NamespaceManager? get_namespace_manager ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]