File: function.h

package info (click to toggle)
gearmand 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,876 kB
  • ctags: 1,656
  • sloc: ansic: 17,412; sh: 10,894; makefile: 76; cpp: 9
file content (83 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* Gearman server and library
 * Copyright (C) 2008 Brian Aker, Eric Day
 * All rights reserved.
 *
 * Use and distribution licensed under the BSD license.  See
 * the COPYING file in the parent directory for full text.
 */

/**
 * @file
 * @brief Function Declarations
 */

#ifndef __GEARMAN_SERVER_FUNCTION_H__
#define __GEARMAN_SERVER_FUNCTION_H__

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @addtogroup gearman_server_function Function Declarations
 * @ingroup gearman_server
 *
 * This is a low level interface for gearman server functions. This is used
 * internally by the server interface, so you probably want to look there first.
 *
 * @{
 */

/**
 * @ingroup gearman_server_function
 */
struct gearman_server_function_st
{
  struct {
    bool allocated;
  } options;
  uint32_t worker_count;
  uint32_t job_count;
  uint32_t job_total;
  uint32_t job_running;
  uint32_t max_queue_size;
  size_t function_name_size;
  gearman_server_st *server;
  gearman_server_function_st *next;
  gearman_server_function_st *prev;
  char *function_name;
  gearman_server_worker_st *worker_list;
  gearman_server_job_st *job_list[GEARMAN_JOB_PRIORITY_MAX];
  gearman_server_job_st *job_end[GEARMAN_JOB_PRIORITY_MAX];
};

/**
 * Add a new function to a server instance.
 */
GEARMAN_API
gearman_server_function_st *
gearman_server_function_get(gearman_server_st *server,
                            const char *function_name,
                            size_t function_name_size);

/**
 * Initialize a server function structure.
 */
GEARMAN_API
gearman_server_function_st *
gearman_server_function_create(gearman_server_st *server,
                               gearman_server_function_st *function);

/**
 * Free a server function structure.
 */
GEARMAN_API
void gearman_server_function_free(gearman_server_function_st *function);

/** @} */

#ifdef __cplusplus
}
#endif

#endif /* __GEARMAN_SERVER_FUNCTION_H__ */