Gearman Developer Documentation

Concurrent Task Interface
[Client Interface]

Functions

void gearman_task_free (gearman_task_st *task)
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, const 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, const 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, const 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, const 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, const 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, const 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, const 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_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_task_free ( gearman_task_st task  ) 

Free a task structure.

Parameters:
[in] task Structure previously initialized with one of the gearman_client_add_task() functions.

Definition at line 400 of file client.c.

void gearman_client_task_free_all ( gearman_client_st client  ) 

Free all tasks for a gearman structure.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().

Definition at line 420 of file client.c.

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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call to clean up task context.

Definition at line 426 of file client.c.

gearman_task_st* gearman_client_add_task ( gearman_client_st client,
gearman_task_st task,
const 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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] task Caller allocated structure, or NULL to allocate one.
[in] context Application context to associate with the task.
[in] function_name The name of the function to run.
[in] unique Optional unique job identifier, or NULL for a new UUID.
[in] workload The workload to pass to the function when it is run.
[in] workload_size Size of the workload.
[out] ret_ptr Standard gearman return value.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.

Definition at line 432 of file client.c.

gearman_task_st* gearman_client_add_task_high ( gearman_client_st client,
gearman_task_st task,
const 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.

Definition at line 446 of file client.c.

gearman_task_st* gearman_client_add_task_low ( gearman_client_st client,
gearman_task_st task,
const 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.

Definition at line 460 of file client.c.

gearman_task_st* gearman_client_add_task_background ( gearman_client_st client,
gearman_task_st task,
const 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.

Definition at line 474 of file client.c.

gearman_task_st* gearman_client_add_task_high_background ( gearman_client_st client,
gearman_task_st task,
const 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.

Definition at line 489 of file client.c.

gearman_task_st* gearman_client_add_task_low_background ( gearman_client_st client,
gearman_task_st task,
const 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.

Definition at line 504 of file client.c.

gearman_task_st* gearman_client_add_task_status ( gearman_client_st client,
gearman_task_st task,
const 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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] task Caller allocated structure, or NULL to allocate one.
[in] context Application context to associate with the task.
[in] job_handle The job handle to get status for.
[out] ret_ptr Standard gearman return value.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.

Definition at line 518 of file client.c.

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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 548 of file client.c.

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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 554 of file client.c.

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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 560 of file client.c.

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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 566 of file client.c.

void gearman_client_set_status_fn ( gearman_client_st client,
gearman_status_fn function 
)

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

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 572 of file client.c.

void gearman_client_set_complete_fn ( gearman_client_st client,
gearman_complete_fn function 
)

Callback function when a task is complete.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 578 of file client.c.

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] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 584 of file client.c.

void gearman_client_set_fail_fn ( gearman_client_st client,
gearman_fail_fn function 
)

Callback function when a task has failed.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] function Function to call.

Definition at line 590 of file client.c.

void gearman_client_clear_fn ( gearman_client_st client  ) 

Clear all task callback functions.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().

Definition at line 596 of file client.c.

gearman_return_t gearman_client_run_tasks ( gearman_client_st client  ) 

Run tasks that have been added in parallel.

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

Definition at line 608 of file client.c.


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