Ignore *.exe
[awesomized/libmemcached] / libmemcached / server.h
1 /* LibMemcached
2 * Copyright (C) 2006-2009 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 *
8 * Summary: String structure used for libmemcached.
9 *
10 */
11
12 #ifndef __LIBMEMCACHED_SERVER_H__
13 #define __LIBMEMCACHED_SERVER_H__
14
15
16 struct memcached_server_st {
17 struct {
18 bool is_allocated:1;
19 bool is_initialized:1;
20 bool sockaddr_inited:1;
21 bool is_shutting_down:1;
22 } options;
23 uint32_t number_of_hosts;
24 uint32_t cursor_active;
25 in_port_t port;
26 int cached_errno;
27 memcached_socket_t fd;
28 uint32_t io_bytes_sent; /* # bytes sent since last read */
29 uint32_t server_failure_counter;
30 uint32_t weight;
31 struct { // Place any "state" sort variables in here.
32 bool is_corked:1;
33 bool is_dead:1;
34 } state;
35 struct {
36 uint32_t read;
37 uint32_t write;
38 } io_wait_count;
39 uint8_t major_version;
40 uint8_t micro_version;
41 uint8_t minor_version;
42 memcached_connection_t type;
43 char *read_ptr;
44 char *cached_server_error;
45 size_t read_buffer_length;
46 size_t read_data_length;
47 size_t write_buffer_offset;
48 struct addrinfo *address_info;
49 time_t next_retry;
50 const memcached_st *root;
51 uint64_t limit_maxbytes;
52 char read_buffer[MEMCACHED_MAX_BUFFER];
53 char write_buffer[MEMCACHED_MAX_BUFFER];
54 char hostname[NI_MAXHOST];
55 };
56
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 LIBMEMCACHED_API
63 memcached_return_t memcached_server_cursor(const memcached_st *ptr,
64 const memcached_server_fn *callback,
65 void *context,
66 uint32_t number_of_callbacks);
67
68 LIBMEMCACHED_API
69 memcached_server_instance_st memcached_server_by_key(const memcached_st *ptr,
70 const char *key,
71 size_t key_length,
72 memcached_return_t *error);
73
74 LIBMEMCACHED_API
75 void memcached_server_error_reset(memcached_server_st *ptr);
76
77 LIBMEMCACHED_API
78 void memcached_server_free(memcached_server_st *ptr);
79
80 LIBMEMCACHED_LOCAL
81 memcached_server_st *memcached_server_clone(memcached_server_st *destination,
82 const memcached_server_st *source);
83
84 LIBMEMCACHED_API
85 memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *ptr);
86
87
88 LIBMEMCACHED_API
89 memcached_return_t memcached_server_add_udp(memcached_st *ptr,
90 const char *hostname,
91 in_port_t port);
92 LIBMEMCACHED_API
93 memcached_return_t memcached_server_add_unix_socket(memcached_st *ptr,
94 const char *filename);
95 LIBMEMCACHED_API
96 memcached_return_t memcached_server_add(memcached_st *ptr,
97 const char *hostname, in_port_t port);
98
99 LIBMEMCACHED_API
100 memcached_return_t memcached_server_add_udp_with_weight(memcached_st *ptr,
101 const char *hostname,
102 in_port_t port,
103 uint32_t weight);
104 LIBMEMCACHED_API
105 memcached_return_t memcached_server_add_unix_socket_with_weight(memcached_st *ptr,
106 const char *filename,
107 uint32_t weight);
108 LIBMEMCACHED_API
109 memcached_return_t memcached_server_add_with_weight(memcached_st *ptr, const char *hostname,
110 in_port_t port,
111 uint32_t weight);
112
113 /**
114 Operations on Single Servers.
115 */
116 LIBMEMCACHED_API
117 uint32_t memcached_server_response_count(memcached_server_instance_st self);
118
119 LIBMEMCACHED_API
120 const char *memcached_server_name(memcached_server_instance_st self);
121
122 LIBMEMCACHED_API
123 in_port_t memcached_server_port(memcached_server_instance_st self);
124
125 LIBMEMCACHED_API
126 const char *memcached_server_error(memcached_server_instance_st ptr);
127
128
129
130 #ifdef __cplusplus
131 } // extern "C"
132 #endif
133
134 #endif /* __LIBMEMCACHED_SERVER_H__ */