Gearman Public API Documentation

Functions
Concurrent Task Interface
Client Declarations

Functions

void gearman_client_task_free_all (gearman_client_st *client)
void gearman_client_set_task_context_free_fn (gearman_client_st *client, gearman_task_context_free_fn *function)
gearman_task_stgearman_client_add_task (gearman_client_st *client, gearman_task_st *task, void *context, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)
gearman_task_stgearman_client_add_task_high (gearman_client_st *client, gearman_task_st *task, void *context, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)
gearman_task_stgearman_client_add_task_low (gearman_client_st *client, gearman_task_st *task, void *context, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)
gearman_task_stgearman_client_add_task_background (gearman_client_st *client, gearman_task_st *task, void *context, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)
gearman_task_stgearman_client_add_task_high_background (gearman_client_st *client, gearman_task_st *task, void *context, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)
gearman_task_stgearman_client_add_task_low_background (gearman_client_st *client, gearman_task_st *task, void *context, const char *function_name, const char *unique, const void *workload, size_t workload_size, gearman_return_t *ret_ptr)
gearman_task_stgearman_client_add_task_status (gearman_client_st *client, gearman_task_st *task, void *context, const char *job_handle, gearman_return_t *ret_ptr)
void gearman_client_set_workload_fn (gearman_client_st *client, gearman_workload_fn *function)
void gearman_client_set_created_fn (gearman_client_st *client, gearman_created_fn *function)
void gearman_client_set_data_fn (gearman_client_st *client, gearman_data_fn *function)
void gearman_client_set_warning_fn (gearman_client_st *client, gearman_warning_fn *function)
void gearman_client_set_status_fn (gearman_client_st *client, gearman_universal_status_fn *function)
void gearman_client_set_complete_fn (gearman_client_st *client, gearman_complete_fn *function)
void gearman_client_set_exception_fn (gearman_client_st *client, gearman_exception_fn *function)
void gearman_client_set_fail_fn (gearman_client_st *client, gearman_fail_fn *function)
void gearman_client_clear_fn (gearman_client_st *client)
gearman_return_t gearman_client_run_tasks (gearman_client_st *client)

Detailed Description

Use the following set of functions to multiple run tasks concurrently.

See Main Page for full details.


Function Documentation

void gearman_client_task_free_all ( gearman_client_st client)

Free all tasks for a gearman structure.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
void gearman_client_set_task_context_free_fn ( gearman_client_st client,
gearman_task_context_free_fn function 
)

Set function to call when tasks are being cleaned up so applications can clean up the task context.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call to clean up task context.
gearman_task_st* gearman_client_add_task ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
gearman_return_t ret_ptr 
)

Add a task to be run in parallel.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]taskCaller allocated structure, or NULL to allocate one.
[in]contextApplication context to associate with the task.
[in]function_nameThe name of the function to run.
[in]uniqueOptional unique job identifier, or NULL for a new UUID.
[in]workloadThe workload to pass to the function when it is run.
[in]workload_sizeSize of the workload.
[out]ret_ptrStandard gearman return value.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.
gearman_task_st* gearman_client_add_task_high ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
gearman_return_t ret_ptr 
)

Add a high priority task to be run in parallel. See gearman_client_add_task() for details.

gearman_task_st* gearman_client_add_task_low ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
gearman_return_t ret_ptr 
)

Add a low priority task to be run in parallel. See gearman_client_add_task() for details.

gearman_task_st* gearman_client_add_task_background ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
gearman_return_t ret_ptr 
)

Add a background task to be run in parallel. See gearman_client_add_task() for details.

gearman_task_st* gearman_client_add_task_high_background ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
gearman_return_t ret_ptr 
)

Add a high priority background task to be run in parallel. See gearman_client_add_task() for details.

gearman_task_st* gearman_client_add_task_low_background ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
gearman_return_t ret_ptr 
)

Add a low priority background task to be run in parallel. See gearman_client_add_task() for details.

gearman_task_st* gearman_client_add_task_status ( gearman_client_st client,
gearman_task_st task,
void *  context,
const char *  job_handle,
gearman_return_t ret_ptr 
)

Add task to get the status for a backgound task in parallel.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]taskCaller allocated structure, or NULL to allocate one.
[in]contextApplication context to associate with the task.
[in]job_handleThe job handle to get status for.
[out]ret_ptrStandard gearman return value.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.
void gearman_client_set_workload_fn ( gearman_client_st client,
gearman_workload_fn function 
)

Callback function when workload data needs to be sent for a task.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_created_fn ( gearman_client_st client,
gearman_created_fn function 
)

Callback function when a job has been created for a task.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_data_fn ( gearman_client_st client,
gearman_data_fn function 
)

Callback function when there is a data packet for a task.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_warning_fn ( gearman_client_st client,
gearman_warning_fn function 
)

Callback function when there is a warning packet for a task.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_status_fn ( gearman_client_st client,
gearman_universal_status_fn function 
)

Callback function when there is a status packet for a task.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_complete_fn ( gearman_client_st client,
gearman_complete_fn function 
)

Callback function when a task is complete.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_exception_fn ( gearman_client_st client,
gearman_exception_fn function 
)

Callback function when there is an exception packet for a task.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_set_fail_fn ( gearman_client_st client,
gearman_fail_fn function 
)

Callback function when a task has failed.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
[in]functionFunction to call.
void gearman_client_clear_fn ( gearman_client_st client)

Clear all task callback functions.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
gearman_return_t gearman_client_run_tasks ( gearman_client_st client)

Run tasks that have been added in parallel.

Parameters:
[in]clientStructure previously initialized with gearman_client_create() or gearman_client_clone().
Returns:
Standard gearman return value.