AsDataPool: AppStream Library Reference Manual

## AsDataPool AsDataPool — Collect and temporarily store metadata from different sources |

## Functions

GQuark | as_data_pool_error_quark ()
AsDataPool * | as_data_pool_new ()
const gchar * | as_data_pool_get_locale ()
void | as_data_pool_set_locale ()
gboolean | as_data_pool_update ()
GList * | as_data_pool_get_components ()
AsComponent * | as_data_pool_get_component_by_id ()
GPtrArray * | as_data_pool_get_metadata_locations ()
void | as_data_pool_set_metadata_locations ()

## Types and Values

#define | AS_TYPE_DATA_POOL
struct | AsDataPoolClass
enum | AsDataPoolError
#define | AS_DATA_POOL_ERROR
| AsDataPool

## Object Hierarchy

        GObject
        ╰── AsDataPool

## Description

This class contains a temporary pool of metadata which has been collected from different sources on the system. It can directly be used, but usually it is accessed through a AsDatabase instance. This class is used by internally by the cache builder, but might be useful for others.

See also: AsDatabase

## Functions

### as_data_pool_error_quark ()

    GQuark
    as_data_pool_error_quark (void);

#### Returns

An error quark.

### as_data_pool_new ()

    AsDataPool *
    as_data_pool_new (void);

Creates a new AsDataPool.

#### Returns

a AsDataPool.

[transfer full]

### as_data_pool_get_locale ()

    const gchar *
    as_data_pool_get_locale (AsDataPool *dpool);

Gets the currently used locale.

#### Parameters

dpool | An instance of AsDataPool. |

#### Returns

Locale used for metadata parsing.

### as_data_pool_set_locale ()

    void
    as_data_pool_set_locale (AsDataPool *dpool,
                             const gchar *locale);

Sets the current locale which should be used when parsing metadata.

#### Parameters

dpool | An instance of AsDataPool. |
locale | the locale. |

### as_data_pool_update ()

    gboolean
    as_data_pool_update (AsDataPool *dpool,
                         GError **error);

Builds an index of all found components in the watched locations. The function will try to get as much data into the pool as possible, so even if the updates completes with `FALSE`, it might still add components to the pool.

#### Parameters

dpool | An instance of AsDataPool. |
error | A GError or `NULL`. |

#### Returns

`TRUE` if update completed without error.

### as_data_pool_get_components ()

    GList *
    as_data_pool_get_components (AsDataPool *dpool);

Get a list of found components.

#### Parameters

dpool | An instance of AsDataPool. |

#### Returns

a list of AsComponent instances, free with `g_list_free()`.

[element-type AsComponent][transfer container]

### as_data_pool_get_component_by_id ()

    AsComponent *
    as_data_pool_get_component_by_id (AsDataPool *dpool,
                                      const gchar *id);

Get a specific component by its ID.

#### Parameters

dpool | An instance of AsDataPool. |
id | The AppStream-ID to look for. |

#### Returns

An AsComponent.

[transfer full]

### as_data_pool_get_metadata_locations ()

    GPtrArray *
    as_data_pool_get_metadata_locations (AsDataPool *dpool);

Return a list of all locations which are searched for metadata.

#### Parameters

dpool | An instance of AsDataPool. |

#### Returns

A string-list of watched (absolute) filepaths.

[transfer none][element-type utf8]

### as_data_pool_set_metadata_locations ()

    void
    as_data_pool_set_metadata_locations (AsDataPool *dpool,
                                         gchar **dirs);

Set locations for the data pool to read it's data from. This is mainly used for testing purposes. Each location should have an "xmls" and/or "yaml" subdirectory with the actual data as (compressed) AppStream XML or DEP-11 YAML in it.

#### Parameters

dpool | An instance of AsDataPool. |
dirs | a zero-terminated array of data input directories. | [array zero-terminated=1]

## Types and Values

### AS_TYPE_DATA_POOL

    #define AS_TYPE_DATA_POOL (as_data_pool_get_type ())

### struct AsDataPoolClass

    struct AsDataPoolClass {
    	GObjectClass parent_class;
    };

### enum AsDataPoolError

A metadata pool error.

#### Members

AS_DATA_POOL_ERROR_FAILED | Generic failure |

### AS_DATA_POOL_ERROR

    #define AS_DATA_POOL_ERROR as_data_pool_error_quark ()

### AsDataPool

    typedef struct _AsDataPool AsDataPool;