26
26
gearman_options_t options;
27
gearman_verbose_t verbose;
31
uint32_t packet_count;
27
35
gearman_con_st *con_list;
29
36
gearman_job_st *job_list;
31
37
gearman_task_st *task_list;
33
38
gearman_packet_st *packet_list;
34
uint32_t packet_count;
35
39
struct pollfd *pfds;
39
char last_error[GEARMAN_MAX_ERROR_SIZE];
40
gearman_verbose_t verbose;
41
40
gearman_log_fn *log_fn;
43
42
gearman_event_watch_fn *event_watch;
60
60
struct gearman_packet_st
63
gearman_packet_st *next;
64
gearman_packet_st *prev;
65
62
gearman_packet_options_t options;
66
63
gearman_magic_t magic;
67
64
gearman_command_t command;
69
gearman_packet_st *next;
70
gearman_packet_st *prev;
69
73
uint8_t *arg[GEARMAN_MAX_COMMAND_ARGS];
70
74
size_t arg_size[GEARMAN_MAX_COMMAND_ARGS];
72
75
uint8_t args_buffer[GEARMAN_ARGS_BUFFER_SIZE];
91
91
struct gearman_con_st
93
gearman_con_options_t options;
96
94
gearman_con_state_t state;
97
gearman_con_options_t options;
99
char host[NI_MAXHOST];
95
gearman_con_send_state_t send_state;
96
gearman_con_recv_state_t recv_state;
101
struct addrinfo *addrinfo;
102
struct addrinfo *addrinfo_next;
106
101
uint32_t created_id;
107
102
uint32_t created_id_next;
108
gearman_packet_st packet;
110
gearman_con_send_state_t send_state;
111
uint8_t send_buffer[GEARMAN_SEND_BUFFER_SIZE];
112
uint8_t *send_buffer_ptr;
113
103
size_t send_buffer_size;
114
104
size_t send_data_size;
115
105
size_t send_data_offset;
117
gearman_con_recv_state_t recv_state;
118
gearman_packet_st *recv_packet;
119
uint8_t recv_buffer[GEARMAN_RECV_BUFFER_SIZE];
120
uint8_t *recv_buffer_ptr;
121
106
size_t recv_buffer_size;
122
107
size_t recv_data_size;
123
108
size_t recv_data_offset;
110
gearman_con_st *next;
111
gearman_con_st *prev;
113
struct addrinfo *addrinfo;
114
struct addrinfo *addrinfo_next;
115
uint8_t *send_buffer_ptr;
116
gearman_packet_st *recv_packet;
117
uint8_t *recv_buffer_ptr;
119
gearman_con_protocol_data_free_fn *protocol_data_free_fn;
120
gearman_con_recv_fn *recv_fn;
121
gearman_con_recv_data_fn *recv_data_fn;
122
gearman_con_send_fn *send_fn;
123
gearman_con_send_data_fn *send_data_fn;
124
gearman_packet_pack_fn *packet_pack_fn;
125
gearman_packet_unpack_fn *packet_unpack_fn;
126
gearman_packet_st packet;
127
char host[NI_MAXHOST];
128
uint8_t send_buffer[GEARMAN_SEND_BUFFER_SIZE];
129
uint8_t recv_buffer[GEARMAN_RECV_BUFFER_SIZE];
165
171
struct gearman_client_st
168
gearman_st gearman_static;
173
gearman_client_options_t options;
169
174
gearman_client_state_t state;
170
gearman_client_options_t options;
175
gearman_return_t do_ret;
172
176
uint32_t new_tasks;
173
177
uint32_t running_tasks;
174
181
gearman_con_st *con;
175
182
gearman_task_st *task;
176
gearman_task_st do_task;
179
gearman_return_t do_ret;
180
184
gearman_workload_fn *workload_fn;
181
185
gearman_created_fn *created_fn;
182
186
gearman_data_fn *data_fn;
193
199
struct gearman_worker_st
196
gearman_st gearman_static;
197
201
gearman_worker_options_t options;
198
202
gearman_worker_state_t state;
199
gearman_packet_st grab_job;
200
gearman_packet_st pre_sleep;
203
gearman_worker_work_state_t work_state;
204
uint32_t function_count;
205
size_t work_result_size;
201
207
gearman_con_st *con;
202
208
gearman_job_st *job;
203
209
gearman_worker_function_st *function;
204
210
gearman_worker_function_st *function_list;
205
uint32_t function_count;
206
gearman_worker_work_state_t work_state;
207
gearman_job_st work_job;
208
211
gearman_worker_function_st *work_function;
209
212
void *work_result;
210
size_t work_result_size;
213
gearman_st gearman_static;
214
gearman_packet_st grab_job;
215
gearman_packet_st pre_sleep;
216
gearman_job_st work_job;
216
222
struct gearman_worker_function_st
224
gearman_worker_function_options_t options;
218
225
gearman_worker_function_st *next;
219
226
gearman_worker_function_st *prev;
220
gearman_worker_function_options_t options;
221
227
char *function_name;
222
228
gearman_worker_fn *worker_fn;
223
229
const void *fn_arg;
230
236
struct gearman_server_st
232
238
gearman_server_options_t options;
233
char job_handle_prefix[GEARMAN_JOB_HANDLE_SIZE];
234
uint32_t job_handle_count;
236
240
bool shutdown_graceful;
243
uint32_t job_handle_count;
244
uint32_t thread_count;
245
uint32_t function_count;
247
uint32_t unique_count;
248
uint32_t free_packet_count;
249
uint32_t free_job_count;
250
uint32_t free_client_count;
251
uint32_t free_worker_count;
237
253
gearman_server_thread_st *thread_list;
238
uint32_t thread_count;
239
gearman_server_packet_st *free_packet_list;
240
uint32_t free_packet_count;
241
254
gearman_server_function_st *function_list;
242
uint32_t function_count;
243
gearman_server_job_st *job_hash[GEARMAN_JOB_HASH_SIZE];
245
gearman_server_job_st *unique_hash[GEARMAN_JOB_HASH_SIZE];
246
uint32_t unique_count;
255
gearman_server_packet_st *free_packet_list;
247
256
gearman_server_job_st *free_job_list;
248
uint32_t free_job_count;
249
257
gearman_server_client_st *free_client_list;
250
uint32_t free_client_count;
251
258
gearman_server_worker_st *free_worker_list;
252
uint32_t free_worker_count;
259
gearman_server_log_fn *log_fn;
261
gearman_st gearman_static;
253
262
pthread_mutex_t proc_lock;
254
263
pthread_cond_t proc_cond;
255
264
pthread_t proc_id;
259
gearman_st gearman_static;
260
gearman_server_log_fn *log_fn;
265
char job_handle_prefix[GEARMAN_JOB_HANDLE_SIZE];
266
gearman_server_job_st *job_hash[GEARMAN_JOB_HASH_SIZE];
267
gearman_server_job_st *unique_hash[GEARMAN_JOB_HASH_SIZE];
267
273
struct gearman_server_thread_st
269
275
gearman_server_thread_options_t options;
279
uint32_t free_con_count;
280
uint32_t free_packet_count;
270
282
gearman_server_st *server;
271
283
gearman_server_thread_st *next;
272
284
gearman_server_thread_st *prev;
273
pthread_mutex_t lock;
274
285
gearman_server_thread_log_fn *log_fn;
275
286
void *log_fn_arg;
276
287
gearman_server_thread_run_fn *run_fn;
279
gearman_st gearman_static;
280
289
gearman_server_con_st *con_list;
282
290
gearman_server_con_st *io_list;
284
291
gearman_server_con_st *proc_list;
286
292
gearman_server_con_st *free_con_list;
287
uint32_t free_con_count;
288
293
gearman_server_packet_st *free_packet_list;
289
uint32_t free_packet_count;
294
gearman_st gearman_static;
295
pthread_mutex_t lock;
295
301
struct gearman_server_con_st
297
303
gearman_con_st con; /* This must be the first struct member. */
304
gearman_server_con_options_t options;
305
gearman_return_t ret;
310
uint32_t io_packet_count;
311
uint32_t proc_packet_count;
312
uint32_t worker_count;
313
uint32_t client_count;
298
314
gearman_server_thread_st *thread;
299
315
gearman_server_con_st *next;
300
316
gearman_server_con_st *prev;
301
gearman_server_con_options_t options;
302
gearman_return_t ret;
303
317
gearman_server_packet_st *packet;
304
318
gearman_server_packet_st *io_packet_list;
305
319
gearman_server_packet_st *io_packet_end;
306
uint32_t io_packet_count;
307
320
gearman_server_packet_st *proc_packet_list;
308
321
gearman_server_packet_st *proc_packet_end;
309
uint32_t proc_packet_count;
310
322
gearman_server_con_st *io_next;
311
323
gearman_server_con_st *io_prev;
312
324
gearman_server_con_st *proc_next;
313
325
gearman_server_con_st *proc_prev;
314
326
gearman_server_worker_st *worker_list;
315
uint32_t worker_count;
316
327
gearman_server_client_st *client_list;
317
uint32_t client_count;
318
328
const char *host;
319
329
const char *port;
320
330
char id[GEARMAN_SERVER_CON_ID_SIZE];
339
345
struct gearman_server_function_st
347
gearman_server_function_options_t options;
348
uint32_t worker_count;
351
uint32_t job_running;
352
uint32_t max_queue_size;
353
size_t function_name_size;
341
354
gearman_server_st *server;
342
355
gearman_server_function_st *next;
343
356
gearman_server_function_st *prev;
344
gearman_server_function_options_t options;
345
357
char *function_name;
346
size_t function_name_size;
347
358
gearman_server_worker_st *worker_list;
348
uint32_t worker_count;
349
359
gearman_server_job_st *job_list[GEARMAN_JOB_PRIORITY_MAX];
350
360
gearman_server_job_st *job_end[GEARMAN_JOB_PRIORITY_MAX];
353
uint32_t job_running;
354
uint32_t max_queue_size;
374
380
struct gearman_server_worker_st
376
382
gearman_server_worker_options_t options;
377
384
gearman_server_con_st *con;
378
385
gearman_server_worker_st *con_next;
379
386
gearman_server_worker_st *con_prev;
380
387
gearman_server_function_st *function;
381
388
gearman_server_worker_st *function_next;
382
389
gearman_server_worker_st *function_prev;
384
390
gearman_server_job_st *job;
390
396
struct gearman_server_job_st
398
gearman_server_job_options_t options;
399
gearman_job_priority_t priority;
400
uint32_t job_handle_key;
402
uint32_t client_count;
404
uint32_t denominator;
392
406
gearman_server_st *server;
393
407
gearman_server_job_st *next;
394
408
gearman_server_job_st *prev;
396
410
gearman_server_job_st *unique_prev;
397
411
gearman_server_function_st *function;
398
412
gearman_server_job_st *function_next;
399
gearman_server_job_options_t options;
400
gearman_job_priority_t priority;
414
gearman_server_client_st *client_list;
415
gearman_server_worker_st *worker;
401
416
char job_handle[GEARMAN_JOB_HANDLE_SIZE];
402
uint32_t job_handle_key;
403
417
char unique[GEARMAN_UNIQUE_SIZE];
407
gearman_server_client_st *client_list;
408
uint32_t client_count;
409
gearman_server_worker_st *worker;
411
uint32_t denominator;
417
423
struct gearmand_st
419
425
gearmand_options_t options;
426
gearman_verbose_t verbose;
427
gearman_return_t ret;
423
430
uint32_t threads;
424
gearman_verbose_t verbose;
431
uint32_t thread_count;
432
uint32_t free_dcon_count;
433
uint32_t max_thread_free_dcon_count;
425
436
gearmand_log_fn *log_fn;
426
437
void *log_fn_arg;
427
gearman_return_t ret;
438
struct event_base *base;
439
gearmand_port_st *port_list;
440
gearmand_thread_st *thread_list;
441
gearmand_thread_st *thread_add_next;
442
gearmand_con_st *free_dcon_list;
428
443
gearman_server_st server;
429
struct event_base *base;
430
struct addrinfo *addrinfo;
431
struct addrinfo *addrinfo_next;
444
struct event wakeup_event;
450
struct gearmand_port_st
432
453
uint32_t listen_count;
454
gearmand_st *gearmand;
455
gearman_con_add_fn *add_fn;
434
457
struct event *listen_event;
436
struct event wakeup_event;
437
gearmand_thread_st *thread_list;
438
uint32_t thread_count;
439
gearmand_thread_st *thread_add_next;
440
gearmand_con_st *free_dcon_list;
441
uint32_t free_dcon_count;
442
uint32_t max_thread_free_dcon_count;
448
463
struct gearmand_thread_st
450
465
gearmand_thread_options_t options;
468
uint32_t dcon_add_count;
469
uint32_t free_dcon_count;
451
471
gearmand_thread_st *next;
452
472
gearmand_thread_st *prev;
453
473
gearmand_st *gearmand;
474
struct event_base *base;
475
gearmand_con_st *dcon_list;
476
gearmand_con_st *dcon_add_list;
477
gearmand_con_st *free_dcon_list;
454
478
gearman_server_thread_st server_thread;
479
struct event wakeup_event;
457
481
pthread_mutex_t lock;
458
struct event_base *base;
460
struct event wakeup_event;
461
gearmand_con_st *dcon_list;
463
gearmand_con_st *dcon_add_list;
464
uint32_t dcon_add_count;
465
gearmand_con_st *free_dcon_list;
466
uint32_t free_dcon_count;
472
487
struct gearmand_con_st
491
gearmand_thread_st *thread;
474
492
gearmand_con_st *next;
475
493
gearmand_con_st *prev;
476
gearmand_thread_st *thread;
478
char host[NI_MAXHOST];
479
char port[NI_MAXSERV];
480
494
gearman_server_con_st *server_con;
481
495
gearman_con_st *con;
496
gearman_con_add_fn *add_fn;
483
497
struct event event;
498
char host[NI_MAXHOST];
499
char port[NI_MAXSERV];
503
* @ingroup gearman_conf
505
struct gearman_conf_st
507
gearman_conf_options_t options;
508
gearman_return_t last_return;
513
gearman_conf_module_st **module_list;
514
gearman_conf_option_st *option_list;
515
struct option *option_getopt;
516
char option_short[GEARMAN_CONF_MAX_OPTION_SHORT];
517
char last_error[GEARMAN_MAX_ERROR_SIZE];
521
* @ingroup gearman_conf
523
struct gearman_conf_option_st
526
gearman_conf_module_st *module;
528
const char *value_name;
534
* @ingroup gearman_conf_module
536
struct gearman_conf_module_st
538
gearman_conf_module_options_t options;
539
size_t current_option;
540
size_t current_value;
541
gearman_conf_st *conf;
486
545
#ifdef __cplusplus