[tracker-miners/wip/carlosg/writeback-refactor: 10/13] tracker-miner-fs: Drop tracker-writeback interaction
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/writeback-refactor: 10/13] tracker-miner-fs: Drop tracker-writeback interaction
- Date: Wed, 20 May 2020 20:57:01 +0000 (UTC)
commit 493b933cfce14d93a6f40aef64fdaf4a460ccedf
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed May 20 14:13:16 2020 +0200
tracker-miner-fs: Drop tracker-writeback interaction
There was this code still taking care of listening to tracker-store
changes, and doing the PerformWriteback call. The former was gone
and this got broken. Now tracker-writeback has replacement API, so
this no longer is necessary.
src/miners/fs/meson.build | 3 -
src/miners/fs/tracker-main.c | 18 -
src/miners/fs/tracker-miner-files.c | 196 ----------
src/miners/fs/tracker-writeback-dispatcher.c | 393 --------------------
src/miners/fs/tracker-writeback-dispatcher.h | 53 ---
src/miners/fs/tracker-writeback-listener.c | 516 ---------------------------
src/miners/fs/tracker-writeback-listener.h | 53 ---
src/miners/fs/tracker-writeback.c | 137 -------
8 files changed, 1369 deletions(-)
---
diff --git a/src/miners/fs/meson.build b/src/miners/fs/meson.build
index e117f9968..afd967947 100644
--- a/src/miners/fs/meson.build
+++ b/src/miners/fs/meson.build
@@ -6,9 +6,6 @@ sources = [
'tracker-miner-files-index.c',
'tracker-miner-files-peer-listener.c',
'tracker-storage.c',
- 'tracker-writeback-listener.c',
- 'tracker-writeback-dispatcher.c',
- 'tracker-writeback.c',
]
tracker_miner_fs_deps = [
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 29b2ea992..8199e094c 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -38,7 +38,6 @@
#include "tracker-config.h"
#include "tracker-miner-files.h"
#include "tracker-miner-files-index.h"
-#include "tracker-writeback.h"
#define ABOUT \
"Tracker " PACKAGE_VERSION "\n"
@@ -99,8 +98,6 @@ log_option_values (TrackerConfig *config)
g_message ("General options:");
g_message (" Initial Sleep ........................ %d",
tracker_config_get_initial_sleep (config));
- g_message (" Writeback ............................ %s",
- tracker_config_get_enable_writeback (config) ? "yes" : "no");
g_message ("Indexer options:");
g_message (" Throttle level ....................... %d",
@@ -916,23 +913,10 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
- tracker_writeback_init (TRACKER_MINER_FILES (miner_files),
- config,
- &error);
-
- if (error) {
- g_critical ("Couldn't create writeback handling: '%s'",
- error ? error->message : "unknown error");
- g_object_unref (config);
- g_object_unref (miner_files);
- return EXIT_FAILURE;
- }
-
/* Create new TrackerMinerFilesIndex object */
miner_files_index = tracker_miner_files_index_new (TRACKER_MINER_FILES (miner_files));
if (!miner_files_index) {
g_object_unref (miner_files);
- tracker_writeback_shutdown ();
g_object_unref (config);
return EXIT_FAILURE;
}
@@ -1012,8 +996,6 @@ main (gint argc, gchar *argv[])
g_object_unref (connection);
tracker_domain_ontology_unref (domain_ontology);
- tracker_writeback_shutdown ();
-
g_print ("\nOK\n\n");
return EXIT_SUCCESS;
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 316aa8f74..3054c3135 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -118,9 +118,6 @@ struct TrackerMinerFilesPrivate {
guint stale_volumes_check_id;
GList *extraction_queue;
-
- GHashTable *writeback_tasks;
- gboolean paused_for_writeback;
};
enum {
@@ -134,13 +131,6 @@ enum {
PROP_DOMAIN,
};
-enum {
- WRITEBACK,
- N_SIGNALS
-};
-
-static guint signals[N_SIGNALS] = { 0 };
-
static void miner_files_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -249,89 +239,6 @@ G_DEFINE_TYPE_WITH_CODE (TrackerMinerFiles, tracker_miner_files, TRACKER_TYPE_MI
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
miner_files_initable_iface_init));
-static void
-sync_writeback_pause_state (TrackerMinerFiles *mf)
-{
- guint n_writeback_tasks = g_hash_table_size (mf->private->writeback_tasks);
-
- if (n_writeback_tasks > 0 && !mf->private->paused_for_writeback) {
- tracker_miner_pause (TRACKER_MINER (mf));
- mf->private->paused_for_writeback = TRUE;
- } else if (n_writeback_tasks == 0 && mf->private->paused_for_writeback) {
- mf->private->paused_for_writeback = FALSE;
- tracker_miner_resume (TRACKER_MINER (mf));
- }
-}
-
-static void
-writeback_remove_recursively (TrackerMinerFiles *mf,
- GFile *file)
-{
- GHashTableIter iter;
- GFile *writeback_file;
-
- if (g_hash_table_size (mf->private->writeback_tasks) == 0)
- return;
-
- /* Remove and cancel writeback tasks in this directory */
- g_hash_table_iter_init (&iter, mf->private->writeback_tasks);
- while (g_hash_table_iter_next (&iter, (gpointer*) &writeback_file, NULL)) {
- if (g_file_equal (writeback_file, file) ||
- g_file_has_prefix (writeback_file, file)) {
- g_hash_table_iter_remove (&iter);
- }
- }
-
- sync_writeback_pause_state (mf);
-}
-
-static gboolean
-miner_files_filter_event (TrackerMinerFS *fs,
- TrackerMinerFSEventType type,
- GFile *file,
- GFile *source_file)
-{
- TrackerMinerFiles *mf = TRACKER_MINER_FILES (fs);
- GCancellable *cancellable;
-
- switch (type) {
- case TRACKER_MINER_FS_EVENT_CREATED:
- break;
- case TRACKER_MINER_FS_EVENT_UPDATED:
- /* If the file is in the writeback task pool, this is the
- * file update applying it, so the event should be filtered
- * out.
- */
- if (g_hash_table_lookup_extended (mf->private->writeback_tasks, file,
- NULL, (gpointer*) &cancellable)) {
- if (!cancellable) {
- /* The task was already notified, we can remove
- * it now, so later updates will be processed.
- */
- g_hash_table_remove (mf->private->writeback_tasks, file);
- sync_writeback_pause_state (mf);
- }
-
- /* There is a writeback task, pending or satisfied.
- * Either way, this update should be ignored.
- */
- return TRUE;
- }
- break;
- case TRACKER_MINER_FS_EVENT_DELETED:
- writeback_remove_recursively (mf, file);
- break;
- case TRACKER_MINER_FS_EVENT_MOVED:
- /* If the origin file is also being written back,
- * cancel it as this is an external operation.
- */
- writeback_remove_recursively (mf, source_file);
- break;
- }
-
- return FALSE;
-}
-
static void
tracker_miner_files_class_init (TrackerMinerFilesClass *klass)
{
@@ -348,34 +255,6 @@ tracker_miner_files_class_init (TrackerMinerFilesClass *klass)
miner_fs_class->remove_file = miner_files_remove_file;
miner_fs_class->remove_children = miner_files_remove_children;
miner_fs_class->move_file = miner_files_move_file;
- miner_fs_class->filter_event = miner_files_filter_event;
-
- /**
- * TrackerMinerFiles::writeback-file:
- * @miner: the #TrackerMinerFiles
- * @file: a #GFile
- * @rdf_types: the set of RDF types
- * @results: (element-type GStrv): a set of results prepared by the preparation query
- * @cancellable: a #GCancellable
- *
- * The ::writeback-file signal is emitted whenever a file must be written
- * back
- *
- * Returns: %TRUE on success, %FALSE otherwise
- **/
- signals[WRITEBACK] =
- g_signal_new ("writeback",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL,
- NULL,
- NULL,
- G_TYPE_NONE,
- 4,
- G_TYPE_FILE,
- G_TYPE_STRV,
- G_TYPE_PTR_ARRAY,
- G_TYPE_CANCELLABLE);
g_object_class_install_property (object_class,
PROP_CONFIG,
@@ -435,17 +314,6 @@ tracker_miner_files_check_unextracted (TrackerMinerFiles *mf)
check_unextracted_cb, mf);
}
-static void
-cancel_and_unref (gpointer data)
-{
- GCancellable *cancellable = data;
-
- if (cancellable) {
- g_cancellable_cancel (cancellable);
- g_object_unref (cancellable);
- }
-}
-
static gboolean
extractor_lost_timeout_cb (gpointer user_data)
{
@@ -514,10 +382,6 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
priv->mtime_check = TRUE;
priv->quark_mount_point_uuid = g_quark_from_static_string ("tracker-mount-point-uuid");
- priv->writeback_tasks = g_hash_table_new_full (g_file_hash,
- (GEqualFunc) g_file_equal,
- g_object_unref, cancel_and_unref);
-
priv->extract_check_cancellable = g_cancellable_new ();
rdf_types = tracker_extract_module_manager_get_all_rdf_types ();
@@ -567,8 +431,6 @@ miner_files_initable_init (GInitable *initable,
fs = TRACKER_MINER_FS (initable);
indexing_tree = tracker_miner_fs_get_indexing_tree (fs);
tracker_indexing_tree_set_filter_hidden (indexing_tree, TRUE);
- g_signal_connect_swapped (indexing_tree, "directory-removed",
- G_CALLBACK (writeback_remove_recursively), mf);
miner_files_update_filters (mf);
@@ -951,7 +813,6 @@ miner_files_finalize (GObject *object)
}
g_list_free (priv->extraction_queue);
- g_hash_table_destroy (priv->writeback_tasks);
G_OBJECT_CLASS (tracker_miner_files_parent_class)->finalize (object);
}
@@ -3614,60 +3475,3 @@ tracker_miner_files_set_mtime_checking (TrackerMinerFiles *mf,
{
mf->private->mtime_check = mtime_check;
}
-
-void
-tracker_miner_files_writeback_file (TrackerMinerFiles *mf,
- GFile *file,
- GStrv rdf_types,
- GPtrArray *results)
-{
- GCancellable *cancellable;
-
- if (!g_hash_table_contains (mf->private->writeback_tasks, file)) {
- cancellable = g_cancellable_new ();
- g_hash_table_insert (mf->private->writeback_tasks, g_object_ref (file), cancellable);
- sync_writeback_pause_state (mf);
- g_signal_emit (mf, signals[WRITEBACK], 0, file, rdf_types,
- results, cancellable);
- }
-}
-
-/**
- * tracker_miner_files_writeback_notify:
- * @fs: a #TrackerMinerFS
- * @file: a #GFile
- * @error: a #GError with the error that happened during processing, or %NULL.
- *
- * Notifies @fs that all writing back on @file has been finished, if any error
- * happened during file data processing, it should be passed in @error, else
- * that parameter will contain %NULL to reflect success.
- **/
-void
-tracker_miner_files_writeback_notify (TrackerMinerFiles *mf,
- GFile *file,
- const GError *error)
-{
- GCancellable *cancellable;
-
- g_return_if_fail (TRACKER_IS_MINER_FILES (mf));
- g_return_if_fail (G_IS_FILE (file));
-
- cancellable = g_hash_table_lookup (mf->private->writeback_tasks, file);
-
- if (!cancellable)
- return;
-
- if (error) {
- gchar *uri = g_file_get_uri (file);
- g_warning ("Writeback on %s got error: %s\n",
- uri, error->message);
- g_free (uri);
- }
-
- /* Drop the cancellable, it will be detected on the next file
- * update in miner_files_filter_event().
- */
- g_hash_table_steal (mf->private->writeback_tasks, file);
- g_hash_table_insert (mf->private->writeback_tasks, file, NULL);
- g_object_unref (cancellable);
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]