Commit 2be3f349 authored by Martyn Russell's avatar Martyn Russell
Browse files

libtracker-miner: Split TrackerEnumerator into 2 classes, now with TrackerDataProvider

So now we have:
- TrackerEnumerator (GInterface)
- TrackerFileEnumerator (using GIO API)
- TrackerDataProvider (GInterface) which provides a TrackerEnumerator
- TrackerFileDataProvider (using GIO API) implemented as internal default
parent db70857e
......@@ -28,26 +28,34 @@
</para>
</partintro>
<chapter>
<title>Basics and foundations</title>
<xi:include href="xml/tracker-miner-enums.xml"/>
<xi:include href="xml/tracker-miner-common.xml"/>
</chapter>
<chapter>
<title>Base abstract miner classes</title>
<xi:include href="xml/tracker-miner-object.xml"/>
<xi:include href="xml/tracker-miner-online.xml"/>
<xi:include href="xml/tracker-data-provider.xml"/>
<xi:include href="xml/tracker-enumerator.xml"/>
<xi:include href="xml/tracker-decorator.xml"/>
<xi:include href="xml/tracker-indexing-tree.xml"/>
</chapter>
<chapter>
<title>Miner classes for file system</title>
<xi:include href="xml/tracker-miner-fs.xml"/>
<xi:include href="xml/tracker-file-data-provider.xml"/>
<xi:include href="xml/tracker-file-enumerator.xml"/>
<xi:include href="xml/tracker-indexing-tree.xml"/>
<xi:include href="xml/tracker-decorator-fs.xml"/>
</chapter>
<chapter>
<title>Utilities</title>
<xi:include href="xml/tracker-thumbnailer.xml"/>
<xi:include href="xml/tracker-miner-enums.xml"/>
<xi:include href="xml/tracker-media-art.xml"/>
</chapter>
</part>
......
<SECTION>
<FILE>tracker-data-provider</FILE>
<TITLE>TrackerDataProvider</TITLE>
TrackerDataProviderIface
tracker_data_provider_get_crawl_flags
tracker_data_provider_set_crawl_flags
tracker_data_provider_begin
tracker_data_provider_begin_async
tracker_data_provider_begin_finish
tracker_data_provider_end
tracker_data_provider_end_async
tracker_data_provider_end_finish
TrackerDataProvider
<SUBSECTION Standard>
TRACKER_DATA_PROVIDER
TRACKER_DATA_PROVIDER_GET_IFACE
TRACKER_IS_DATA_PROVIDER
TRACKER_TYPE_DATA_PROVIDER
tracker_data_provider_get_type
</SECTION>
<SECTION>
<FILE>tracker-decorator</FILE>
<TITLE>TrackerDecorator</TITLE>
TrackerDecorator
TrackerDecoratorClass
TrackerDecoratorError
tracker_decorator_error_quark
tracker_decorator_get_data_source
tracker_decorator_get_class_names
tracker_decorator_get_n_items
tracker_decorator_prepend_id
tracker_decorator_delete_id
tracker_decorator_next
tracker_decorator_next_finish
tracker_decorator_set_priority_rdf_types
tracker_decorator_info_ref
tracker_decorator_info_unref
tracker_decorator_info_get_urn
tracker_decorator_info_get_url
tracker_decorator_info_get_mimetype
tracker_decorator_info_get_task
tracker_decorator_info_get_sparql
<SUBSECTION Standard>
TRACKER_DECORATOR
TRACKER_DECORATOR_CLASS
TRACKER_DECORATOR_GET_CLASS
TRACKER_IS_DECORATOR
TRACKER_IS_DECORATOR_CLASS
TRACKER_TYPE_DECORATOR
TrackerDecoratorInfo
tracker_decorator_get_type
tracker_decorator_info_get_type
</SECTION>
<SECTION>
<FILE>tracker-decorator-fs</FILE>
<TITLE>TrackerDecoratorFS</TITLE>
TrackerDecoratorFS
TrackerDecoratorFSClass
<SUBSECTION Standard>
TRACKER_DECORATOR_FS
TRACKER_DECORATOR_FS_CLASS
TRACKER_DECORATOR_FS_GET_CLASS
TRACKER_IS_DECORATOR_FS
TRACKER_IS_DECORATOR_FS_CLASS
TRACKER_TYPE_DECORATOR_FS
tracker_decorator_fs_get_type
</SECTION>
<SECTION>
<FILE>tracker-enumerator</FILE>
<TITLE>TrackerEnumerator</TITLE>
TrackerEnumeratorIface
tracker_enumerator_next
tracker_enumerator_next_async
tracker_enumerator_next_finish
TrackerEnumerator
<SUBSECTION Standard>
TRACKER_ENUMERATOR
TRACKER_ENUMERATOR_GET_IFACE
TRACKER_IS_ENUMERATOR
TRACKER_TYPE_ENUMERATOR
tracker_enumerator_get_type
</SECTION>
<SECTION>
<FILE>tracker-file-data-provider</FILE>
<TITLE>TrackerFileDataProvider</TITLE>
TrackerFileDataProviderClass
tracker_file_data_provider_new
TrackerFileDataProvider
<SUBSECTION Standard>
TRACKER_FILE_DATA_PROVIDER
TRACKER_FILE_DATA_PROVIDER_CLASS
TRACKER_FILE_DATA_PROVIDER_GET_CLASS
TRACKER_IS_FILE_DATA_PROVIDER
TRACKER_IS_FILE_DATA_PROVIDER_CLASS
TRACKER_TYPE_FILE_DATA_PROVIDER
TrackerFileDataProviderPrivate
tracker_file_data_provider_get_type
</SECTION>
<SECTION>
<FILE>tracker-file-enumerator</FILE>
<TITLE>TrackerFileEnumerator</TITLE>
TrackerFileEnumeratorClass
tracker_file_enumerator_new
TrackerFileEnumerator
<SUBSECTION Standard>
TRACKER_FILE_ENUMERATOR
TRACKER_FILE_ENUMERATOR_CLASS
TRACKER_FILE_ENUMERATOR_GET_CLASS
TRACKER_IS_FILE_ENUMERATOR
TRACKER_IS_FILE_ENUMERATOR_CLASS
TRACKER_TYPE_FILE_ENUMERATOR
tracker_file_enumerator_get_type
</SECTION>
<SECTION>
<FILE>tracker-indexing-tree</FILE>
<TITLE>TrackerIndexingTree</TITLE>
TrackerIndexingTree
TrackerIndexingTreeClass
tracker_indexing_tree_new
tracker_indexing_tree_add
tracker_indexing_tree_remove
tracker_indexing_tree_add_filter
tracker_indexing_tree_clear_filters
tracker_indexing_tree_file_is_indexable
tracker_indexing_tree_file_is_root
tracker_indexing_tree_file_matches_filter
tracker_indexing_tree_get_default_policy
tracker_indexing_tree_file_is_indexable
tracker_indexing_tree_parent_is_indexable
tracker_indexing_tree_get_filter_hidden
tracker_indexing_tree_get_master_root
tracker_indexing_tree_set_filter_hidden
tracker_indexing_tree_get_default_policy
tracker_indexing_tree_set_default_policy
tracker_indexing_tree_get_root
tracker_indexing_tree_get_master_root
tracker_indexing_tree_file_is_root
tracker_indexing_tree_list_roots
tracker_indexing_tree_new
tracker_indexing_tree_parent_is_indexable
tracker_indexing_tree_remove
tracker_indexing_tree_set_default_policy
tracker_indexing_tree_set_filter_hidden
<SUBSECTION Standard>
TRACKER_INDEXING_TREE
TRACKER_INDEXING_TREE_CLASS
......@@ -30,8 +149,9 @@ tracker_indexing_tree_get_type
</SECTION>
<SECTION>
<FILE>tracker-miner</FILE>
TrackerMinerError
<FILE>tracker-media-art</FILE>
tracker_media_art_queue_remove
tracker_media_art_queue_empty
</SECTION>
<SECTION>
......@@ -42,19 +162,25 @@ TRACKER_MINER_FS_GRAPH_URN
<SECTION>
<FILE>tracker-miner-enum-types</FILE>
<SUBSECTION Standard>
TRACKER_TYPE_CRAWL_FLAGS
TRACKER_TYPE_DIRECTORY_FLAGS
TRACKER_TYPE_FILTER_POLICY
TRACKER_TYPE_FILTER_TYPE
TRACKER_TYPE_NETWORK_TYPE
tracker_crawl_flags_get_type
tracker_directory_flags_get_type
tracker_filter_policy_get_type
tracker_filter_type_get_type
tracker_network_type_get_type
</SECTION>
<SECTION>
<FILE>tracker-miner-enums</FILE>
TrackerDirectoryFlags
TrackerFilterPolicy
TrackerFilterType
TrackerFilterPolicy
TrackerNetworkType
TrackerCrawlFlags
</SECTION>
<SECTION>
......@@ -63,31 +189,32 @@ TrackerFilterType
TrackerMinerFS
TrackerMinerFSClass
TrackerMinerFSError
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_check_directory
tracker_miner_fs_check_directory_with_priority
tracker_miner_fs_check_file
tracker_miner_fs_check_file_with_priority
tracker_miner_fs_directory_add
tracker_miner_fs_directory_remove
tracker_miner_fs_directory_remove_full
tracker_miner_fs_file_notify
tracker_miner_fs_force_mtime_checking
tracker_miner_fs_check_file
tracker_miner_fs_check_file_with_priority
tracker_miner_fs_check_directory
tracker_miner_fs_check_directory_with_priority
tracker_miner_fs_force_recheck
tracker_miner_fs_get_indexing_tree
tracker_miner_fs_get_enumerator
tracker_miner_fs_get_initial_crawling
tracker_miner_fs_get_mtime_checking
tracker_miner_fs_get_parent_urn
tracker_miner_fs_get_throttle
tracker_miner_fs_get_urn
tracker_miner_fs_has_items_to_process
tracker_miner_fs_query_urn
tracker_miner_fs_set_initial_crawling
tracker_miner_fs_set_mtime_checking
tracker_miner_fs_set_throttle
tracker_miner_fs_writeback_file
tracker_miner_fs_writeback_notify
tracker_miner_fs_file_notify
tracker_miner_fs_get_urn
tracker_miner_fs_get_parent_urn
tracker_miner_fs_query_urn
tracker_miner_fs_has_items_to_process
<SUBSECTION Standard>
TRACKER_IS_MINER_FS
TRACKER_IS_MINER_FS_CLASS
......@@ -97,32 +224,32 @@ TRACKER_MINER_FS_GET_CLASS
TRACKER_TYPE_MINER_FS
TrackerMinerFSPrivate
tracker_miner_fs_get_type
tracker_miner_fs_error_quark
</SECTION>
<SECTION>
<FILE>tracker-miner-object</FILE>
<TITLE>TrackerMiner</TITLE>
TRACKER_MINER_ERROR
TRACKER_MINER_ERROR_DOMAIN
TRACKER_MINER_DBUS_INTERFACE
TRACKER_MINER_DBUS_NAME_PREFIX
TRACKER_MINER_DBUS_PATH_PREFIX
TRACKER_MINER_ERROR_DOMAIN
TRACKER_MINER_ERROR
TrackerMiner
TrackerMinerClass
TrackerMinerError
tracker_miner_error_quark
tracker_miner_get_connection
tracker_miner_get_dbus_connection
tracker_miner_get_dbus_full_name
tracker_miner_get_dbus_full_path
tracker_miner_get_n_pause_reasons
tracker_miner_start
tracker_miner_stop
tracker_miner_ignore_next_update
tracker_miner_is_paused
tracker_miner_is_started
tracker_miner_is_paused
tracker_miner_get_n_pause_reasons
tracker_miner_pause
tracker_miner_resume
tracker_miner_start
tracker_miner_stop
tracker_miner_get_connection
tracker_miner_get_dbus_connection
tracker_miner_get_dbus_full_name
tracker_miner_get_dbus_full_path
<SUBSECTION Standard>
TRACKER_IS_MINER
TRACKER_IS_MINER_CLASS
......@@ -137,19 +264,17 @@ tracker_miner_get_type
<SECTION>
<FILE>tracker-miner-online</FILE>
<TITLE>TrackerMinerOnline</TITLE>
TrackerMinerOnline
TrackerMinerOnlineClass
tracker_miner_online_get_type
tracker_miner_online_get_network_type
TrackerNetworkType
tracker_network_type_get_type
<SUBSECTION Standard>
TRACKER_IS_MINER_ONLINE
TRACKER_IS_MINER_ONLINE_CLASS
TRACKER_MINER_ONLINE
TRACKER_MINER_ONLINE_CLASS
TRACKER_MINER_ONLINE_GET_CLASS
TRACKER_IS_MINER_ONLINE
TRACKER_IS_MINER_ONLINE_CLASS
TRACKER_TYPE_MINER_ONLINE
TrackerMinerOnline
tracker_miner_online_get_type
</SECTION>
<SECTION>
......@@ -157,99 +282,17 @@ TRACKER_TYPE_MINER_ONLINE
<TITLE>TrackerThumbnailer</TITLE>
TrackerThumbnailer
TrackerThumbnailerClass
tracker_thumbnailer_cleanup
tracker_thumbnailer_get_type
tracker_thumbnailer_move_add
tracker_thumbnailer_new
tracker_thumbnailer_remove_add
tracker_thumbnailer_send
tracker_thumbnailer_move_add
tracker_thumbnailer_remove_add
tracker_thumbnailer_cleanup
<SUBSECTION Standard>
TRACKER_IS_THUMBNAILER
TRACKER_IS_THUMBNAILER_CLASS
TRACKER_THUMBNAILER
TRACKER_THUMBNAILER_CLASS
TRACKER_THUMBNAILER_GET_CLASS
TRACKER_IS_THUMBNAILER
TRACKER_IS_THUMBNAILER_CLASS
TRACKER_TYPE_NETWORK_TYPE
TRACKER_TYPE_THUMBNAILER
</SECTION>
<SECTION>
<FILE>tracker-decorator</FILE>
<TITLE>TrackerDecorator</TITLE>
TrackerDecorator
TrackerDecoratorClass
TrackerDecoratorError
TrackerDecoratorInfo
tracker_decorator_get_type
tracker_decorator_error_quark
tracker_decorator_get_class_names
tracker_decorator_get_data_source
tracker_decorator_get_n_items
tracker_decorator_set_priority_rdf_types
tracker_decorator_prepend_id
tracker_decorator_delete_id
tracker_decorator_next
tracker_decorator_next_finish
tracker_decorator_info_get_type
tracker_decorator_info_ref
tracker_decorator_info_unref
tracker_decorator_info_get_mimetype
tracker_decorator_info_get_sparql
tracker_decorator_info_get_task
tracker_decorator_info_get_url
tracker_decorator_info_get_urn
<SUBSECTION Standard>
TRACKER_DECORATOR
TRACKER_DECORATOR_CLASS
TRACKER_DECORATOR_GET_CLASS
TRACKER_IS_DECORATOR
TRACKER_IS_DECORATOR_CLASS
TRACKER_TYPE_DECORATOR
</SECTION>
<SECTION>
<FILE>tracker-decorator-fs</FILE>
<TITLE>TrackerDecoratorFS</TITLE>
TrackerDecoratorFS
TrackerDecoratorFSClass
tracker_decorator_fs_get_type
<SUBSECTION Standard>
TRACKER_DECORATOR_FS
TRACKER_DECORATOR_FS_CLASS
TRACKER_DECORATOR_FS_GET_CLASS
TRACKER_IS_DECORATOR_FS
TRACKER_IS_DECORATOR_FS_CLASS
TRACKER_TYPE_DECORATOR_FS
</SECTION>
<SECTION>
<FILE>tracker-enumerator</FILE>
<TITLE>TrackerEnumerator</TITLE>
TrackerEnumeratorIface
tracker_enumerator_get_children
tracker_enumerator_get_children_async
tracker_enumerator_get_children_finish
TrackerEnumerator
<SUBSECTION Standard>
TRACKER_ENUMERATOR
TRACKER_ENUMERATOR_GET_IFACE
TRACKER_IS_ENUMERATOR
TRACKER_TYPE_ENUMERATOR
tracker_enumerator_get_type
</SECTION>
<SECTION>
<FILE>tracker-file-enumerator</FILE>
<TITLE>TrackerFileEnumerator</TITLE>
tracker_file_enumerator_new
<SUBSECTION Standard>
TRACKER_FILE_ENUMERATOR
TRACKER_FILE_ENUMERATOR_CLASS
TRACKER_FILE_ENUMERATOR_GET_CLASS
TRACKER_IS_FILE_ENUMERATOR
TRACKER_IS_FILE_ENUMERATOR_CLASS
TRACKER_TYPE_FILE_ENUMERATOR
TrackerFileEnumerator
TrackerFileEnumeratorClass
tracker_file_enumerator_get_type
tracker_thumbnailer_get_type
</SECTION>
......@@ -33,6 +33,8 @@ libtracker_minerincludedir=$(includedir)/tracker-$(TRACKER_API_VERSION)/libtrack
private_sources = \
tracker-crawler.c \
tracker-crawler.h \
tracker-file-data-provider.c \
tracker-file-data-provider.h \
tracker-file-enumerator.c \
tracker-file-enumerator.h \
tracker-file-notifier.h \
......@@ -59,13 +61,15 @@ endif
miner_sources = \
$(libtracker_miner_monitor_sources) \
$(libtracker_miner_monitor_headers) \
tracker-enumerator.c \
tracker-enumerator.h \
tracker-data-provider.c \
tracker-data-provider.h \
tracker-decorator.c \
tracker-decorator.h \
tracker-decorator-internal.h \
tracker-decorator-fs.c \
tracker-decorator-fs.h \
tracker-enumerator.c \
tracker-enumerator.h \
tracker-indexing-tree.c \
tracker-indexing-tree.h \
tracker-miner-enum-types.c \
......@@ -84,9 +88,10 @@ libtracker_miner_@TRACKER_API_VERSION@_la_SOURCES = \
$(miner_sources)
libtracker_minerinclude_HEADERS = \
tracker-enumerator.h \
tracker-data-provider.h \
tracker-decorator.h \
tracker-decorator-fs.h \
tracker-enumerator.h \
tracker-indexing-tree.h \
tracker-miner.h \
tracker-miner-common.h \
......@@ -102,7 +107,7 @@ if !ENABLE_GCOV
# Using enable_gcov instead of have_unit_test because when doing a release
# we disable gcov but NOT the unit tests
libtracker_miner_@TRACKER_API_VERSION@_la_LDFLAGS += \
-export-symbols-regex '^tracker_(enumerator|crawl|miner|indexing_tree|directory_flags|filter_type|filter_policy|network_type|decorator)_.*'
-export-symbols-regex '^tracker_(data_provider|enumerator|crawl|miner|indexing_tree|directory_flags|filter_type|filter_policy|network_type|decorator)_.*'
endif
libtracker_miner_@TRACKER_API_VERSION@_la_LIBADD = \
......
......@@ -20,7 +20,7 @@
#include "config.h"
#include "tracker-crawler.h"
#include "tracker-file-enumerator.h"
#include "tracker-file-data-provider.h"
#include "tracker-miner-enums.h"
#include "tracker-miner-enum-types.h"
#include "tracker-utils.h"
......@@ -70,7 +70,7 @@ struct DirectoryRootInfo {
};
struct TrackerCrawlerPrivate {
TrackerEnumerator *enumerator;
TrackerDataProvider *data_provider;
/* Directories to crawl */
GQueue *directories;
......@@ -96,11 +96,13 @@ struct TrackerCrawlerPrivate {
typedef struct {
TrackerCrawler *crawler;
TrackerEnumerator *enumerator;
DirectoryRootInfo *root_info;
DirectoryProcessingData *dir_info;
GFile *dir_file;
GCancellable *cancellable;
} EnumeratorData;
GSList *files;
} DataProviderData;
enum {
CHECK_DIRECTORY,
......@@ -113,7 +115,7 @@ enum {
enum {
PROP_0,
PROP_ENUMERATOR,
PROP_DATA_PROVIDER,
};
static void crawler_get_property (GObject *object,
......@@ -130,7 +132,7 @@ static gboolean check_defaults (TrackerCrawler *crawler,
static gboolean check_contents_defaults (TrackerCrawler *crawler,
GFile *file,
GList *contents);
static void file_enumerate_children (TrackerCrawler *crawler,
static void data_provider_begin (TrackerCrawler *crawler,
DirectoryRootInfo *info,
DirectoryProcessingData *dir_data);
......@@ -214,11 +216,11 @@ tracker_crawler_class_init (TrackerCrawlerClass *klass)
1, G_TYPE_BOOLEAN);
g_object_class_install_property (object_class,
PROP_ENUMERATOR,
g_param_spec_object ("enumerator",
"Enumerator",
"Enumerator to use to crawl structures populating data, e.g. like GFileEnumerator",
TRACKER_TYPE_ENUMERATOR,
PROP_DATA_PROVIDER,
g_param_spec_object ("data-provider",
"Data provider",
"Data provider to use to crawl structures populating data, e.g. like GFileEnumerator",
TRACKER_TYPE_DATA_PROVIDER,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
......@@ -250,8 +252,8 @@ crawler_set_property (GObject *object,
priv = TRACKER_CRAWLER (object)->priv;
switch (prop_id) {
case PROP_ENUMERATOR:
priv->enumerator = g_value_dup_object (value);
case PROP_DATA_PROVIDER:
priv->data_provider = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -270,8 +272,8 @@ crawler_get_property (GObject *object,
priv = TRACKER_CRAWLER (object)->priv;
switch (prop_id) {
case PROP_ENUMERATOR:
g_value_set_object (value, priv->enumerator);
case PROP_DATA_PROVIDER:
g_value_set_object (value, priv->data_provider);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
......@@ -320,15 +322,15 @@ check_contents_defaults (TrackerCrawler *crawler,
}
TrackerCrawler *
tracker_crawler_new (TrackerEnumerator *enumerator)
tracker_crawler_new (TrackerDataProvider *data_provider)
{
if (!enumerator) {
/* Default to the file enumerator if none is passed */
enumerator = tracker_file_enumerator_new ();
if (!data_provider) {
/* Default to the file data_provider if none is passed */
data_provider = tracker_file_data_provider_new ();
}
return g_object_new (TRACKER_TYPE_CRAWLER,
"enumerator", enumerator,
"data-provider", data_provider,
NULL);
}
......@@ -549,7 +551,7 @@ process_func (gpointer data)
/* Directory contents haven't been inspected yet,
* stop this idle function while it's being iterated
*/
file_enumerate_children (crawler, info, dir_data);
data_provider_begin (crawler, info, dir_data);
stop_idle = TRUE;
}
} else if (dir_data->was_inspected &&
......@@ -649,113 +651,66 @@ process_func_stop (TrackerCrawler *crawler)
}
}
static EnumeratorData *
enumerator_data_new (TrackerCrawler *crawler,
DirectoryRootInfo *root_info,
DirectoryProcessingData *dir_info)
static DataProviderData *
data_provider_data_new (TrackerCrawler *crawler,
DirectoryRootInfo *root_info,
DirectoryProcessingData *dir_info)