237ff54d1a7c76ccc823d9f85154eb6ad56fe44b
[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 #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_WHEEL_SIZE 1024
23 #define MEMCACHED_POINTS_PER_SERVER 100
24 #define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */
25 #define MEMCACHED_STRIDE 4
26 #define MEMCACHED_DEFAULT_TIMEOUT INT32_MAX
27
28 typedef enum {
29 MEMCACHED_SUCCESS,
30 MEMCACHED_FAILURE,
31 MEMCACHED_HOST_LOOKUP_FAILURE,
32 MEMCACHED_CONNECTION_FAILURE,
33 MEMCACHED_CONNECTION_BIND_FAILURE,
34 MEMCACHED_WRITE_FAILURE,
35 MEMCACHED_READ_FAILURE,
36 MEMCACHED_UNKNOWN_READ_FAILURE,
37 MEMCACHED_PROTOCOL_ERROR,
38 MEMCACHED_CLIENT_ERROR,
39 MEMCACHED_SERVER_ERROR,
40 MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE,
41 MEMCACHED_DATA_EXISTS,
42 MEMCACHED_DATA_DOES_NOT_EXIST,
43 MEMCACHED_NOTSTORED,
44 MEMCACHED_STORED,
45 MEMCACHED_NOTFOUND,
46 MEMCACHED_MEMORY_ALLOCATION_FAILURE,
47 MEMCACHED_PARTIAL_READ,
48 MEMCACHED_SOME_ERRORS,
49 MEMCACHED_NO_SERVERS,
50 MEMCACHED_END,
51 MEMCACHED_DELETED,
52 MEMCACHED_VALUE,
53 MEMCACHED_STAT,
54 MEMCACHED_ERRNO,
55 MEMCACHED_FAIL_UNIX_SOCKET,
56 MEMCACHED_NOT_SUPPORTED,
57 MEMCACHED_NO_KEY_PROVIDED,
58 MEMCACHED_FETCH_NOTFINISHED,
59 MEMCACHED_TIMEOUT,
60 MEMCACHED_BUFFERED,
61 MEMCACHED_BAD_KEY_PROVIDED,
62 MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */
63 } memcached_return;
64
65 typedef enum {
66 MEMCACHED_DISTRIBUTION_MODULA,
67 MEMCACHED_DISTRIBUTION_CONSISTENT,
68 MEMCACHED_DISTRIBUTION_CONSISTENT_WHEEL,
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;
90
91 typedef enum {
92 MEMCACHED_CALLBACK_USER_DATA,
93 MEMCACHED_CALLBACK_CLEANUP_FUNCTION,
94 MEMCACHED_CALLBACK_CLONE_FUNCTION,
95 MEMCACHED_CALLBACK_MALLOC_FUNCTION,
96 MEMCACHED_CALLBACK_REALLOC_FUNCTION,
97 MEMCACHED_CALLBACK_FREE_FUNCTION,
98 MEMCACHED_CALLBACK_GET_FAILURE,
99 MEMCACHED_CALLBACK_DELETE_TRIGGER,
100 } memcached_callback;
101
102 typedef enum {
103 MEMCACHED_HASH_DEFAULT= 0,
104 MEMCACHED_HASH_MD5,
105 MEMCACHED_HASH_CRC,
106 MEMCACHED_HASH_FNV1_64,
107 MEMCACHED_HASH_FNV1A_64,
108 MEMCACHED_HASH_FNV1_32,
109 MEMCACHED_HASH_FNV1A_32,
110 MEMCACHED_HASH_KETAMA,
111 MEMCACHED_HASH_HSIEH,
112 MEMCACHED_HASH_MURMUR,
113 } memcached_hash;
114
115 typedef enum {
116 MEMCACHED_CONNECTION_UNKNOWN,
117 MEMCACHED_CONNECTION_TCP,
118 MEMCACHED_CONNECTION_UDP,
119 MEMCACHED_CONNECTION_UNIX_SOCKET,
120 } memcached_connection;
121
122 typedef enum {
123 MEMCACHED_NOT_ALLOCATED,
124 MEMCACHED_ALLOCATED,
125 MEMCACHED_USED,
126 } memcached_allocated;
127
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif /* __MEMCACHED_CONSTANTS_H__ */