Gearman Developer Documentation

Gearman Constants

Defines

#define GEARMAN_DEFAULT_TCP_HOST   "127.0.0.1"
#define GEARMAN_DEFAULT_TCP_PORT   4730
#define GEARMAN_DEFAULT_SOCKET_TIMEOUT   10
#define GEARMAN_DEFAULT_SOCKET_SEND_SIZE   32768
#define GEARMAN_DEFAULT_SOCKET_RECV_SIZE   32768
#define GEARMAN_MAX_ERROR_SIZE   1024
#define GEARMAN_PACKET_HEADER_SIZE   12
#define GEARMAN_JOB_HANDLE_SIZE   64
#define GEARMAN_OPTION_SIZE   64
#define GEARMAN_UNIQUE_SIZE   64
#define GEARMAN_MAX_COMMAND_ARGS   8
#define GEARMAN_ARGS_BUFFER_SIZE   128
#define GEARMAN_SEND_BUFFER_SIZE   8192
#define GEARMAN_RECV_BUFFER_SIZE   8192
#define GEARMAN_WORKER_WAIT_TIMEOUT   (10 * 1000)
#define GEARMAN_LOG(__gearman, __verbose,...)
#define GEARMAN_FATAL(__gearman,...)   GEARMAN_LOG(__gearman, GEARMAN_VERBOSE_FATAL, __VA_ARGS__)
#define GEARMAN_ERROR(__gearman,...)
#define GEARMAN_INFO(__gearman,...)
#define GEARMAN_DEBUG(__gearman,...)
#define GEARMAN_CRAZY(__gearman,...)
#define GEARMAN_ERROR_SET(__gearman, __function,...)
#define GEARMAN_LIST_ADD(__list, __obj, __prefix)
#define GEARMAN_LIST_DEL(__list, __obj, __prefix)
#define GEARMAN_FIFO_ADD(__list, __obj, __prefix)
#define GEARMAN_FIFO_DEL(__list, __obj, __prefix)
#define GEARMAN_HASH_ADD(__hash, __key, __obj, __prefix)
#define GEARMAN_HASH_DEL(__hash, __key, __obj, __prefix)

Typedefs

typedef gearman_return_tgearman_workload_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_created_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_data_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_warning_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_status_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_complete_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_exception_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_fail_fn )(gearman_task_st *task)
typedef gearman_return_tgearman_parse_server_fn )(const char *host, in_port_t port, void *context)
typedef void *( gearman_worker_fn )(gearman_job_st *job, void *context, size_t *result_size, gearman_return_t *ret_ptr)
typedef gearman_return_tgearman_event_watch_fn )(gearman_con_st *con, short events, void *context)
typedef void *( gearman_malloc_fn )(size_t size, void *context)
typedef void( gearman_free_fn )(void *ptr, void *context)
typedef void( gearman_task_context_free_fn )(gearman_task_st *task, void *context)
typedef void( gearman_log_fn )(const char *line, gearman_verbose_t verbose, void *context)
typedef void( gearman_con_protocol_context_free_fn )(gearman_con_st *con, void *context)
typedef size_t( gearman_packet_pack_fn )(const gearman_packet_st *packet, gearman_con_st *con, void *data, size_t data_size, gearman_return_t *ret_ptr)
typedef size_t( gearman_packet_unpack_fn )(gearman_packet_st *packet, gearman_con_st *con, const void *data, size_t data_size, gearman_return_t *ret_ptr)

Enumerations

enum  gearman_return_t {
  GEARMAN_SUCCESS, GEARMAN_IO_WAIT, GEARMAN_SHUTDOWN, GEARMAN_SHUTDOWN_GRACEFUL,
  GEARMAN_ERRNO, GEARMAN_EVENT, GEARMAN_TOO_MANY_ARGS, GEARMAN_NO_ACTIVE_FDS,
  GEARMAN_INVALID_MAGIC, GEARMAN_INVALID_COMMAND, GEARMAN_INVALID_PACKET, GEARMAN_UNEXPECTED_PACKET,
  GEARMAN_GETADDRINFO, GEARMAN_NO_SERVERS, GEARMAN_LOST_CONNECTION, GEARMAN_MEMORY_ALLOCATION_FAILURE,
  GEARMAN_JOB_EXISTS, GEARMAN_JOB_QUEUE_FULL, GEARMAN_SERVER_ERROR, GEARMAN_WORK_ERROR,
  GEARMAN_WORK_DATA, GEARMAN_WORK_WARNING, GEARMAN_WORK_STATUS, GEARMAN_WORK_EXCEPTION,
  GEARMAN_WORK_FAIL, GEARMAN_NOT_CONNECTED, GEARMAN_COULD_NOT_CONNECT, GEARMAN_SEND_IN_PROGRESS,
  GEARMAN_RECV_IN_PROGRESS, GEARMAN_NOT_FLUSHING, GEARMAN_DATA_TOO_LARGE, GEARMAN_INVALID_FUNCTION_NAME,
  GEARMAN_INVALID_WORKER_FUNCTION, GEARMAN_NO_REGISTERED_FUNCTIONS, GEARMAN_NO_JOBS, GEARMAN_ECHO_DATA_CORRUPTION,
  GEARMAN_NEED_WORKLOAD_FN, GEARMAN_PAUSE, GEARMAN_UNKNOWN_STATE, GEARMAN_PTHREAD,
  GEARMAN_PIPE_EOF, GEARMAN_QUEUE_ERROR, GEARMAN_FLUSH_DATA, GEARMAN_SEND_BUFFER_TOO_SMALL,
  GEARMAN_IGNORE_PACKET, GEARMAN_UNKNOWN_OPTION, GEARMAN_TIMEOUT, GEARMAN_MAX_RETURN
}
enum  gearman_verbose_t {
  GEARMAN_VERBOSE_FATAL, GEARMAN_VERBOSE_ERROR, GEARMAN_VERBOSE_INFO, GEARMAN_VERBOSE_DEBUG,
  GEARMAN_VERBOSE_CRAZY, GEARMAN_VERBOSE_MAX
}

Variables

gearman_command_info_st gearman_command_info_list [GEARMAN_COMMAND_MAX]

Define Documentation

#define GEARMAN_DEFAULT_TCP_HOST   "127.0.0.1"

Definition at line 27 of file constants.h.

#define GEARMAN_DEFAULT_TCP_PORT   4730

Definition at line 28 of file constants.h.

#define GEARMAN_DEFAULT_SOCKET_TIMEOUT   10

Definition at line 29 of file constants.h.

#define GEARMAN_DEFAULT_SOCKET_SEND_SIZE   32768

Definition at line 30 of file constants.h.

#define GEARMAN_DEFAULT_SOCKET_RECV_SIZE   32768

Definition at line 31 of file constants.h.

#define GEARMAN_MAX_ERROR_SIZE   1024

Definition at line 32 of file constants.h.

#define GEARMAN_PACKET_HEADER_SIZE   12

Definition at line 33 of file constants.h.

#define GEARMAN_JOB_HANDLE_SIZE   64

Definition at line 34 of file constants.h.

#define GEARMAN_OPTION_SIZE   64

Definition at line 35 of file constants.h.

#define GEARMAN_UNIQUE_SIZE   64

Definition at line 36 of file constants.h.

#define GEARMAN_MAX_COMMAND_ARGS   8

Definition at line 37 of file constants.h.

#define GEARMAN_ARGS_BUFFER_SIZE   128

Definition at line 38 of file constants.h.

#define GEARMAN_SEND_BUFFER_SIZE   8192

Definition at line 39 of file constants.h.

#define GEARMAN_RECV_BUFFER_SIZE   8192

Definition at line 40 of file constants.h.

#define GEARMAN_WORKER_WAIT_TIMEOUT   (10 * 1000)

Definition at line 41 of file constants.h.

#define GEARMAN_LOG ( __gearman,
__verbose,
...   ) 
Value:
{ \
  if ((__gearman)->log_fn != NULL) \
  { \
    char _log_buffer[GEARMAN_MAX_ERROR_SIZE]; \
    snprintf(_log_buffer, GEARMAN_MAX_ERROR_SIZE, __VA_ARGS__); \
    (*((__gearman)->log_fn))(_log_buffer, __verbose, \
                             (void *)(__gearman)->log_context); \
  } \
}

Macro to print verbose messages.

Definition at line 95 of file common.h.

#define GEARMAN_FATAL ( __gearman,
...   )     GEARMAN_LOG(__gearman, GEARMAN_VERBOSE_FATAL, __VA_ARGS__)

Macro to log fatal errors.

Definition at line 109 of file common.h.

#define GEARMAN_ERROR ( __gearman,
...   ) 
Value:
{ \
  unlikely ((__gearman)->verbose >= GEARMAN_VERBOSE_ERROR) \
    GEARMAN_LOG(__gearman, GEARMAN_VERBOSE_ERROR, __VA_ARGS__) \
}

Macro to log errors.

Definition at line 118 of file common.h.

#define GEARMAN_INFO ( __gearman,
...   ) 
Value:
{ \
  unlikely ((__gearman)->verbose >= GEARMAN_VERBOSE_INFO) \
    GEARMAN_LOG(__gearman, GEARMAN_VERBOSE_INFO, __VA_ARGS__) \
}

Macro to log infomational messages.

Definition at line 129 of file common.h.

#define GEARMAN_DEBUG ( __gearman,
...   ) 
Value:
{ \
  unlikely ((__gearman)->verbose >= GEARMAN_VERBOSE_DEBUG) \
    GEARMAN_LOG(__gearman, GEARMAN_VERBOSE_DEBUG, __VA_ARGS__) \
}

Macro to log errors.

Definition at line 140 of file common.h.

#define GEARMAN_CRAZY ( __gearman,
...   ) 
Value:
{ \
  unlikely ((__gearman)->verbose >= GEARMAN_VERBOSE_CRAZY) \
    GEARMAN_LOG(__gearman, GEARMAN_VERBOSE_CRAZY, __VA_ARGS__) \
}

Macro to log errors.

Definition at line 151 of file common.h.

#define GEARMAN_ERROR_SET ( __gearman,
__function,
...   ) 
Value:
{ \
  if ((__gearman)->log_fn == NULL) \
  { \
    snprintf((__gearman)->last_error, GEARMAN_MAX_ERROR_SIZE, \
             __function ":" __VA_ARGS__); \
  } \
  else \
    GEARMAN_FATAL(__gearman, __function ":" __VA_ARGS__) \
}

Macro to set error string.

Definition at line 162 of file common.h.

#define GEARMAN_LIST_ADD ( __list,
__obj,
__prefix   ) 
Value:
{ \
  if (__list ## _list != NULL) \
    __list ## _list->__prefix ## prev= __obj; \
  __obj->__prefix ## next= __list ## _list; \
  __obj->__prefix ## prev= NULL; \
  __list ## _list= __obj; \
  __list ## _count++; \
}

Add an object to a list.

Definition at line 205 of file common.h.

#define GEARMAN_LIST_DEL ( __list,
__obj,
__prefix   ) 
Value:
{ \
  if (__list ## _list == __obj) \
    __list ## _list= __obj->__prefix ## next; \
  if (__obj->__prefix ## prev != NULL) \
    __obj->__prefix ## prev->__prefix ## next= __obj->__prefix ## next; \
  if (__obj->__prefix ## next != NULL) \
    __obj->__prefix ## next->__prefix ## prev= __obj->__prefix ## prev; \
  __list ## _count--; \
}

Delete an object from a list.

Definition at line 218 of file common.h.

#define GEARMAN_FIFO_ADD ( __list,
__obj,
__prefix   ) 
Value:
{ \
  if (__list ## _end == NULL) \
    __list ## _list= __obj; \
  else \
    __list ## _end->__prefix ## next= __obj; \
  __list ## _end= __obj; \
  __list ## _count++; \
}

Add an object to a fifo list.

Definition at line 232 of file common.h.

#define GEARMAN_FIFO_DEL ( __list,
__obj,
__prefix   ) 
Value:
{ \
  __list ## _list= __obj->__prefix ## next; \
  if (__list ## _list == NULL) \
    __list ## _end= NULL; \
  __list ## _count--; \
}

Delete an object from a fifo list.

Definition at line 245 of file common.h.

#define GEARMAN_HASH_ADD ( __hash,
__key,
__obj,
__prefix   ) 
Value:
{ \
  if (__hash ## _hash[__key] != NULL) \
    __hash ## _hash[__key]->__prefix ## prev= __obj; \
  __obj->__prefix ## next= __hash ## _hash[__key]; \
  __obj->__prefix ## prev= NULL; \
  __hash ## _hash[__key]= __obj; \
  __hash ## _count++; \
}

Add an object to a hash.

Definition at line 256 of file common.h.

#define GEARMAN_HASH_DEL ( __hash,
__key,
__obj,
__prefix   ) 
Value:
{ \
  if (__hash ## _hash[__key] == __obj) \
    __hash ## _hash[__key]= __obj->__prefix ## next; \
  if (__obj->__prefix ## prev != NULL) \
    __obj->__prefix ## prev->__prefix ## next= __obj->__prefix ## next; \
  if (__obj->__prefix ## next != NULL) \
    __obj->__prefix ## next->__prefix ## prev= __obj->__prefix ## prev; \
  __hash ## _count--; \
}

Delete an object from a hash.

Definition at line 269 of file common.h.


Typedef Documentation

Definition at line 394 of file constants.h.

Definition at line 395 of file constants.h.

Definition at line 396 of file constants.h.

Definition at line 397 of file constants.h.

Definition at line 398 of file constants.h.

Definition at line 399 of file constants.h.

Definition at line 400 of file constants.h.

Definition at line 401 of file constants.h.

typedef gearman_return_t( gearman_parse_server_fn)(const char *host, in_port_t port, void *context)

Definition at line 403 of file constants.h.

typedef void*( gearman_worker_fn)(gearman_job_st *job, void *context, size_t *result_size, gearman_return_t *ret_ptr)

Definition at line 407 of file constants.h.

typedef gearman_return_t( gearman_event_watch_fn)(gearman_con_st *con, short events, void *context)

Definition at line 411 of file constants.h.

typedef void*( gearman_malloc_fn)(size_t size, void *context)

Definition at line 414 of file constants.h.

typedef void( gearman_free_fn)(void *ptr, void *context)

Definition at line 415 of file constants.h.

typedef void( gearman_task_context_free_fn)(gearman_task_st *task, void *context)

Definition at line 417 of file constants.h.

typedef void( gearman_log_fn)(const char *line, gearman_verbose_t verbose, void *context)

Definition at line 420 of file constants.h.

typedef void( gearman_con_protocol_context_free_fn)(gearman_con_st *con, void *context)

Definition at line 423 of file constants.h.

typedef size_t( gearman_packet_pack_fn)(const gearman_packet_st *packet, gearman_con_st *con, void *data, size_t data_size, gearman_return_t *ret_ptr)

Definition at line 426 of file constants.h.

typedef size_t( gearman_packet_unpack_fn)(gearman_packet_st *packet, gearman_con_st *con, const void *data, size_t data_size, gearman_return_t *ret_ptr)

Definition at line 430 of file constants.h.


Enumeration Type Documentation

Return codes.

Enumerator:
GEARMAN_SUCCESS 
GEARMAN_IO_WAIT 
GEARMAN_SHUTDOWN 
GEARMAN_SHUTDOWN_GRACEFUL 
GEARMAN_ERRNO 
GEARMAN_EVENT 
GEARMAN_TOO_MANY_ARGS 
GEARMAN_NO_ACTIVE_FDS 
GEARMAN_INVALID_MAGIC 
GEARMAN_INVALID_COMMAND 
GEARMAN_INVALID_PACKET 
GEARMAN_UNEXPECTED_PACKET 
GEARMAN_GETADDRINFO 
GEARMAN_NO_SERVERS 
GEARMAN_LOST_CONNECTION 
GEARMAN_MEMORY_ALLOCATION_FAILURE 
GEARMAN_JOB_EXISTS 
GEARMAN_JOB_QUEUE_FULL 
GEARMAN_SERVER_ERROR 
GEARMAN_WORK_ERROR 
GEARMAN_WORK_DATA 
GEARMAN_WORK_WARNING 
GEARMAN_WORK_STATUS 
GEARMAN_WORK_EXCEPTION 
GEARMAN_WORK_FAIL 
GEARMAN_NOT_CONNECTED 
GEARMAN_COULD_NOT_CONNECT 
GEARMAN_SEND_IN_PROGRESS 
GEARMAN_RECV_IN_PROGRESS 
GEARMAN_NOT_FLUSHING 
GEARMAN_DATA_TOO_LARGE 
GEARMAN_INVALID_FUNCTION_NAME 
GEARMAN_INVALID_WORKER_FUNCTION 
GEARMAN_NO_REGISTERED_FUNCTIONS 
GEARMAN_NO_JOBS 
GEARMAN_ECHO_DATA_CORRUPTION 
GEARMAN_NEED_WORKLOAD_FN 
GEARMAN_PAUSE 
GEARMAN_UNKNOWN_STATE 
GEARMAN_PTHREAD 
GEARMAN_PIPE_EOF 
GEARMAN_QUEUE_ERROR 
GEARMAN_FLUSH_DATA 
GEARMAN_SEND_BUFFER_TOO_SMALL 
GEARMAN_IGNORE_PACKET 
GEARMAN_UNKNOWN_OPTION 
GEARMAN_TIMEOUT 
GEARMAN_MAX_RETURN 

Definition at line 57 of file constants.h.

Verbosity levels.

Enumerator:
GEARMAN_VERBOSE_FATAL 
GEARMAN_VERBOSE_ERROR 
GEARMAN_VERBOSE_INFO 
GEARMAN_VERBOSE_DEBUG 
GEARMAN_VERBOSE_CRAZY 
GEARMAN_VERBOSE_MAX 

Definition at line 112 of file constants.h.


Variable Documentation

Command information array.

Command info. Update GEARMAN_MAX_COMMAND_ARGS to the largest number in the args column.

Definition at line 30 of file packet.c.


Generated on Tue Oct 13 20:19:22 2009 by  doxygen 1.6.1