AC_CHECK_HEADERS([sasl/sasl.h])
AC_CHECK_HEADERS([execinfo.h])
AC_CHECK_HEADERS([cxxabi.h],
- AC_DEFINE([HAVE_CXXABI_H], [1], [Have cxxabi.h]),
- AC_DEFINE([HAVE_CXXABI_H], [0], [Have cxxabi.h]))
+ AC_DEFINE([HAVE_CXXABI_H], [1], [Have cxxabi.h]),
+ AC_DEFINE([HAVE_CXXABI_H], [0], [Have cxxabi.h]))
+
+AX_COMPILER_VENDOR
AC_CXX_HEADER_STDCXX_98
+AX_TLS
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
AC_CHECK_LIB([rt], [clock_gettime],
[
- rt_lib="-lrt"
+ RT_LIB="-lrt"
+ AC_SUBST(RT_LIB)
AC_DEFINE([HAVE_LIBRT], [ 1 ], [Have clock_gettime])
],
[
return rc;
}
- if (memcached_failed(rc= memcached_validate_key_length(key_length, ptr->flags.binary_protocol)))
- {
- return rc;
- }
-
if (memcached_failed(rc= memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
{
return memcached_set_error(*ptr, rc, MEMCACHED_AT);
return rc;
}
- rc= memcached_validate_key_length(key_length, ptr->flags.binary_protocol);
- if (memcached_failed(rc))
+ if (memcached_failed(rc= memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
{
- return rc;
+ return memcached_set_error(*ptr, rc, MEMCACHED_AT);
}
if (expiration)
memcached_server_write_instance_st instance;
instance= memcached_server_instance_fetch(ptr, server_key);
- /* 256 I BELIEVE is the upper limit of slabs */
- for (uint32_t x= 0; x < 256; x++)
+ /* MAX_NUMBER_OF_SLAB_CLASSESdefined to 200 in Memcached 1.4.10 */
+ for (uint32_t x= 0; x < 200; x++)
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
int buffer_length= snprintf(buffer, sizeof(buffer), "%u", x);
No support for Binary protocol yet
@todo Fix this so that we just flush, switch to ascii, and then go back to binary.
*/
- if (ptr->flags.binary_protocol)
+ if (memcached_is_binary(ptr))
{
- return MEMCACHED_FAILURE;
+ return memcached_set_error(*ptr, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT, memcached_literal_param("Binary protocol is not supported for memcached_dump()"));
}
return ascii_dump(ptr, callback, context, number_of_callbacks);
if (memcached_is_binary(ptr) == false)
{
- return MEMCACHED_NOT_SUPPORTED;
+ return memcached_set_error(*ptr, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT,
+ memcached_literal_param("ASCII protocol is not supported for memcached_mget_execute_by_key()"));
}
memcached_callback_st *original_callbacks= ptr->callbacks;
protocol_binary_request_getk request= { }; //= {.bytes= {0}};
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
if (mget_mode)
+ {
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETKQ;
+ }
else
+ {
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;
+ }
memcached_return_t vk;
vk= memcached_validate_key_length(key_length[x],
ptr->flags.binary_protocol);
- unlikely (vk != MEMCACHED_SUCCESS)
+ if (vk != MEMCACHED_SUCCESS)
{
if (x > 0)
{
return NULL;
}
- if (memcached_failed(rc= memcached_validate_key_length(key_length, ptr->flags.binary_protocol)))
+ if (memcached_failed(rc= (memcached_key_test(*ptr, (const char **)&key, &key_length, 1))))
{
*error= rc;
return NULL;
}
- if (memcached_failed((memcached_key_test(*ptr, (const char **)&key, &key_length, 1))))
- {
- *error= MEMCACHED_BAD_KEY_PROVIDED;
- return NULL;
- }
-
uint32_t server_key= memcached_generate_hash(ptr, key, key_length);
return memcached_server_instance_by_position(ptr, server_key);
void memcached_server_error_reset(memcached_server_st *self)
{
WATCHPOINT_ASSERT(self);
- if (not self)
+ if (self == NULL)
{
return;
}
return rc;
}
- if (memcached_failed(rc= memcached_validate_key_length(key_length, memcached_is_binary(ptr))))
+ if (memcached_failed(rc= memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
{
return rc;
}
- if (memcached_failed(memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
- {
- return MEMCACHED_BAD_KEY_PROVIDED;
- }
-
uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
memcached_server_write_instance_st instance= memcached_server_instance_fetch(ptr, server_key);
if (memcached_failed(rc= memcached_validate_key_length(key_length, ptr->flags.binary_protocol)))
{
- return memcached_set_error(*ptr, rc, MEMCACHED_AT);
+ return rc;
}
uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
--- /dev/null
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPILER_VENDOR
+#
+# DESCRIPTION
+#
+# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
+# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
+# watcom, etc. The vendor is returned in the cache variable
+# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+# Copyright (c) 2008 Matteo Frigo
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 11
+
+AC_DEFUN([AX_COMPILER_VENDOR],
+[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
+ [# note: don't check for gcc first since some other compilers define __GNUC__
+ vendors="intel: __ICC,__ECC,__INTEL_COMPILER
+ ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__
+ pathscale: __PATHCC__,__PATHSCALE__
+ clang: __clang__
+ gnu: __GNUC__
+ sun: __SUNPRO_C,__SUNPRO_CC
+ hp: __HP_cc,__HP_aCC
+ dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
+ borland: __BORLANDC__,__TURBOC__
+ comeau: __COMO__
+ cray: _CRAYC
+ kai: __KCC
+ lcc: __LCC__
+ sgi: __sgi,sgi
+ microsoft: _MSC_VER
+ metrowerks: __MWERKS__
+ watcom: __WATCOMC__
+ portland: __PGI
+ unknown: UNKNOWN"
+ for ventest in $vendors; do
+ case $ventest in
+ *:) vendor=$ventest; continue ;;
+ *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
+ esac
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
+ #if !($vencpp)
+ thisisanerror;
+ #endif
+ ])], [break])
+ done
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
+ ])
+])
--- /dev/null
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_tls.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_TLS([action-if-found], [action-if-not-found])
+#
+# DESCRIPTION
+#
+# Provides a test for the compiler support of thread local storage (TLS)
+# extensions. Defines TLS if it is found. Currently knows about GCC/ICC
+# and MSVC. I think SunPro uses the same as GCC, and Borland apparently
+# supports either.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk>
+# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 10
+
+AC_DEFUN([AX_TLS], [
+ AC_MSG_CHECKING(for thread local storage (TLS) class)
+ AC_CACHE_VAL(ac_cv_tls, [
+ ax_tls_keywords="__thread __declspec(thread) none"
+ for ax_tls_keyword in $ax_tls_keywords; do
+ AS_CASE([$ax_tls_keyword],
+ [none], [ac_cv_tls=none ; break],
+ [AC_TRY_COMPILE(
+ [#include <stdlib.h>
+ static void
+ foo(void) {
+ static ] $ax_tls_keyword [ int bar;
+ exit(1);
+ }],
+ [],
+ [ac_cv_tls=$ax_tls_keyword ; break],
+ ac_cv_tls=none
+ )])
+ done
+ ])
+ AC_MSG_RESULT($ac_cv_tls)
+
+ AS_IF([test "$ac_cv_tls" != "none"],
+ AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
+ m4_ifnblank([$1], [$1]),
+ m4_ifnblank([$2], [$2])
+ )
+])
%setup -q
%{__mkdir} examples
-%{__cp} tests/*.{cc,cpp,h} examples/
+#%{__cp} tests/*.{cc,h} examples/
%build
%exclude %{_libdir}/libmemcachedutil.a
%exclude %{_libdir}/libmemcachedprotocol.a
%{_libdir}/libhashkit.so.1.0.0
-%{_libdir}/libmemcached.so.8.0.0
+%{_libdir}/libmemcached.so.9.0.0
%{_libdir}/libmemcachedutil.so.2.0.0
%{_libdir}/libmemcachedprotocol.so.0.0.0
%{_libdir}/libhashkit.so.1
-%{_libdir}/libmemcached.so.8
+%{_libdir}/libmemcached.so.9
%{_libdir}/libmemcachedprotocol.so.0
%{_libdir}/libmemcachedutil.so.2
%{_mandir}/man1/memcapable.1.gz
%{_includedir}/libmemcached/memcached.hpp
%{_includedir}/libmemcached/util.h
+%{_includedir}/libmemcached-1.0/alloc.h
%{_includedir}/libmemcached-1.0/allocators.h
%{_includedir}/libmemcached-1.0/analyze.h
%{_includedir}/libmemcached-1.0/auto.h
%{_includedir}/libmemcached-1.0/basic_string.h
%{_includedir}/libmemcached-1.0/behavior.h
%{_includedir}/libmemcached-1.0/callback.h
+%{_includedir}/libmemcached-1.0/callbacks.h
%{_includedir}/libmemcached-1.0/configure.h
-%{_includedir}/libmemcached-1.0/constants.h
+%{_includedir}/libmemcached-1.0/defaults.h
%{_includedir}/libmemcached-1.0/delete.h
+%{_includedir}/libmemcached-1.0/deprecated_types.h
%{_includedir}/libmemcached-1.0/dump.h
%{_includedir}/libmemcached-1.0/error.h
-%{_includedir}/libmemcached-1.0/exist.h
-%{_includedir}/libmemcached-1.0/touch.h
%{_includedir}/libmemcached-1.0/exception.hpp
+%{_includedir}/libmemcached-1.0/exist.h
%{_includedir}/libmemcached-1.0/fetch.h
%{_includedir}/libmemcached-1.0/flush.h
%{_includedir}/libmemcached-1.0/flush_buffers.h
%{_includedir}/libmemcached-1.0/get.h
%{_includedir}/libmemcached-1.0/hash.h
+%{_includedir}/libmemcached-1.0/limits.h
%{_includedir}/libmemcached-1.0/memcached.h
%{_includedir}/libmemcached-1.0/memcached.hpp
%{_includedir}/libmemcached-1.0/options.h
%{_includedir}/libmemcached-1.0/stats.h
%{_includedir}/libmemcached-1.0/storage.h
%{_includedir}/libmemcached-1.0/strerror.h
-%{_includedir}/libmemcached-1.0/string.h
+%{_includedir}/libmemcached-1.0/struct/allocator.h
+%{_includedir}/libmemcached-1.0/struct/analysis.h
+%{_includedir}/libmemcached-1.0/struct/callback.h
+%{_includedir}/libmemcached-1.0/struct/memcached.h
+%{_includedir}/libmemcached-1.0/struct/result.h
+%{_includedir}/libmemcached-1.0/struct/sasl.h
+%{_includedir}/libmemcached-1.0/struct/server.h
+%{_includedir}/libmemcached-1.0/struct/stat.h
+%{_includedir}/libmemcached-1.0/struct/string.h
+%{_includedir}/libmemcached-1.0/touch.h
+%{_includedir}/libmemcached-1.0/triggers.h
%{_includedir}/libmemcached-1.0/types.h
+%{_includedir}/libmemcached-1.0/types/behavior.h
+%{_includedir}/libmemcached-1.0/types/callback.h
+%{_includedir}/libmemcached-1.0/types/connection.h
+%{_includedir}/libmemcached-1.0/types/hash.h
+%{_includedir}/libmemcached-1.0/types/return.h
+%{_includedir}/libmemcached-1.0/types/server_distribution.h
%{_includedir}/libmemcached-1.0/verbosity.h
%{_includedir}/libmemcached-1.0/version.h
%{_includedir}/libmemcached-1.0/visibility.h
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+#include <libtest/test.hpp>
+
+#include <libmemcached-1.0/memcached.h>
+#include <libmemcached/util.h>
+
+using namespace libtest;
+
+#include "tests/libmemcached-1.0/dump.h"
+
+static memcached_return_t callback_dump_counter(const memcached_st *,
+ const char *,
+ size_t ,
+ void *context)
+{
+ size_t *counter= (size_t *)context;
+
+ *counter= *counter +1;
+
+ return MEMCACHED_SUCCESS;
+}
+
+test_return_t memcached_dump_TEST(memcached_st *memc)
+{
+ test_skip(false, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
+
+ size_t count= 0;
+ memcached_dump_fn callbacks[1];
+ callbacks[0]= &callback_dump_counter;
+
+ test_compare_hint(MEMCACHED_SUCCESS, memcached_dump(memc, callbacks, &count, 1), memcached_last_error_message(memc));
+
+ return TEST_SUCCESS;
+}
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Libmemcached library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+test_return_t memcached_dump_TEST(memcached_st *);
tests/ketama.h \
tests/ketama_test_cases.h \
tests/ketama_test_cases_spy.h \
+ tests/libmemcached-1.0/dump.h \
tests/namespace.h \
tests/parser.h \
tests/touch.h \
tests/libmemcached-1.0/callbacks.cc \
tests/libmemcached-1.0/debug.cc \
tests/libmemcached-1.0/deprecated.cc \
+ tests/libmemcached-1.0/dump.cc \
tests/libmemcached-1.0/error_conditions.cc \
tests/libmemcached-1.0/exist.cc \
tests/libmemcached-1.0/ketama.cc \
#include "tests/ketama.h"
#include "tests/namespace.h"
#include "tests/parser.h"
+#include "tests/libmemcached-1.0/dump.h"
#include "tests/touch.h"
#include "tests/callbacks.h"
#include "tests/pool.h"
{"memcached_exist_by_key(MEMCACHED_SUCCESS)", true, (test_callback_fn*)memcached_exist_by_key_SUCCESS },
{"memcached_touch", 0, (test_callback_fn*)test_memcached_touch},
{"memcached_touch_with_prefix", 0, (test_callback_fn*)test_memcached_touch_by_key},
+ {"memcached_dump()", 0, (test_callback_fn*)memcached_dump_TEST },
{0, 0, 0}
};