First merge of Trond's patches (cherry picking).
[m6w6/libmemcached] / libmemcached / memcached_constants.h
index 5fdede9a765923ddc6b428f7732078ca1ced2c24..cbdbf4b58467c82b89c6c2ffd6b21688b35bbf48 100644 (file)
@@ -1,18 +1,17 @@
-/*
- * Summary: Constants for libmemcached
+/* LibMemcached
+ * Copyright (C) 2006-2009 Brian Aker 
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license.  See
+ * the COPYING file in the parent directory for full text.
  *
- * Copy: See Copyright for the status of this software.
+ * Summary: Constants for libmemcached
  *
- * Author: Brian Aker
  */
 
 #ifndef __MEMCACHED_CONSTANTS_H__
 #define __MEMCACHED_CONSTANTS_H__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Public defines */
 #define MEMCACHED_DEFAULT_PORT 11211
 #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
@@ -21,7 +20,7 @@ extern "C" {
 #define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */
 #define MEMCACHED_POINTS_PER_SERVER 100
 #define MEMCACHED_POINTS_PER_SERVER_KETAMA 160
-#define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */ 
+#define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */
 #define MEMCACHED_STRIDE 4
 #define MEMCACHED_DEFAULT_TIMEOUT 1000
 #define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */
@@ -66,15 +65,19 @@ typedef enum {
   MEMCACHED_INVALID_HOST_PROTOCOL,
   MEMCACHED_SERVER_MARKED_DEAD,
   MEMCACHED_UNKNOWN_STAT_KEY,
+  MEMCACHED_E2BIG,
+  MEMCACHED_INVALID_ARGUMENTS,
   MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
-} memcached_return;
+} memcached_return_t;
+
 
 typedef enum {
   MEMCACHED_DISTRIBUTION_MODULA,
   MEMCACHED_DISTRIBUTION_CONSISTENT,
   MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA,
-  MEMCACHED_DISTRIBUTION_RANDOM
-} memcached_server_distribution;
+  MEMCACHED_DISTRIBUTION_RANDOM,
+  MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY
+} memcached_server_distribution_t;
 
 typedef enum {
   MEMCACHED_BEHAVIOR_NO_BLOCK,
@@ -106,20 +109,27 @@ typedef enum {
   MEMCACHED_BEHAVIOR_NOREPLY,
   MEMCACHED_BEHAVIOR_USE_UDP,
   MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS,
-  MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS
-} memcached_behavior;
+  MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS,
+  MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE,
+  MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ
+} memcached_behavior_t;
+
+#define MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED 0
+#define MEMCACHED_KETAMA_COMPAT_SPY 1
 
 typedef enum {
-  MEMCACHED_CALLBACK_PREFIX_KEY,
-  MEMCACHED_CALLBACK_USER_DATA,
-  MEMCACHED_CALLBACK_CLEANUP_FUNCTION,
-  MEMCACHED_CALLBACK_CLONE_FUNCTION,
-  MEMCACHED_CALLBACK_MALLOC_FUNCTION,
-  MEMCACHED_CALLBACK_REALLOC_FUNCTION,
-  MEMCACHED_CALLBACK_FREE_FUNCTION,
-  MEMCACHED_CALLBACK_GET_FAILURE,
-  MEMCACHED_CALLBACK_DELETE_TRIGGER
-} memcached_callback;
+  MEMCACHED_CALLBACK_PREFIX_KEY = 0,
+  MEMCACHED_CALLBACK_USER_DATA = 1,
+  MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2,
+  MEMCACHED_CALLBACK_CLONE_FUNCTION = 3,
+#ifdef MEMCACHED_ENABLE_DEPRECATED
+  MEMCACHED_CALLBACK_MALLOC_FUNCTION = 4,
+  MEMCACHED_CALLBACK_REALLOC_FUNCTION = 5,
+  MEMCACHED_CALLBACK_FREE_FUNCTION = 6,
+#endif
+  MEMCACHED_CALLBACK_GET_FAILURE = 7,
+  MEMCACHED_CALLBACK_DELETE_TRIGGER = 8
+} memcached_callback_t;
 
 typedef enum {
   MEMCACHED_HASH_DEFAULT= 0,
@@ -132,17 +142,13 @@ typedef enum {
   MEMCACHED_HASH_HSIEH,
   MEMCACHED_HASH_MURMUR,
   MEMCACHED_HASH_JENKINS
-} memcached_hash;
+} memcached_hash_t;
 
 typedef enum {
   MEMCACHED_CONNECTION_UNKNOWN,
   MEMCACHED_CONNECTION_TCP,
   MEMCACHED_CONNECTION_UDP,
   MEMCACHED_CONNECTION_UNIX_SOCKET
-} memcached_connection;
-
-#ifdef __cplusplus
-}
-#endif
+} memcached_connection_t;
 
 #endif /* __MEMCACHED_CONSTANTS_H__ */