Data Structures |
struct | gearmand_port_st |
struct | gearmand_st |
Modules |
| Connection Declarations |
| Thread Declarations |
Enumerations |
enum | gearmand_wakeup_t {
GEARMAND_WAKEUP_PAUSE,
GEARMAND_WAKEUP_SHUTDOWN,
GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL,
GEARMAND_WAKEUP_CON,
GEARMAND_WAKEUP_RUN
} |
Functions |
gearmand_st * | gearmand_create (const char *host, in_port_t port) |
void | gearmand_free (gearmand_st *gearmand) |
void | gearmand_set_backlog (gearmand_st *gearmand, int backlog) |
void | gearmand_set_job_retries (gearmand_st *gearmand, uint8_t job_retries) |
void | gearmand_set_worker_wakeup (gearmand_st *gearmand, uint8_t worker_wakeup) |
void | gearmand_set_threads (gearmand_st *gearmand, uint32_t threads) |
void | gearmand_set_log_fn (gearmand_st *gearmand, gearman_log_fn *function, void *context, gearman_verbose_t verbose) |
gearman_return_t | gearmand_port_add (gearmand_st *gearmand, in_port_t port, gearman_connection_add_fn *function) |
gearman_return_t | gearmand_run (gearmand_st *gearmand) |
void | gearmand_wakeup (gearmand_st *gearmand, gearmand_wakeup_t wakeup) |
void | gearmand_set_round_robin (gearmand_st *gearmand, bool round_robin) |
Detailed Description
This is a server implementation using the gearman_server interface.
Enumeration Type Documentation
Wakeup events for gearmand_st.
- Enumerator:
GEARMAND_WAKEUP_PAUSE |
|
GEARMAND_WAKEUP_SHUTDOWN |
|
GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL |
|
GEARMAND_WAKEUP_CON |
|
GEARMAND_WAKEUP_RUN |
|
Definition at line 48 of file constants.h.
Function Documentation
gearmand_st* gearmand_create |
( |
const char * |
host, |
|
|
in_port_t |
port |
|
) |
| |
Create a server instance.
- Parameters:
-
host | Host for the server to listen on. |
port | Port for the server to listen on. |
- Returns:
- Pointer to an allocated gearmand structure.
Free resources used by a server instace.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
void gearmand_set_backlog |
( |
gearmand_st * |
gearmand, |
|
|
int |
backlog |
|
) |
| |
Set socket backlog for listening connection.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
backlog | Number of backlog connections to set during listen. |
void gearmand_set_job_retries |
( |
gearmand_st * |
gearmand, |
|
|
uint8_t |
job_retries |
|
) |
| |
Set maximum job retry count.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
job_retries | Number of job attempts. |
void gearmand_set_worker_wakeup |
( |
gearmand_st * |
gearmand, |
|
|
uint8_t |
worker_wakeup |
|
) |
| |
Set maximum number of workers to wake up per job.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
worker_wakeup | Number of workers to wake up. |
void gearmand_set_threads |
( |
gearmand_st * |
gearmand, |
|
|
uint32_t |
threads |
|
) |
| |
Set number of I/O threads for server to use.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
threads | Number of threads. |
Set logging callback for server instance.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
function | Function to call when there is a logging message. |
context | Argument to pass into the log callback function. |
verbose | Verbosity level. |
Add a port to listen on when starting server with optional callback.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
port | Port for the server to listen on. |
function | Optional callback function that is called when a connection has been accepted on the given port. |
- Returns:
- Standard gearman return value.
Run the server instance.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
- Returns:
- Standard gearman return value.
Interrupt a running gearmand server from another thread. You should only call this when another thread is currently running gearmand_run() and you want to wakeup the server with the given event.
- Parameters:
-
gearmand | Server instance structure previously initialized with gearmand_create. |
wakeup | Wakeup event to send to running gearmand. |
void gearmand_set_round_robin |
( |
gearmand_st * |
gearmand, |
|
|
bool |
round_robin |
|
) |
| |
Sets the round-robin mode on the server object. RR will distribute work fairly among every function assigned to a worker, instead of draining each function before moving on to the next.
- Parameters:
-
gearmand | Server instance previously initialized |
bool | true=round robin is used, false=round robin is not used |