~clint-fewbar/ubuntu/precise/gearmand/drop-unneeded-patches

« back to all changes in this revision

Viewing changes to libgearman-server/server.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2009-09-28 21:43:31 UTC
  • mto: (1.2.3 upstream) (6.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20090928214331-9bku0d3v1b1ypgp4
ImportĀ upstreamĀ versionĀ 0.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * @brief Gearman Server Declarations
12
12
 */
13
13
 
14
 
#include <libgearman-server/struct/server.h>
 
14
#ifndef __GEARMAN_SERVER_H__
 
15
#define __GEARMAN_SERVER_H__
15
16
 
16
 
#pragma once
 
17
#include <libgearman/gearman.h>
 
18
#include <libgearman-server/constants.h>
 
19
#include <libgearman-server/structs.h>
 
20
#include <libgearman-server/conf.h>
 
21
#include <libgearman-server/conf_module.h>
 
22
#include <libgearman-server/conn.h>
 
23
#include <libgearman-server/packet.h>
 
24
#include <libgearman-server/function.h>
 
25
#include <libgearman-server/client.h>
 
26
#include <libgearman-server/worker.h>
 
27
#include <libgearman-server/job.h>
 
28
#include <libgearman-server/thread.h>
17
29
 
18
30
#ifdef __cplusplus
19
31
extern "C" {
20
32
#endif
21
33
 
22
 
#include <pthread.h>
23
 
 
24
 
inline static void gearmand_set_round_robin(gearman_server_st *server, bool round_robin)
25
 
{
26
 
  server->flags.round_robin= round_robin;
27
 
}
 
34
/**
 
35
 * @addtogroup gearman_server Server Interface
 
36
 * This is the interface gearman servers should use.
 
37
 * @{
 
38
 */
 
39
 
 
40
/**
 
41
 * Initialize a server structure. This cannot fail if the caller supplies a
 
42
 * server structure.
 
43
 * @param server Caller allocated server structure, or NULL to allocate one.
 
44
 * @return Pointer to an allocated server structure if server parameter was
 
45
 *         NULL, or the server parameter pointer if it was not NULL.
 
46
 */
 
47
GEARMAN_API
 
48
gearman_server_st *gearman_server_create(gearman_server_st *server);
 
49
 
 
50
/**
 
51
 * Free resources used by a server structure.
 
52
 * @param server Server structure previously initialized with
 
53
 *        gearman_server_create.
 
54
 */
 
55
GEARMAN_API
 
56
void gearman_server_free(gearman_server_st *server);
 
57
 
 
58
/**
 
59
 * Set maximum job retry count.
 
60
 * @param server Server structure previously initialized with
 
61
 *        gearman_server_create.
 
62
 * @param job_retries Number of job attempts.
 
63
 */
 
64
GEARMAN_API
 
65
void gearman_server_set_job_retries(gearman_server_st *server,
 
66
                                    uint8_t job_retries);
 
67
 
 
68
/**
 
69
 * Set logging callback for server instance.
 
70
 * @param server Server structure previously initialized with
 
71
 *        gearman_server_create.
 
72
 * @param function Function to call when there is a logging message.
 
73
 * @param context Argument to pass into the log callback function.
 
74
 * @param verbose Verbosity level.
 
75
 */
 
76
GEARMAN_API
 
77
void gearman_server_set_log_fn(gearman_server_st *server,
 
78
                               gearman_log_fn *function,
 
79
                               const void *context, gearman_verbose_t verbose);
28
80
 
29
81
/**
30
82
 * Process commands for a connection.
33
85
 * @return Standard gearman return value.
34
86
 */
35
87
GEARMAN_API
36
 
gearmand_error_t gearman_server_run_command(gearman_server_con_st *server_con,
37
 
                                            gearmand_packet_st *packet);
 
88
gearman_return_t gearman_server_run_command(gearman_server_con_st *server_con,
 
89
                                            gearman_packet_st *packet);
38
90
 
39
91
/**
40
92
 * Tell server that it should enter a graceful shutdown state.
44
96
 *         the server is ready to shutdown now.
45
97
 */
46
98
GEARMAN_API
47
 
gearmand_error_t gearman_server_shutdown_graceful(gearman_server_st *server);
 
99
gearman_return_t gearman_server_shutdown_graceful(gearman_server_st *server);
48
100
 
49
101
/**
50
102
 * Replay the persistent queue to load all unfinshed jobs into the server. This
55
107
 *         the server is ready to shutdown now.
56
108
 */
57
109
GEARMAN_API
58
 
gearmand_error_t gearman_server_queue_replay(gearman_server_st *server);
 
110
gearman_return_t gearman_server_queue_replay(gearman_server_st *server);
59
111
 
60
112
/**
61
113
 * Get persistent queue context.
68
120
 * functions.
69
121
 */
70
122
GEARMAN_API
71
 
void gearman_server_set_queue(gearman_server_st *server,
72
 
                              void *context,
73
 
                              gearman_queue_add_fn *add,
74
 
                              gearman_queue_flush_fn *flush,
75
 
                              gearman_queue_done_fn *done,
76
 
                              gearman_queue_replay_fn *replay);
 
123
void gearman_server_set_queue_context(gearman_server_st *server,
 
124
                                      const void *context);
 
125
 
 
126
/**
 
127
 * Set function to call when jobs need to be stored in the persistent queue.
 
128
 */
 
129
GEARMAN_API
 
130
void gearman_server_set_queue_add_fn(gearman_server_st *server,
 
131
                                     gearman_queue_add_fn *function);
 
132
 
 
133
/**
 
134
 * Set function to call when the persistent queue should be flushed to disk.
 
135
 */
 
136
GEARMAN_API
 
137
void gearman_server_set_queue_flush_fn(gearman_server_st *server,
 
138
                                       gearman_queue_flush_fn *function);
 
139
 
 
140
/**
 
141
 * Set function to call when a job should be removed from the persistent queue.
 
142
 */
 
143
GEARMAN_API
 
144
void gearman_server_set_queue_done_fn(gearman_server_st *server,
 
145
                                      gearman_queue_done_fn *function);
 
146
 
 
147
/**
 
148
 * Set function to call when jobs in the persistent queue should be replayed
 
149
 * after a restart.
 
150
 */
 
151
GEARMAN_API
 
152
void gearman_server_set_queue_replay_fn(gearman_server_st *server,
 
153
                                        gearman_queue_replay_fn *function);
77
154
 
78
155
/** @} */
79
156
 
80
157
#ifdef __cplusplus
81
158
}
82
159
#endif
 
160
 
 
161
#endif /* __GEARMAN_SERVER_H__ */