From patchwork Mon Dec 7 22:19:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: morganamilo X-Patchwork-Id: 1832 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 84F851C999109 for ; Mon, 7 Dec 2020 23:16:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1, MAILING_LIST_MULTI=-1,SPF_HELO_PASS=-0.001,T_DMARC_POLICY_NONE=0.01 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: Received: from mail.archlinux.org (mail.archlinux.org [IPv6:2a01:4f9:c010:3052::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 7 Dec 2020 23:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1607379734; bh=L+NZoimLwMo2MskhIDXIeLnZJCVew8cHTDtAw9uLLxo=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To; b=T+mcBj/XSgGMjuicvl/mBd/9WLCqYChzMMGDnP50oEwGLE7zkbjtY6e6HlNnVu3gL 5VF0tF4vPrCiXXf3QMcMlTAIAeqYByUytgCf7bAjbH74EeyVsKVRIAY90iRTAwRv1v 1cdw5cwqVDyU+m5IxMqpRIZ2DPaGJt4rBCSczsVYlmsg33pCsfm9d5ziqw+UmjXU82 RGD269XuXM+RRu3z1RKlNHLjcMObhL9aWp8SE+icmjFDsboRWlQlUAYId8uUOPqqu+ afIkWX93D3UhseBsFMXq0Fw8+j35iOS8mxFZlcHVX7hFb7A36cfvHbMBBkeMe6ob1u Notw0k3RKNvN4LTmf7xUTbUBiFAOOowv0DiW4MPet2O1g+HDVThTsXHKUBdw5Sfasd 97BgA6tvZHH2Fuc9MBtcupAz7aJ7Rl1FpSOqLhtSSy7BqTLbg1lPtNcwpRvZMd8Y3D IaNU8d/M3lmmBY3dhUATC5+/RUw9SsR7n90Od+ziu4b0FCliU9ChrgUKGu7jacK8TM y8O47IYbvzPp2wUx75blqdYBGY2Anxj/ZO2YoRBbTopy5E/2Fb7KfT1gUdTU99sUzl BrMWdnzFxj/+xc2taZVmrFjH16qiUeTr+4ogE5IGKv+fDNO62vCz57JkrKMawMa0hN Qx1AAaD8bVoS+Pkpdh7QAEiw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1607382990; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ANf0qjLh3/DlbeEKNhROTlJmh0EJc9wyUJYAdoBe8mE=; b=R25DNCmmNTS0Tw73nf/3whJ3WdGV933HSnFnrzOm6J7/tPndcQd88ZOS/lQLnuKuHK0vyN 3kCfEmlVCO+4zddwCfiXx95GqRkewrCRgSxucoomQo8q7m0FzVBfVu8h/HZ7i8trO5GUaA DfB8jXSgITgXmfsN6BDZsPV8GsjzlWZbzMccE2tAEmc7FtKof9baWRO06kw5b1tOpsP/LF AGUOLtSGzFH3x7IGarwrghiOce4acWyWCu42eyEAVIl+ExpR0AUYVpFSQ+zsJw4uR5V+mM eoJwDn0upOw3tOuus+nsF+0JVYd+6q98/xfI+pHYdKk/lcULOf/kjD7B4aRW2ga/6RBgbQ fZXs2PZJvmI0OtXKR+Ive9XsUGD5xErDWuEEsUp33NhtZehQBXXfSyf6ROvhugAuNbRFwx ybYl49GzbJPPoJQe9rfoWahkAcBhsihTaaSi1h1RVcd9o8FwGNpKbQoUYC36HqAbrObhB+ rpcISnTVCdzeoPldGXUbLeqf7eQlbwyMUY7c2JF7GQg0Fluq4EQqYQ8pDg6yZ9FzaSnKue XAiM868jTU6QiyfzsQhGZCQFIgZ62hfCe00vwT05fBsVQTmcr7IVKDmha3Cw5ZYBuqEjrl QkiO9PI18890T55AiffDmzyTVJL8XLk0WHEZVQmnDrnmIYX/WmXVU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1607382990; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ANf0qjLh3/DlbeEKNhROTlJmh0EJc9wyUJYAdoBe8mE=; b=WL9BGzzje2WmThAhdCMC020iE8w5CfbAYj7mBcJ41nx2BkdJCi+B9QOuE342cuaWPP5P1L LQB6y181F9sFyUBQ== From: morganamilo DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1607379729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANf0qjLh3/DlbeEKNhROTlJmh0EJc9wyUJYAdoBe8mE=; b=xUq9U6KFzbxjTC3/sOYPc9RhvgavjbwooM2nNFyq8VMB2L5X/6QaImJ0ZrsWtoPLBS/1nt GKuYdaLKFX95mqDx69IVPemf9gcQnZOW+Xs1sL3YEO4pplR9NQZjDaVmim9c4lywdQQK05 r2/jrRsM503b9bsxbl4fdRKQmz3lCdAHw95+mloVHpNXo9RP6+TXSpYNMWFWxPexdzY0PV LaMKKJKlibsw8lGFXmb9eCDb/66BD2aMdb/c00q3BC6Geaeao89W04y5SU91YY3WVXbTPG PmOc8k3p7+DzDM0uSduRj/I43++Ux6uslFUt871dAVMCDSkCDtXrSvJLGIVGt+Js2TmKht xTyhXqtrXldXju5NnkZilmpoPt7NWQpt0KmYpRoLIMjztryIltBuxbkvOIrqirBEEhb9HS ZgQA4LErLg19sZ2qJu2dY9c90Sg0A1xH+DmDB+c3KRKF4wRx8YDz4fozInIzyPQ8yZEo3w NF20+4qcoOQe3hWUCksCJ6EPdDrV3elPuJtDr3X42PEzntlhFwkpxokw3GhuyX6eczO4Es /ZcrE/GJ6ExZIGLA2m6g/0fchiOeT9iW50Rb2hEjt86mf4TE4XNQH5BZTXhHk8RLKAOotQ jtxT4bQ2onH/Hw43+hKlaV9sSxsC/L8Lu4tcpyDfY3dgbsxmwQ3Nw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1607379729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANf0qjLh3/DlbeEKNhROTlJmh0EJc9wyUJYAdoBe8mE=; b=4bwzj/wYSx3lyeGOMvOS76f+IyhTy88QtpRORzOg/ilH3S5LPwnRmRAaMkxFrMx/MIE24X McvmLfKGXmfiUgBA== To: pacman-dev@archlinux.org Date: Mon, 7 Dec 2020 22:19:41 +0000 Message-Id: <20201207221956.667322-9-morganamilo@archlinux.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201207221956.667322-1-morganamilo@archlinux.org> References: <20201207221956.667322-1-morganamilo@archlinux.org> MIME-Version: 1.0 Subject: [pacman-dev] [PATCH 08/23] doc: document databases X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" Authentication-Results: mail.archlinux.org; auth=pass smtp.auth=luna smtp.mailfrom=pacman-dev-bounces@archlinux.org --- lib/libalpm/alpm.h | 468 ++++++++++++++++++++++++--------------------- 1 file changed, 249 insertions(+), 219 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index a8d48432..c71c275f 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -94,6 +94,38 @@ typedef struct __alpm_pkg_t alpm_pkg_t; /** Transaction structure used internally by libalpm */ typedef struct __alpm_trans_t alpm_trans_t; +/* + * Structures + */ + +/** Package group */ +typedef struct _alpm_group_t { + /** group name */ + char *name; + /** list of alpm_pkg_t packages */ + alpm_list_t *packages; +} alpm_group_t; + +/** File in a package */ +typedef struct _alpm_file_t { + char *name; + off_t size; + mode_t mode; +} alpm_file_t; + +/** Package filelist container */ +typedef struct _alpm_filelist_t { + size_t count; + alpm_file_t *files; +} alpm_filelist_t; + +/** Local package or package file backup entry */ +typedef struct _alpm_backup_t { + char *name; + char *hash; +} alpm_backup_t; + + /** @addtogroup alpm_api ALPM * @brief The libalpm Public API @@ -1123,6 +1155,223 @@ typedef int (*alpm_cb_fetch)(const char *url, const char *localpath, /** @} */ +/** @addtogroup alpm_databases Database + * @brief Functions to query and manipulate the database of libalpm. + * @{ + */ + +/** Get the database of locally installed packages. + * The returned pointer points to an internal structure + * of libalpm which should only be manipulated through + * libalpm functions. + * @return a reference to the local database + */ +alpm_db_t *alpm_get_localdb(alpm_handle_t *handle); + +/** Get the list of sync databases. + * Returns a list of alpm_db_t structures, one for each registered + * sync database. + * + * @param handle the context handle + * @return a reference to an internal list of alpm_db_t structures + */ +alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle); + +/** Register a sync database of packages. + * Databases can not be registered when there is an active transaction. + * + * @param handle the context handle + * @param treename the name of the sync repository + * @param level what level of signature checking to perform on the + * database; note that this must be a '.sig' file type verification + * @return an alpm_db_t* on success (the value), NULL on error + */ +alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename, + int level); + +/** Unregister all package databases. + * Databases can not be unregistered while there is an active transaction. + * + * @param handle the context handle + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ +int alpm_unregister_all_syncdbs(alpm_handle_t *handle); + +/** Unregister a package database. + * Databases can not be unregistered when there is an active transaction. + * + * @param db pointer to the package database to unregister + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ +int alpm_db_unregister(alpm_db_t *db); + +/** Get the name of a package database. + * @param db pointer to the package database + * @return the name of the package database, NULL on error + */ +const char *alpm_db_get_name(const alpm_db_t *db); + +/** Get the signature verification level for a database. + * Will return the default verification level if this database is set up + * with ALPM_SIG_USE_DEFAULT. + * @param db pointer to the package database + * @return the signature verification level + */ +int alpm_db_get_siglevel(alpm_db_t *db); + +/** Check the validity of a database. + * This is most useful for sync databases and verifying signature status. + * If invalid, the handle error code will be set accordingly. + * @param db pointer to the package database + * @return 0 if valid, -1 if invalid (pm_errno is set accordingly) + */ +int alpm_db_get_valid(alpm_db_t *db); + +/** @name Server accessors + * @{ + */ + +/** Get the list of servers assigned to this db. + * @param db pointer to the database to get the servers from + * @return a char* list of servers + */ +alpm_list_t *alpm_db_get_servers(const alpm_db_t *db); + +/** Sets the list of servers for the database to use. + * @param db the database to set the servers + * @param servers a char* list of servers. Note: the database will + * take ownership of the list and it should no longer be + * freed by the caller + */ +int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers); + +/** Add a download server to a database. + * @param db database pointer + * @param url url of the server + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ +int alpm_db_add_server(alpm_db_t *db, const char *url); + +/** Remove a download server from a database. + * @param db database pointer + * @param url url of the server + * @return 0 on success, 1 on server not present, + * -1 on error (pm_errno is set accordingly) + */ +int alpm_db_remove_server(alpm_db_t *db, const char *url); + +/* End of server accessors */ +/** @} */ + +/** Update package databases. + * + * An update of the package databases in the list \a dbs will be attempted. + * Unless \a force is true, the update will only be performed if the remote + * databases were modified since the last update. + * + * This operation requires a database lock, and will return an applicable error + * if the lock could not be obtained. + * + * Example: + * @code + * alpm_list_t *dbs = alpm_get_syncdbs(config->handle); + * ret = alpm_db_update(config->handle, dbs, force); + * if(ret < 0) { + * pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"), + * alpm_strerror(alpm_errno(config->handle))); + * } + * @endcode + * + * @note After a successful update, the \link alpm_db_get_pkgcache() + * package cache \endlink will be invalidated + * @param handle the context handle + * @param dbs list of package databases to update + * @param force if true, then forces the update, otherwise update only in case + * the databases aren't up to date + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ +int alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force); + +/** Get a package entry from a package database. + * Looking up a package is O(1) and will be significantly faster than + * iterating over the pkgcahe. + * @param db pointer to the package database to get the package from + * @param name of the package + * @return the package entry on success, NULL on error + */ +alpm_pkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name); + +/** Get the package cache of a package database. + * This is a list of all packages the db contains. + * @param db pointer to the package database to get the package from + * @return the list of packages on success, NULL on error + */ +alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db); + +/** Get a group entry from a package database. + * Looking up a group is O(1) and will be significantly faster than + * iterating over the groupcahe. + * @param db pointer to the package database to get the group from + * @param name of the group + * @return the groups entry on success, NULL on error + */ +alpm_group_t *alpm_db_get_group(alpm_db_t *db, const char *name); + +/** Get the group cache of a package database. + * @param db pointer to the package database to get the group from + * @return the list of groups on success, NULL on error + */ +alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db); + +/** Searches a database with regular expressions. + * @param db pointer to the package database to search in + * @param needles a list of regular expressions to search for + * @param ret pointer to list for storing packages matching all + * regular expressions - must point to an empty (NULL) alpm_list_t *. + * @return 0 on success, -1 on error (pm_errno is set accordingly) + */ +int alpm_db_search(alpm_db_t *db, const alpm_list_t *needles, + alpm_list_t **ret); + +/** The usage level of a database. */ +typedef enum _alpm_db_usage_t { + /** Enable refreshes for this database */ + ALPM_DB_USAGE_SYNC = 1, + /** Enable search for this database */ + ALPM_DB_USAGE_SEARCH = (1 << 1), + /** Enable installing packages from this database */ + ALPM_DB_USAGE_INSTALL = (1 << 2), + /** Enable sysupgrades with this database */ + ALPM_DB_USAGE_UPGRADE = (1 << 3), + /** Enable all usage levels */ + ALPM_DB_USAGE_ALL = (1 << 4) - 1, +} alpm_db_usage_t; + +/** @name Usage accessors + * @{ + */ + +/** Sets the usage of a database. + * @param db pointer to the package database to set the status for + * @param usage a bitmask of alpm_db_usage_t values + * @return 0 on success, or -1 on error + */ +int alpm_db_set_usage(alpm_db_t *db, int usage); + +/** Gets the usage of a database. + * @param db pointer to the package database to get the status of + * @param usage pointer to an alpm_db_usage_t to store db's status + * @return 0 on success, or -1 on error + */ +int alpm_db_get_usage(alpm_db_t *db, int *usage); + +/* End of usage accessors */ +/** @} */ + +/* End of alpm_databases */ +/** @} */ + + /* * Enumerations * These ones are used in multiple contexts, so are forward-declared. @@ -1152,37 +1401,6 @@ typedef enum _alpm_pkgvalidation_t { ALPM_PKG_VALIDATION_SIGNATURE = (1 << 3) } alpm_pkgvalidation_t; -/* - * Structures - */ - -/** Package group */ -typedef struct _alpm_group_t { - /** group name */ - char *name; - /** list of alpm_pkg_t packages */ - alpm_list_t *packages; -} alpm_group_t; - -/** File in a package */ -typedef struct _alpm_file_t { - char *name; - off_t size; - mode_t mode; -} alpm_file_t; - -/** Package filelist container */ -typedef struct _alpm_filelist_t { - size_t count; - alpm_file_t *files; -} alpm_filelist_t; - -/** Local package or package file backup entry */ -typedef struct _alpm_backup_t { - char *name; - char *hash; -} alpm_backup_t; - /* * Logging facilities */ @@ -1405,194 +1623,6 @@ int alpm_option_set_parallel_downloads(alpm_handle_t *handle, unsigned int num_s /** @} */ -/** @addtogroup alpm_api_databases Database Functions - * Functions to query and manipulate the database of libalpm. - * @{ - */ - -/** Get the database of locally installed packages. - * The returned pointer points to an internal structure - * of libalpm which should only be manipulated through - * libalpm functions. - * @return a reference to the local database - */ -alpm_db_t *alpm_get_localdb(alpm_handle_t *handle); - -/** Get the list of sync databases. - * Returns a list of alpm_db_t structures, one for each registered - * sync database. - * @param handle the context handle - * @return a reference to an internal list of alpm_db_t structures - */ -alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle); - -/** Register a sync database of packages. - * @param handle the context handle - * @param treename the name of the sync repository - * @param level what level of signature checking to perform on the - * database; note that this must be a '.sig' file type verification - * @return an alpm_db_t* on success (the value), NULL on error - */ -alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename, - int level); - -/** Unregister all package databases. - * @param handle the context handle - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int alpm_unregister_all_syncdbs(alpm_handle_t *handle); - -/** Unregister a package database. - * @param db pointer to the package database to unregister - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int alpm_db_unregister(alpm_db_t *db); - -/** Get the name of a package database. - * @param db pointer to the package database - * @return the name of the package database, NULL on error - */ -const char *alpm_db_get_name(const alpm_db_t *db); - -/** Get the signature verification level for a database. - * Will return the default verification level if this database is set up - * with ALPM_SIG_USE_DEFAULT. - * @param db pointer to the package database - * @return the signature verification level - */ -int alpm_db_get_siglevel(alpm_db_t *db); - -/** Check the validity of a database. - * This is most useful for sync databases and verifying signature status. - * If invalid, the handle error code will be set accordingly. - * @param db pointer to the package database - * @return 0 if valid, -1 if invalid (pm_errno is set accordingly) - */ -int alpm_db_get_valid(alpm_db_t *db); - -/** @name Accessors to the list of servers for a database. - * @{ - */ - -/** Get the list of servers assigned to this db. - * @param db pointer to the database to get the servers from - * @return a char* list of servers - */ -alpm_list_t *alpm_db_get_servers(const alpm_db_t *db); - -/** Sets the list of servers for the database to use. - * @param db the database to set the servers - * @param a char* list of servers. Note: the database will - * take ownership of the list and it should no longer be - * freed by the caller - */ -int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers); - -/** Add a download server to a database. - * @param db database pointer - * @param url url of the server - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int alpm_db_add_server(alpm_db_t *db, const char *url); - -/** Remove a download server from a database. - * @param db database pointer - * @param url url of the server - * @return 0 on success, 1 on server not present, - * -1 on error (pm_errno is set accordingly) - */ -int alpm_db_remove_server(alpm_db_t *db, const char *url); -/** @} */ - -/** Update package databases - * - * An update of the package databases in the list \a dbs will be attempted. - * Unless \a force is true, the update will only be performed if the remote - * databases were modified since the last update. - * - * This operation requires a database lock, and will return an applicable error - * if the lock could not be obtained. - * - * Example: - * @code - * alpm_list_t *dbs = alpm_get_syncdbs(); - * ret = alpm_db_update(config->handle, dbs, force); - * if(ret < 0) { - * pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"), - * alpm_strerror(alpm_errno(config->handle))); - * } - * @endcode - * - * @note After a successful update, the \link alpm_db_get_pkgcache() - * package cache \endlink will be invalidated - * @param handle the context handle - * @param dbs list of package databases to update - * @param force if true, then forces the update, otherwise update only in case - * the databases aren't up to date - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force); - -/** Get a package entry from a package database. - * @param db pointer to the package database to get the package from - * @param name of the package - * @return the package entry on success, NULL on error - */ -alpm_pkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name); - -/** Get the package cache of a package database. - * @param db pointer to the package database to get the package from - * @return the list of packages on success, NULL on error - */ -alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db); - -/** Get a group entry from a package database. - * @param db pointer to the package database to get the group from - * @param name of the group - * @return the groups entry on success, NULL on error - */ -alpm_group_t *alpm_db_get_group(alpm_db_t *db, const char *name); - -/** Get the group cache of a package database. - * @param db pointer to the package database to get the group from - * @return the list of groups on success, NULL on error - */ -alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db); - -/** Searches a database with regular expressions. - * @param db pointer to the package database to search in - * @param needles a list of regular expressions to search for - * @param ret pointer to list for storing packages matching all - * regular expressions - must point to an empty (NULL) alpm_list_t *. - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int alpm_db_search(alpm_db_t *db, const alpm_list_t *needles, - alpm_list_t **ret); - -typedef enum _alpm_db_usage_t { - ALPM_DB_USAGE_SYNC = 1, - ALPM_DB_USAGE_SEARCH = (1 << 1), - ALPM_DB_USAGE_INSTALL = (1 << 2), - ALPM_DB_USAGE_UPGRADE = (1 << 3), - ALPM_DB_USAGE_ALL = (1 << 4) - 1, -} alpm_db_usage_t; - -/** Sets the usage of a database. - * @param db pointer to the package database to set the status for - * @param usage a bitmask of alpm_db_usage_t values - * @return 0 on success, or -1 on error - */ -int alpm_db_set_usage(alpm_db_t *db, int usage); - -/** Gets the usage of a database. - * @param db pointer to the package database to get the status of - * @param usage pointer to an alpm_db_usage_t to store db's status - * @return 0 on success, or -1 on error - */ -int alpm_db_get_usage(alpm_db_t *db, int *usage); - -/** @} */ - /** @addtogroup alpm_api_packages Package Functions * Functions to manipulate libalpm packages * @{