Gearman Public API Documentation

Gearman Server Declarations

Data Structures

struct  gearman_server_st

Modules

 Constants
 Types
 Protocol Plugins
 Queue Plugins
 Client Declarations
 Configuration Declarations
 Configuration Module Declarations
 Function Declarations
 Job Declarations
 Packet Declarations
 Thread Declarations
 Worker Declarations

Functions

gearman_server_stgearman_server_create (gearman_server_st *server)
void gearman_server_free (gearman_server_st *server)
void gearman_server_set_job_retries (gearman_server_st *server, uint8_t job_retries)
void gearman_server_set_worker_wakeup (gearman_server_st *server, uint8_t worker_wakeup)
void gearman_server_set_log_fn (gearman_server_st *server, gearman_log_fn *function, void *context, gearman_verbose_t verbose)
gearman_return_t gearman_server_run_command (gearman_server_con_st *server_con, gearman_packet_st *packet)
gearman_return_t gearman_server_shutdown_graceful (gearman_server_st *server)
gearman_return_t gearman_server_queue_replay (gearman_server_st *server)
void * gearman_server_queue_context (const gearman_server_st *server)
void gearman_server_set_queue_context (gearman_server_st *server, void *context)
void gearman_server_set_queue_add_fn (gearman_server_st *server, gearman_queue_add_fn *function)
void gearman_server_set_queue_flush_fn (gearman_server_st *server, gearman_queue_flush_fn *function)
void gearman_server_set_queue_done_fn (gearman_server_st *server, gearman_queue_done_fn *function)
void gearman_server_set_queue_replay_fn (gearman_server_st *server, gearman_queue_replay_fn *function)

Detailed Description

This is the interface gearman servers should use.


Function Documentation

gearman_server_st* gearman_server_create ( gearman_server_st server  ) 

Initialize a server structure. This cannot fail if the caller supplies a server structure.

Parameters:
server Caller allocated server structure, or NULL to allocate one.
Returns:
Pointer to an allocated server structure if server parameter was NULL, or the server parameter pointer if it was not NULL.
void gearman_server_free ( gearman_server_st server  ) 

Free resources used by a server structure.

Parameters:
server Server structure previously initialized with gearman_server_create.
void gearman_server_set_job_retries ( gearman_server_st server,
uint8_t  job_retries 
)

Set maximum job retry count.

Parameters:
server Server structure previously initialized with gearman_server_create.
job_retries Number of job attempts.
void gearman_server_set_worker_wakeup ( gearman_server_st server,
uint8_t  worker_wakeup 
)

Set maximum number of workers to wake up per job.

Parameters:
server Server structure previously initialized with gearman_server_create.
worker_wakeup Number of workers to wake up.
void gearman_server_set_log_fn ( gearman_server_st server,
gearman_log_fn function,
void *  context,
gearman_verbose_t  verbose 
)

Set logging callback for server instance.

Parameters:
server Server structure previously initialized with gearman_server_create.
function Function to call when there is a logging message.
context Argument to pass into the log callback function.
verbose Verbosity level.
gearman_return_t gearman_server_run_command ( gearman_server_con_st server_con,
gearman_packet_st packet 
)

Process commands for a connection.

Parameters:
server_con Server connection that has a packet to process.
packet The packet that needs processing.
Returns:
Standard gearman return value.
gearman_return_t gearman_server_shutdown_graceful ( gearman_server_st server  ) 

Tell server that it should enter a graceful shutdown state.

Parameters:
server Server structure previously initialized with gearman_server_create.
Returns:
Standard gearman return value. This will return GEARMAN_SHUTDOWN if the server is ready to shutdown now.
gearman_return_t gearman_server_queue_replay ( gearman_server_st server  ) 

Replay the persistent queue to load all unfinshed jobs into the server. This should only be run at startup.

Parameters:
server Server structure previously initialized with gearman_server_create.
Returns:
Standard gearman return value. This will return GEARMAN_SHUTDOWN if the server is ready to shutdown now.
void* gearman_server_queue_context ( const gearman_server_st server  ) 

Get persistent queue context.

void gearman_server_set_queue_context ( gearman_server_st server,
void *  context 
)

Set persistent queue context that will be passed back to all queue callback functions.

void gearman_server_set_queue_add_fn ( gearman_server_st server,
gearman_queue_add_fn function 
)

Set function to call when jobs need to be stored in the persistent queue.

void gearman_server_set_queue_flush_fn ( gearman_server_st server,
gearman_queue_flush_fn function 
)

Set function to call when the persistent queue should be flushed to disk.

void gearman_server_set_queue_done_fn ( gearman_server_st server,
gearman_queue_done_fn function 
)

Set function to call when a job should be removed from the persistent queue.

void gearman_server_set_queue_replay_fn ( gearman_server_st server,
gearman_queue_replay_fn function 
)

Set function to call when jobs in the persistent queue should be replayed after a restart.

Generated on Mon Jun 14 15:58:44 2010 by  doxygen 1.6.3