summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm.h
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2020-03-26 21:19:59 +0100
committerAllan McRae <allan@archlinux.org>2020-05-09 03:58:21 +0200
commita8a1a1bb3ec98a8471cb5cd13d096f39a267f789 (patch)
tree3a57e57e8dad88cc4bb51a0cd6b6d87d5a708b59 /lib/libalpm/alpm.h
parentfe8e13341bdeae4a59c0270a632c29e71ae9deda (diff)
downloadpacman-a8a1a1bb3ec98a8471cb5cd13d096f39a267f789.tar.gz
pacman-a8a1a1bb3ec98a8471cb5cd13d096f39a267f789.tar.xz
Introduce alpm_dbs_update() function for parallel db updates
This is an equivalent of alpm_db_update but for multiplexed (parallel) download. The difference is that this function accepts list of databases to update. And then ALPM internals download it in parallel if possible. Add a stub for _alpm_multi_download the function that will do parallel payloads downloads in the future. Introduce dload_payload->filepath field that contains url path to the file we download. It is like fileurl field but does not contain protocol/server part. The rationale for having this field is that with the curl multidownload the server retry logic is going to move to a curl callback. And the callback needs to be able to reconstruct the 'next' fileurl. One will be able to do it by getting the next server url from 'servers' list and then concat with filepath. Once the 'parallel download' refactoring is over 'fileurl' field will go away. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm.h')
-rw-r--r--lib/libalpm/alpm.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 5d559db1..2cf20343 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -1049,6 +1049,35 @@ int alpm_db_remove_server(alpm_db_t *db, const char *url);
*/
int alpm_db_update(int force, alpm_db_t *db);
+/** 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_dbs_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_dbs_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