Commit 354fc70f authored by Martyn Russell's avatar Martyn Russell

libtracker-miner: Removed TrackerCrawlFlags and use TrackerDirectoryFlags

This patch does the following things:
- The _NO_STAT flag has been added.
- The _FOLLOW_SYMLINKS flag has been added in the follow-symlinks branch and
  is not intended for this development cycle
- Remove TrackerDataProvider's _{get|set}_dir_flags() API (no longer used).
parent 578738de
......@@ -107,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_(data_provider|enumerator|crawl|miner|indexing_tree|directory_flags|filter_type|filter_policy|network_type|decorator)_.*'
-export-symbols-regex '^tracker_(data_provider|enumerator|miner|indexing_tree|directory_flags|filter_type|filter_policy|network_type|decorator)_.*'
endif
libtracker_miner_@TRACKER_API_VERSION@_la_LIBADD = \
......
......@@ -72,6 +72,8 @@ struct DirectoryRootInfo {
GQueue *directory_processing_queue;
TrackerDirectoryFlags flags;
DataProviderData *dpd;
/* Directory stats */
......@@ -464,14 +466,14 @@ directory_processing_data_add_child (DirectoryProcessingData *data,
}
static DirectoryRootInfo *
directory_root_info_new (GFile *file,
gint max_depth,
gchar *file_attributes,
TrackerCrawlFlags flags)
directory_root_info_new (GFile *file,
gint max_depth,
gchar *file_attributes,
TrackerDirectoryFlags flags)
{
DirectoryRootInfo *info;
DirectoryProcessingData *dir_info;
gboolean enable_stat;
gboolean allow_stat = TRUE;
info = g_slice_new0 (DirectoryRootInfo);
......@@ -481,14 +483,21 @@ directory_root_info_new (GFile *file,
info->tree = g_node_new (g_object_ref (file));
enable_stat = (flags & TRACKER_CRAWL_FLAG_NO_STAT) == 0;
info->flags = flags;
if (enable_stat && file_attributes) {
if ((info->flags & TRACKER_DIRECTORY_FLAG_NO_STAT) != 0) {
allow_stat = FALSE;
}
if (allow_stat && file_attributes) {
GFileInfo *file_info;
GFileQueryInfoFlags file_flags;
file_flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
file_info = g_file_query_info (file,
file_attributes,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
file_flags,
NULL,
NULL);
g_object_set_qdata_full (G_OBJECT (file),
......@@ -1012,7 +1021,7 @@ data_provider_begin (TrackerCrawler *crawler,
tracker_data_provider_begin_async (crawler->priv->data_provider,
dpd->dir_file,
attrs,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
info->flags,
G_PRIORITY_LOW,
dpd->cancellable,
data_provider_begin_cb,
......@@ -1021,12 +1030,12 @@ data_provider_begin (TrackerCrawler *crawler,
}
gboolean
tracker_crawler_start (TrackerCrawler *crawler,
GFile *file,
gint max_depth)
tracker_crawler_start (TrackerCrawler *crawler,
GFile *file,
TrackerDirectoryFlags flags,
gint max_depth)
{
TrackerCrawlerPrivate *priv;
TrackerCrawlFlags flags;
DirectoryRootInfo *info;
gboolean enable_stat;
......@@ -1035,8 +1044,7 @@ tracker_crawler_start (TrackerCrawler *crawler,
priv = crawler->priv;
flags = tracker_data_provider_get_crawl_flags (priv->data_provider);
enable_stat = (flags & TRACKER_CRAWL_FLAG_NO_STAT) == 0;
enable_stat = (flags & TRACKER_DIRECTORY_FLAG_NO_STAT) == 0;
if (enable_stat && !g_file_query_exists (file, NULL)) {
/* This shouldn't happen, unless the removal/unmount notification
......
......@@ -75,6 +75,7 @@ GType tracker_crawler_get_type (void);
TrackerCrawler *tracker_crawler_new (TrackerDataProvider *data_provider);
gboolean tracker_crawler_start (TrackerCrawler *crawler,
GFile *file,
TrackerDirectoryFlags flags,
gint max_depth);
void tracker_crawler_stop (TrackerCrawler *crawler);
void tracker_crawler_pause (TrackerCrawler *crawler);
......
......@@ -57,61 +57,12 @@ tracker_data_provider_default_init (TrackerDataProviderInterface *iface)
{
}
/**
* tracker_data_provider_get_crawl_flags:
* @data_provider: a #TrackerDataProvider
*
* Get the conditions used to provide data, for example, following symlinks.
*
* Returns: the #TrackerCrawlFlags used with this @data_provider.
*
* Since: 1.2
**/
TrackerCrawlFlags
tracker_data_provider_get_crawl_flags (TrackerDataProvider *data_provider)
{
TrackerDataProviderIface *iface;
g_return_val_if_fail (TRACKER_IS_DATA_PROVIDER (data_provider), TRACKER_CRAWL_FLAG_NONE);
iface = TRACKER_DATA_PROVIDER_GET_IFACE (data_provider);
g_return_val_if_fail (iface->get_crawl_flags != NULL, TRACKER_CRAWL_FLAG_NONE);
return (* iface->get_crawl_flags) (data_provider);
}
/**
* tracker_data_provider_set_crawl_flags:
* @data_provider: a #TrackerDataProvider
* @flags: the #TrackerCrawlFlags to use
*
* Sets the #TrackerCrawlFlags used with this @data_provider. Each time
* tracker_data_provider_begin() is called, these flags are used.
*
* Since: 1.2
**/
void
tracker_data_provider_set_crawl_flags (TrackerDataProvider *data_provider,
TrackerCrawlFlags flags)
{
TrackerDataProviderIface *iface;
g_return_if_fail (TRACKER_IS_DATA_PROVIDER (data_provider));
iface = TRACKER_DATA_PROVIDER_GET_IFACE (data_provider);
g_return_if_fail (iface->set_crawl_flags != NULL);
(* iface->set_crawl_flags) (data_provider, flags);
}
/**
* tracker_data_provider_begin:
* @data_provider: a #TrackerDataProvider
* @url: a #GFile to enumerate
* @attributes: an attribute query string
* @flags: a set of GFileQueryInfoFlags
* @flags: a set of #TrackerDirectoryFlags
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occurring, or %NULL to ignore
*
......@@ -135,12 +86,12 @@ tracker_data_provider_set_crawl_flags (TrackerDataProvider *data_provider,
* Since: 1.2
**/
TrackerEnumerator *
tracker_data_provider_begin (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error)
tracker_data_provider_begin (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
GCancellable *cancellable,
GError **error)
{
TrackerDataProviderIface *iface;
......@@ -168,7 +119,7 @@ tracker_data_provider_begin (TrackerDataProvider *data_provider,
* @data_provider: a #TrackerDataProvider.
* @url: a #GFile to enumerate
* @attributes: an attribute query string
* @flags: a set of GFileQueryInfoFlags
* @flags: a set of #TrackerDirectoryFlags
* @io_priority: the [I/O priority][io-priority] of the request
* @cancellable: (allow-none): optional #GCancellable object, %NULL to
* ignore
......@@ -200,14 +151,14 @@ tracker_data_provider_begin (TrackerDataProvider *data_provider,
* Since: 1.2
**/
void
tracker_data_provider_begin_async (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
tracker_data_provider_begin_async (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
TrackerDataProviderIface *iface;
......
......@@ -49,10 +49,6 @@ typedef struct _TrackerDataProviderIface TrackerDataProviderIface;
/**
* TrackerDataProviderIface:
* @g_iface: Parent interface type.
* @get_crawl_flags: Called when before data_provider starts to know how
* to enumerate.
* @set_crawl_flags: Called when setting the flags an data_provider
* should use.
* @begin: Called when the data_provider is synchronously
* opening and starting the iteration of a given location.
* @begin_async: Called when the data_provider is synchronously
......@@ -74,43 +70,40 @@ struct _TrackerDataProviderIface {
GTypeInterface g_iface;
/* Virtual Table */
TrackerCrawlFlags (* get_crawl_flags) (TrackerDataProvider *data_provider);
void (* set_crawl_flags) (TrackerDataProvider *data_provider,
TrackerCrawlFlags flags);
/* Start the data_provider for a given location, attributes and flags */
TrackerEnumerator * (* begin) (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error);
void (* begin_async) (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
TrackerEnumerator * (* begin_finish) (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
TrackerEnumerator * (* begin) (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
GCancellable *cancellable,
GError **error);
void (* begin_async) (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
TrackerEnumerator * (* begin_finish) (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
/* Close the given location */
gboolean (* end) (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
GCancellable *cancellable,
GError **error);
void (* end_async) (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* end_finish) (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
gboolean (* end) (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
GCancellable *cancellable,
GError **error);
void (* end_async) (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* end_finish) (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
/*< private >*/
/* Padding for future expansion */
......@@ -125,40 +118,36 @@ struct _TrackerDataProviderIface {
};
GType tracker_data_provider_get_type (void) G_GNUC_CONST;
TrackerCrawlFlags tracker_data_provider_get_crawl_flags (TrackerDataProvider *data_provider);
void tracker_data_provider_set_crawl_flags (TrackerDataProvider *data_provider,
TrackerCrawlFlags flags);
TrackerEnumerator *tracker_data_provider_begin (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error);
void tracker_data_provider_begin_async (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
TrackerEnumerator *tracker_data_provider_begin_finish (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
gboolean tracker_data_provider_end (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
GCancellable *cancellable,
GError **error);
void tracker_data_provider_end_async (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean tracker_data_provider_end_finish (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
TrackerEnumerator *tracker_data_provider_begin (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
GCancellable *cancellable,
GError **error);
void tracker_data_provider_begin_async (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
TrackerEnumerator *tracker_data_provider_begin_finish (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
gboolean tracker_data_provider_end (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
GCancellable *cancellable,
GError **error);
void tracker_data_provider_end_async (TrackerDataProvider *data_provider,
TrackerEnumerator *enumerator,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean tracker_data_provider_end_finish (TrackerDataProvider *data_provider,
GAsyncResult *result,
GError **error);
G_END_DECLS
......
......@@ -28,13 +28,12 @@ static void tracker_file_data_provider_file_iface_init (TrackerDataProviderIface
struct _TrackerFileDataProvider {
GObject parent_instance;
TrackerCrawlFlags crawl_flags;
};
typedef struct {
GFile *url;
gchar *attributes;
GFileQueryInfoFlags flags;
TrackerDirectoryFlags flags;
} BeginData;
/**
......@@ -72,34 +71,12 @@ tracker_file_data_provider_class_init (TrackerFileDataProviderClass *klass)
static void
tracker_file_data_provider_init (TrackerFileDataProvider *fe)
{
fe->crawl_flags = TRACKER_CRAWL_FLAG_NONE;
}
static TrackerCrawlFlags
file_data_provider_get_crawl_flags (TrackerDataProvider *data_provider)
{
TrackerFileDataProvider *fe;
fe = TRACKER_FILE_DATA_PROVIDER (data_provider);
return fe->crawl_flags;
}
static void
file_data_provider_set_crawl_flags (TrackerDataProvider *data_provider,
TrackerCrawlFlags flags)
{
TrackerFileDataProvider *fe;
fe = TRACKER_FILE_DATA_PROVIDER (data_provider);
fe->crawl_flags = flags;
}
static BeginData *
begin_data_new (GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags)
begin_data_new (GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags)
{
BeginData *data;
......@@ -125,14 +102,15 @@ begin_data_free (BeginData *data)
}
static TrackerEnumerator *
file_data_provider_begin (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error)
file_data_provider_begin (TrackerDataProvider *data_provider,
GFile *url,
const gchar *attributes,
TrackerDirectoryFlags flags,
GCancellable *cancellable,
GError **error)
{
TrackerEnumerator *enumerator;
GFileQueryInfoFlags file_flags;
GFileEnumerator *fe;
GError *local_error = NULL;
......@@ -140,13 +118,24 @@ file_data_provider_begin (TrackerDataProvider *data_provider,
return NULL;
}
/* We ignore the TRACKER_DIRECTORY_FLAG_NO_STAT here, it makes
* no sense to be at this point with that flag. So we warn
* about it...
*/
if ((flags & TRACKER_DIRECTORY_FLAG_NO_STAT) != 0) {
g_warning ("Did not expect to have TRACKER_DIRECTORY_FLAG_NO_STAT "
"flag in %s(), continuing anyway...",
__FUNCTION__);
}
file_flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
fe = g_file_enumerate_children (url,
attributes,
flags,
file_flags,
cancellable,
&local_error);
if (local_error) {
gchar *uri;
......@@ -197,14 +186,14 @@ file_data_provider_begin_thread (GTask *task,
}
static void
file_data_provider_begin_async (TrackerDataProvider *data_provider,
GFile *dir,
const gchar *attributes,
GFileQueryInfoFlags flags,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
file_data_provider_begin_async (TrackerDataProvider *data_provider,
GFile *dir,
const gchar *attributes,
TrackerDirectoryFlags flags,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
......@@ -293,8 +282,6 @@ file_data_provider_end_finish (TrackerDataProvider *data_provider,
static void
tracker_file_data_provider_file_iface_init (TrackerDataProviderIface *iface)
{
iface->get_crawl_flags = file_data_provider_get_crawl_flags;
iface->set_crawl_flags = file_data_provider_set_crawl_flags;
iface->begin = file_data_provider_begin;
iface->begin_async = file_data_provider_begin_async;
iface->begin_finish = file_data_provider_begin_finish;
......
......@@ -27,7 +27,6 @@ static void tracker_file_enumerator_file_iface_init (TrackerEnumeratorIface *ifa
struct _TrackerFileEnumerator {
GObject parent_instance;
TrackerCrawlFlags crawl_flags;
GFileEnumerator *file_enumerator;
};
......@@ -72,7 +71,6 @@ tracker_file_enumerator_class_init (TrackerFileEnumeratorClass *klass)
static void
tracker_file_enumerator_init (TrackerFileEnumerator *fe)
{
fe->crawl_flags = TRACKER_CRAWL_FLAG_NONE;
}
static gpointer
......
......@@ -562,7 +562,7 @@ static gboolean
crawl_directory_in_current_root (TrackerFileNotifier *notifier)
{
TrackerFileNotifierPrivate *priv = notifier->priv;
gboolean recurse, retval = FALSE;
gint depth;
GFile *directory;
if (!priv->current_index_root)
......@@ -574,10 +574,19 @@ crawl_directory_in_current_root (TrackerFileNotifier *notifier)
return FALSE;
g_cancellable_reset (priv->cancellable);
recurse = (priv->current_index_root->flags & TRACKER_DIRECTORY_FLAG_RECURSE) != 0;
retval = tracker_crawler_start (priv->crawler, directory,
(recurse) ? MAX_DEPTH : 1);
return retval;
if ((priv->current_index_root->flags & TRACKER_DIRECTORY_FLAG_RECURSE) == 0) {
/* Don't recurse */
depth = 1;
} else {
/* Recurse */
depth = MAX_DEPTH;
}
return tracker_crawler_start (priv->crawler,
directory,
priv->current_index_root->flags,
depth);
}
static void
......
......@@ -40,7 +40,7 @@ typedef struct _FindNodeData FindNodeData;
struct _NodeData
{
GFile *file;
guint flags : 7;
guint flags;
guint shallow : 1;
};
......@@ -698,24 +698,37 @@ tracker_indexing_tree_file_is_indexable (TrackerIndexingTree *tree,
g_return_val_if_fail (TRACKER_IS_INDEXING_TREE (tree), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
if (file_type == G_FILE_TYPE_UNKNOWN)
file_type = g_file_query_file_type (file,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL);
filter = (file_type == G_FILE_TYPE_DIRECTORY) ?
TRACKER_FILTER_DIRECTORY : TRACKER_FILTER_FILE;
if (indexing_tree_file_is_filtered (tree, filter, file)) {
return FALSE;
}
config_file = tracker_indexing_tree_get_root (tree,file, &config_flags);
config_file = tracker_indexing_tree_get_root (tree, file, &config_flags);
if (!config_file) {
/* Not under an added dir */
return FALSE;
}
/* Don't check file type if _NO_STAT is given in flags */
if (file_type == G_FILE_TYPE_UNKNOWN &&
(config_flags & TRACKER_DIRECTORY_FLAG_NO_STAT) != 0) {
GFileQueryInfoFlags file_flags;
file_flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
file_type = g_file_query_file_type (file, file_flags, NULL);
filter = (file_type == G_FILE_TYPE_DIRECTORY) ?
TRACKER_FILTER_DIRECTORY : TRACKER_FILTER_FILE;
if (indexing_tree_file_is_filtered (tree, filter, file)) {
return FALSE;
}
} else if (file_type != G_FILE_TYPE_UNKNOWN) {
filter = (file_type == G_FILE_TYPE_DIRECTORY) ?
TRACKER_FILTER_DIRECTORY : TRACKER_FILTER_FILE;
if (indexing_tree_file_is_filtered (tree, filter, file)) {
return FALSE;
}
}
/* FIXME: Shouldn't we only do this for file_type == G_FILE_TYPE_DIRECTORY ? */
if (config_flags & TRACKER_DIRECTORY_FLAG_IGNORE) {
return FALSE;
}
......
......@@ -37,22 +37,35 @@ G_BEGIN_DECLS
* TrackerDirectoryFlags:
* @TRACKER_DIRECTORY_FLAG_NONE: No flags.
* @TRACKER_DIRECTORY_FLAG_RECURSE: Should recurse in the directory.
* @TRACKER_DIRECTORY_FLAG_CHECK_MTIME: Should check mtimes of items in the directory.
* @TRACKER_DIRECTORY_FLAG_MONITOR: Should setup monitors in the items found in the directory.
* @TRACKER_DIRECTORY_FLAG_IGNORE: Should ignore the directory contents.
* @TRACKER_DIRECTORY_FLAG_PRESERVE: Should preserve items in the directory even if the directory gets removed.
* @TRACKER_DIRECTORY_FLAG_PRIORITY: Internally a priority queue is used and this flag makes sure the directory is given a priority over other directories queued.
* @TRACKER_DIRECTORY_FLAG_CHECK_MTIME: Should check mtimes of items
* in the directory.
* @TRACKER_DIRECTORY_FLAG_MONITOR: Should setup monitors in the items
* found in the directory.
* @TRACKER_DIRECTORY_FLAG_IGNORE: Should ignore the directory
* contents.
* @TRACKER_DIRECTORY_FLAG_PRESERVE: Should preserve items in the
* directory even if the directory gets removed.
* @TRACKER_DIRECTORY_FLAG_PRIORITY: Internally a priority queue is
* used and this flag makes sure the directory is given a priority
* over other directories queued.
* @TRACKER_DIRECTORY_FLAG_NO_STAT: For cases where the content being
* crawled by the #TrackerEnumerator is not local (e.g. it's on a
* server somewhere), use the #TRACKER_DIRECTORY_FLAG_NO_STAT flag.
* The default is to use stat() and assume we're mining a local or
* mounted file system.
*
* Flags used when adding a new directory to be indexed in the #TrackerIndexingTree.
* Flags used when adding a new directory to be indexed in the
* #TrackerIndexingTree, #TrackerDataProvider and #TrackerEnumerator.
*/
typedef enum {
TRACKER_DIRECTORY_FLAG_NONE = 0,
TRACKER_DIRECTORY_FLAG_RECURSE = 1 << 1,
TRACKER_DIRECTORY_FLAG_CHECK_MTIME = 1 << 2,
TRACKER_DIRECTORY_FLAG_MONITOR = 1 << 3,
TRACKER_DIRECTORY_FLAG_IGNORE = 1 << 4,
TRACKER_DIRECTORY_FLAG_PRESERVE = 1 << 5,
TRACKER_DIRECTORY_FLAG_PRIORITY = 1 << 6
TRACKER_DIRECTORY_FLAG_NONE = 0,
TRACKER_DIRECTORY_FLAG_RECURSE = 1 << 1,
TRACKER_DIRECTORY_FLAG_CHECK_MTIME = 1 << 2,
TRACKER_DIRECTORY_FLAG_MONITOR = 1 << 3,
TRACKER_DIRECTORY_FLAG_IGNORE = 1 << 4,
TRACKER_DIRECTORY_FLAG_PRESERVE = 1 << 5,
TRACKER_DIRECTORY_FLAG_PRIORITY = 1 << 6,
TRACKER_DIRECTORY_FLAG_NO_STAT = 1 << 7
} TrackerDirectoryFlags;
/**
......@@ -109,28 +122,6 @@ typedef enum {
TRACKER_NETWORK_TYPE_LAN
} TrackerNetworkType;
/**
* TrackerCrawlFlags:
* @TRACKER_CRAWL_FLAG_NONE: No flags.
* @TRACKER_CRAWL_FLAG_NO_STAT: For cases where the content being crawled by the
* #TrackerEnumerator is not local (e.g. it's on a server somewhere),
* use the #TRACKER_CRAWL_FLAG_NO_STAT flag. The default is to use
* stat() and assume we're mining a local or mounted file system.
* @TRACKER_CRAWL_FLAG_FOLLOW_SYMLINKS: The enumerator should follow
* symlinks. This is disabled by default because it's easy for Tracker
* to get into recursive loop situations with symlinks. For those
* using interesting scenarios like git-annex or software heavily
* using symlinks (and properly) this is for you.
*
* Flags used when crawling directory structures. This can be
* dependent on the #TrackerEnumerator employed at the time of course.
*/
typedef enum {
TRACKER_CRAWL_FLAG_NONE = 0,
TRACKER_CRAWL_FLAG_NO_STAT = 1 << 1,
TRACKER_CRAWL_FLAG_FOLLOW_SYMLINKS = 1 << 2,
} TrackerCrawlFlags;
G_END_DECLS
#endif /* __TRACKER_MINER_ENUMS_H__ */
......@@ -1862,6 +1862,7 @@ item_move (TrackerMinerFS *fs,
uri = g_file_get_uri (file);
source_uri = g_file_get_uri (source_file);
/* FIXME: Should check the _NO_STAT on TrackerDirectoryFlags first! */
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
......
......@@ -126,7 +126,7 @@ test_crawler_crawl (void)
file = g_file_new_for_path (TEST_DATA_DIR);
started = tracker_crawler_start (crawler, file, -1);
started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, -1);
g_assert_cmpint (started, ==, 1);
......@@ -153,7 +153,7 @@ test_crawler_crawl_interrupted (void)
file = g_file_new_for_path (TEST_DATA_DIR);