From 4dbcef0d5281cb190837a9d39ace9c1807b47537 Mon Sep 17 00:00:00 2001 From: Philip Van Hoof Date: Tue, 29 Jun 2010 14:22:32 +0200 Subject: libtracker-data: Added tracker:domainIndex property In this commit the tracker:domainIndex property has no function yet. It'll be implemented to represent a setting that will make the storage redundantly store a property in the table of its domain, in order to allow placing an index on the column for that table. For example nmm:MusicPiece has a domain-index on nie:title. This will make it store a redundent copy of nie:title in nmm:MusicPiece's SQL table, while also having a copy in nie:InformationElement's table. The advantage is a less complex query and the possibility to set an index on the redundant column in nmm:MusicPiece's table. --- src/libtracker-data/tracker-class.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/libtracker-data/tracker-class.c') diff --git a/src/libtracker-data/tracker-class.c b/src/libtracker-data/tracker-class.c index 112186ec5..49a8e6dfa 100644 --- a/src/libtracker-data/tracker-class.c +++ b/src/libtracker-data/tracker-class.c @@ -42,6 +42,7 @@ struct _TrackerClassPrivate { gboolean notify; GArray *super_classes; + GArray *domain_indexes; }; static void class_finalize (GObject *object); @@ -67,6 +68,7 @@ tracker_class_init (TrackerClass *service) priv->id = 0; priv->super_classes = g_array_new (TRUE, TRUE, sizeof (TrackerClass *)); + priv->domain_indexes = g_array_new (TRUE, TRUE, sizeof (TrackerProperty *)); /* Make GET_PRIV working */ service->priv = priv; @@ -83,6 +85,7 @@ class_finalize (GObject *object) g_free (priv->name); g_array_free (priv->super_classes, TRUE); + g_array_free (priv->domain_indexes, TRUE); (G_OBJECT_CLASS (tracker_class_parent_class)->finalize) (object); } @@ -157,6 +160,18 @@ tracker_class_get_super_classes (TrackerClass *service) return (TrackerClass **) priv->super_classes->data; } +TrackerProperty ** +tracker_class_get_domain_indexes (TrackerClass *service) +{ + TrackerClassPrivate *priv; + + g_return_val_if_fail (TRACKER_IS_CLASS (service), NULL); + + priv = GET_PRIV (service); + + return (TrackerProperty **) priv->domain_indexes->data; +} + gboolean tracker_class_get_is_new (TrackerClass *service) { @@ -261,7 +276,6 @@ tracker_class_set_id (TrackerClass *service, priv->id = value; } - void tracker_class_add_super_class (TrackerClass *service, TrackerClass *value) @@ -276,6 +290,20 @@ tracker_class_add_super_class (TrackerClass *service, g_array_append_val (priv->super_classes, value); } +void +tracker_class_add_domain_index (TrackerClass *service, + TrackerProperty *value) +{ + TrackerClassPrivate *priv; + + g_return_if_fail (TRACKER_IS_CLASS (service)); + g_return_if_fail (TRACKER_IS_PROPERTY (value)); + + priv = GET_PRIV (service); + + g_array_append_val (priv->domain_indexes, value); +} + void tracker_class_set_is_new (TrackerClass *service, gboolean value) @@ -289,6 +317,7 @@ tracker_class_set_is_new (TrackerClass *service, priv->is_new = value; } + void tracker_class_set_notify (TrackerClass *service, gboolean value) -- cgit v1.2.1