2 * Summary: String structure used for libmemcached.
4 * Copy: See Copyright for the status of this software.
9 #ifndef __MEMCACHED_SERVER_H__
10 #define __MEMCACHED_SERVER_H__
16 struct memcached_server_st
{
20 unsigned int cursor_active
;
24 uint32_t io_bytes_sent
; /* # bytes sent since last read */
25 uint32_t server_failure_counter
;
27 uint8_t major_version
;
28 uint8_t micro_version
;
29 uint8_t minor_version
;
30 memcached_connection type
;
32 size_t read_buffer_length
;
33 size_t read_data_length
;
34 size_t write_buffer_offset
;
35 struct addrinfo
*address_info
;
38 uint64_t limit_maxbytes
;
39 char read_buffer
[MEMCACHED_MAX_BUFFER
];
40 char write_buffer
[MEMCACHED_MAX_BUFFER
];
41 char hostname
[MEMCACHED_MAX_HOST_LENGTH
];
44 #define memcached_server_count(A) (A)->number_of_hosts
45 #define memcached_server_name(A,B) (B).hostname
46 #define memcached_server_port(A,B) (B).port
47 #define memcached_server_list(A) (A)->hosts
48 #define memcached_server_response_count(A) (A)->cursor_active
51 memcached_return
memcached_server_cursor(memcached_st
*ptr
,
52 memcached_server_function
*callback
,
54 unsigned int number_of_callbacks
);
57 memcached_server_st
*memcached_server_by_key(memcached_st
*ptr
, const char *key
,
58 size_t key_length
, memcached_return
*error
);
60 /* These should not currently be used by end users */
61 /* TODO: Is the above comment valid? If so, how can we unit test these if they
62 * aren't exported. If not, we should remove the comment */
64 memcached_server_st
*memcached_server_create(memcached_st
*memc
, memcached_server_st
*ptr
);
67 memcached_server_st
*memcached_server_create_with(memcached_st
*memc
, memcached_server_st
*host
,
68 const char *hostname
, unsigned int port
,
69 uint32_t weight
, memcached_connection type
);
72 void memcached_server_free(memcached_server_st
*ptr
);
74 memcached_server_st
*memcached_server_clone(memcached_server_st
*clone
, memcached_server_st
*ptr
);
76 memcached_analysis_st
*memcached_analyze(memcached_st
*memc
, memcached_stat_st
*memc_stat
,
77 memcached_return
*error
);
80 memcached_return
memcached_server_remove(memcached_server_st
*st_ptr
);
86 #endif /* __MEMCACHED_SERVER_H__ */