1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 typedef struct Transaction Transaction;
5 
6 #include "hashmap.h"
7 #include "job.h"
8 #include "manager.h"
9 #include "unit.h"
10 
11 struct Transaction {
12         /* Jobs to be added */
13         Hashmap *jobs;      /* Unit object => Job object list 1:1 */
14         Job *anchor_job;      /* the job the user asked for */
15         bool irreversible;
16 };
17 
18 Transaction *transaction_new(bool irreversible);
19 void transaction_free(Transaction *tr);
20 
21 void transaction_add_propagate_reload_jobs(Transaction *tr, Unit *unit, Job *by, bool ignore_order, sd_bus_error *e);
22 int transaction_add_job_and_dependencies(
23                 Transaction *tr,
24                 JobType type,
25                 Unit *unit,
26                 Job *by,
27                 bool matters,
28                 bool conflicts,
29                 bool ignore_requirements,
30                 bool ignore_order,
31                 sd_bus_error *e);
32 int transaction_activate(Transaction *tr, Manager *m, JobMode mode, Set *affected, sd_bus_error *e);
33 int transaction_add_isolate_jobs(Transaction *tr, Manager *m);
34 int transaction_add_triggering_jobs(Transaction *tr, Unit *u);
35 void transaction_abort(Transaction *tr);
36