sysupdate: Report download progress via sd_notify

We set up a NOTIFY_SOCKET to get download progress notifications from
each individual import helper. Along with the number of import jobs we
have to run, this gives an overall progress value which we report using
sd_notify
This commit is contained in:
Adrian Vovk
2024-07-12 14:38:09 +01:00
committed by Tom Coldrick
parent e37164cafc
commit 8db5e9b657
4 changed files with 283 additions and 22 deletions
+7 -2
View File
@@ -12,6 +12,7 @@ typedef struct Transfer Transfer;
#include "sysupdate-partition.h"
#include "sysupdate-resource.h"
#include "sysupdate.h"
struct Transfer {
char *definition_path;
@@ -44,9 +45,13 @@ struct Transfer {
/* If we write to a partition in a partition table, the metrics of it */
PartitionInfo partition_info;
PartitionChange partition_change;
Context *context;
};
Transfer *transfer_new(void);
typedef int (*TransferProgress)(const Transfer *t, const Instance *inst, unsigned percentage);
Transfer *transfer_new(Context *ctx);
Transfer *transfer_free(Transfer *t);
DEFINE_TRIVIAL_CLEANUP_FUNC(Transfer*, transfer_free);
@@ -57,6 +62,6 @@ int transfer_resolve_paths(Transfer *t, const char *root, const char *node);
int transfer_vacuum(Transfer *t, uint64_t space, const char *extra_protected_version);
int transfer_acquire_instance(Transfer *t, Instance *i);
int transfer_acquire_instance(Transfer *t, Instance *i, TransferProgress cb, void *userdata);
int transfer_install_instance(Transfer *t, Instance *i, const char *root);