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




commit 5cb0970ac41abea34b53243b47bb0a3bfa84cb23
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 519fee079..5b2587cd6 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]