update: handle actual package updates outside of the library

This commit is contained in:
ngn
2024-07-18 19:25:35 +03:00
parent 17d572add0
commit bc79c642ac
7 changed files with 60 additions and 52 deletions

View File

@ -36,11 +36,6 @@ typedef enum lm_ctx_sync_state {
SYNC_LIST_FAIL = 5,
} lm_ctx_sync_state_t;
typedef enum lm_ctx_update_state {
UPDATE_REMOVE = 0,
UPDATE_INSTALL = 1,
} lm_ctx_update_state_t;
/* ###################
## ctx callbacks ##
################### */
@ -49,8 +44,6 @@ typedef bool (*lm_ctx_download_callback_t)(
lm_ctx_t *ctx, lm_pkg_t *pkg, bool is_archive, size_t current, size_t total, void *data);
typedef bool (*lm_ctx_install_callback_t)(
lm_ctx_t *ctx, lm_pkg_t *pkg, char *file, size_t current, size_t total, void *data);
typedef bool (*lm_ctx_update_callback_t)(
lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_update_state_t state, char *file, size_t current, size_t total, void *data);
typedef bool (*lm_ctx_sync_callback_t)(
lm_ctx_t *ctx, lm_pool_t *pool, lm_ctx_sync_state_t state, size_t current, size_t total, void *data);
typedef bool (*lm_ctx_serve_callback_t)(lm_pool_t *pool, lm_mptp_t *packet, struct sockaddr *addr, void *data);
@ -78,8 +71,7 @@ void lm_ctx_resolve_free(lm_ctx_resolve_list_t *list); // frees the res
lm_ctx_update_list_t *lm_ctx_update_list(lm_ctx_t *ctx); // get a list of packages to update
lm_pkg_t *lm_ctx_update_list_next(lm_ctx_update_list_t *list); // get the next package in the update list
void lm_ctx_update_list_free(lm_ctx_update_list_t *list); // free the update list
bool lm_ctx_update(lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_update_callback_t callback,
void *data); // returns a list of packages to update
lm_pkg_t *lm_ctx_update(lm_ctx_t *ctx, lm_pkg_t *pkg); // returns the updated version of a package
bool lm_ctx_removeable(lm_ctx_t *ctx, lm_pkg_t *pkg); // checks if a package is available for removal
bool lm_ctx_remove(