Add more info to the protocol doc.
[beanstalkd.git] / job.h
blobcd09ab6e5d1674f36c377c346f1c893ac4d93baa
1 /* job.h - a job in the queue */
3 #ifndef job_h
4 #define job_h
6 #include <time.h>
8 #define JOB_STATE_INVALID 0
9 #define JOB_STATE_READY 1
10 #define JOB_STATE_RESERVED 2
11 #define JOB_STATE_BURIED 3
12 #define JOB_STATE_DELAYED 4
14 typedef struct job *job;
16 struct job {
17 job prev, next; /* linked list of jobs */
18 unsigned long long int id;
19 unsigned int pri;
20 unsigned int delay;
21 int body_size;
22 time_t creation;
23 time_t deadline;
24 unsigned int timeout_ct;
25 unsigned int release_ct;
26 unsigned int bury_ct;
27 unsigned int kick_ct;
28 char state;
29 char body[];
32 job allocate_job(int body_size);
33 job make_job(unsigned int pri, unsigned int delay, int body_size);
35 typedef int(*job_cmp_fn)(job, job);
36 int job_pri_cmp(job a, job b);
37 int job_delay_cmp(job a, job b);
39 job job_copy(job j);
41 const char * job_state(job j);
43 int job_list_any_p(job head);
44 job job_remove(job j);
45 void job_insert(job head, job j);
47 unsigned long long int total_jobs();
49 #endif /*job_h*/