[tracker/wip/carlosg/domain-ontologies: 31/76] libtracker-miner: Remove tracker_miner_fs_set_mtime_checking()



commit c07c657566beeb983ab51bdc3bde6827c3c02e37
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jun 18 12:36:48 2017 +0200

    libtracker-miner: Remove tracker_miner_fs_set_mtime_checking()
    
    This is just used to set the TRACKER_DIRECTORY_FLAG_CHECK_MTIME flag on
    the TrackerIndexingTree for all files. Given libtracker-miner has this
    fine grained switch and all use of it happens in src/miners/fs, just move
    the global toggle there and remove it from libtracker-miner API.
    
    The only usage of this flag inside libtracker-miner happened inside
    tracker_miner_fs_directory_add(), which was superseded by
    TrackerIndexingTree too and is scheduled for removal.

 .../libtracker-miner/libtracker-miner-sections.txt |    2 -
 src/libtracker-miner/tracker-miner-fs.c            |   75 --------------------
 src/libtracker-miner/tracker-miner-fs.h            |    3 -
 src/libtracker-miner/tracker-miner.vapi            |    3 -
 src/miners/fs/tracker-main.c                       |    2 +-
 src/miners/fs/tracker-miner-files.c                |   15 +++-
 src/miners/fs/tracker-miner-files.h                |    3 +
 7 files changed, 16 insertions(+), 87 deletions(-)
---
diff --git a/docs/reference/libtracker-miner/libtracker-miner-sections.txt 
b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
index 42384ca..c842388 100644
--- a/docs/reference/libtracker-miner/libtracker-miner-sections.txt
+++ b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
@@ -185,10 +185,8 @@ tracker_miner_fs_error_quark
 tracker_miner_fs_get_indexing_tree
 tracker_miner_fs_get_data_provider
 tracker_miner_fs_get_throttle
-tracker_miner_fs_get_mtime_checking
 tracker_miner_fs_get_initial_crawling
 tracker_miner_fs_set_throttle
-tracker_miner_fs_set_mtime_checking
 tracker_miner_fs_set_initial_crawling
 tracker_miner_fs_add_directory_without_parent
 tracker_miner_fs_directory_add
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 4903a43..15298e9 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -198,8 +198,6 @@ struct _TrackerMinerFSPrivate {
 
        /* Properties */
        gdouble throttle;
-       guint mtime_checking : 1;   /* TRUE if mtime checks should be done
-                                    * during initial crawling. */
        guint initial_crawling : 1; /* TRUE if initial crawling should be
                                     * done */
 
@@ -269,7 +267,6 @@ enum {
        PROP_WAIT_POOL_LIMIT,
        PROP_READY_POOL_LIMIT,
        PROP_DATA_PROVIDER,
-       PROP_MTIME_CHECKING,
        PROP_INITIAL_CRAWLING
 };
 
@@ -409,13 +406,6 @@ tracker_miner_fs_class_init (TrackerMinerFSClass *klass)
                                                              TRACKER_TYPE_DATA_PROVIDER,
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
        g_object_class_install_property (object_class,
-                                        PROP_MTIME_CHECKING,
-                                        g_param_spec_boolean ("mtime-checking",
-                                                              "Mtime checking",
-                                                              "Whether to perform mtime checks during 
initial crawling or not",
-                                                              TRUE,
-                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-       g_object_class_install_property (object_class,
                                         PROP_INITIAL_CRAWLING,
                                         g_param_spec_boolean ("initial-crawling",
                                                               "Initial crawling",
@@ -678,7 +668,6 @@ tracker_miner_fs_init (TrackerMinerFS *object)
        priv->quark_attribute_updated = g_quark_from_static_string ("tracker-attribute-updated");
        priv->quark_reentry_counter = g_quark_from_static_string ("tracker-reentry-counter");
 
-       priv->mtime_checking = TRUE;
        priv->initial_crawling = TRUE;
 
        priv->roots_to_notify = g_hash_table_new_full (g_file_hash,
@@ -917,9 +906,6 @@ fs_set_property (GObject      *object,
        case PROP_DATA_PROVIDER:
                fs->priv->data_provider = g_value_dup_object (value);
                break;
-       case PROP_MTIME_CHECKING:
-               fs->priv->mtime_checking = g_value_get_boolean (value);
-               break;
        case PROP_INITIAL_CRAWLING:
                fs->priv->initial_crawling = g_value_get_boolean (value);
                break;
@@ -952,9 +938,6 @@ fs_get_property (GObject    *object,
        case PROP_READY_POOL_LIMIT:
                g_value_set_uint (value, fs->priv->sparql_buffer_limit);
                break;
-       case PROP_MTIME_CHECKING:
-               g_value_set_boolean (value, fs->priv->mtime_checking);
-               break;
        case PROP_DATA_PROVIDER:
                g_value_set_object (value, fs->priv->data_provider);
                break;
@@ -2756,10 +2739,6 @@ tracker_miner_fs_directory_add (TrackerMinerFS *fs,
                flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
        }
 
-       if (fs->priv->mtime_checking) {
-               flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
-       }
-
        tracker_indexing_tree_add (fs->priv->indexing_tree,
                                   file,
                                   flags);
@@ -3404,60 +3383,6 @@ tracker_miner_fs_query_urn (TrackerMinerFS *fs,
 }
 
 /**
- * tracker_miner_fs_set_mtime_checking:
- * @fs: a #TrackerMinerFS
- * @mtime_checking: a #gboolean
- *
- * Tells the miner-fs that during the crawling phase, directory mtime
- * checks should or shouldn't be performed against the database to
- * make sure we have the most up to date version of the file being
- * checked at the time. Setting this to #FALSE can dramatically
- * improve the start up the crawling of the @fs.
- *
- * The down side is that using this consistently means that some files
- * on the disk may be out of date with files in the database.
- *
- * The main purpose of this function is for systems where a @fs is
- * running the entire time and where it is very unlikely that a file
- * could be changed outside between startup and shutdown of the
- * process using this API.
- *
- * The default if not set directly is that @mtime_checking is %TRUE.
- *
- * Since: 0.10
- **/
-void
-tracker_miner_fs_set_mtime_checking (TrackerMinerFS *fs,
-                                     gboolean        mtime_checking)
-{
-       g_return_if_fail (TRACKER_IS_MINER_FS (fs));
-
-       fs->priv->mtime_checking = mtime_checking;
-}
-
-/**
- * tracker_miner_fs_get_mtime_checking:
- * @fs: a #TrackerMinerFS
- *
- * Returns a boolean used to identify if file modification time checks
- * are performed when processing content. This may be set to %FALSE if
- * working prodominently with cloud data where you can't perform these
- * checks. By default and for local file systems, this is enabled.
- *
- * Returns: %TRUE if mtime checks for directories against the database
- * are done when @fs crawls the file system, otherwise %FALSE.
- *
- * Since: 0.10
- **/
-gboolean
-tracker_miner_fs_get_mtime_checking (TrackerMinerFS *fs)
-{
-       g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), FALSE);
-
-       return fs->priv->mtime_checking;
-}
-
-/**
  * tracker_miner_fs_set_initial_crawling:
  * @fs: a #TrackerMinerFS
  * @do_initial_crawling: a #gboolean
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index e82fe89..bbed7a8 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -131,13 +131,10 @@ GQuark                tracker_miner_fs_error_quark           (void);
 TrackerIndexingTree * tracker_miner_fs_get_indexing_tree     (TrackerMinerFS  *fs);
 TrackerDataProvider * tracker_miner_fs_get_data_provider     (TrackerMinerFS  *fs);
 gdouble               tracker_miner_fs_get_throttle          (TrackerMinerFS  *fs);
-gboolean              tracker_miner_fs_get_mtime_checking    (TrackerMinerFS  *fs);
 gboolean              tracker_miner_fs_get_initial_crawling  (TrackerMinerFS  *fs);
 
 void                  tracker_miner_fs_set_throttle          (TrackerMinerFS  *fs,
                                                               gdouble          throttle);
-void                  tracker_miner_fs_set_mtime_checking    (TrackerMinerFS  *fs,
-                                                              gboolean         mtime_checking);
 void                  tracker_miner_fs_set_initial_crawling  (TrackerMinerFS  *fs,
                                                               gboolean         do_initial_crawling);
 
diff --git a/src/libtracker-miner/tracker-miner.vapi b/src/libtracker-miner/tracker-miner.vapi
index 2fba620..9f7bec7 100644
--- a/src/libtracker-miner/tracker-miner.vapi
+++ b/src/libtracker-miner/tracker-miner.vapi
@@ -122,18 +122,15 @@ namespace Tracker {
                public unowned Tracker.DataProvider get_data_provider ();
                public unowned Tracker.IndexingTree get_indexing_tree ();
                public bool get_initial_crawling ();
-               public bool get_mtime_checking ();
                public double get_throttle ();
                public unowned string? get_urn (GLib.File file);
                public bool has_items_to_process ();
                public string query_urn (GLib.File file);
                public void set_initial_crawling (bool do_initial_crawling);
-               public void set_mtime_checking (bool mtime_checking);
                public void set_throttle (double throttle);
                public void writeback_notify (GLib.File file, GLib.Error error);
                public Tracker.DataProvider data_provider { get; construct; }
                public bool initial_crawling { get; set; }
-               public bool mtime_checking { get; set construct; }
                [NoAccessorMethod]
                public uint processing_pool_ready_limit { get; set construct; }
                [NoAccessorMethod]
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index a7cdca3..826d5c5 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -812,7 +812,7 @@ main (gint argc, gchar *argv[])
 
        /* Configure files miner */
        tracker_miner_fs_set_initial_crawling (TRACKER_MINER_FS (miner_files), do_crawling);
-       tracker_miner_fs_set_mtime_checking (TRACKER_MINER_FS (miner_files), do_mtime_checking);
+       tracker_miner_files_set_mtime_checking (TRACKER_MINER_FILES (miner_files), do_mtime_checking);
        g_signal_connect (miner_files, "finished",
                          G_CALLBACK (miner_finished_cb),
                          NULL);
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 93b1b3d..590b019 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -96,6 +96,7 @@ struct TrackerMinerFilesPrivate {
 
        guint force_recheck_id;
 
+       gboolean mtime_check;
        gboolean index_removable_devices;
        gboolean index_optical_discs;
        guint volumes_changed_id;
@@ -294,6 +295,7 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
                          G_CALLBACK (mount_pre_unmount_cb),
                          mf);
 
+       priv->mtime_check = TRUE;
        priv->quark_mount_point_uuid = g_quark_from_static_string ("tracker-mount-point-uuid");
 }
 
@@ -437,7 +439,7 @@ miner_files_initable_init (GInitable     *initable,
                        flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
                }
 
-               if (tracker_miner_fs_get_mtime_checking (TRACKER_MINER_FS (mf))) {
+               if (mf->private->mtime_check) {
                        flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
                }
 
@@ -492,7 +494,7 @@ miner_files_initable_init (GInitable     *initable,
                        flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
                }
 
-               if (tracker_miner_fs_get_mtime_checking (TRACKER_MINER_FS (mf))) {
+               if (mf->private->mtime_check) {
                        flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
                }
 
@@ -1676,7 +1678,7 @@ update_directories_from_new_config (TrackerMinerFS *mf,
                flags |= TRACKER_DIRECTORY_FLAG_MONITOR;
        }
 
-       if (tracker_miner_fs_get_mtime_checking (TRACKER_MINER_FS (mf))) {
+       if (priv->mtime_check) {
                flags |= TRACKER_DIRECTORY_FLAG_CHECK_MTIME;
        }
 
@@ -3359,3 +3361,10 @@ tracker_miner_files_set_need_mtime_check (gboolean needed)
 
        g_free (filename);
 }
+
+void
+tracker_miner_files_set_mtime_checking (TrackerMinerFiles *mf,
+                                        gboolean           mtime_check)
+{
+       mf->private->mtime_check = mtime_check;
+}
diff --git a/src/miners/fs/tracker-miner-files.h b/src/miners/fs/tracker-miner-files.h
index 10121b1..c9522ec 100644
--- a/src/miners/fs/tracker-miner-files.h
+++ b/src/miners/fs/tracker-miner-files.h
@@ -79,6 +79,9 @@ void     tracker_miner_files_set_last_crawl_done  (gboolean done);
 gboolean tracker_miner_files_get_need_mtime_check (void);
 void     tracker_miner_files_set_need_mtime_check (gboolean needed);
 
+void     tracker_miner_files_set_mtime_checking   (TrackerMinerFiles *miner,
+                                                   gboolean           mtime_checking);
+
 G_END_DECLS
 
 #endif /* __TRACKER_MINER_FS_FILES_H__ */


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