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_st * | gearman_client_create (gearman_client_st *client) |
gearman_client_st * | gearman_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
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.
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().
Free resources used by a client structure.
- Parameters:
-
Get options for a client structure.
- Parameters:
-
- Returns:
- Options set for the client structure.
Set options for a client structure.
- Parameters:
-
Add options for a client structure.
- Parameters:
-
Remove options for a client structure.
- Parameters:
-
Get the application context for a client.
- Parameters:
-
- Returns:
- Application context that was previously set, or NULL.
Set the application context for a client.
- Parameters:
-
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:
-
- Returns:
- Standard gearman return value.
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:
-
- Returns:
- Standard gearman return value.
Remove all servers currently associated with the client.
- Parameters:
-
When in non-blocking I/O mode, wait for activity from one of the servers.
- Parameters:
-
- Returns:
- Standard gearman return value.