From: Brian Aker Date: Wed, 9 Apr 2008 16:31:12 +0000 (-0700) Subject: Fixing up final bits for release. X-Git-Tag: 0.20~1^2~20 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=acfe9c2d6b22bf010e4a81d81430830ab1763829;p=awesomized%2Flibmemcached Fixing up final bits for release. --- diff --git a/ChangeLog b/ChangeLog index ca405d1e..f17c7475 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -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!) diff --git a/libmemcached/memcached_storage.c b/libmemcached/memcached_storage.c index c9aa8722..0f6daa4e 100644 --- a/libmemcached/memcached_storage.c +++ b/libmemcached/memcached_storage.c @@ -8,6 +8,16 @@ */ #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) @@ -31,14 +41,14 @@ 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; @@ -47,6 +57,9 @@ memcached_return memcached_send(memcached_st *ptr, 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; @@ -112,3 +125,178 @@ error: 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; +} diff --git a/libmemcached/memcached_storage.h b/libmemcached/memcached_storage.h index 83d397a7..98211f6b 100644 --- a/libmemcached/memcached_storage.h +++ b/libmemcached/memcached_storage.h @@ -13,63 +13,78 @@ 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 } diff --git a/support/libmemcached.spec.in b/support/libmemcached.spec.in index b370e840..09ecebdc 100644 --- a/support/libmemcached.spec.in +++ b/support/libmemcached.spec.in @@ -52,6 +52,14 @@ memerror - Creates human readable messages from libmemecached error codes. %{_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