-0.19 Tue Apr 8 08:39:46 PDT 2008
+0.19 Wed Apr 9 09:30:53 PDT 2008
* Documentation fix in libmemcached.
* Fixed bug where sort was always occuring on hosts
* Logic fix in branch prediction (thanks Jay!)
*/
#include "common.h"
+#include "memcached_io.h"
+
+typedef enum {
+ SET_OP,
+ REPLACE_OP,
+ ADD_OP,
+ PREPEND_OP,
+ APPEND_OP,
+ CAS_OP,
+} memcached_storage_action;
/* Inline this */
static char *storage_op_string(memcached_storage_action verb)
return SET_OP;
}
-memcached_return memcached_send(memcached_st *ptr,
- char *master_key, size_t master_key_length,
- char *key, size_t key_length,
- char *value, size_t value_length,
- time_t expiration,
- uint32_t flags,
- uint64_t cas,
- memcached_storage_action verb)
+static inline memcached_return memcached_send(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags,
+ uint64_t cas,
+ memcached_storage_action verb)
{
char to_write;
size_t write_length;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
unsigned int server_key;
+ WATCHPOINT_ASSERT(!(value == NULL && value_length > 0));
+ WATCHPOINT_ASSERT(!(value && value_length == 0));
+
unlikely (key_length == 0)
return MEMCACHED_NO_KEY_PROVIDED;
return rc;
}
+
+memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_SET_START();
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, SET_OP);
+ LIBMEMCACHED_MEMCACHED_SET_END();
+ return rc;
+}
+
+memcached_return memcached_add(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_ADD_START();
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, ADD_OP);
+ LIBMEMCACHED_MEMCACHED_ADD_END();
+ return rc;
+}
+
+memcached_return memcached_replace(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_REPLACE_START();
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, REPLACE_OP);
+ LIBMEMCACHED_MEMCACHED_REPLACE_END();
+ return rc;
+}
+
+memcached_return memcached_prepend(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, PREPEND_OP);
+ return rc;
+}
+
+memcached_return memcached_append(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, APPEND_OP);
+ return rc;
+}
+
+memcached_return memcached_cas(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags,
+ uint64_t cas)
+{
+ memcached_return rc;
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, cas, CAS_OP);
+ return rc;
+}
+
+memcached_return memcached_set_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_SET_START();
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, SET_OP);
+ LIBMEMCACHED_MEMCACHED_SET_END();
+ return rc;
+}
+
+memcached_return memcached_add_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_ADD_START();
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, ADD_OP);
+ LIBMEMCACHED_MEMCACHED_ADD_END();
+ return rc;
+}
+
+memcached_return memcached_replace_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ LIBMEMCACHED_MEMCACHED_REPLACE_START();
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, REPLACE_OP);
+ LIBMEMCACHED_MEMCACHED_REPLACE_END();
+ return rc;
+}
+
+memcached_return memcached_prepend_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, PREPEND_OP);
+ return rc;
+}
+
+memcached_return memcached_append_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags)
+{
+ memcached_return rc;
+ rc= memcached_send(ptr, key, key_length,
+ key, key_length, value, value_length,
+ expiration, flags, 0, APPEND_OP);
+ return rc;
+}
+
+memcached_return memcached_cas_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags,
+ uint64_t cas)
+{
+ memcached_return rc;
+ rc= memcached_send(ptr, master_key, master_key_length,
+ key, key_length, value, value_length,
+ expiration, flags, cas, CAS_OP);
+ return rc;
+}
extern "C" {
#endif
-typedef enum {
- SET_OP,
- REPLACE_OP,
- ADD_OP,
- PREPEND_OP,
- APPEND_OP,
- CAS_OP,
-} memcached_storage_action;
-
-/* This is not available for public use. */
-memcached_return memcached_send(memcached_st *ptr,
- char *master_key, size_t master_key_length,
- char *key, size_t key_length,
- char *value, size_t value_length,
- time_t expiration,
- uint32_t flags,
- uint64_t cas,
- memcached_storage_action verb);
-
-
-/* All of the functions/macros for adding data to the server */
-
-#define memcached_set(PTR, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (KEY), (KEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, SET_OP)
-
-#define memcached_add(PTR, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (KEY), (KEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, ADD_OP)
-
-#define memcached_replace(PTR, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (KEY), (KEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, REPLACE_OP)
-
-#define memcached_prepend(PTR, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (KEY), (KEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, PREPEND_OP)
-
-#define memcached_append(PTR, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (KEY), (KEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, APPEND_OP)
-
-#define memcached_cas(PTR, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS, CAS) \
- memcached_send((PTR), (KEY), (KEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), (CAS), CAS_OP)
-
-#define memcached_set_by_key(PTR, MKEY, MKEY_LEN, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (MKEY), (MKEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, SET_OP)
-
-#define memcached_add_by_key(PTR, MKEY, MKEY_LEN, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (MKEY), (MKEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, ADD_OP)
-
-#define memcached_replace_by_key(PTR, MKEY, MKEY_LEN, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (MKEY), (MKEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, REPLACE_OP)
-
-#define memcached_prepend_by_key(PTR, MKEY, MKEY_LEN, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (MKEY), (MKEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, PREPEND_OP)
-
-#define memcached_append_by_key(PTR, MKEY, MKEY_LEN, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS) \
- memcached_send((PTR), (MKEY), (MKEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), 0, APPEND_OP)
-
-#define memcached_cas_by_key(PTR, MKEY, MKEY_LEN, KEY, KEY_LEN, VALUE, VALUE_LEN, EXP, FLAGS, CAS) \
- memcached_send((PTR), (MKEY), (MKEY_LEN), (KEY), (KEY_LEN), (VALUE), (VALUE_LEN), (EXP), (FLAGS), (CAS), CAS_OP)
+/* All of the functions for adding data to the server */
+memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+memcached_return memcached_add(memcached_st *ptr, char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+memcached_return memcached_replace(memcached_st *ptr, char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+memcached_return memcached_append(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+memcached_return memcached_prepend(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+memcached_return memcached_cas(memcached_st *ptr,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags,
+ uint64_t cas);
+
+memcached_return memcached_set_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+
+memcached_return memcached_add_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+
+memcached_return memcached_replace_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+
+memcached_return memcached_prepend_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+
+memcached_return memcached_append_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags);
+
+memcached_return memcached_cas_by_key(memcached_st *ptr,
+ char *master_key, size_t master_key_length,
+ char *key, size_t key_length,
+ char *value, size_t value_length,
+ time_t expiration,
+ uint32_t flags,
+ uint64_t cas);
#ifdef __cplusplus
}
%{_bindir}/memslap
%{_includedir}/libmemcached/memcached.h
%{_includedir}/libmemcached/memcached.hh
+%{_includedir}/libmemcached/libmemcached_config.h
+%{_includedir}/libmemcached/memcached_constants.h
+%{_includedir}/libmemcached/memcached_result.h
+%{_includedir}/libmemcached/memcached_server.h
+%{_includedir}/libmemcached/memcached_storage.h
+%{_includedir}/libmemcached/memcached_string.h
+%{_includedir}/libmemcached/memcached_types.h
+%{_includedir}/libmemcached/memcached_watchpoint.h
%{_libdir}/libmemcached.a
%{_libdir}/libmemcached.la
%{_libdir}/libmemcached.so