[polari/wip/carlosg/tracker: 13/15] lib: Use TrackerResource "add" API when we know replacing is not necessary
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/carlosg/tracker: 13/15] lib: Use TrackerResource "add" API when we know replacing is not necessary
- Date: Sun, 24 Feb 2019 23:13:12 +0000 (UTC)
commit 52cdd07537dfa8264f8e2a55597e0fadea746c04
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Feb 24 23:22:12 2019 +0100
lib: Use TrackerResource "add" API when we know replacing is not necessary
On invariable fields, or those we know have no previous values (eg. a
new message as an anonymous node), we can use tracker_resource_add*
API, which avoids deleting previous values. This should speed up
imports.
This is specially important on the "rdf:type" property, as Tracker
implicitly deletes resources when all rdf:types are gone, so we are
essentially deleting and creating elements for channels/users very
frequently.
src/lib/polari-message.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/lib/polari-message.c b/src/lib/polari-message.c
index bc59bb7..5737a88 100644
--- a/src/lib/polari-message.c
+++ b/src/lib/polari-message.c
@@ -136,8 +136,8 @@ create_account_resource (const char *id)
res = tracker_resource_new (uri);
- tracker_resource_set_uri (res, "rdf:type", "polari:Account");
- tracker_resource_set_string (res, "polari:id", id);
+ tracker_resource_add_uri (res, "rdf:type", "polari:Account");
+ tracker_resource_add_string (res, "polari:id", id);
g_free (uri);
@@ -156,10 +156,10 @@ create_channel_resource (const char *name,
res = tracker_resource_new (uri);
- tracker_resource_set_uri (res, "rdf:type", is_room ? "polari:Room"
+ tracker_resource_add_uri (res, "rdf:type", is_room ? "polari:Room"
: "polari:Conversation");
- tracker_resource_set_string (res, "polari:name", name);
- tracker_resource_set_take_relation (res, "polari:account",
+ tracker_resource_add_string (res, "polari:name", name);
+ tracker_resource_add_take_relation (res, "polari:account",
create_account_resource (account_id));
g_free (uri);
@@ -180,7 +180,7 @@ create_sender_resource (const char *nick,
res = tracker_resource_new (uri);
- tracker_resource_set_uri (res, "rdf:type", is_self ? "polari:SelfContact"
+ tracker_resource_add_uri (res, "rdf:type", is_self ? "polari:SelfContact"
: "polari:Contact");
tracker_resource_set_string (res, "polari:nick", nick);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]