Gearman Public API Documentation

Single Task Interface
[Client Declarations]

Functions

void * gearman_client_do (gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, size_t *result_size, gearman_return_t *ret_ptr)
void * gearman_client_do_high (gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, size_t *result_size, gearman_return_t *ret_ptr)
void * gearman_client_do_low (gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, size_t *result_size, gearman_return_t *ret_ptr)
const char * gearman_client_do_job_handle (const gearman_client_st *client)
void gearman_client_do_status (gearman_client_st *client, uint32_t *numerator, uint32_t *denominator)
gearman_return_t gearman_client_do_background (gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, char *job_handle)
gearman_return_t gearman_client_do_high_background (gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, char *job_handle)
gearman_return_t gearman_client_do_low_background (gearman_client_st *client, const char *function_name, const char *unique, const void *workload, size_t workload_size, char *job_handle)
gearman_return_t gearman_client_job_status (gearman_client_st *client, const char *job_handle, bool *is_known, bool *is_running, uint32_t *numerator, uint32_t *denominator)
gearman_return_t gearman_client_echo (gearman_client_st *client, const void *workload, size_t workload_size)

Detailed Description

Use the following set of functions to run one task at a time.

See Main Page for full details.


Function Documentation

void* gearman_client_do ( gearman_client_st client,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
size_t *  result_size,
gearman_return_t ret_ptr 
)

Run a single task and return an allocated result.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[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] result_size The size of the data being returned.
[out] ret_ptr Standard gearman return value. In the case of GEARMAN_WORK_DATA, GEARMAN_WORK_WARNING, or GEARMAN_WORK_STATUS, the caller should take any actions to handle the event and then call this function again. This may happen multiple times until a GEARMAN_WORK_ERROR, GEARMAN_WORK_FAIL, or GEARMAN_SUCCESS (work complete) is returned. For GEARMAN_WORK_DATA or GEARMAN_WORK_WARNING, the result_size will be set to the intermediate data chunk being returned and an allocated data buffer will be returned. For GEARMAN_WORK_STATUS, the caller can use gearman_client_do_status() to get the current tasks status.
Returns:
The result allocated by the library, this needs to be freed when the caller is done using it.
void* gearman_client_do_high ( gearman_client_st client,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
size_t *  result_size,
gearman_return_t ret_ptr 
)

Run a high priority task and return an allocated result. See gearman_client_do() for parameter and return information.

void* gearman_client_do_low ( gearman_client_st client,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
size_t *  result_size,
gearman_return_t ret_ptr 
)

Run a low priority task and return an allocated result. See gearman_client_do() for parameter and return information.

const char* gearman_client_do_job_handle ( const gearman_client_st client  ) 

Get the job handle for the running task. This should be used between repeated gearman_client_do() (and related) calls to get information.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
Returns:
Pointer to static buffer in the client structure that holds the job handle.
void gearman_client_do_status ( gearman_client_st client,
uint32_t *  numerator,
uint32_t *  denominator 
)

Get the status for the running task. This should be used between repeated gearman_client_do() (and related) calls to get information.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[out] numerator Optional parameter to store the numerator in.
[out] denominator Optional parameter to store the denominator in.
gearman_return_t gearman_client_do_background ( gearman_client_st client,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
char *  job_handle 
)

Run a task in the background.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[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] job_handle A buffer to store the job handle in. Must be at least GEARMAN_JOB_HANDLE_SIZE bytes long.
Returns:
Standard gearman return value.
gearman_return_t gearman_client_do_high_background ( gearman_client_st client,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
char *  job_handle 
)

Run a high priority task in the background. See gearman_client_do_background() for parameter and return information.

gearman_return_t gearman_client_do_low_background ( gearman_client_st client,
const char *  function_name,
const char *  unique,
const void *  workload,
size_t  workload_size,
char *  job_handle 
)

Run a low priority task in the background. See gearman_client_do_background() for parameter and return information.

gearman_return_t gearman_client_job_status ( gearman_client_st client,
const char *  job_handle,
bool *  is_known,
bool *  is_running,
uint32_t *  numerator,
uint32_t *  denominator 
)

Get the status for a backgound job.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] job_handle The job handle to get status for.
[out] is_known Optional parameter to store the known status in.
[out] is_running Optional parameter to store the running status in.
[out] numerator Optional parameter to store the numerator in.
[out] denominator Optional parameter to store the denominator in.
Returns:
Standard gearman return value.
gearman_return_t gearman_client_echo ( gearman_client_st client,
const void *  workload,
size_t  workload_size 
)

Send data to all job servers to see if they echo it back. This is a test function to see if the job servers are responding properly.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] workload The workload to ask the server to echo back.
[in] workload_size Size of the workload.
Returns:
Standard gearman return value.
Generated on Tue Jun 15 11:40:19 2010 by  doxygen 1.6.3