Gearman Public API Documentation

Client Interface

Modules

 Single Task Interface
 Concurrent Task Interface
 Task Management

Enumerations

enum  gearman_client_options_t {
  GEARMAN_CLIENT_ALLOCATED = (1 << 0), GEARMAN_CLIENT_NON_BLOCKING = (1 << 1), GEARMAN_CLIENT_TASK_IN_USE = (1 << 2), GEARMAN_CLIENT_UNBUFFERED_RESULT = (1 << 3),
  GEARMAN_CLIENT_NO_NEW = (1 << 4), GEARMAN_CLIENT_FREE_TASKS = (1 << 5)
}
enum  gearman_client_state_t { GEARMAN_CLIENT_STATE_IDLE, GEARMAN_CLIENT_STATE_NEW, GEARMAN_CLIENT_STATE_SUBMIT, GEARMAN_CLIENT_STATE_PACKET }

Functions

gearman_client_stgearman_client_create (gearman_client_st *client)
gearman_client_stgearman_client_clone (gearman_client_st *client, const gearman_client_st *from)
void gearman_client_free (gearman_client_st *client)
const char * gearman_client_error (const gearman_client_st *client)
int gearman_client_errno (const gearman_client_st *client)
gearman_client_options_t gearman_client_options (const gearman_client_st *client)
void gearman_client_set_options (gearman_client_st *client, gearman_client_options_t options)
void gearman_client_add_options (gearman_client_st *client, gearman_client_options_t options)
void gearman_client_remove_options (gearman_client_st *client, gearman_client_options_t options)
int gearman_client_timeout (gearman_client_st *client)
void gearman_client_set_timeout (gearman_client_st *client, int timeout)
void * gearman_client_context (const gearman_client_st *client)
void gearman_client_set_context (gearman_client_st *client, const void *context)
void gearman_client_set_log_fn (gearman_client_st *client, gearman_log_fn *function, const void *context, gearman_verbose_t verbose)
void gearman_client_set_event_watch_fn (gearman_client_st *client, gearman_event_watch_fn *function, const void *context)
void gearman_client_set_workload_malloc_fn (gearman_client_st *client, gearman_malloc_fn *function, const void *context)
void gearman_client_set_workload_free_fn (gearman_client_st *client, gearman_free_fn *function, const void *context)
gearman_return_t gearman_client_add_server (gearman_client_st *client, const char *host, in_port_t port)
gearman_return_t gearman_client_add_servers (gearman_client_st *client, const char *servers)
void gearman_client_remove_servers (gearman_client_st *client)
gearman_return_t gearman_client_wait (gearman_client_st *client)

Detailed Description

This is the interface gearman clients should use. You can run tasks one at a time or concurrently.

See Main Page for full details.


Enumeration Type Documentation

Options for gearman_client_st.

Enumerator:
GEARMAN_CLIENT_ALLOCATED 
GEARMAN_CLIENT_NON_BLOCKING 
GEARMAN_CLIENT_TASK_IN_USE 
GEARMAN_CLIENT_UNBUFFERED_RESULT 
GEARMAN_CLIENT_NO_NEW 
GEARMAN_CLIENT_FREE_TASKS 

Definition at line 312 of file constants.h.

States for gearman_client_st.

Enumerator:
GEARMAN_CLIENT_STATE_IDLE 
GEARMAN_CLIENT_STATE_NEW 
GEARMAN_CLIENT_STATE_SUBMIT 
GEARMAN_CLIENT_STATE_PACKET 

Definition at line 326 of file constants.h.


Function Documentation

gearman_client_st* gearman_client_create ( gearman_client_st client  ) 

Initialize a client structure. Always check the return value even if passing in a pre-allocated structure. Some other initialization may have failed.

Parameters:
[in] client Caller allocated structure, or NULL to allocate one.
Returns:
On success, a pointer to the (possibly allocated) structure. On failure this will be NULL.
gearman_client_st* gearman_client_clone ( gearman_client_st client,
const gearman_client_st from 
)

Clone a client structure.

Parameters:
[in] client Caller allocated structure, or NULL to allocate one.
[in] from Structure to use as a source to clone from.
Returns:
Same return as gearman_client_create().
void gearman_client_free ( gearman_client_st client  ) 

Free resources used by a client structure.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
const char* gearman_client_error ( const gearman_client_st client  ) 

See gearman_error() for details.

int gearman_client_errno ( const gearman_client_st client  ) 

See gearman_errno() for details.

gearman_client_options_t gearman_client_options ( const gearman_client_st client  ) 

Get options for a client structure.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
Returns:
Options set for the client structure.
void gearman_client_set_options ( gearman_client_st client,
gearman_client_options_t  options 
)

Set options for a client structure.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] options Available options for client structures.
void gearman_client_add_options ( gearman_client_st client,
gearman_client_options_t  options 
)

Add options for a client structure.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] options Available options for client structures.
void gearman_client_remove_options ( gearman_client_st client,
gearman_client_options_t  options 
)

Remove options for a client structure.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] options Available options for client structures.
int gearman_client_timeout ( gearman_client_st client  ) 

See gearman_timeout() for details.

void gearman_client_set_timeout ( gearman_client_st client,
int  timeout 
)

See gearman_set_timeout() for details.

void* gearman_client_context ( const gearman_client_st client  ) 

Get the application context for a client.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
Returns:
Application context that was previously set, or NULL.
void gearman_client_set_context ( gearman_client_st client,
const void *  context 
)

Set the application context for a client.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] context Application context to set.
void gearman_client_set_log_fn ( gearman_client_st client,
gearman_log_fn function,
const void *  context,
gearman_verbose_t  verbose 
)

See gearman_set_log_fn() for details.

void gearman_client_set_event_watch_fn ( gearman_client_st client,
gearman_event_watch_fn function,
const void *  context 
)

See gearman_set_event_watch_fn() for details.

void gearman_client_set_workload_malloc_fn ( gearman_client_st client,
gearman_malloc_fn function,
const void *  context 
)
void gearman_client_set_workload_free_fn ( gearman_client_st client,
gearman_free_fn function,
const void *  context 
)
gearman_return_t gearman_client_add_server ( gearman_client_st client,
const char *  host,
in_port_t  port 
)

Add a job server to a client. This goes into a list of servers that can be used to run tasks. No socket I/O happens here, it is just added to a list.

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] host Hostname or IP address (IPv4 or IPv6) of the server to add.
[in] port Port of the server to add.
Returns:
Standard gearman return value.
gearman_return_t gearman_client_add_servers ( gearman_client_st client,
const char *  servers 
)

Add a list of job servers to a client. The format for the server list is: SERVER[:PORT][,SERVER[:PORT]]... Some examples are: 10.0.0.1,10.0.0.2,10.0.0.3 localhost:1234,jobserver2.domain.com:7003,10.0.0.3

Parameters:
[in] client Structure previously initialized with gearman_client_create() or gearman_client_clone().
[in] servers Server list described above.
Returns:
Standard gearman return value.
void gearman_client_remove_servers ( gearman_client_st client  ) 

Remove all servers currently associated with the client.

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

When in non-blocking I/O mode, wait for activity from one of the servers.

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

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