[tracker-miners/sam/index-location: 13/21] Rename for-process flag to watch-for-caller



commit 98348965cf30c024ad5f42f9376cecdf3acc7ad5
Author: Sam Thursfield <sam afuera me uk>
Date:   Thu Jul 9 02:13:02 2020 +0200

    Rename for-process flag to watch-for-caller
    
    This flag enables two things: the location is watched for changes,
    and the location is un-indexed if the calling process exits. I
    think the new name is clearer.

 src/libtracker-miners-common/tracker-enums.h |  2 +-
 src/miners/fs/tracker-miner-files-index.c    |  4 ++--
 src/miners/fs/tracker-miner-files-index.xml  |  2 +-
 src/tracker/tracker-miner-manager.c          |  4 ++--
 tests/functional-tests/helpers.py            | 10 +++-------
 5 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/src/libtracker-miners-common/tracker-enums.h b/src/libtracker-miners-common/tracker-enums.h
index 311d6813e..05ee9d151 100644
--- a/src/libtracker-miners-common/tracker-enums.h
+++ b/src/libtracker-miners-common/tracker-enums.h
@@ -34,7 +34,7 @@ typedef enum {
 } TrackerSerializationFormat;
 
 typedef enum {
-       TRACKER_INDEX_LOCATION_FLAG_FOR_PROCESS = 1 << 0,
+       TRACKER_INDEX_LOCATION_FLAG_WATCH_FOR_CALLER = 1 << 0,
        TRACKER_INDEX_LOCATION_FLAG_AWAIT_MINER_FS = 1 << 1,
        TRACKER_INDEX_LOCATION_FLAG_AWAIT_EXTRACT = 1 << 2,
 } TrackerIndexLocationFlags;
diff --git a/src/miners/fs/tracker-miner-files-index.c b/src/miners/fs/tracker-miner-files-index.c
index bc1138823..d209878b7 100644
--- a/src/miners/fs/tracker-miner-files-index.c
+++ b/src/miners/fs/tracker-miner-files-index.c
@@ -263,7 +263,7 @@ handle_method_call_index_location (TrackerMinerFilesIndex *miner,
                return;
        }
 
-       watch_source = flags & TRACKER_INDEX_LOCATION_FLAG_FOR_PROCESS;
+       watch_source = flags & TRACKER_INDEX_LOCATION_FLAG_WATCH_FOR_CALLER;
 
        request = tracker_g_dbus_request_begin (invocation, "%s(uri:'%s')", __FUNCTION__, file_uri);
 
@@ -343,7 +343,7 @@ handle_method_call_index_location (TrackerMinerFilesIndex *miner,
                if (watch_source) {
                        internal_error = g_error_new_literal (TRACKER_MINER_INDEX_ERROR,
                                                              TRACKER_MINER_INDEX_ERROR_DIRECTORIES_ONLY,
-                                                             "Only directories can be processed in 
`for-process` mode");
+                                                             "Only directories can be processed in 
`watch-for-caller` mode");
                        tracker_dbus_request_end (request, internal_error);
                        g_dbus_method_invocation_return_gerror (invocation, internal_error);
 
diff --git a/src/miners/fs/tracker-miner-files-index.xml b/src/miners/fs/tracker-miner-files-index.xml
index cd33f7433..2c453c622 100644
--- a/src/miners/fs/tracker-miner-files-index.xml
+++ b/src/miners/fs/tracker-miner-files-index.xml
@@ -5,7 +5,7 @@
     <method name='IndexLocation'>"
       <arg type='s' name='uri' direction='in' />"
       <arg type='as' name='flags' direction='in'>"
-        <doc:doc><doc:summary>Allowed values: for-process, await-miner-fs, 
await-extract</doc:summary></doc:doc>
+        <doc:doc><doc:summary>Allowed values: watch-for-caller, await-miner-fs, 
await-extract</doc:summary></doc:doc>
       </arg>
     </method>
   </interface>
diff --git a/src/tracker/tracker-miner-manager.c b/src/tracker/tracker-miner-manager.c
index 3e8574102..5687909e2 100644
--- a/src/tracker/tracker-miner-manager.c
+++ b/src/tracker/tracker-miner-manager.c
@@ -1543,7 +1543,7 @@ tracker_indexing_task_run (GTask        *task,
        GVariant *v;
        GError *error = NULL;
        const gchar **flags;
-       const gchar *flags_for_process[] = {"for-process", NULL};
+       const gchar *flags_watch[] = {"watch-for-caller", NULL};
 
        priv = tracker_miner_manager_get_instance_private (manager);
 
@@ -1554,7 +1554,7 @@ tracker_indexing_task_run (GTask        *task,
        uri = g_file_get_uri (data->root);
 
        if (data->for_process) {
-               flags = flags_for_process;
+               flags = flags_watch;
        } else {
                flags = NULL;
        }
diff --git a/tests/functional-tests/helpers.py b/tests/functional-tests/helpers.py
index 9c18ebcd4..fca42e03b 100644
--- a/tests/functional-tests/helpers.py
+++ b/tests/functional-tests/helpers.py
@@ -192,13 +192,9 @@ class MinerFsHelper ():
         return Tracker.SparqlConnection.bus_new(
             'org.freedesktop.Tracker3.Miner.Files', None, self.bus)
 
-    def index_file(self, uri):
-        log.debug("IndexFile(%s)", uri)
-        return self.index.IndexFile('(s)', uri)
-
-    def index_file_for_process(self, uri):
-        log.debug("IndexFileForProcess(%s)", uri)
-        return self.index.IndexFileForProcess('(s)', uri)
+    def index_location(self, uri, flags):
+        log.debug("IndexLocation(%s, %s)", uri, flags)
+        return self.index.IndexFile('(sas)', uri, flags)
 
     def await_file_processed(self, path, status=True):
         expected = [FileProcessedResult(path, status)]


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