This is a server implementation using the gearman_server interface.
enum gearmand_wakeup_t |
Wakeup events for gearmand_st.
GEARMAND_WAKEUP_PAUSE | |
GEARMAND_WAKEUP_SHUTDOWN | |
GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL | |
GEARMAND_WAKEUP_CON | |
GEARMAND_WAKEUP_RUN |
Definition at line 48 of file constants.h.
gearmand_st* gearmand_create | ( | const char * | host, |
in_port_t | port | ||
) |
Create a server instance.
host | Host for the server to listen on. |
port | Port for the server to listen on. |
Definition at line 51 of file gearmand.c.
void gearmand_free | ( | gearmand_st * | gearmand | ) |
Free resources used by a server instace.
gearmand | Server instance structure previously initialized with gearmand_create. |
Definition at line 98 of file gearmand.c.
void gearmand_set_backlog | ( | gearmand_st * | gearmand, |
int | backlog | ||
) |
Set socket backlog for listening connection.
gearmand | Server instance structure previously initialized with gearmand_create. |
backlog | Number of backlog connections to set during listen. |
Definition at line 140 of file gearmand.c.
void gearmand_set_job_retries | ( | gearmand_st * | gearmand, |
uint8_t | job_retries | ||
) |
Set maximum job retry count.
gearmand | Server instance structure previously initialized with gearmand_create. |
job_retries | Number of job attempts. |
Definition at line 145 of file gearmand.c.
void gearmand_set_worker_wakeup | ( | gearmand_st * | gearmand, |
uint8_t | worker_wakeup | ||
) |
Set maximum number of workers to wake up per job.
gearmand | Server instance structure previously initialized with gearmand_create. |
worker_wakeup | Number of workers to wake up. |
Definition at line 150 of file gearmand.c.
void gearmand_set_threads | ( | gearmand_st * | gearmand, |
uint32_t | threads | ||
) |
Set number of I/O threads for server to use.
gearmand | Server instance structure previously initialized with gearmand_create. |
threads | Number of threads. |
Definition at line 155 of file gearmand.c.
void gearmand_set_log_fn | ( | gearmand_st * | gearmand, |
gearman_log_fn * | function, | ||
void * | context, | ||
gearman_verbose_t | verbose | ||
) |
Set logging callback for server instance.
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. |
Definition at line 160 of file gearmand.c.
gearman_return_t gearmand_port_add | ( | gearmand_st * | gearmand, |
in_port_t | port, | ||
gearman_connection_add_fn * | function | ||
) |
Add a port to listen on when starting server with optional callback.
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. |
Definition at line 169 of file gearmand.c.
gearman_return_t gearmand_run | ( | gearmand_st * | gearmand | ) |
Run the server instance.
gearmand | Server instance structure previously initialized with gearmand_create. |
Definition at line 195 of file gearmand.c.
void gearmand_wakeup | ( | gearmand_st * | gearmand, |
gearmand_wakeup_t | wakeup | ||
) |
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.
gearmand | Server instance structure previously initialized with gearmand_create. |
wakeup | Wakeup event to send to running gearmand. |
Definition at line 274 of file gearmand.c.
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.
gearmand | Server instance previously initialized |
bool | true=round robin is used, false=round robin is not used |
Definition at line 284 of file gearmand.c.