diff options
author | Anatol Pomozov <anatol.pomozov@gmail.com> | 2021-03-16 00:33:08 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2021-03-25 02:39:03 +0100 |
commit | 1e60a5f00674a9a9b0c530c741bd6701d0e1e834 (patch) | |
tree | 8539fba8183d42179f6b5504f32725bd1901de4c /lib/libalpm/alpm.h | |
parent | 9bf3d6a7603bf48771a20d1f4bd789670e7446f7 (diff) | |
download | pacman-1e60a5f00674a9a9b0c530c741bd6701d0e1e834.tar.gz pacman-1e60a5f00674a9a9b0c530c741bd6701d0e1e834.tar.xz |
Remove "total download" callback in favor of generic event callback
Total download callback called right before packages start downloaded.
But we already have an event for such event (ALPM_EVENT_PKG_RETRIEVE_START)
and it is naturally to use the event to pass information about expected
download size.
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.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 0909fe11..833df829 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -926,6 +926,16 @@ typedef struct _alpm_event_hook_run_t { size_t total; } alpm_event_hook_run_t; +/** Packages downloading about to start. */ +typedef struct _alpm_event_pkg_retrieve_t { + /** Type of event */ + alpm_event_type_t type; + /** Number of packages to download */ + size_t num; + /** Total size of packages to download */ + off_t total_size; +} alpm_event_pkg_retrieve_t; + /** Events. * This is a union passed to the callback that allows the frontend to know * which type of event was triggered (via type). It is then possible to @@ -954,6 +964,8 @@ typedef union _alpm_event_t { alpm_event_hook_t hook; /** A hook was ran */ alpm_event_hook_run_t hook_run; + /** Download packages */ + alpm_event_pkg_retrieve_t pkg_retrieve; } alpm_event_t; /** Event callback. @@ -1197,12 +1209,6 @@ typedef void (*alpm_cb_download)(const char *filename, alpm_download_event_type_t event, void *data); -/** Total Download callback. - * @param howmany the number of packages that will be downloaded during \link alpm_trans_commit \endlink. - * @param total amount that will be downloaded during \link alpm_trans_commit \endlink. - */ -typedef void (*alpm_cb_totaldl)(size_t howmany, off_t total); - /** A callback for downloading files * @param url the URL of the file to be downloaded * @param localpath the directory to which the file should be downloaded @@ -1525,20 +1531,6 @@ alpm_cb_fetch alpm_option_get_fetchcb(alpm_handle_t *handle); */ int alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb); -/** Returns the callback used to report total download size. - * @param handle the context handle - * @return the currently set total download callback - */ -alpm_cb_totaldl alpm_option_get_totaldlcb(alpm_handle_t *handle); - -/** Sets the callback used to report total download size. - * @param handle the context handle - * @param cb the cb to use - * @return 0 on success, -1 on error (pm_errno is set accordingly) - */ -int alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb); - - /** Returns the callback used for events. * @param handle the context handle * @return the currently set event callback |