createrepo_c library
0.9.1
C library for metadata manipulation
|
Typedefs | |
typedef struct _cr_Metadata | cr_Metadata |
Enumerations | |
enum | cr_HashTableKey { CR_HT_KEY_DEFAULT, CR_HT_KEY_HASH = CR_HT_KEY_DEFAULT, CR_HT_KEY_NAME, CR_HT_KEY_FILENAME, CR_HT_KEY_SENTINEL } |
enum | cr_HashTableKeyDupAction { CR_HT_DUPACT_KEEPFIRST = 0, CR_HT_DUPACT_REMOVEALL, CR_HT_DUPACT_SENTINEL } |
Functions | |
cr_HashTableKey | cr_metadata_key (cr_Metadata *md) |
GHashTable * | cr_metadata_hashtable (cr_Metadata *md) |
cr_Metadata * | cr_metadata_new (cr_HashTableKey key, int use_single_chunk, GSList *pkglist) |
gboolean | cr_metadata_set_dupaction (cr_Metadata *md, cr_HashTableKeyDupAction dupaction) |
void | cr_metadata_free (cr_Metadata *md) |
int | cr_metadata_load_xml (cr_Metadata *md, struct cr_MetadataLocation *ml, GError **err) |
int | cr_metadata_locate_and_load_xml (cr_Metadata *md, const char *repopath, GError **err) |
Module for loading yum xml metadata.
Example:
typedef struct _cr_Metadata cr_Metadata |
Metadata object
Definition at line 85 of file load_metadata.h.
enum cr_HashTableKey |
Package attribute used as key in the hashtable.
Enumerator | |
---|---|
CR_HT_KEY_DEFAULT |
default = pkg hash |
CR_HT_KEY_HASH |
pkg hash (cr_Package ->pkgId) |
CR_HT_KEY_NAME |
pkg name (cr_Package ->name) |
CR_HT_KEY_FILENAME |
pkg filename (cr_Package ->location_href) |
CR_HT_KEY_SENTINEL |
last element, terminator, .. |
Definition at line 59 of file load_metadata.h.
Internally, and by default, the loaded metadata are indexed by pkgId (pkg's hash). But when you select different attribute for indexing (see cr_HashTableKey). The situation that multiple packages has the same (key) attribute. This enum lists provided methos for resolution of such conflicts.
Enumerator | |
---|---|
CR_HT_DUPACT_KEEPFIRST |
First encontered item wins, other will be removed - Default |
CR_HT_DUPACT_REMOVEALL |
Remove all conflicting items. |
CR_HT_DUPACT_SENTINEL |
Last element, terminator, ... |
Definition at line 74 of file load_metadata.h.
void cr_metadata_free | ( | cr_Metadata * | md | ) |
Destroy metadata.
md | cr_Metadata object |
GHashTable* cr_metadata_hashtable | ( | cr_Metadata * | md | ) |
Return hashtable from a cr_Metadata
md | cr_Metadata object. |
cr_HashTableKey cr_metadata_key | ( | cr_Metadata * | md | ) |
Return cr_HashTableKey from a cr_Metadata
md | cr_Metadata object. |
int cr_metadata_load_xml | ( | cr_Metadata * | md, |
struct cr_MetadataLocation * | ml, | ||
GError ** | err | ||
) |
Load metadata from the specified location.
md | metadata object |
ml | metadata location |
err | GError ** |
int cr_metadata_locate_and_load_xml | ( | cr_Metadata * | md, |
const char * | repopath, | ||
GError ** | err | ||
) |
Locate and load metadata from the specified path.
md | metadata object |
repopath | path to repo (to directory with repodata/ subdir) |
err | GError ** |
cr_Metadata* cr_metadata_new | ( | cr_HashTableKey | key, |
int | use_single_chunk, | ||
GSList * | pkglist | ||
) |
Create new (empty) metadata hashtable. It is NOT thread safe to load data into single cr_Metadata from multiple threads. But non modifying access to the loaded data in cr_Metadata is thread safe.
key | key specifies which value will be (is) used as key in hash table |
use_single_chunk | use only one string chunk (all loaded packages share one string chunk in the cr_Metadata object) Packages will not be standalone objects. This option leads to less memory consumption. |
pkglist | load only packages which base filename is in this list. If param is NULL all packages are loaded. |
gboolean cr_metadata_set_dupaction | ( | cr_Metadata * | md, |
cr_HashTableKeyDupAction | dupaction | ||
) |
Set action how to deal with duplicated items.