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