[tracker/wip/carlosg/update-perf: 15/61] libtracker-sparql: Refactor handling of domain indexes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 15/61] libtracker-sparql: Refactor handling of domain indexes
- Date: Mon, 22 Aug 2022 22:07:42 +0000 (UTC)
commit e593f147c89ddd412545f7714a77486ad020a94c
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 20 13:01:17 2022 +0200
libtracker-sparql: Refactor handling of domain indexes
This was separated on a separate function for inserts, but not deletes.
Rename the domain index insertion function, and separate deletion handling
to another separate function.
src/libtracker-sparql/core/tracker-data-update.c | 57 ++++++++++++------------
1 file changed, 28 insertions(+), 29 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index 04b3c3b53..d96990fe9 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -1686,9 +1686,9 @@ resource_in_domain_index_class (TrackerData *data,
}
static void
-process_domain_indexes (TrackerData *data,
- TrackerProperty *property,
- const GValue *gvalue)
+insert_property_domain_indexes (TrackerData *data,
+ TrackerProperty *property,
+ const GValue *gvalue)
{
TrackerClass **domain_index_classes;
@@ -1704,6 +1704,25 @@ process_domain_indexes (TrackerData *data,
}
}
+static void
+delete_property_domain_indexes (TrackerData *data,
+ TrackerProperty *property,
+ const GValue *gvalue)
+{
+ TrackerClass **domain_index_classes;
+
+ domain_index_classes = tracker_property_get_domain_indexes (property);
+ while (*domain_index_classes) {
+ if (resource_in_domain_index_class (data, *domain_index_classes)) {
+ cache_delete_value (data,
+ *domain_index_classes,
+ property,
+ gvalue);
+ }
+ domain_index_classes++;
+ }
+}
+
static gboolean
maybe_convert_value (TrackerData *data,
TrackerPropertyType source,
@@ -1880,9 +1899,8 @@ cache_insert_metadata_decomposed (TrackerData *data,
if (tracker_property_get_data_type (property) == TRACKER_PROPERTY_TYPE_RESOURCE)
tracker_data_resource_ref (data, g_value_get_int64 (object), multiple_values);
- if (!multiple_values) {
- process_domain_indexes (data, property, object);
- }
+ if (!multiple_values)
+ insert_property_domain_indexes (data, property, object);
change = TRUE;
}
@@ -1922,18 +1940,8 @@ delete_metadata_decomposed (TrackerData *data,
if (tracker_property_get_data_type (property) == TRACKER_PROPERTY_TYPE_RESOURCE)
tracker_data_resource_unref (data, g_value_get_int64 (object), multiple_values);
- if (!multiple_values) {
- TrackerClass **domain_index_classes;
-
- domain_index_classes = tracker_property_get_domain_indexes (property);
-
- while (*domain_index_classes) {
- if (resource_in_domain_index_class (data, *domain_index_classes))
- cache_delete_value (data, *domain_index_classes, property, object);
-
- domain_index_classes++;
- }
- }
+ if (!multiple_values)
+ delete_property_domain_indexes (data, property, object);
change = TRUE;
}
@@ -2089,17 +2097,8 @@ cache_delete_resource_type_full (TrackerData *data,
if (tracker_property_get_data_type (prop) == TRACKER_PROPERTY_TYPE_RESOURCE)
tracker_data_resource_unref (data, g_value_get_int64 (©),
multiple_values);
- if (!multiple_values) {
- TrackerClass **domain_index_classes;
-
- domain_index_classes = tracker_property_get_domain_indexes (prop);
- while (*domain_index_classes) {
- if (resource_in_domain_index_class (data, *domain_index_classes))
- cache_delete_value (data, *domain_index_classes, prop, ©);
-
- domain_index_classes++;
- }
- }
+ if (!multiple_values)
+ delete_property_domain_indexes (data, prop, ©);
g_value_unset (©);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]