]>
Commit | Line | Data |
---|---|---|
60918275 LP |
1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ |
2 | ||
3 | #ifndef foojobhfoo | |
4 | #define foojobhfoo | |
5 | ||
6 | #include <stdbool.h> | |
7 | #include <inttypes.h> | |
8 | ||
9 | typedef struct Job Job; | |
10 | typedef enum JobType JobType; | |
11 | typedef enum JobMode JobMode; | |
12 | ||
13 | #include "manager.h" | |
14 | #include "name.h" | |
15 | #include "hashmap.h" | |
16 | #include "list.h" | |
17 | ||
18 | enum JobType { | |
19 | JOB_START, | |
20 | JOB_STOP, | |
21 | JOB_VERIFY_STARTED, | |
22 | JOB_RELOAD, | |
23 | JOB_RESTART, | |
24 | JOB_TRY_RESTART, /* restart if running */ | |
25 | JOB_RESTART_FINISH, /* 2nd part of a restart, i.e. the actual starting */ | |
26 | _JOB_TYPE_MAX | |
27 | }; | |
28 | ||
29 | typedef enum JobState { | |
30 | JOB_WAITING, | |
31 | JOB_RUNNING, | |
32 | JOB_DONE, | |
33 | _JOB_STATE_MAX | |
34 | } JobState; | |
35 | ||
36 | enum JobMode { | |
37 | JOB_FAIL, | |
38 | JOB_REPLACE, | |
39 | _JOB_MODE_MAX | |
40 | }; | |
41 | ||
42 | struct Job { | |
43 | Manager *manager; | |
44 | uint32_t id; | |
45 | ||
46 | JobType type; | |
47 | JobState state; | |
48 | Name *name; | |
49 | ||
50 | bool linked:1; | |
51 | }; | |
52 | ||
53 | Job* job_new(Manager *m, JobType type, Name *name); | |
54 | int job_link(Job *job); | |
55 | void job_free(Job *job); | |
a66d02c3 | 56 | void job_dump(Job *j, FILE*f); |
60918275 LP |
57 | |
58 | #endif |