47774d37e641adab8138ea5eac3716fd5ea6a626
[awesomized/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 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 /* Public defines */
17 #define MEMCACHED_DEFAULT_PORT 11211
18 #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
19 #define MEMCACHED_MAX_BUFFER 8196
20 #define MEMCACHED_MAX_HOST_LENGTH 64
21 #define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */
22 #define MEMCACHED_POINTS_PER_SERVER 100
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 12
28
29 typedef enum {
30 MEMCACHED_SUCCESS,
31 MEMCACHED_FAILURE,
32 MEMCACHED_HOST_LOOKUP_FAILURE,
33 MEMCACHED_CONNECTION_FAILURE,
34 MEMCACHED_CONNECTION_BIND_FAILURE,
35 MEMCACHED_WRITE_FAILURE,
36 MEMCACHED_READ_FAILURE,
37 MEMCACHED_UNKNOWN_READ_FAILURE,
38 MEMCACHED_PROTOCOL_ERROR,
39 MEMCACHED_CLIENT_ERROR,
40 MEMCACHED_SERVER_ERROR,
41 MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE,
42 MEMCACHED_DATA_EXISTS,
43 MEMCACHED_DATA_DOES_NOT_EXIST,
44 MEMCACHED_NOTSTORED,
45 MEMCACHED_STORED,
46 MEMCACHED_NOTFOUND,
47 MEMCACHED_MEMORY_ALLOCATION_FAILURE,
48 MEMCACHED_PARTIAL_READ,
49 MEMCACHED_SOME_ERRORS,
50 MEMCACHED_NO_SERVERS,
51 MEMCACHED_END,
52 MEMCACHED_DELETED,
53 MEMCACHED_VALUE,
54 MEMCACHED_STAT,
55 MEMCACHED_ERRNO,
56 MEMCACHED_FAIL_UNIX_SOCKET,
57 MEMCACHED_NOT_SUPPORTED,
58 MEMCACHED_NO_KEY_PROVIDED,
59 MEMCACHED_FETCH_NOTFINISHED,
60 MEMCACHED_TIMEOUT,
61 MEMCACHED_BUFFERED,
62 MEMCACHED_BAD_KEY_PROVIDED,
63 MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
64 } memcached_return;
65
66 typedef enum {
67 MEMCACHED_DISTRIBUTION_MODULA,
68 MEMCACHED_DISTRIBUTION_CONSISTENT,
69 MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA
70 } memcached_server_distribution;
71
72 typedef enum {
73 MEMCACHED_BEHAVIOR_NO_BLOCK,
74 MEMCACHED_BEHAVIOR_TCP_NODELAY,
75 MEMCACHED_BEHAVIOR_HASH,
76 MEMCACHED_BEHAVIOR_KETAMA,
77 MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE,
78 MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
79 MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
80 MEMCACHED_BEHAVIOR_SUPPORT_CAS,
81 MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
82 MEMCACHED_BEHAVIOR_DISTRIBUTION,
83 MEMCACHED_BEHAVIOR_BUFFER_REQUESTS,
84 MEMCACHED_BEHAVIOR_USER_DATA,
85 MEMCACHED_BEHAVIOR_SORT_HOSTS,
86 MEMCACHED_BEHAVIOR_VERIFY_KEY,
87 MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT,
88 MEMCACHED_BEHAVIOR_RETRY_TIMEOUT,
89 MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED,
90 MEMCACHED_BEHAVIOR_KETAMA_HASH,
91 MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
92 MEMCACHED_BEHAVIOR_SND_TIMEOUT,
93 MEMCACHED_BEHAVIOR_RCV_TIMEOUT,
94 MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
95 } memcached_behavior;
96
97 typedef enum {
98 MEMCACHED_CALLBACK_PREFIX_KEY,
99 MEMCACHED_CALLBACK_USER_DATA,
100 MEMCACHED_CALLBACK_CLEANUP_FUNCTION,
101 MEMCACHED_CALLBACK_CLONE_FUNCTION,
102 MEMCACHED_CALLBACK_MALLOC_FUNCTION,
103 MEMCACHED_CALLBACK_REALLOC_FUNCTION,
104 MEMCACHED_CALLBACK_FREE_FUNCTION,
105 MEMCACHED_CALLBACK_GET_FAILURE,
106 MEMCACHED_CALLBACK_DELETE_TRIGGER
107 } memcached_callback;
108
109 typedef enum {
110 MEMCACHED_HASH_DEFAULT= 0,
111 MEMCACHED_HASH_MD5,
112 MEMCACHED_HASH_CRC,
113 MEMCACHED_HASH_FNV1_64,
114 MEMCACHED_HASH_FNV1A_64,
115 MEMCACHED_HASH_FNV1_32,
116 MEMCACHED_HASH_FNV1A_32,
117 MEMCACHED_HASH_HSIEH,
118 MEMCACHED_HASH_MURMUR,
119 MEMCACHED_HASH_JENKINS
120 } memcached_hash;
121
122 typedef enum {
123 MEMCACHED_CONNECTION_UNKNOWN,
124 MEMCACHED_CONNECTION_TCP,
125 MEMCACHED_CONNECTION_UDP,
126 MEMCACHED_CONNECTION_UNIX_SOCKET
127 } memcached_connection;
128
129 typedef enum {
130 MEMCACHED_NOT_ALLOCATED,
131 MEMCACHED_ALLOCATED,
132 MEMCACHED_USED
133 } memcached_allocated;
134
135
136 #ifdef __cplusplus
137 }
138 #endif
139
140 #endif /* __MEMCACHED_CONSTANTS_H__ */