[tracker/wip/carlosg/anonymous-nodes: 7/24] libtracker-data: Avoid querying unnecessary IDs for notifications




commit 371ddb66a677afa986cf0527a167624ccf007f31
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Sep 21 16:57:12 2021 +0200

    libtracker-data: Avoid querying unnecessary IDs for notifications
    
    We only care about passing "<subject> rdf:type <class>" triples vs.
    anything else to distinguish between create/delete and update. We
    can avoid the ID queries for all other rdfs:Resource properties,
    so be a bit more specific here.

 src/libtracker-data/tracker-data-update.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index b27f2da1c..761e47a01 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -322,7 +322,7 @@ tracker_data_remove_insert_statement_callback (TrackerData             *data,
 void
 tracker_data_dispatch_insert_statement_callbacks (TrackerData *data,
                                                   gint         predicate_id,
-                                                  gint         object_id)
+                                                  gint         class_id)
 {
        if (data->insert_callbacks) {
                guint n;
@@ -335,7 +335,7 @@ tracker_data_dispatch_insert_statement_callbacks (TrackerData *data,
                                            data->resource_buffer->graph->graph,
                                            data->resource_buffer->id,
                                            predicate_id,
-                                           object_id,
+                                           class_id,
                                            data->resource_buffer->types,
                                            delegate->user_data);
                }
@@ -383,7 +383,7 @@ tracker_data_remove_delete_statement_callback (TrackerData             *data,
 void
 tracker_data_dispatch_delete_statement_callbacks (TrackerData *data,
                                                   gint         predicate_id,
-                                                  gint         object_id)
+                                                  gint         class_id)
 {
        if (data->delete_callbacks) {
                guint n;
@@ -396,7 +396,7 @@ tracker_data_dispatch_delete_statement_callbacks (TrackerData *data,
                                            data->resource_buffer->graph->graph,
                                            data->resource_buffer->id,
                                            predicate_id,
-                                           object_id,
+                                           class_id,
                                            data->resource_buffer->types,
                                            delegate->user_data);
                }
@@ -2654,7 +2654,6 @@ tracker_data_insert_statement_with_uri (TrackerData  *data,
        TrackerClass    *class;
        TrackerProperty *property;
        gint             prop_id = 0;
-       gint             object_id = 0;
        gboolean change = FALSE;
        TrackerOntologies *ontologies;
        const gchar *object_str;
@@ -2709,13 +2708,9 @@ tracker_data_insert_statement_with_uri (TrackerData  *data,
                }
 
                if (change) {
-                       object_id = query_resource_id (data, object_str, error);
-                       if (object_id == 0)
-                               return;
-
                        tracker_data_dispatch_insert_statement_callbacks (data,
                                                                          prop_id,
-                                                                         object_id);
+                                                                         0);
                }
        }
 }


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