Gearman Developer Documentation

Gearmand

Data Structures

struct  gearmand_st
struct  gearmand_port_st

Modules

 Private Gearman Daemon Functions

Enumerations

enum  gearmand_options_t { GEARMAND_LISTEN_EVENT = (1 << 0), GEARMAND_WAKEUP_EVENT = (1 << 1) }
enum  gearmand_wakeup_t {
  GEARMAND_WAKEUP_PAUSE = (1 << 0), GEARMAND_WAKEUP_SHUTDOWN = (1 << 1), GEARMAND_WAKEUP_SHUTDOWN_GRACEFUL = (1 << 2), GEARMAND_WAKEUP_CON = (1 << 3),
  GEARMAND_WAKEUP_RUN = (1 << 4)
}

Functions

gearmand_stgearmand_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_threads (gearmand_st *gearmand, uint32_t threads)
void gearmand_set_log_fn (gearmand_st *gearmand, gearman_log_fn *function, const void *context, gearman_verbose_t verbose)
gearman_return_t gearmand_port_add (gearmand_st *gearmand, in_port_t port, gearman_con_add_fn *function)
gearman_return_t gearmand_run (gearmand_st *gearmand)
void gearmand_wakeup (gearmand_st *gearmand, gearmand_wakeup_t wakeup)

Detailed Description

This is a server implementation using the gearman_server interface.


Enumeration Type Documentation

Options for gearmand_st.

Enumerator:
GEARMAND_LISTEN_EVENT 
GEARMAND_WAKEUP_EVENT 

Definition at line 134 of file constants.h.

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 144 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.

Definition at line 51 of file gearmand.c.

void gearmand_free ( gearmand_st gearmand  ) 

Free resources used by a server instace.

Parameters:
gearmand Server instance structure previously initialized with gearmand_create.

Definition at line 97 of file gearmand.c.

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.

Definition at line 139 of file gearmand.c.

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.

Definition at line 144 of file gearmand.c.

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.

Definition at line 149 of file gearmand.c.

void gearmand_set_log_fn ( gearmand_st gearmand,
gearman_log_fn function,
const void *  context,
gearman_verbose_t  verbose 
)

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.

Definition at line 154 of file gearmand.c.

gearman_return_t gearmand_port_add ( gearmand_st gearmand,
in_port_t  port,
gearman_con_add_fn function 
)

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.

Definition at line 163 of file gearmand.c.

gearman_return_t gearmand_run ( gearmand_st gearmand  ) 

Run the server instance.

Parameters:
gearmand Server instance structure previously initialized with gearmand_create.
Returns:
Standard gearman return value.

Definition at line 189 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.

Parameters:
gearmand Server instance structure previously initialized with gearmand_create.
wakeup Wakeup event to send to running gearmand.

Definition at line 268 of file gearmand.c.


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