core: add method to enqueue multiple jobs in a single call (#42182)

Currently only a single job for a single unit can be enqueued
atomically,
so there is no guarantee that, e.g., starting a unit and its socket
at the same time will happen in the same transaction. That forces
callers to 'know' the right order in which to start new units being
installed, or failures will occur. It also means some ordering
constraints are ignored, in case the separate calls are done
in the wrong manual order.

Add a new EnqueueUnitJobMany() D-Bus method that takes a list of units
to start.
This commit is contained in:
Luca Boccassi
2026-06-22 21:35:17 +01:00
committed by GitHub
12 changed files with 1042 additions and 60 deletions
+12
View File
@@ -11,6 +11,7 @@
#include "log.h"
#include "path-lookup.h"
#include "show-status.h"
#include "transaction.h"
#include "unit.h"
struct libmnt_monitor;
@@ -576,6 +577,17 @@ int manager_dispatch_external_fd_to_unit(Manager *m, const char *unit_id, const
int manager_load_startable_unit_or_warn(Manager *m, const char *name, const char *path, Unit **ret);
int manager_load_unit_from_dbus_path(Manager *m, const char *s, sd_bus_error *e, Unit **_u);
int manager_add_jobs(
Manager *m,
JobType type,
char * const *names,
bool reload_if_possible,
JobMode mode,
TransactionAddFlags extra_flags,
Set *affected_jobs,
sd_bus_error *reterr_error,
Set *ret_jobs);
int manager_add_job_full(
Manager *m,
JobType type,