Top | ![]() |
![]() |
![]() |
![]() |
#define | AS_TYPE_DATA_POOL |
struct | AsDataPoolClass |
enum | AsCacheFlags |
enum | AsDataPoolError |
#define | AS_DATA_POOL_ERROR |
AsDataPool |
This class loads AppStream metadata from various sources and refines it with existing knowledge about the system (e.g. by setting absolute pazhs for cached icons). An AsDataPool will use an on-disk cache to store metadata is has read and refined to speed up the loading time when the same data is requested a second time.
You can find AppStream metadata matching farious criteria, and also add new metadata to the pool. The caching behavior can be controlled by the application using AsDataPool.
An AppStream cache object can also be created and read using the appstreamcli(1) utility.
See also: AsComponent
const gchar *
as_data_pool_get_locale (AsDataPool *dpool
);
Gets the currently used locale.
void as_data_pool_set_locale (AsDataPool *dpool
,const gchar *locale
);
Sets the current locale which should be used when parsing metadata.
gboolean as_data_pool_load (AsDataPool *dpool
,GCancellable *cancellable
,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 update completes with FALSE
, it might still have added components to the pool.
The function will load from all possible data sources, preferring caches if they are up to date.
gboolean
as_data_pool_load_metadata (AsDataPool *dpool
);
Load fresh metadata from AppStream directories.
gboolean as_data_pool_load_cache_file (AsDataPool *dpool
,const gchar *fname
,GError **error
);
Load AppStream metadata from a cache file.
dpool |
An instance of AsDataPool. |
|
fname |
Filename of the cache file to load into the pool. |
|
error |
gboolean as_data_pool_save_cache_file (AsDataPool *dpool
,const gchar *fname
,GError **error
);
Serialize AppStream metadata to a cache file.
dpool |
An instance of AsDataPool. |
|
fname |
Filename of the cache file the pool contents should be dumped to. |
|
error |
void
as_data_pool_clear (AsDataPool *dpool
);
Remove all metadat from the pool.
gboolean as_data_pool_add_component (AsDataPool *dpool
,AsComponent *cpt
,GError **error
);
Register a new component in the AppStream metadata pool.
GPtrArray *
as_data_pool_get_components (AsDataPool *dpool
);
Get a list of found components.
AsComponent * as_data_pool_get_component_by_id (AsDataPool *dpool
,const gchar *id
);
Get a specific component by its ID.
GPtrArray * as_data_pool_get_components_by_provided_item (AsDataPool *dpool
,AsProvidedKind kind
,const gchar *item
,GError **error
);
Find components in the AppStream data pool whcih provide a certain item.
dpool |
An instance of AsDataPool. |
|
kind |
An AsProvidesKind |
|
item |
The value of the provided item. |
|
error |
an array of AsComponent objects which have been found.
[element-type AsComponent][transfer full]
GPtrArray * as_data_pool_get_components_by_kind (AsDataPool *dpool
,AsComponentKind kind
,GError **error
);
Return a list of all components in the pool which are of a certain kind.
an array of AsComponent objects which have been found.
[element-type AsComponent][transfer full]
GPtrArray * as_data_pool_get_components_by_categories (AsDataPool *dpool
,const gchar *categories
);
Return a list of components which are in one of the categories.
dpool |
An instance of AsDatabase. |
|
categories |
A semicolon-separated list of XDG categories to include. |
an array of AsComponent objects which have been found.
[element-type AsComponent][transfer full]
GPtrArray * as_data_pool_search (AsDataPool *dpool
,const gchar *search
);
Search for a list of components matching the search terms. The list will be unordered.
Since: 0.9.7
GPtrArray *
as_data_pool_get_metadata_locations (AsDataPool *dpool
);
Return a list of all locations which are searched for metadata.
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.
dpool |
An instance of AsDataPool. |
|
dirs |
a zero-terminated array of data input directories. |
[array zero-terminated=1] |
AsCacheFlags
as_data_pool_get_cache_flags (AsDataPool *dpool
);
Get the AsCacheFlags for this data pool.
void as_data_pool_set_cache_flags (AsDataPool *dpool
,AsCacheFlags flags
);
Set the AsCacheFlags for this data pool.
gboolean as_data_pool_refresh_cache (AsDataPool *dpool
,gboolean force
,GError **error
);
Update the AppStream cache. There is normally no need to call this function manually, because cache updates are handled transparently in the background.
dpool |
An instance of AsDataPool. |
|
force |
Enforce refresh, even if source data has not changed. |
time_t
as_data_pool_get_cache_age (AsDataPool *dpool
);
Get the age of our internal cache.
gboolean as_data_pool_update (AsDataPool *dpool
,GError **error
);
as_data_pool_update
is deprecated and should not be used in newly-written code.
A metadata pool error.