## TrackerMiner TrackerMiner — Abstract base class for data miners |

## Functions

GQuark | tracker_miner_error_quark ()
void | tracker_miner_start ()
void | tracker_miner_stop ()
gboolean | tracker_miner_is_started ()
gboolean | tracker_miner_is_paused ()
void | tracker_miner_pause ()
gboolean | tracker_miner_resume ()
TrackerSparqlConnection * | tracker_miner_get_connection ()

## Types and Values

#define | TRACKER_MINER_DBUS_INTERFACE
#define | TRACKER_MINER_DBUS_NAME_PREFIX
#define | TRACKER_MINER_DBUS_PATH_PREFIX
#define | TRACKER_MINER_ERROR_DOMAIN
#define | TRACKER_MINER_ERROR
struct | TrackerMiner
| TrackerMinerClass
enum | TrackerMinerError

## Includes

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

## Description

TrackerMiner is an abstract base class to help developing data miners for tracker-store, being an abstract class it doesn't do much by itself, but provides the basic signaling and control over the actual indexing task.

TrackerMiner implements the GInitable interface, and thus, all objects of types inheriting from TrackerMiner must be initialized with `g_initable_init()` just after creation (or directly created with `g_initable_new()`).

## Functions

### tracker_miner_error_quark ()

    GQuark
    tracker_miner_error_quark (void);

Gives the caller the GQuark used to identify TrackerMiner errors in GError structures. The GQuark is used as the domain for the error.

#### Returns

the GQuark used for the domain of a GError.

Since: 0.8

### tracker_miner_start ()

    void
    tracker_miner_start (TrackerMiner *miner);

Tells the miner to start processing data.

#### Parameters

miner | a TrackerMiner |

Since: 0.8

### tracker_miner_stop ()

    void
    tracker_miner_stop (TrackerMiner *miner);

Tells the miner to stop processing data.

#### Parameters

miner | a TrackerMiner |

Since: 0.8

### tracker_miner_is_started ()

    gboolean
    tracker_miner_is_started (TrackerMiner *miner);

Returns TRUE if the miner has been started.

#### Parameters

miner | a TrackerMiner |

#### Returns

TRUE if the miner is already started.

Since: 0.8

### tracker_miner_is_paused ()

    gboolean
    tracker_miner_is_paused (TrackerMiner *miner);

Returns TRUE if the miner is paused.

#### Parameters

miner | a TrackerMiner |

#### Returns

TRUE if the miner is paused.

Since: 0.10

### tracker_miner_pause ()

    void
    tracker_miner_pause (TrackerMiner *miner);

Asks `miner` to pause. This call may be called multiple times, but “paused” will only be emitted the first time. The same number of `tracker_miner_resume()` calls are expected in order to resume operations.

#### Parameters

miner | a TrackerMiner |

### tracker_miner_resume ()

    gboolean
    tracker_miner_resume (TrackerMiner *miner);

Asks the miner to resume processing. This needs to be called as many times as `tracker_miner_pause()` calls were done previously. This function will return TRUE when the miner is actually resumed.

#### Parameters

miner | a TrackerMiner |

#### Returns

TRUE if the miner resumed its operations.

### tracker_miner_get_connection ()

    TrackerSparqlConnection *
    tracker_miner_get_connection (TrackerMiner *miner);

Gets the TrackerSparqlConnection initialized by `miner`

#### Parameters

miner | a TrackerMiner |

#### Returns

a TrackerSparqlConnection.

[transfer none]

Since: 0.10

## Types and Values

### TRACKER_MINER_DBUS_INTERFACE

    #define TRACKER_MINER_DBUS_INTERFACE   "org.freedesktop.Tracker1.Miner"

The name of the D-Bus interface to use for all data miners that inter-operate with Tracker.

Since: 0.8

### TRACKER_MINER_DBUS_NAME_PREFIX

    #define TRACKER_MINER_DBUS_NAME_PREFIX "org.freedesktop.Tracker1.Miner."

D-Bus name prefix to use for all data miners. This allows custom miners to be written using `TRACKER_MINER_DBUS_NAME_PREFIX` + "Files" for example and would show up on D-Bus under "org.freedesktop.Tracker1.Miner.Files".

Since: 0.8

### TRACKER_MINER_DBUS_PATH_PREFIX

    #define TRACKER_MINER_DBUS_PATH_PREFIX "/org/freedesktop/Tracker1/Miner/"

D-Bus path prefix to use for all data miners. This allows custom miners to be written using `TRACKER_MINER_DBUS_PATH_PREFIX` + "Files" for example and would show up on D-Bus under "/org/freedesktop/Tracker1/Miner/Files".

Since: 0.8

### TRACKER_MINER_ERROR_DOMAIN

    #define TRACKER_MINER_ERROR_DOMAIN "TrackerMiner"

Used as the domain for any GErrors reported by `TrackerMiner` objects.

Since: 0.8

### TRACKER_MINER_ERROR

    #define TRACKER_MINER_ERROR        tracker_miner_error_quark()

Returns the `GQuark` used for GErrors and for `TrackerMiner` implementations. This calls `tracker_miner_error_quark()`.

Since: 0.8

### struct TrackerMiner

    struct TrackerMiner {
    	GObject parent_instance;
    	TrackerMinerPrivate *priv;
    };

Abstract miner object.

### TrackerMinerClass

    typedef struct {
    	GObjectClass parent_class;

    	/* signals */
    	void (* started)            (TrackerMiner *miner);
    	void (* stopped)            (TrackerMiner *miner);

    	void (* paused)             (TrackerMiner *miner);
    	void (* resumed)            (TrackerMiner *miner);

    	void (* progress)           (TrackerMiner *miner,
    	                             const gchar  *status,
    	                             gdouble       progress,
    	                             gint          remaining_time);

    	/* <Private> */
    	gpointer padding[10];
    } TrackerMinerClass;

Virtual methods left to implement.

#### Members

`started` () | Called when the miner is told to start collecting data. |
`stopped` () | Called when the miner is told to stop collecting data. |
`paused` () | Called when the miner is told to pause. |
`resumed` () | Called when the miner is told to resume activity. |
`progress` () | progress. |
gpointer `padding`[10]; | Reserved for future API improvements. |

### enum TrackerMinerError

Possible errors returned when calling TrackerMiner APIs or subclassed miners where the error is generic to all miners.

#### Members

TRACKER_MINER_ERROR_NAME_MISSING | No name was given when creating the miner. The name is crucial for D-Bus presence and a host of other things. |
TRACKER_MINER_ERROR_NAME_UNAVAILABLE | The name trying to be used for the miner was not available, possibly because the miner is already running with the same name in another process. |
TRACKER_MINER_ERROR_PAUSED | Given by miners when an API is used at the time the miner itself is paused and such actions should be avoided. |
TRACKER_MINER_ERROR_PAUSED_ALREADY | The pause request has already been given by the same application with the same reason. Duplicate pause calls with the same reason by the same application can not be carried out. |
TRACKER_MINER_ERROR_INVALID_COOKIE | When pausing a miner, a cookie (or `gint` based ID) is given. That cookie must be used to resume a previous pause request. If the cookie is unrecognised, this error is given. |