ZifMd

ZifMd — Metadata file common functionality

Synopsis

#define             ZIF_MD_ERROR
                    ZifMd;
                    ZifMdPrivate;
                    ZifMdClass;
enum                ZifMdType;
enum                ZifMdError;
GQuark              zif_md_error_quark                  (void);
ZifMd *             zif_md_new                          (void);
void                zif_md_set_mdtype                   (ZifMd *md,
                                                         ZifMdType type);
void                zif_md_set_store_remote             (ZifMd *md,
                                                         ZifStoreRemote *remote);
ZifStoreRemote *    zif_md_get_store_remote             (ZifMd *md);
void                zif_md_set_id                       (ZifMd *md,
                                                         const gchar *id);
void                zif_md_set_filename                 (ZifMd *md,
                                                         const gchar *filename);
void                zif_md_set_timestamp                (ZifMd *md,
                                                         guint timestamp);
void                zif_md_set_location                 (ZifMd *md,
                                                         const gchar *location);
void                zif_md_set_checksum                 (ZifMd *md,
                                                         const gchar *checksum);
void                zif_md_set_checksum_uncompressed    (ZifMd *md,
                                                         const gchar *checksum_uncompressed);
void                zif_md_set_checksum_type            (ZifMd *md,
                                                         GChecksumType checksum_type);
const gchar *       zif_md_type_to_text                 (ZifMdType type);
const gchar *       zif_md_get_id                       (ZifMd *md);
ZifMdType           zif_md_get_mdtype                   (ZifMd *md);
const gchar *       zif_md_get_filename                 (ZifMd *md);
const gchar *       zif_md_get_filename_uncompressed    (ZifMd *md);
const gchar *       zif_md_get_location                 (ZifMd *md);
gboolean            zif_md_load                         (ZifMd *md,
                                                         ZifState *state,
                                                         GError **error);
gboolean            zif_md_unload                       (ZifMd *md,
                                                         ZifState *state,
                                                         GError **error);
gboolean            zif_md_clean                        (ZifMd *md,
                                                         GError **error);
gboolean            zif_md_file_check                   (ZifMd *md,
                                                         gboolean use_uncompressed,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_search_file                  (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_search_name                  (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_search_details               (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_search_group                 (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_search_pkgid                 (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_what_provides                (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_resolve                      (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_get_packages                 (ZifMd *md,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_find_package                 (ZifMd *md,
                                                         const gchar *package_id,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_get_changelog                (ZifMd *md,
                                                         const gchar *pkgid,
                                                         ZifState *state,
                                                         GError **error);
GPtrArray *         zif_md_get_files                    (ZifMd *md,
                                                         ZifPackage *package,
                                                         ZifState *state,
                                                         GError **error);

Object Hierarchy

  GObject
   +----ZifMd
         +----ZifMdComps
         +----ZifMdFilelistsSql
         +----ZifMdFilelistsXml
         +----ZifMdMetalink
         +----ZifMdMirrorlist
         +----ZifMdOtherSql
         +----ZifMdPrimarySql
         +----ZifMdPrimaryXml
         +----ZifMdUpdateinfo

Description

This provides an abstract metadata class. It is implemented by ZifMdFilelistsSql, ZifMdFilelistsXml, ZifMdPrimaryXml, ZifMdPrimarySql and many others.

Details

ZIF_MD_ERROR

#define ZIF_MD_ERROR		(zif_md_error_quark ())


ZifMd

typedef struct _ZifMd ZifMd;


ZifMdPrivate

typedef struct _ZifMdPrivate ZifMdPrivate;

Private ZifMd data


ZifMdClass

typedef struct {
	GObjectClass				 parent_class;
	/* vtable */
	gboolean	 (*load)		(ZifMd			*md,
						 ZifState		*state,
						 GError			**error);
	gboolean	 (*unload)		(ZifMd			*md,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*search_file)		(ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*search_name)		(ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*search_details) (ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*search_group) (ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*search_pkgid) (ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*what_provides) (ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*resolve)		(ZifMd			*md,
						 gchar			**search,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*get_packages) (ZifMd			*md,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*find_package) (ZifMd			*md,
						 const gchar		*package_id,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*get_changelog) (ZifMd			*md,
						 const gchar		*pkgid,
						 ZifState		*state,
						 GError			**error);
	GPtrArray *(*get_files)		(ZifMd			*md,
						 ZifPackage		*package,
						 ZifState		*state,
						 GError			**error);
} ZifMdClass;


enum ZifMdType

typedef enum {
	ZIF_MD_TYPE_PRIMARY_XML,
	ZIF_MD_TYPE_PRIMARY_SQL,
	ZIF_MD_TYPE_FILELISTS_XML,
	ZIF_MD_TYPE_FILELISTS_SQL,
	ZIF_MD_TYPE_OTHER_XML,
	ZIF_MD_TYPE_OTHER_SQL,
	ZIF_MD_TYPE_COMPS,
	ZIF_MD_TYPE_COMPS_GZ,
	ZIF_MD_TYPE_METALINK,
	ZIF_MD_TYPE_MIRRORLIST,
	ZIF_MD_TYPE_PRESTODELTA,
	ZIF_MD_TYPE_UPDATEINFO,
	ZIF_MD_TYPE_UNKNOWN
} ZifMdType;


enum ZifMdError

typedef enum {
	ZIF_MD_ERROR_FAILED,
	ZIF_MD_ERROR_NO_SUPPORT,
	ZIF_MD_ERROR_FAILED_TO_LOAD,
	ZIF_MD_ERROR_FAILED_AS_OFFLINE,
	ZIF_MD_ERROR_FAILED_DOWNLOAD,
	ZIF_MD_ERROR_BAD_SQL,
	ZIF_MD_ERROR_FILE_TOO_OLD,
	ZIF_MD_ERROR_NO_FILENAME,
	ZIF_MD_ERROR_LAST
} ZifMdError;


zif_md_error_quark ()

GQuark              zif_md_error_quark                  (void);

Returns :

Our personal error quark.

Since 0.1.0


zif_md_new ()

ZifMd *             zif_md_new                          (void);

Returns :

A new ZifMd class instance.

Since 0.1.0


zif_md_set_mdtype ()

void                zif_md_set_mdtype                   (ZifMd *md,
                                                         ZifMdType type);

Sets the type of the metadata, e.g. ZIF_MD_TYPE_FILELISTS_SQL.

md :

the ZifMd object

type :

the metadata type

Since 0.1.0


zif_md_set_store_remote ()

void                zif_md_set_store_remote             (ZifMd *md,
                                                         ZifStoreRemote *remote);

Sets the remote store for this metadata.

md :

the ZifMd object

remote :

the ZifStoreRemote that created this metadata object

Since 0.1.0


zif_md_get_store_remote ()

ZifStoreRemote *    zif_md_get_store_remote             (ZifMd *md);

Gets the remote store for this metadata.

md :

the ZifMd object

Returns :

A ZifStoreRemote or NULL for unset

Since 0.1.0


zif_md_set_id ()

void                zif_md_set_id                       (ZifMd *md,
                                                         const gchar *id);

Sets the repository ID for this metadata.

md :

the ZifMd object

id :

the repository id, e.g. "fedora"

Since 0.1.0


zif_md_set_filename ()

void                zif_md_set_filename                 (ZifMd *md,
                                                         const gchar *filename);

Sets the filename of the compressed file.

md :

the ZifMd object

filename :

the base filename, e.g. "master.xml.bz2"

Since 0.1.0


zif_md_set_timestamp ()

void                zif_md_set_timestamp                (ZifMd *md,
                                                         guint timestamp);

Sets the timestamp of the compressed file.

md :

the ZifMd object

timestamp :

the timestamp value

Since 0.1.0


zif_md_set_location ()

void                zif_md_set_location                 (ZifMd *md,
                                                         const gchar *location);

Sets the location of the compressed file, e.g. "repodata/35d817e-primary.sqlite.bz2"

md :

the ZifMd object

location :

the location

Since 0.1.0


zif_md_set_checksum ()

void                zif_md_set_checksum                 (ZifMd *md,
                                                         const gchar *checksum);

Sets the checksum of the compressed file.

md :

the ZifMd object

checksum :

the checksum value

Since 0.1.0


zif_md_set_checksum_uncompressed ()

void                zif_md_set_checksum_uncompressed    (ZifMd *md,
                                                         const gchar *checksum_uncompressed);

Sets the checksum of the uncompressed file.

md :

the ZifMd object

checksum_uncompressed :

the uncompressed checksum value

Since 0.1.0


zif_md_set_checksum_type ()

void                zif_md_set_checksum_type            (ZifMd *md,
                                                         GChecksumType checksum_type);

Sets the checksum_type of the files.

md :

the ZifMd object

checksum_type :

the checksum type

Since 0.1.0


zif_md_type_to_text ()

const gchar *       zif_md_type_to_text                 (ZifMdType type);

type :

Returns :

Since 0.1.0


zif_md_get_id ()

const gchar *       zif_md_get_id                       (ZifMd *md);

Gets the md identifier, usually the repo name.

md :

the ZifMd object

Returns :

the repo id.

Since 0.1.0


zif_md_get_mdtype ()

ZifMdType           zif_md_get_mdtype                   (ZifMd *md);

Gets the type of the repo.

md :

the ZifMd object

Returns :

the type

Since 0.1.0


zif_md_get_filename ()

const gchar *       zif_md_get_filename                 (ZifMd *md);

Gets the compressed filename of the repo.

md :

the ZifMd object

Returns :

the filename

Since 0.1.0


zif_md_get_filename_uncompressed ()

const gchar *       zif_md_get_filename_uncompressed    (ZifMd *md);

Gets the uncompressed filename of the repo.

md :

the ZifMd object

Returns :

the filename

Since 0.1.0


zif_md_get_location ()

const gchar *       zif_md_get_location                 (ZifMd *md);

Gets the location of the repo.

md :

the ZifMd object

Returns :

the location

Since 0.1.0


zif_md_load ()

gboolean            zif_md_load                         (ZifMd *md,
                                                         ZifState *state,
                                                         GError **error);

Load the metadata store.

md :

the ZifMd object

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

TRUE for success, FALSE for failure

Since 0.1.0


zif_md_unload ()

gboolean            zif_md_unload                       (ZifMd *md,
                                                         ZifState *state,
                                                         GError **error);

Unload the metadata store.

md :

the ZifMd object

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

TRUE for success, FALSE for failure

Since 0.1.0


zif_md_clean ()

gboolean            zif_md_clean                        (ZifMd *md,
                                                         GError **error);

Clean the metadata store.

md :

the ZifMd object

error :

a GError which is used on failure, or NULL

Returns :

TRUE for success, FALSE for failure

Since 0.1.0


zif_md_file_check ()

gboolean            zif_md_file_check                   (ZifMd *md,
                                                         gboolean use_uncompressed,
                                                         ZifState *state,
                                                         GError **error);

Check the metadata files to make sure they are valid.

md :

the ZifMd object

use_uncompressed :

If we should check only the uncompresed version

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

TRUE for success, FALSE for failure

Since 0.1.0


zif_md_search_file ()

GPtrArray *         zif_md_search_file                  (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Gets a list of all packages that contain the file. Results are pkgId's descriptors, i.e. 64 bit hashes as test.

md :

the ZifMd object

search :

the search term, e.g. "/usr/bin/powertop"

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

a string list of pkgId's

Since 0.1.0


zif_md_search_name ()

GPtrArray *         zif_md_search_name                  (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Finds all packages that match the name.

md :

the ZifMd object

search :

the search term, e.g. "power"

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_search_details ()

GPtrArray *         zif_md_search_details               (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Finds all packages that match the name or description.

md :

the ZifMd object

search :

the search term, e.g. "advanced"

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_search_group ()

GPtrArray *         zif_md_search_group                 (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Finds all packages that match the group.

md :

the ZifMd object

search :

the search term, e.g. "games/console"

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_search_pkgid ()

GPtrArray *         zif_md_search_pkgid                 (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Finds all packages that match the given pkgId.

md :

the ZifMd object

search :

the search term as a 64 bit hash

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_what_provides ()

GPtrArray *         zif_md_what_provides                (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Finds all packages that match the given provide.

md :

the ZifMd object

search :

the provide, e.g. "mimehandler(application/ogg)"

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_resolve ()

GPtrArray *         zif_md_resolve                      (ZifMd *md,
                                                         gchar **search,
                                                         ZifState *state,
                                                         GError **error);

Finds all remote packages that match the name exactly.

md :

the ZifMd object

search :

the search term, e.g. "gnome-power-manager"

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_get_packages ()

GPtrArray *         zif_md_get_packages                 (ZifMd *md,
                                                         ZifState *state,
                                                         GError **error);

Returns all packages in the repo.

md :

the ZifMd object

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_find_package ()

GPtrArray *         zif_md_find_package                 (ZifMd *md,
                                                         const gchar *package_id,
                                                         ZifState *state,
                                                         GError **error);

Finds all packages that match PackageId.

md :

the ZifMd object

package_id :

the PackageId to match

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifPackageRemote's

Since 0.1.0


zif_md_get_changelog ()

GPtrArray *         zif_md_get_changelog                (ZifMd *md,
                                                         const gchar *pkgid,
                                                         ZifState *state,
                                                         GError **error);

Gets the changelog data for a specific package

md :

the ZifMd object

pkgid :

the internal pkgid to match

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of ZifChangeset's

Since 0.1.0


zif_md_get_files ()

GPtrArray *         zif_md_get_files                    (ZifMd *md,
                                                         ZifPackage *package,
                                                         ZifState *state,
                                                         GError **error);

Gets the file list for a specific package.

md :

the ZifMd object

package :

the ZifPackage

state :

a ZifState to use for progress reporting

error :

a GError which is used on failure, or NULL

Returns :

an array of strings, free with g_ptr_array_unref()

Since 0.1.0