<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
  <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
]>
<refentry id="AsDataPool">
<refmeta>
<refentrytitle role="top_of_page" id="AsDataPool.top_of_page">AsDataPool</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>APPSTREAM Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>AsDataPool</refname>
<refpurpose>Collect and temporarily store metadata from different sources</refpurpose>
</refnamediv>

<refsect1 id="AsDataPool.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="AS-TYPE-DATA-POOL:CAPS">AS_TYPE_DATA_POOL</link></entry></row>
<row><entry role="function_type"><link linkend="GQuark"><returnvalue>GQuark</returnvalue></link>
</entry><entry role="function_name"><link linkend="as-data-pool-error-quark">as_data_pool_error_quark</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="AsDataPool"><returnvalue>AsDataPool</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="as-data-pool-new">as_data_pool_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="as-data-pool-get-locale">as_data_pool_get_locale</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="as-data-pool-set-locale">as_data_pool_set_locale</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="as-data-pool-update">as_data_pool_update</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="as-data-pool-get-components">as_data_pool_get_components</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="AsComponent"><returnvalue>AsComponent</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="as-data-pool-get-component-by-id">as_data_pool_get_component_by_id</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GPtrArray"><returnvalue>GPtrArray</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="as-data-pool-get-metadata-locations">as_data_pool_get_metadata_locations</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="as-data-pool-set-metadata-locations">as_data_pool_set_metadata_locations</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="AsDataPool.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="name" colwidth="150px"/>
<colspec colname="description"/>
<tbody>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="AsDataPoolClass">AsDataPoolClass</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="AsDataPoolError">AsDataPoolError</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="AS-DATA-POOL-ERROR:CAPS">AS_DATA_POOL_ERROR</link></entry></row>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="AsDataPool-struct">AsDataPool</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="AsDataPool.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> AsDataPool
</screen>
</refsect1>


<refsect1 id="AsDataPool.description" role="desc">
<title role="desc.title">Description</title>
<para>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 <link linkend="AsDatabase"><type>AsDatabase</type></link> instance.
This class is used by internally by the cache builder, but might be useful for others.</para>
<para>See also: <link linkend="AsDatabase"><type>AsDatabase</type></link></para>

</refsect1>
<refsect1 id="AsDataPool.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="AS-TYPE-DATA-POOL:CAPS" role="macro">
<title>AS_TYPE_DATA_POOL</title>
<indexterm zone="AS-TYPE-DATA-POOL:CAPS"><primary>AS_TYPE_DATA_POOL</primary></indexterm>
<programlisting language="C">#define AS_TYPE_DATA_POOL (as_data_pool_get_type ())
</programlisting>
<para>
</para>
</refsect2>
<refsect2 id="as-data-pool-error-quark" role="function">
<title>as_data_pool_error_quark&#160;()</title>
<indexterm zone="as-data-pool-error-quark"><primary>as_data_pool_error_quark</primary></indexterm>
<programlisting language="C"><link linkend="GQuark"><returnvalue>GQuark</returnvalue></link>
as_data_pool_error_quark (<parameter><type>void</type></parameter>);</programlisting>
<refsect3 role="returns">
<title>Returns</title>
<para> An error quark.</para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-new" role="function">
<title>as_data_pool_new&#160;()</title>
<indexterm zone="as-data-pool-new"><primary>as_data_pool_new</primary></indexterm>
<programlisting language="C"><link linkend="AsDataPool"><returnvalue>AsDataPool</returnvalue></link>&#160;*
as_data_pool_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para>
<refsect3 role="returns">
<title>Returns</title>
<para> a <link linkend="AsDataPool"><type>AsDataPool</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-get-locale" role="function">
<title>as_data_pool_get_locale&#160;()</title>
<indexterm zone="as-data-pool-get-locale"><primary>as_data_pool_get_locale</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
as_data_pool_get_locale (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>);</programlisting>
<para>Gets the currently used locale.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> Locale used for metadata parsing.</para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-set-locale" role="function">
<title>as_data_pool_set_locale&#160;()</title>
<indexterm zone="as-data-pool-set-locale"><primary>as_data_pool_set_locale</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
as_data_pool_set_locale (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>,
                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *locale</parameter>);</programlisting>
<para>Sets the current locale which should be used when parsing metadata.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>locale</para></entry>
<entry role="parameter_description"><para>the locale.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="as-data-pool-update" role="function">
<title>as_data_pool_update&#160;()</title>
<indexterm zone="as-data-pool-update"><primary>as_data_pool_update</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
as_data_pool_update (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>,
                     <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>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 <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>, it might still add components to the pool.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>A <link linkend="GError"><type>GError</type></link> or <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if update completed without error.</para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-get-components" role="function">
<title>as_data_pool_get_components&#160;()</title>
<indexterm zone="as-data-pool-get-components"><primary>as_data_pool_get_components</primary></indexterm>
<programlisting language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
as_data_pool_get_components (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>);</programlisting>
<para>Get a list of found components.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> a list of <link linkend="AsComponent"><type>AsComponent</type></link> instances, free with <link linkend="g-list-free"><function>g_list_free()</function></link>. </para>
<para><emphasis role="annotation">[<acronym>element-type</acronym> AsComponent][<acronym>transfer container</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-get-component-by-id" role="function">
<title>as_data_pool_get_component_by_id&#160;()</title>
<indexterm zone="as-data-pool-get-component-by-id"><primary>as_data_pool_get_component_by_id</primary></indexterm>
<programlisting language="C"><link linkend="AsComponent"><returnvalue>AsComponent</returnvalue></link>&#160;*
as_data_pool_get_component_by_id (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>,
                                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *id</parameter>);</programlisting>
<para>Get a specific component by its ID.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>id</para></entry>
<entry role="parameter_description"><para>The AppStream-ID to look for.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> An <link linkend="AsComponent"><type>AsComponent</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-get-metadata-locations" role="function">
<title>as_data_pool_get_metadata_locations&#160;()</title>
<indexterm zone="as-data-pool-get-metadata-locations"><primary>as_data_pool_get_metadata_locations</primary></indexterm>
<programlisting language="C"><link linkend="GPtrArray"><returnvalue>GPtrArray</returnvalue></link>&#160;*
as_data_pool_get_metadata_locations (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>);</programlisting>
<para>Return a list of all locations which are searched for metadata.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 role="returns">
<title>Returns</title>
<para> A string-list of watched (absolute) filepaths. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="as-data-pool-set-metadata-locations" role="function">
<title>as_data_pool_set_metadata_locations&#160;()</title>
<indexterm zone="as-data-pool-set-metadata-locations"><primary>as_data_pool_set_metadata_locations</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
as_data_pool_set_metadata_locations (<parameter><link linkend="AsDataPool"><type>AsDataPool</type></link> *dpool</parameter>,
                                     <parameter><link linkend="gchar"><type>gchar</type></link> **dirs</parameter>);</programlisting>
<para>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.</para>
<refsect3 role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dpool</para></entry>
<entry role="parameter_description"><para>An instance of <link linkend="AsDataPool"><type>AsDataPool</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>dirs</para></entry>
<entry role="parameter_description"><para> a zero-terminated array of data input directories. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>array</acronym> zero-terminated=1]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="AsDataPool.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="AsDataPoolClass" role="struct">
<title>struct AsDataPoolClass</title>
<indexterm zone="AsDataPoolClass"><primary>AsDataPoolClass</primary></indexterm>
<programlisting language="C">struct AsDataPoolClass {
	GObjectClass parent_class;
};
</programlisting>
<para>
</para>
</refsect2>
<refsect2 id="AsDataPoolError" role="enum">
<title>enum AsDataPoolError</title>
<indexterm zone="AsDataPoolError"><primary>AsDataPoolError</primary></indexterm>
<para>A metadata pool error.</para>
<refsect3 role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="AS-DATA-POOL-ERROR-FAILED:CAPS">AS_DATA_POOL_ERROR_FAILED</para></entry>
<entry role="enum_member_description"><para>Generic failure</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="AS-DATA-POOL-ERROR:CAPS" role="macro">
<title>AS_DATA_POOL_ERROR</title>
<indexterm zone="AS-DATA-POOL-ERROR:CAPS"><primary>AS_DATA_POOL_ERROR</primary></indexterm>
<programlisting language="C">#define AS_DATA_POOL_ERROR&#160;as_data_pool_error_quark ()
</programlisting>
<para>
</para>
</refsect2>
<refsect2 id="AsDataPool-struct" role="struct">
<title>AsDataPool</title>
<indexterm zone="AsDataPool-struct"><primary>AsDataPool</primary></indexterm>
<programlisting language="C">typedef struct _AsDataPool AsDataPool;</programlisting>
<para>
</para>
</refsect2>

</refsect1>

</refentry>
