[tracker-miners/wip/carlosg/miner-changes: 1/3] libtracker-miner: Drop TrackerDecorator::data-source



commit 4eb34c1745f89551a96572980147deddb60b55b4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jun 18 13:54:21 2020 +0200

    libtracker-miner: Drop TrackerDecorator::data-source
    
    We now use extractorHash everywhere.

 src/libtracker-miner/tracker-decorator-fs.c     |  7 +---
 src/libtracker-miner/tracker-decorator.c        | 55 +------------------------
 src/libtracker-miner/tracker-decorator.h        |  1 -
 src/tracker-extract/tracker-extract-decorator.c |  3 --
 4 files changed, 3 insertions(+), 63 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-decorator-fs.c b/src/libtracker-miner/tracker-decorator-fs.c
index 9b7fb5f51..d849e2425 100644
--- a/src/libtracker-miner/tracker-decorator-fs.c
+++ b/src/libtracker-miner/tracker-decorator-fs.c
@@ -159,10 +159,8 @@ check_files (TrackerDecorator    *decorator,
              GAsyncReadyCallback  callback)
 {
        TrackerSparqlConnection *sparql_conn;
-       const gchar *data_source;
        GString *query;
 
-       data_source = tracker_decorator_get_data_source (decorator);
        query = g_string_new ("SELECT tracker:id(?urn) tracker:id(?type) { ?urn ");
 
        if (mount_point_urn) {
@@ -173,9 +171,8 @@ check_files (TrackerDecorator    *decorator,
 
        g_string_append (query, " a nfo:FileDataObject ;"
                                " a ?type .");
-       g_string_append_printf (query,
-                               "FILTER (! EXISTS { ?urn nie:dataSource <%s> } ",
-                               data_source);
+       g_string_append (query,
+                        "FILTER (! EXISTS { ?urn tracker:extractorHash ?h } ");
 
        _tracker_decorator_query_append_rdf_type_filter (decorator, query);
 
diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c
index 1dc730706..f9a4618a4 100644
--- a/src/libtracker-miner/tracker-decorator.c
+++ b/src/libtracker-miner/tracker-decorator.c
@@ -68,7 +68,6 @@ struct _SparqlUpdate {
 
 struct _TrackerDecoratorPrivate {
        TrackerNotifier *notifier;
-       gchar *data_source;
 
        GArray *classes; /* Array of ClassInfo */
        gchar **class_names;
@@ -101,8 +100,7 @@ struct _TrackerDecoratorPrivate {
 };
 
 enum {
-       PROP_DATA_SOURCE = 1,
-       PROP_CLASS_NAMES,
+       PROP_CLASS_NAMES = 1,
        PROP_COMMIT_BATCH_SIZE,
        PROP_PRIORITY_RDF_TYPES,
 };
@@ -853,9 +851,6 @@ tracker_decorator_get_property (GObject    *object,
        priv = TRACKER_DECORATOR (object)->priv;
 
        switch (param_id) {
-       case PROP_DATA_SOURCE:
-               g_value_set_string (value, priv->data_source);
-               break;
        case PROP_CLASS_NAMES:
                g_value_set_boxed (value, priv->class_names);
                break;
@@ -911,9 +906,6 @@ tracker_decorator_set_property (GObject      *object,
        priv = decorator->priv;
 
        switch (param_id) {
-       case PROP_DATA_SOURCE:
-               priv->data_source = g_value_dup_string (value);
-               break;
        case PROP_CLASS_NAMES:
                decorator_set_classes (decorator, g_value_get_boxed (value));
                break;
@@ -1001,17 +993,6 @@ tracker_decorator_initable_iface_init (GInitableIface *iface)
        iface->init = tracker_decorator_initable_init;
 }
 
-static void
-tracker_decorator_constructed (GObject *object)
-{
-       TrackerDecoratorPrivate *priv;
-
-       G_OBJECT_CLASS (tracker_decorator_parent_class)->constructed (object);
-
-       priv = TRACKER_DECORATOR (object)->priv;
-       g_assert (priv->data_source);
-}
-
 static void
 tracker_decorator_finalize (GObject *object)
 {
@@ -1044,7 +1025,6 @@ tracker_decorator_finalize (GObject *object)
        g_clear_pointer (&priv->sparql_buffer, g_array_unref);
        g_clear_pointer (&priv->commit_buffer, g_array_unref);
        g_sequence_free (priv->blacklist_items);
-       g_free (priv->data_source);
        g_timer_destroy (priv->timer);
 
        G_OBJECT_CLASS (tracker_decorator_parent_class)->finalize (object);
@@ -1101,7 +1081,6 @@ tracker_decorator_class_init (TrackerDecoratorClass *klass)
 
        object_class->get_property = tracker_decorator_get_property;
        object_class->set_property = tracker_decorator_set_property;
-       object_class->constructed = tracker_decorator_constructed;
        object_class->finalize = tracker_decorator_finalize;
 
        miner_class->paused = tracker_decorator_paused;
@@ -1109,15 +1088,6 @@ tracker_decorator_class_init (TrackerDecoratorClass *klass)
        miner_class->started = tracker_decorator_started;
        miner_class->stopped = tracker_decorator_stopped;
 
-       g_object_class_install_property (object_class,
-                                        PROP_DATA_SOURCE,
-                                        g_param_spec_string ("data-source",
-                                                             "Data source URN",
-                                                             "nie:DataSource to use in this decorator",
-                                                             NULL,
-                                                             G_PARAM_READWRITE |
-                                                             G_PARAM_CONSTRUCT_ONLY |
-                                                             G_PARAM_STATIC_STRINGS));
        g_object_class_install_property (object_class,
                                         PROP_CLASS_NAMES,
                                         g_param_spec_boxed ("class-names",
@@ -1204,29 +1174,6 @@ tracker_decorator_init (TrackerDecorator *decorator)
        priv->tasks = g_hash_table_new (NULL, NULL);
 }
 
-/**
- * tracker_decorator_get_data_source:
- * @decorator: a #TrackerDecorator.
- *
- * The unique string identifying this #TrackerDecorator that has
- * extracted the extended metadata. This is essentially an identifier
- * so it's clear WHO has extracted this extended metadata.
- *
- * Returns: a const gchar* or #NULL if an error happened.
- *
- * Since: 0.18
- **/
-const gchar *
-tracker_decorator_get_data_source (TrackerDecorator *decorator)
-{
-       TrackerDecoratorPrivate *priv;
-
-       g_return_val_if_fail (TRACKER_IS_DECORATOR (decorator), NULL);
-
-       priv = decorator->priv;
-       return priv->data_source;
-}
-
 /**
  * tracker_decorator_get_class_names:
  * @decorator: a #TrackerDecorator.
diff --git a/src/libtracker-miner/tracker-decorator.h b/src/libtracker-miner/tracker-decorator.h
index af00d566f..2ee8dbf26 100644
--- a/src/libtracker-miner/tracker-decorator.h
+++ b/src/libtracker-miner/tracker-decorator.h
@@ -96,7 +96,6 @@ typedef enum {
 GType         tracker_decorator_get_type          (void) G_GNUC_CONST;
 GQuark        tracker_decorator_error_quark       (void);
 
-const gchar * tracker_decorator_get_data_source   (TrackerDecorator     *decorator);
 const gchar** tracker_decorator_get_class_names   (TrackerDecorator     *decorator);
 guint         tracker_decorator_get_n_items       (TrackerDecorator     *decorator);
 
diff --git a/src/tracker-extract/tracker-extract-decorator.c b/src/tracker-extract/tracker-extract-decorator.c
index 025419986..7ae8bfafe 100644
--- a/src/tracker-extract/tracker-extract-decorator.c
+++ b/src/tracker-extract/tracker-extract-decorator.c
@@ -30,8 +30,6 @@ enum {
        PROP_EXTRACTOR = 1
 };
 
-#define TRACKER_EXTRACT_DATA_SOURCE TRACKER_PREFIX_TRACKER "extractor-data-source"
-#define TRACKER_EXTRACT_FAILURE_DATA_SOURCE TRACKER_PREFIX_TRACKER "extractor-failure-data-source"
 #define MAX_EXTRACTING_FILES 1
 
 #define TRACKER_EXTRACT_DECORATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
TRACKER_TYPE_EXTRACT_DECORATOR, TrackerExtractDecoratorPrivate))
@@ -724,7 +722,6 @@ tracker_extract_decorator_new (TrackerSparqlConnection  *connection,
        return g_initable_new (TRACKER_TYPE_EXTRACT_DECORATOR,
                               cancellable, error,
                               "connection", connection,
-                              "data-source", TRACKER_EXTRACT_DATA_SOURCE,
                               "class-names", supported_classes,
                               "extractor", extract,
                               NULL);


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