1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
9 typedef struct Job Job;
10 typedef struct JobDependency JobDependency;
11 typedef enum JobType JobType;
12 typedef enum JobMode JobMode;
13 typedef enum JobState JobState;
24 JOB_RELOAD, /* reload if running */
25 JOB_RELOAD_OR_START, /* reload if running, start if not running */
26 JOB_RESTART, /* stop if running, then start unconditionally */
27 JOB_TRY_RESTART, /* stop and start if running */
29 _JOB_TYPE_INVALID = -1
45 struct JobDependency {
46 /* Encodes that the 'subject' job needs the 'object' job in
47 * some way. This structure is used only while building a transaction. */
53 /* Linked list for the subjects, resp objects */
54 JobDependency *subject_prev, *subject_next;
55 JobDependency *object_prev, *object_next;
68 bool matters_to_anchor:1;
70 /* These fields are used only while building a transaction */
71 Job *transaction_next, *transaction_prev;
73 JobDependency *subject_list;
74 JobDependency *object_list;
76 /* used for graph algs as a "I have been here" marker */
81 Job* job_new(Manager *m, JobType type, Name *name);
82 void job_free(Job *job);
83 void job_dump(Job *j, FILE*f, const char *prefix);
85 JobDependency* job_dependency_new(Job *subject, Job *object, bool matters);
86 void job_dependency_free(JobDependency *l);
87 void job_dependency_delete(Job *subject, Job *object, bool *matters);
89 bool job_is_anchor(Job *j);
91 int job_merge(Job *j, Job *other);
93 const char* job_type_to_string(JobType t);
94 int job_type_merge(JobType *a, JobType b);
95 bool job_type_mergeable(JobType a, JobType b);
96 bool job_type_is_superset(JobType a, JobType b);
97 bool job_type_is_conflicting(JobType a, JobType b);