Fix for Debian linking issues.
[m6w6/libmemcached] / libmemcached / constants.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: Constants for libmemcached
9 *
10 */
11
12 #ifndef __MEMCACHED_CONSTANTS_H__
13 #define __MEMCACHED_CONSTANTS_H__
14
15 /* Public defines */
16 #define MEMCACHED_DEFAULT_PORT 11211
17 #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
18 #define MEMCACHED_MAX_BUFFER 8196
19 #define MEMCACHED_MAX_HOST_LENGTH 64
20 #define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */
21 #define MEMCACHED_POINTS_PER_SERVER 100
22 #define MEMCACHED_POINTS_PER_SERVER_KETAMA 160
23 #define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */
24 #define MEMCACHED_STRIDE 4
25 #define MEMCACHED_DEFAULT_TIMEOUT 1000
26 #define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */
27 #define MEMCACHED_PREFIX_KEY_MAX_SIZE 128
28 #define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU
29 #define MEMCACHED_VERSION_STRING_LENGTH 24
30
31
32 typedef enum {
33 MEMCACHED_SUCCESS,
34 MEMCACHED_FAILURE,
35 MEMCACHED_HOST_LOOKUP_FAILURE,
36 MEMCACHED_CONNECTION_FAILURE,
37 MEMCACHED_CONNECTION_BIND_FAILURE,
38 MEMCACHED_WRITE_FAILURE,
39 MEMCACHED_READ_FAILURE,
40 MEMCACHED_UNKNOWN_READ_FAILURE,
41 MEMCACHED_PROTOCOL_ERROR,
42 MEMCACHED_CLIENT_ERROR,
43 MEMCACHED_SERVER_ERROR,
44 MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE,
45 MEMCACHED_DATA_EXISTS,
46 MEMCACHED_DATA_DOES_NOT_EXIST,
47 MEMCACHED_NOTSTORED,
48 MEMCACHED_STORED,
49 MEMCACHED_NOTFOUND,
50 MEMCACHED_MEMORY_ALLOCATION_FAILURE,
51 MEMCACHED_PARTIAL_READ,
52 MEMCACHED_SOME_ERRORS,
53 MEMCACHED_NO_SERVERS,
54 MEMCACHED_END,
55 MEMCACHED_DELETED,
56 MEMCACHED_VALUE,
57 MEMCACHED_STAT,
58 MEMCACHED_ITEM,
59 MEMCACHED_ERRNO,
60 MEMCACHED_FAIL_UNIX_SOCKET,
61 MEMCACHED_NOT_SUPPORTED,
62 MEMCACHED_NO_KEY_PROVIDED, /* Deprecated. Use MEMCACHED_BAD_KEY_PROVIDED! */
63 MEMCACHED_FETCH_NOTFINISHED,
64 MEMCACHED_TIMEOUT,
65 MEMCACHED_BUFFERED,
66 MEMCACHED_BAD_KEY_PROVIDED,
67 MEMCACHED_INVALID_HOST_PROTOCOL,
68 MEMCACHED_SERVER_MARKED_DEAD,
69 MEMCACHED_UNKNOWN_STAT_KEY,
70 MEMCACHED_E2BIG,
71 MEMCACHED_INVALID_ARGUMENTS,
72 MEMCACHED_KEY_TOO_BIG,
73 MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
74 } memcached_return_t;
75
76
77 typedef enum {
78 MEMCACHED_DISTRIBUTION_MODULA,
79 MEMCACHED_DISTRIBUTION_CONSISTENT,
80 MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA,
81 MEMCACHED_DISTRIBUTION_RANDOM,
82 MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY,
83 MEMCACHED_DISTRIBUTION_CONSISTENT_MAX
84 } memcached_server_distribution_t;
85
86 typedef enum {
87 MEMCACHED_BEHAVIOR_NO_BLOCK,
88 MEMCACHED_BEHAVIOR_TCP_NODELAY,
89 MEMCACHED_BEHAVIOR_HASH,
90 MEMCACHED_BEHAVIOR_KETAMA,
91 MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE,
92 MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
93 MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
94 MEMCACHED_BEHAVIOR_SUPPORT_CAS,
95 MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
96 MEMCACHED_BEHAVIOR_DISTRIBUTION,
97 MEMCACHED_BEHAVIOR_BUFFER_REQUESTS,
98 MEMCACHED_BEHAVIOR_USER_DATA,
99 MEMCACHED_BEHAVIOR_SORT_HOSTS,
100 MEMCACHED_BEHAVIOR_VERIFY_KEY,
101 MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT,
102 MEMCACHED_BEHAVIOR_RETRY_TIMEOUT,
103 MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED,
104 MEMCACHED_BEHAVIOR_KETAMA_HASH,
105 MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
106 MEMCACHED_BEHAVIOR_SND_TIMEOUT,
107 MEMCACHED_BEHAVIOR_RCV_TIMEOUT,
108 MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT,
109 MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK,
110 MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK,
111 MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH,
112 MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY,
113 MEMCACHED_BEHAVIOR_NOREPLY,
114 MEMCACHED_BEHAVIOR_USE_UDP,
115 MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS,
116 MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS,
117 MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ,
118 MEMCACHED_BEHAVIOR_CORK,
119 MEMCACHED_BEHAVIOR_MAX
120 } memcached_behavior_t;
121
122 typedef enum {
123 MEMCACHED_CALLBACK_PREFIX_KEY = 0,
124 MEMCACHED_CALLBACK_USER_DATA = 1,
125 MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2,
126 MEMCACHED_CALLBACK_CLONE_FUNCTION = 3,
127 #ifdef MEMCACHED_ENABLE_DEPRECATED
128 MEMCACHED_CALLBACK_MALLOC_FUNCTION = 4,
129 MEMCACHED_CALLBACK_REALLOC_FUNCTION = 5,
130 MEMCACHED_CALLBACK_FREE_FUNCTION = 6,
131 #endif
132 MEMCACHED_CALLBACK_GET_FAILURE = 7,
133 MEMCACHED_CALLBACK_DELETE_TRIGGER = 8,
134 MEMCACHED_CALLBACK_MAX
135 } memcached_callback_t;
136
137 typedef enum {
138 MEMCACHED_HASH_DEFAULT= 0,
139 MEMCACHED_HASH_MD5,
140 MEMCACHED_HASH_CRC,
141 MEMCACHED_HASH_FNV1_64,
142 MEMCACHED_HASH_FNV1A_64,
143 MEMCACHED_HASH_FNV1_32,
144 MEMCACHED_HASH_FNV1A_32,
145 MEMCACHED_HASH_HSIEH,
146 MEMCACHED_HASH_MURMUR,
147 MEMCACHED_HASH_JENKINS,
148 MEMCACHED_HASH_CUSTOM,
149 MEMCACHED_HASH_MAX
150 } memcached_hash_t;
151
152 typedef enum {
153 MEMCACHED_CONNECTION_UNKNOWN,
154 MEMCACHED_CONNECTION_TCP,
155 MEMCACHED_CONNECTION_UDP,
156 MEMCACHED_CONNECTION_UNIX_SOCKET,
157 MEMCACHED_CONNECTION_MAX
158 } memcached_connection_t;
159
160 #endif /* __MEMCACHED_CONSTANTS_H__ */