AsDatabase

AsDatabase — Read-only access to the AppStream component database

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── AsDatabase

Includes

#include <appstream.h>

Description

This object provides access to the Appstream Xapian database of available software components. You can search for components using various criteria, as well as getting some information about the data provided by this AppStream database.

By default, the global software component cache is used as datasource, unless a different database is explicitly defined via as_database_set_location().

A new cache can be created using the appstreamcli(1) utility.

See also: AsComponent, AsDataPool

Functions

as_database_new ()

AsDatabase *
as_database_new (void);

as_database_new is deprecated and should not be used in newly-written code.

Creates a new AsDatabase.

Returns

a AsDatabase.

[transfer full]


as_database_error_quark ()

GQuark
as_database_error_quark (void);

Returns

An error quark.


as_database_open ()

gboolean
as_database_open (AsDatabase *db,
                  GError **error);

as_database_open is deprecated and should not be used in newly-written code.

Open the current AppStream metadata cache for reading.

Parameters

db

An instance of AsDatabase.

 

error

A GError or NULL.

 

Returns

TRUE on success, FALSE on error.


as_database_get_location ()

const gchar *
as_database_get_location (AsDatabase *db);

as_database_get_location is deprecated and should not be used in newly-written code.

Get the current path of the AppStream database we use.

Parameters

db

An instance of AsDatabase.

 

as_database_set_location ()

void
as_database_set_location (AsDatabase *db,
                          const gchar *dir);

as_database_set_location is deprecated and should not be used in newly-written code.

Set the location of the AppStream database we use.

Parameters

db

An instance of AsDatabase.

 

dir

The directory of the Xapian database.

 

as_database_find_components ()

GPtrArray *
as_database_find_components (AsDatabase *db,
                             const gchar *term,
                             const gchar *cats_str,
                             GError **error);

as_database_find_components is deprecated and should not be used in newly-written code.

Find components in the AppStream database, which match a given term. You can limit the search to a specific set of categories by setting the categories string to a semicolon-separated list of lower-cased category names.

Parameters

db

An instance of AsDatabase.

 

term

a search-term to look for.

[nullable]

cats_str

A semicolon-delimited list of lower-cased category names, e.g. "science;development".

[nullable]

error

A GError or NULL.

 

Returns

an array of AsComponent objects which have been found.

[element-type AsComponent][transfer full]


as_database_get_all_components ()

GPtrArray *
as_database_get_all_components (AsDatabase *db,
                                GError **error);

as_database_get_all_components is deprecated and should not be used in newly-written code.

Dump a list of all software components found in the database.

Parameters

db

An instance of AsDatabase.

 

error

A GError or NULL.

 

Returns

an array of AsComponent objects.

[element-type AsComponent][transfer full]


as_database_get_component_by_id ()

AsComponent *
as_database_get_component_by_id (AsDatabase *db,
                                 const gchar *cid,
                                 GError **error);

as_database_get_component_by_id is deprecated and should not be used in newly-written code.

Get a component by its AppStream-ID.

Parameters

db

An instance of AsDatabase.

 

cid

the ID of the component, e.g. "org.kde.gwenview.desktop"

 

error

A GError or NULL.

 

Returns

an AsComponent or NULL if none was found.

[transfer full]


as_database_get_components_by_provided_item ()

GPtrArray *
as_database_get_components_by_provided_item
                               (AsDatabase *db,
                                AsProvidedKind kind,
                                const gchar *item,
                                GError **error);

as_database_get_components_by_provided_item is deprecated and should not be used in newly-written code.

Find components in the Appstream database.

Parameters

db

An instance of AsDatabase.

 

kind

an AsProvidesKind

 

item

the name of the provided item.

 

error

A GError or NULL.

 

Returns

an array of AsComponent objects which have been found, NULL on error.

[element-type AsComponent][transfer full]


as_database_get_components_by_kind ()

GPtrArray *
as_database_get_components_by_kind (AsDatabase *db,
                                    AsComponentKind kind,
                                    GError **error);

as_database_get_components_by_kind is deprecated and should not be used in newly-written code.

Return a list of all components in the database which match a certain kind.

Parameters

db

An instance of AsDatabase.

 

kind

an AsComponentKind.

 

error

A GError or NULL.

 

Returns

an array of AsComponent objects which have been found, NULL on error.

[element-type AsComponent][transfer full]

Types and Values

AS_TYPE_DATABASE

#define AS_TYPE_DATABASE (as_database_get_type ())


struct AsDatabaseClass

struct AsDatabaseClass {
	GObjectClass parent_class;
};


enum AsDatabaseError

AsDatabaseError is deprecated and should not be used in newly-written code.

A database query error.

Members

AS_DATABASE_ERROR_FAILED

Generic failure

 

AS_DATABASE_ERROR_MISSING

Database was not found

 

AS_DATABASE_ERROR_CLOSED

Tried to perform action on a closed database.

 

AS_DATABASE_ERROR_TERM_INVALID

A query term was invalid.

 

AS_DATABASE_ERROR

#define AS_DATABASE_ERROR as_database_error_quark ()


AsDatabase

typedef struct _AsDatabase AsDatabase;