Top | ![]() |
![]() |
![]() |
![]() |
GQuark | tracker_miner_fs_error_quark () |
TrackerIndexingTree * | tracker_miner_fs_get_indexing_tree () |
TrackerDataProvider * | tracker_miner_fs_get_data_provider () |
gdouble | tracker_miner_fs_get_throttle () |
void | tracker_miner_fs_set_throttle () |
void | tracker_miner_fs_check_file () |
void | tracker_miner_fs_notify_finish () |
const gchar * | tracker_miner_fs_get_urn () |
gchar * | tracker_miner_fs_query_urn () |
gboolean | tracker_miner_fs_has_items_to_process () |
enum | TrackerMinerFSEventType |
struct | TrackerMinerFS |
TrackerMinerFSClass | |
enum | TrackerMinerFSError |
TrackerMinerFS is an abstract base class for miners that collect data from a filesystem where parent/child relationships need to be inserted into the database correctly with queue management.
All the filesystem crawling and monitoring is abstracted away, leaving to implementations the decisions of what directories/files should it process, and the actual data extraction.
Example creating a TrackerMinerFS with our own file system root and data provider.
First create our class and base it on TrackerMinerFS:
1 2 3 |
G_DEFINE_TYPE_WITH_CODE (MyMinerFiles, my_miner_files, TRACKER_TYPE_MINER_FS, G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, my_miner_files_initable_iface_init)) |
Later in our class creation function, we are supplying the
arguments we want. In this case, the 'root' is a GFile pointing to
a root URI location (for example 'file:///') and 'data_provider' is a
TrackerDataProvider used to enumerate 'root' and return children it
finds. If 'data_provider' is NULL
(the default), then a
TrackerFileDataProvider is created automatically.
1 2 3 4 5 6 7 8 9 10 |
// Note that only 'name' is mandatory miner = g_initable_new (MY_TYPE_MINER_FILES, NULL, error, "name", "MyMinerFiles", "root", root, "data-provider", data_provider, "processing-pool-wait-limit", 10, "processing-pool-ready-limit", 100, NULL); |
GQuark
tracker_miner_fs_error_quark (void
);
Gives the caller the GQuark used to identify TrackerMinerFS errors in GError structures. The GQuark is used as the domain for the error.
Since: 1.2
TrackerIndexingTree *
tracker_miner_fs_get_indexing_tree (TrackerMinerFS *fs
);
Returns the TrackerIndexingTree which determines
what files/directories are indexed by fs
TrackerDataProvider *
tracker_miner_fs_get_data_provider (TrackerMinerFS *fs
);
Returns the TrackerDataProvider implementation, which is being used to supply GFile and GFileInfo content to Tracker.
Since: 1.2
gdouble
tracker_miner_fs_get_throttle (TrackerMinerFS *fs
);
Gets the current throttle value, see
tracker_miner_fs_set_throttle()
for more details.
Since: 0.8
void tracker_miner_fs_set_throttle (TrackerMinerFS *fs
,gdouble throttle
);
Tells the filesystem miner to throttle its operations. A value of
0.0 means no throttling at all, so the miner will perform
operations at full speed, 1.0 is the slowest value. With a value of
1.0, the fs
is typically waiting one full second before handling
the next batch of queued items to be processed.
Since: 0.8
void tracker_miner_fs_check_file (TrackerMinerFS *fs
,GFile *file
,gint priority
,gboolean check_parents
);
Tells the filesystem miner to check and index a file at
a given priority, this file must be part of the usual
crawling directories of TrackerMinerFS. See
tracker_indexing_tree_add()
.
fs |
||
file |
GFile for the file to check |
|
priority |
the priority of the check task |
|
check_parents |
whether to check parents and eligibility or not |
Since: 0.10
void tracker_miner_fs_notify_finish (TrackerMinerFS *fs
,GTask *task
,const gchar *sparql
,GError *error
);
Notifies fs
that all processing on file
has been finished, if any error
happened during file data processing, it should be passed in error
, else
sparql
should contain correct SPARQL representing the operation in
particular.
This function is expected to be called in reaction to all TrackerMinerFS signals
fs |
||
task |
a GTask obtained in a TrackerMinerFS signal/vmethod |
|
sparql |
Resulting sparql for the given operation, or |
[nullable] |
error |
a GError with the error that happened during processing, or |
const gchar * tracker_miner_fs_get_urn (TrackerMinerFS *fs
,GFile *file
);
If the item exists in the store, this function retrieves the URN for a GFile being currently processed.
If file
is not being currently processed by fs
, or doesn't
exist in the store yet, NULL
will be returned.
Since: 0.8
gchar * tracker_miner_fs_query_urn (TrackerMinerFS *fs
,GFile *file
);
If the item exists in the store, this function retrieves the URN of the given GFile
If file
doesn't exist in the store yet, NULL
will be returned.
A newly allocated string with the URN containing the data associated
to file
, or NULL
.
[transfer full]
Since: 0.10
gboolean
tracker_miner_fs_has_items_to_process (TrackerMinerFS *fs
);
The fs
keeps many priority queus for content it is processing.
This function returns TRUE
if the sum of all (or any) priority
queues is more than 0. This includes items deleted, created,
updated, moved or being written back.
Since: 0.10
struct TrackerMinerFS { TrackerMiner parent; TrackerMinerFSPrivate *priv; };
Abstract miner implementation to get data from the filesystem.
typedef struct { TrackerMinerClass parent; gboolean (* process_file) (TrackerMinerFS *fs, GFile *file, GTask *task); 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, GTask *task); void (* finished_root) (TrackerMinerFS *fs, GFile *root, gint directories_found, gint directories_ignored, gint files_found, gint files_ignored); gchar * (* remove_file) (TrackerMinerFS *fs, GFile *file); gchar * (* remove_children) (TrackerMinerFS *fs, GFile *file); gchar * (* move_file) (TrackerMinerFS *fs, GFile *dest, GFile *source, gboolean recursive); gboolean (* filter_event) (TrackerMinerFS *fs, TrackerMinerFSEventType type, GFile *file, GFile *source_file); /* <Private> */ gpointer padding[20]; } TrackerMinerFSClass;
Prototype for the abstract class, process_file
must be implemented
in the deriving class in order to actually extract data.
TrackerMinerClass |
parent object class |
|
Called when the metadata associated to a file is requested. |
||
Called when all processing has been performed. |
||
Called when the metadata associated with a file's attributes changes, for example, the mtime. |
||
Called when all resources on a particular root URI have been processed. |
||
Called when a file is removed. |
||
Called when children have been removed. |
||
Called when a file has moved. |
||
Called to filter the event happening to a file. |
||
Reserved for future API improvements. |
Possible errors returned when calling creating new objects based on the TrackerMinerFS type and other APIs available with this class.
Since: 1.2