File: tracker-miner-fs.h

package info (click to toggle)
tracker 1.10.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 41,032 kB
  • ctags: 21,997
  • sloc: ansic: 238,235; python: 8,639; sh: 4,649; makefile: 3,902; xml: 569; perl: 106; cpp: 61
file content (212 lines) | stat: -rw-r--r-- 11,202 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
 * Copyright (C) 2009, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#ifndef __LIBTRACKER_MINER_MINER_FS_H__
#define __LIBTRACKER_MINER_MINER_FS_H__

#if !defined (__LIBTRACKER_MINER_H_INSIDE__) && !defined (TRACKER_COMPILATION)
#error "Only <libtracker-miner/tracker-miner.h> can be included directly."
#endif

#include <glib-object.h>
#include <gio/gio.h>

#include <libtracker-sparql/tracker-sparql.h>

#include "tracker-miner-object.h"
#include "tracker-data-provider.h"
#include "tracker-indexing-tree.h"

G_BEGIN_DECLS

#define TRACKER_TYPE_MINER_FS         (tracker_miner_fs_get_type())
#define TRACKER_MINER_FS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_MINER_FS, TrackerMinerFS))
#define TRACKER_MINER_FS_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), TRACKER_TYPE_MINER_FS, TrackerMinerFSClass))
#define TRACKER_IS_MINER_FS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_MINER_FS))
#define TRACKER_IS_MINER_FS_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c),  TRACKER_TYPE_MINER_FS))
#define TRACKER_MINER_FS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_MINER_FS, TrackerMinerFSClass))

typedef struct _TrackerMinerFS        TrackerMinerFS;
typedef struct _TrackerMinerFSPrivate TrackerMinerFSPrivate;

/**
 * TrackerMinerFS:
 *
 * Abstract miner implementation to get data from the filesystem.
 **/
struct _TrackerMinerFS {
	TrackerMiner parent;
	TrackerMinerFSPrivate *priv;
};

/**
 * TrackerMinerFSClass:
 * @parent: parent object class
 * @process_file: Called when the metadata associated to a file is
 * requested.
 * @ignore_next_update_file: Called after a writeback event happens on
 * a file (deprecated since 0.12).
 * @finished: Called when all processing has been performed.
 * @process_file_attributes: Called when the metadata associated with
 * a file's attributes changes, for example, the mtime.
 * @writeback_file: Called when a file must be written back
 * @finished_root: Called when all resources on a particular root URI
 * have been processed.
 * @padding: Reserved for future API improvements.
 *
 * Prototype for the abstract class, @process_file must be implemented
 * in the deriving class in order to actually extract data.
 **/
typedef struct {
	TrackerMinerClass parent;

	gboolean (* process_file)             (TrackerMinerFS       *fs,
	                                       GFile                *file,
	                                       TrackerSparqlBuilder *builder,
	                                       GCancellable         *cancellable);
	gboolean (* ignore_next_update_file)  (TrackerMinerFS       *fs,
	                                       GFile                *file,
	                                       TrackerSparqlBuilder *builder,
	                                       GCancellable         *cancellable);
	void     (* finished)                 (TrackerMinerFS       *fs,
	                                       gdouble               elapsed,
	                                       gint                  directories_found,
	                                       gint                  directories_ignored,
	                                       gint                  files_found,
	                                       gint                  files_ignored);
	gboolean (* process_file_attributes)  (TrackerMinerFS       *fs,
	                                       GFile                *file,
	                                       TrackerSparqlBuilder *builder,
	                                       GCancellable         *cancellable);
	gboolean (* writeback_file)           (TrackerMinerFS       *fs,
	                                       GFile                *file,
	                                       GStrv                 rdf_types,
	                                       GPtrArray            *results);
	void     (* finished_root)            (TrackerMinerFS       *fs,
	                                       GFile                *root,
	                                       gint                  directories_found,
	                                       gint                  directories_ignored,
	                                       gint                  files_found,
	                                       gint                  files_ignored);
	gboolean (* remove_file)              (TrackerMinerFS       *fs,
	                                       GFile                *file,
	                                       gboolean              children_only,
	                                       TrackerSparqlBuilder *builder);

	/* <Private> */
	gpointer padding[8];
} TrackerMinerFSClass;

/**
 * TrackerMinerFSError:
 * @TRACKER_MINER_FS_ERROR_INIT: There was an error during
 * initialization of the object. The specific details are in the
 * message.
 *
 * Possible errors returned when calling creating new objects based on
 * the #TrackerMinerFS type and other APIs available with this class.
 *
 * Since: 1.2.
 **/
typedef enum {
	TRACKER_MINER_FS_ERROR_INIT,
} TrackerMinerFSError;

GType                 tracker_miner_fs_get_type              (void) G_GNUC_CONST;
GQuark                tracker_miner_fs_error_quark           (void);

/* Properties */
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);

#ifndef TRACKER_DISABLE_DEPRECATED
/* Setting locations to be processed in IndexingTree */
void                  tracker_miner_fs_add_directory_without_parent
                                                             (TrackerMinerFS  *fs,
                                                              GFile           *file)
                                                             G_GNUC_DEPRECATED;
#endif

void                  tracker_miner_fs_directory_add         (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              gboolean         recurse);
gboolean              tracker_miner_fs_directory_remove      (TrackerMinerFS  *fs,
                                                              GFile           *file);
gboolean              tracker_miner_fs_directory_remove_full (TrackerMinerFS  *fs,
                                                              GFile           *file);
void                  tracker_miner_fs_force_mtime_checking  (TrackerMinerFS  *fs,
                                                              GFile           *directory);

/* Queueing files to be processed AFTER checking rules in IndexingTree */
void                  tracker_miner_fs_check_file            (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              gboolean         check_parents);
void                  tracker_miner_fs_check_file_with_priority
                                                             (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              gint             priority,
                                                              gboolean         check_parents);
void                  tracker_miner_fs_check_directory       (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              gboolean         check_parents);
void                  tracker_miner_fs_check_directory_with_priority
                                                             (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              gint             priority,
                                                              gboolean         check_parents);

void                  tracker_miner_fs_force_recheck         (TrackerMinerFS  *fs);
void                  tracker_miner_fs_writeback_file        (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              GStrv            rdf_types,
                                                              GPtrArray       *results);

/* Continuation for async functions when signalled with ::process-file */
void                  tracker_miner_fs_writeback_notify      (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              const GError    *error);
void                  tracker_miner_fs_file_notify           (TrackerMinerFS  *fs,
                                                              GFile           *file,
                                                              const GError    *error);

/* URNs */
const gchar          *tracker_miner_fs_get_urn               (TrackerMinerFS  *fs,
                                                              GFile           *file);
const gchar          *tracker_miner_fs_get_parent_urn        (TrackerMinerFS  *fs,
                                                              GFile           *file);
gchar                *tracker_miner_fs_query_urn             (TrackerMinerFS  *fs,
                                                              GFile           *file);


/* Progress */
gboolean              tracker_miner_fs_has_items_to_process  (TrackerMinerFS  *fs);

G_END_DECLS

#endif /* __LIBTRACKER_MINER_MINER_FS_H__ */