<refentry id="camel-CamelKeyTable">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelKeyTable.top_of_page">CamelKeyTable</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelKeyTable</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="camel-CamelKeyTable.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
typedef             <link linkend="camel-hash-t">camel_hash_t</link>;
                    <link linkend="CamelPartitionKey">CamelPartitionKey</link>;
                    <link linkend="CamelPartitionKeyBlock">CamelPartitionKeyBlock</link>;
                    <link linkend="CamelPartitionMap">CamelPartitionMap</link>;
                    <link linkend="CamelPartitionMapBlock">CamelPartitionMapBlock</link>;
                    <link linkend="CamelPartitionTable">CamelPartitionTable</link>;
<link linkend="CamelPartitionTable">CamelPartitionTable</link>* <link linkend="camel-partition-table-new">camel_partition_table_new</link>          (<link linkend="struct--CamelBlockFile">struct _CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> root);
<link linkend="int">int</link>                 <link linkend="camel-partition-table-sync">camel_partition_table_sync</link>          (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi);
<link linkend="int">int</link>                 <link linkend="camel-partition-table-add">camel_partition_table_add</link>           (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid);
<link linkend="camel-key-t">camel_key_t</link>         <link linkend="camel-partition-table-lookup">camel_partition_table_lookup</link>        (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi,
                                                         const <link linkend="char">char</link> *key);
<link linkend="void">void</link>                <link linkend="camel-partition-table-remove">camel_partition_table_remove</link>        (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi,
                                                         const <link linkend="char">char</link> *key);
                    <link linkend="CamelKeyBlock">CamelKeyBlock</link>;
                    <link linkend="CamelKeyRootBlock">CamelKeyRootBlock</link>;
struct              <link linkend="CamelKeyKey">CamelKeyKey</link>;
#define             <link linkend="CAMEL-KEY-TABLE-MAX-KEY:CAPS">CAMEL_KEY_TABLE_MAX_KEY</link>
                    <link linkend="CamelKeyTable">CamelKeyTable</link>;
<link linkend="CamelKeyTable">CamelKeyTable</link>*      <link linkend="camel-key-table-new">camel_key_table_new</link>                 (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> root);
<link linkend="int">int</link>                 <link linkend="camel-key-table-sync">camel_key_table_sync</link>                (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki);
<link linkend="camel-key-t">camel_key_t</link>         <link linkend="camel-key-table-add">camel_key_table_add</link>                 (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="camel-block-t">camel_block_t</link> data,
                                                         unsigned <link linkend="int">int</link> flags);
<link linkend="void">void</link>                <link linkend="camel-key-table-set-data">camel_key_table_set_data</link>            (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid,
                                                         <link linkend="camel-block-t">camel_block_t</link> data);
<link linkend="void">void</link>                <link linkend="camel-key-table-set-flags">camel_key_table_set_flags</link>           (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid,
                                                         unsigned <link linkend="int">int</link> flags,
                                                         unsigned <link linkend="int">int</link> set);
<link linkend="camel-block-t">camel_block_t</link>       <link linkend="camel-key-table-lookup">camel_key_table_lookup</link>              (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid,
                                                         <link linkend="char">char</link> **key,
                                                         unsigned <link linkend="int">int</link> *flags);
<link linkend="camel-key-t">camel_key_t</link>         <link linkend="camel-key-table-next">camel_key_table_next</link>                (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> next,
                                                         <link linkend="char">char</link> **keyp,
                                                         unsigned <link linkend="int">int</link> *flagsp,
                                                         <link linkend="camel-block-t">camel_block_t</link> *datap);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelKeyTable.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="camel-CamelKeyTable.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="camel-hash-t" role="typedef">
<title>camel_hash_t</title>
<indexterm zone="camel-hash-t"><primary>camel_hash_t</primary></indexterm><programlisting>typedef guint32 camel_hash_t;	/* a hashed key */
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelPartitionKey" role="struct">
<title>CamelPartitionKey</title>
<indexterm zone="CamelPartitionKey"><primary>CamelPartitionKey</primary></indexterm><programlisting>typedef struct {
	camel_hash_t hashid;
	camel_key_t keyid;
} CamelPartitionKey;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelPartitionKeyBlock" role="struct">
<title>CamelPartitionKeyBlock</title>
<indexterm zone="CamelPartitionKeyBlock"><primary>CamelPartitionKeyBlock</primary></indexterm><programlisting>typedef struct {
	guint32 used;
	struct _CamelPartitionKey keys[(CAMEL_BLOCK_SIZE-4)/sizeof(struct _CamelPartitionKey)];
} CamelPartitionKeyBlock;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelPartitionMap" role="struct">
<title>CamelPartitionMap</title>
<indexterm zone="CamelPartitionMap"><primary>CamelPartitionMap</primary></indexterm><programlisting>typedef struct {
	camel_hash_t hashid;
	camel_block_t blockid;
} CamelPartitionMap;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelPartitionMapBlock" role="struct">
<title>CamelPartitionMapBlock</title>
<indexterm zone="CamelPartitionMapBlock"><primary>CamelPartitionMapBlock</primary></indexterm><programlisting>typedef struct {
	camel_block_t next;
	guint32 used;
	struct _CamelPartitionMap partition[(CAMEL_BLOCK_SIZE-8)/sizeof(struct _CamelPartitionMap)];
} CamelPartitionMapBlock;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelPartitionTable" role="struct">
<title>CamelPartitionTable</title>
<indexterm zone="CamelPartitionTable"><primary>CamelPartitionTable</primary></indexterm><programlisting>typedef struct {
	CamelObject parent;

	struct _CamelPartitionTablePrivate *priv;

	CamelBlockFile *blocks;
	camel_block_t rootid;

	int (*is_key)(CamelPartitionTable *cpi, const char *key, camel_key_t keyid, void *data);
	void *is_key_data;

	/* we keep a list of partition blocks active at all times */
	EDList partition;
} CamelPartitionTable;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-partition-table-new" role="function">
<title>camel_partition_table_new ()</title>
<indexterm zone="camel-partition-table-new"><primary>camel_partition_table_new</primary></indexterm><programlisting><link linkend="CamelPartitionTable">CamelPartitionTable</link>* camel_partition_table_new          (<link linkend="struct--CamelBlockFile">struct _CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> root);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>root</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-partition-table-sync" role="function">
<title>camel_partition_table_sync ()</title>
<indexterm zone="camel-partition-table-sync"><primary>camel_partition_table_sync</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_partition_table_sync          (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cpi</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-partition-table-add" role="function">
<title>camel_partition_table_add ()</title>
<indexterm zone="camel-partition-table-add"><primary>camel_partition_table_add</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_partition_table_add           (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cpi</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>keyid</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-partition-table-lookup" role="function">
<title>camel_partition_table_lookup ()</title>
<indexterm zone="camel-partition-table-lookup"><primary>camel_partition_table_lookup</primary></indexterm><programlisting><link linkend="camel-key-t">camel_key_t</link>         camel_partition_table_lookup        (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi,
                                                         const <link linkend="char">char</link> *key);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cpi</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-partition-table-remove" role="function">
<title>camel_partition_table_remove ()</title>
<indexterm zone="camel-partition-table-remove"><primary>camel_partition_table_remove</primary></indexterm><programlisting><link linkend="void">void</link>                camel_partition_table_remove        (<link linkend="CamelPartitionTable">CamelPartitionTable</link> *cpi,
                                                         const <link linkend="char">char</link> *key);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>cpi</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="CamelKeyBlock" role="struct">
<title>CamelKeyBlock</title>
<indexterm zone="CamelKeyBlock"><primary>CamelKeyBlock</primary></indexterm><programlisting>typedef struct {
	camel_block_t next;
	guint32 used;
	union {
		struct _CamelKeyKey keys[(CAMEL_BLOCK_SIZE-8)/sizeof(struct _CamelKeyKey)];
		char keydata[CAMEL_BLOCK_SIZE-8];
	} u;
} CamelKeyBlock;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelKeyRootBlock" role="struct">
<title>CamelKeyRootBlock</title>
<indexterm zone="CamelKeyRootBlock"><primary>CamelKeyRootBlock</primary></indexterm><programlisting>typedef struct {
	camel_block_t first;
	camel_block_t last;
	camel_key_t free;	/* free list */
} CamelKeyRootBlock;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelKeyKey" role="struct">
<title>struct CamelKeyKey</title>
<indexterm zone="CamelKeyKey"><primary>CamelKeyKey</primary></indexterm><programlisting>struct CamelKeyKey {
	camel_block_t data;
	unsigned int offset:10;
	unsigned int flags:22;
};
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CAMEL-KEY-TABLE-MAX-KEY:CAPS" role="macro">
<title>CAMEL_KEY_TABLE_MAX_KEY</title>
<indexterm zone="CAMEL-KEY-TABLE-MAX-KEY:CAPS"><primary>CAMEL_KEY_TABLE_MAX_KEY</primary></indexterm><programlisting>#define CAMEL_KEY_TABLE_MAX_KEY (128) /* max size of any key */
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelKeyTable" role="struct">
<title>CamelKeyTable</title>
<indexterm zone="CamelKeyTable"><primary>CamelKeyTable</primary></indexterm><programlisting>typedef struct {
	CamelObject parent;

	struct _CamelKeyTablePrivate *priv;

	CamelBlockFile *blocks;

	camel_block_t rootid;

	CamelKeyRootBlock *root;
	CamelBlock *root_block;
} CamelKeyTable;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="camel-key-table-new" role="function">
<title>camel_key_table_new ()</title>
<indexterm zone="camel-key-table-new"><primary>camel_key_table_new</primary></indexterm><programlisting><link linkend="CamelKeyTable">CamelKeyTable</link>*      camel_key_table_new                 (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> root);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>root</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-table-sync" role="function">
<title>camel_key_table_sync ()</title>
<indexterm zone="camel-key-table-sync"><primary>camel_key_table_sync</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_key_table_sync                (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ki</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-table-add" role="function">
<title>camel_key_table_add ()</title>
<indexterm zone="camel-key-table-add"><primary>camel_key_table_add</primary></indexterm><programlisting><link linkend="camel-key-t">camel_key_t</link>         camel_key_table_add                 (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="camel-block-t">camel_block_t</link> data,
                                                         unsigned <link linkend="int">int</link> flags);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ki</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-table-set-data" role="function">
<title>camel_key_table_set_data ()</title>
<indexterm zone="camel-key-table-set-data"><primary>camel_key_table_set_data</primary></indexterm><programlisting><link linkend="void">void</link>                camel_key_table_set_data            (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid,
                                                         <link linkend="camel-block-t">camel_block_t</link> data);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ki</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>keyid</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-table-set-flags" role="function">
<title>camel_key_table_set_flags ()</title>
<indexterm zone="camel-key-table-set-flags"><primary>camel_key_table_set_flags</primary></indexterm><programlisting><link linkend="void">void</link>                camel_key_table_set_flags           (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid,
                                                         unsigned <link linkend="int">int</link> flags,
                                                         unsigned <link linkend="int">int</link> set);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ki</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>keyid</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>set</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-table-lookup" role="function">
<title>camel_key_table_lookup ()</title>
<indexterm zone="camel-key-table-lookup"><primary>camel_key_table_lookup</primary></indexterm><programlisting><link linkend="camel-block-t">camel_block_t</link>       camel_key_table_lookup              (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> keyid,
                                                         <link linkend="char">char</link> **key,
                                                         unsigned <link linkend="int">int</link> *flags);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ki</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>keyid</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-table-next" role="function">
<title>camel_key_table_next ()</title>
<indexterm zone="camel-key-table-next"><primary>camel_key_table_next</primary></indexterm><programlisting><link linkend="camel-key-t">camel_key_t</link>         camel_key_table_next                (<link linkend="CamelKeyTable">CamelKeyTable</link> *ki,
                                                         <link linkend="camel-key-t">camel_key_t</link> next,
                                                         <link linkend="char">char</link> **keyp,
                                                         unsigned <link linkend="int">int</link> *flagsp,
                                                         <link linkend="camel-block-t">camel_block_t</link> *datap);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ki</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>next</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>keyp</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flagsp</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>datap</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
