From 6e50e7a48d1230946aa73d42d47e89307d716b6b Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Mon, 12 Dec 2011 11:59:07 -0500 Subject: [PATCH] Update to tests (just moved for version specifics). Outlined basics for 1.2, and 2.0 --- .bzrignore | 4 + ChangeLog | 2 + configure.ac | 1 + libmemcached-1.0/alloc.h | 54 ++++++++ libmemcached-1.0/allocators.h | 8 -- libmemcached-1.0/analyze.h | 14 +- libmemcached-1.0/callback.h | 6 - libmemcached-1.0/callbacks.h | 53 +++++++ libmemcached-1.0/defaults.h | 54 ++++++++ libmemcached-1.0/deprecated_types.h | 60 ++++++++ libmemcached-1.0/include.am | 23 ++- libmemcached-1.0/limits.h | 46 ++++++ libmemcached-1.0/memcached.h | 114 ++++----------- libmemcached-1.0/platform.h | 4 +- libmemcached-1.0/result.h | 22 +-- libmemcached-1.0/return.h | 57 -------- libmemcached-1.0/sasl.h | 9 +- libmemcached-1.0/server.h | 59 +------- libmemcached-1.0/stats.h | 31 +---- libmemcached-1.0/struct/allocator.h | 46 ++++++ libmemcached-1.0/struct/analysis.h | 51 +++++++ libmemcached-1.0/struct/callback.h | 44 ++++++ libmemcached-1.0/struct/include.am | 15 ++ libmemcached-1.0/struct/memcached.h | 122 ++++++++++++++++ libmemcached-1.0/struct/result.h | 55 ++++++++ libmemcached-1.0/struct/sasl.h | 54 ++++++++ libmemcached-1.0/struct/server.h | 97 +++++++++++++ libmemcached-1.0/struct/stat.h | 68 +++++++++ libmemcached-1.0/{ => struct}/string.h | 2 +- {tests => libmemcached-1.0/t}/c_sasl_test.c | 5 + libmemcached-1.0/t/c_test.c | 61 ++++++++ libmemcached-1.0/t/cc_test.cc | 62 +++++++++ libmemcached-1.0/t/include.am | 32 +++++ libmemcached-1.0/triggers.h | 64 +++++++++ libmemcached-1.0/types.h | 59 -------- .../{constants.h => types/behavior.h} | 88 +----------- libmemcached-1.0/types/callback.h | 54 ++++++++ libmemcached-1.0/types/connection.h | 49 +++++++ libmemcached-1.0/types/hash.h | 58 ++++++++ libmemcached-1.0/types/include.am | 9 ++ libmemcached-1.0/types/return.h | 94 +++++++++++++ libmemcached-1.0/types/server_distribution.h | 54 ++++++++ libmemcached-1.2/allocators.h | 54 ++++++++ libmemcached-1.2/auto.h | 111 +++++++++++++++ libmemcached-1.2/behavior.h | 83 +++++++++++ libmemcached-1.2/callback.h | 50 +++++++ libmemcached-1.2/configure.h.in | 4 +- libmemcached-1.2/delete.h | 57 ++++++++ libmemcached-1.2/dump.h | 50 +++++++ libmemcached-1.2/error.h | 5 +- libmemcached-1.2/exist.h | 52 +++++++ libmemcached-1.2/fetch.h | 53 +++++++ libmemcached-1.2/flush.h | 49 +++++++ libmemcached-1.2/flush_buffers.h | 49 +++++++ libmemcached-1.2/get.h | 102 ++++++++++++++ libmemcached-1.2/hash.h | 52 +++++++ libmemcached-1.2/include.am | 41 +++++- libmemcached-1.2/memcached.h | 65 ++++++++- libmemcached-1.2/options.h | 49 +++++++ libmemcached-1.2/platform.h | 56 ++++++++ libmemcached-1.2/result.h | 67 +++++++++ libmemcached-1.2/return.h | 130 +++++++++++++++++ libmemcached-1.2/sasl.h | 77 ++++++++++ libmemcached-1.2/server.h | 87 ++++++++++++ libmemcached-1.2/stats.h | 49 +++++++ libmemcached-1.2/storage.h | 131 ++++++++++++++++++ libmemcached-1.2/strerror.h | 50 +++++++ {tests => libmemcached-1.2/t}/c_test.c | 0 libmemcached-1.2/t/cc_test.cc | 56 ++++++++ libmemcached-1.2/t/include.am | 8 ++ libmemcached-1.2/touch.h | 59 ++++++++ libmemcached-1.2/types.h | 78 +++++++++++ libmemcached-1.2/verbosity.h | 50 +++++++ libmemcached-1.2/version.h | 52 +++++++ libmemcached-1.2/visibility.h | 87 ++++++++++++ libmemcached-2.0/configure.h.in | 51 +++++++ libmemcached-2.0/error.h | 59 ++++++++ libmemcached-2.0/include.am | 12 ++ libmemcached-2.0/memcached.h | 72 ++++++++++ libmemcached/analyze.cc | 13 +- libmemcached/memory.h | 2 + libtest/memcached.cc | 2 +- tests/hash_plus.cc | 2 +- tests/include.am | 15 +- 84 files changed, 3585 insertions(+), 470 deletions(-) create mode 100644 libmemcached-1.0/alloc.h create mode 100644 libmemcached-1.0/callbacks.h create mode 100644 libmemcached-1.0/defaults.h create mode 100644 libmemcached-1.0/deprecated_types.h create mode 100644 libmemcached-1.0/limits.h create mode 100644 libmemcached-1.0/struct/allocator.h create mode 100644 libmemcached-1.0/struct/analysis.h create mode 100644 libmemcached-1.0/struct/callback.h create mode 100644 libmemcached-1.0/struct/include.am create mode 100644 libmemcached-1.0/struct/memcached.h create mode 100644 libmemcached-1.0/struct/result.h create mode 100644 libmemcached-1.0/struct/sasl.h create mode 100644 libmemcached-1.0/struct/server.h create mode 100644 libmemcached-1.0/struct/stat.h rename libmemcached-1.0/{ => struct}/string.h (98%) rename {tests => libmemcached-1.0/t}/c_sasl_test.c (97%) create mode 100644 libmemcached-1.0/t/c_test.c create mode 100644 libmemcached-1.0/t/cc_test.cc create mode 100644 libmemcached-1.0/t/include.am create mode 100644 libmemcached-1.0/triggers.h rename libmemcached-1.0/{constants.h => types/behavior.h} (54%) create mode 100644 libmemcached-1.0/types/callback.h create mode 100644 libmemcached-1.0/types/connection.h create mode 100644 libmemcached-1.0/types/hash.h create mode 100644 libmemcached-1.0/types/include.am create mode 100644 libmemcached-1.0/types/return.h create mode 100644 libmemcached-1.0/types/server_distribution.h create mode 100644 libmemcached-1.2/allocators.h create mode 100644 libmemcached-1.2/auto.h create mode 100644 libmemcached-1.2/behavior.h create mode 100644 libmemcached-1.2/callback.h create mode 100644 libmemcached-1.2/delete.h create mode 100644 libmemcached-1.2/dump.h create mode 100644 libmemcached-1.2/exist.h create mode 100644 libmemcached-1.2/fetch.h create mode 100644 libmemcached-1.2/flush.h create mode 100644 libmemcached-1.2/flush_buffers.h create mode 100644 libmemcached-1.2/get.h create mode 100644 libmemcached-1.2/hash.h create mode 100644 libmemcached-1.2/options.h create mode 100644 libmemcached-1.2/platform.h create mode 100644 libmemcached-1.2/result.h create mode 100644 libmemcached-1.2/return.h create mode 100644 libmemcached-1.2/sasl.h create mode 100644 libmemcached-1.2/server.h create mode 100644 libmemcached-1.2/stats.h create mode 100644 libmemcached-1.2/storage.h create mode 100644 libmemcached-1.2/strerror.h rename {tests => libmemcached-1.2/t}/c_test.c (100%) create mode 100644 libmemcached-1.2/t/cc_test.cc create mode 100644 libmemcached-1.2/t/include.am create mode 100644 libmemcached-1.2/touch.h create mode 100644 libmemcached-1.2/types.h create mode 100644 libmemcached-1.2/verbosity.h create mode 100644 libmemcached-1.2/version.h create mode 100644 libmemcached-1.2/visibility.h create mode 100644 libmemcached-2.0/configure.h.in create mode 100644 libmemcached-2.0/error.h create mode 100644 libmemcached-2.0/include.am create mode 100644 libmemcached-2.0/memcached.h diff --git a/.bzrignore b/.bzrignore index e74d397b..a365199a 100644 --- a/.bzrignore +++ b/.bzrignore @@ -137,3 +137,7 @@ libmemcached-1.2/configure.h tests/libmemcached-1.0/internals tests/libmemcached-1.0/sasl tests/libmemcached-1.0/testapp +libmemcached-2.0/configure.h +libmemcached-1.0/t/c_test +libmemcached-1.0/t/c_sasl_test +libmemcached-1.0/t/cc_test diff --git a/ChangeLog b/ChangeLog index 6a5ca9d9..422a286f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 1.0.3 +* Fixed C compile issue with memcached_exist() + 1.0.2 Mon Oct 24 08:00:48 PDT 2011 * Dropped libmemcached/memcached_util.h (undocumented header file) * Added memcached_touch() and memcached_touch_by_key() diff --git a/configure.ac b/configure.ac index 24930621..883fa3c4 100644 --- a/configure.ac +++ b/configure.ac @@ -191,6 +191,7 @@ AC_CONFIG_FILES([ libhashkit-1.0/configure.h libmemcached-1.0/configure.h libmemcached-1.2/configure.h + libmemcached-2.0/configure.h support/libmemcached.pc support/libmemcached.spec support/libmemcached-fc.spec diff --git a/libmemcached-1.0/alloc.h b/libmemcached-1.0/alloc.h new file mode 100644 index 00000000..bc65b951 --- /dev/null +++ b/libmemcached-1.0/alloc.h @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + Memory allocation functions. +*/ +typedef void (*memcached_free_fn)(const memcached_st *ptr, void *mem, void *context); +typedef void *(*memcached_malloc_fn)(const memcached_st *ptr, const size_t size, void *context); +typedef void *(*memcached_realloc_fn)(const memcached_st *ptr, void *mem, const size_t size, void *context); +typedef void *(*memcached_calloc_fn)(const memcached_st *ptr, size_t nelem, const size_t elsize, void *context); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.0/allocators.h b/libmemcached-1.0/allocators.h index 9df6e87e..86f05a06 100644 --- a/libmemcached-1.0/allocators.h +++ b/libmemcached-1.0/allocators.h @@ -37,14 +37,6 @@ #pragma once -struct memcached_allocator_t { - memcached_calloc_fn calloc; - memcached_free_fn free; - memcached_malloc_fn malloc; - memcached_realloc_fn realloc; - void *context; -}; - #ifdef __cplusplus extern "C" { #endif diff --git a/libmemcached-1.0/analyze.h b/libmemcached-1.0/analyze.h index 955901a2..0da38143 100644 --- a/libmemcached-1.0/analyze.h +++ b/libmemcached-1.0/analyze.h @@ -35,19 +35,9 @@ * */ -#pragma once +#include -struct memcached_analysis_st { - memcached_st *root; - uint32_t average_item_size; - uint32_t longest_uptime; - uint32_t least_free_server; - uint32_t most_consumed_server; - uint32_t oldest_server; - double pool_hit_ratio; - uint64_t most_used_bytes; - uint64_t least_remaining_bytes; -}; +#pragma once #ifdef __cplusplus extern "C" { diff --git a/libmemcached-1.0/callback.h b/libmemcached-1.0/callback.h index a9465d2e..a62e9aa6 100644 --- a/libmemcached-1.0/callback.h +++ b/libmemcached-1.0/callback.h @@ -37,12 +37,6 @@ #pragma once -struct memcached_callback_st { - memcached_execute_fn *callback; - void *context; - uint32_t number_of_callback; -}; - #ifdef __cplusplus extern "C" { #endif diff --git a/libmemcached-1.0/callbacks.h b/libmemcached-1.0/callbacks.h new file mode 100644 index 00000000..e321ceb4 --- /dev/null +++ b/libmemcached-1.0/callbacks.h @@ -0,0 +1,53 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef memcached_return_t (*memcached_execute_fn)(const memcached_st *ptr, memcached_result_st *result, void *context); +typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_instance_st server, void *context); +typedef memcached_return_t (*memcached_stat_fn)(memcached_server_instance_st server, + const char *key, size_t key_length, + const char *value, size_t value_length, + void *context); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.0/defaults.h b/libmemcached-1.0/defaults.h new file mode 100644 index 00000000..355e63aa --- /dev/null +++ b/libmemcached-1.0/defaults.h @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +/* Public defines */ +#define MEMCACHED_DEFAULT_PORT 11211 +#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_STRIDE 4 +#define MEMCACHED_DEFAULT_TIMEOUT 5000 +#define MEMCACHED_DEFAULT_CONNECT_TIMEOUT 4000 +#define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */ +#define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU +#define MEMCACHED_SERVER_FAILURE_LIMIT 5 +#define MEMCACHED_SERVER_FAILURE_RETRY_TIMEOUT 2 + + diff --git a/libmemcached-1.0/deprecated_types.h b/libmemcached-1.0/deprecated_types.h new file mode 100644 index 00000000..716d3e44 --- /dev/null +++ b/libmemcached-1.0/deprecated_types.h @@ -0,0 +1,60 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * 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. + * + */ + +/* + * Warning, none of these should ever be used. + */ + +#pragma once + +/** + @note The following definitions are just here for backwards compatibility. +*/ +typedef memcached_return_t memcached_return; +typedef memcached_server_distribution_t memcached_server_distribution; +typedef memcached_behavior_t memcached_behavior; +typedef memcached_callback_t memcached_callback; +typedef memcached_hash_t memcached_hash; +typedef memcached_connection_t memcached_connection; +typedef memcached_clone_fn memcached_clone_func; +typedef memcached_cleanup_fn memcached_cleanup_func; +typedef memcached_execute_fn memcached_execute_function; +typedef memcached_server_fn memcached_server_function; +typedef memcached_trigger_key_fn memcached_trigger_key; +typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key; +typedef memcached_dump_fn memcached_dump_func; + diff --git a/libmemcached-1.0/include.am b/libmemcached-1.0/include.am index 39313c2c..124c688e 100644 --- a/libmemcached-1.0/include.am +++ b/libmemcached-1.0/include.am @@ -5,43 +5,52 @@ EXTRA_DIST+= \ libmemcached-1.0/configure.h.in +include libmemcached-1.0/struct/include.am +include libmemcached-1.0/types/include.am + +# Tests for this version of the interface +include libmemcached-1.0/t/include.am + nobase_include_HEADERS+= \ + libmemcached-1.0/alloc.h \ libmemcached-1.0/allocators.h \ libmemcached-1.0/analyze.h \ libmemcached-1.0/auto.h \ libmemcached-1.0/basic_string.h \ libmemcached-1.0/behavior.h \ libmemcached-1.0/callback.h \ + libmemcached-1.0/callbacks.h \ libmemcached-1.0/configure.h \ - libmemcached-1.0/constants.h \ + libmemcached-1.0/defaults.h \ libmemcached-1.0/delete.h \ + libmemcached-1.0/deprecated_types.h \ libmemcached-1.0/dump.h \ libmemcached-1.0/error.h \ - libmemcached-1.0/exist.h \ libmemcached-1.0/exception.hpp \ + libmemcached-1.0/exist.h \ libmemcached-1.0/fetch.h \ libmemcached-1.0/flush.h \ libmemcached-1.0/flush_buffers.h \ libmemcached-1.0/get.h \ libmemcached-1.0/hash.h \ + libmemcached-1.0/limits.h \ libmemcached-1.0/memcached.h \ libmemcached-1.0/memcached.hpp \ libmemcached-1.0/options.h \ libmemcached-1.0/parse.h \ + libmemcached-1.0/platform.h \ libmemcached-1.0/quit.h \ - libmemcached-1.0/return.h \ - libmemcached-1.0/platform.h \ libmemcached-1.0/result.h \ - libmemcached-1.0/sasl.h \ + libmemcached-1.0/return.h \ + libmemcached-1.0/sasl.h \ libmemcached-1.0/server.h \ libmemcached-1.0/server_list.h \ libmemcached-1.0/stats.h \ libmemcached-1.0/storage.h \ libmemcached-1.0/strerror.h \ - libmemcached-1.0/string.h \ libmemcached-1.0/touch.h \ + libmemcached-1.0/triggers.h \ libmemcached-1.0/types.h \ libmemcached-1.0/verbosity.h \ libmemcached-1.0/version.h \ libmemcached-1.0/visibility.h - diff --git a/libmemcached-1.0/limits.h b/libmemcached-1.0/limits.h new file mode 100644 index 00000000..076df407 --- /dev/null +++ b/libmemcached-1.0/limits.h @@ -0,0 +1,46 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#define MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH 20 +#define MEMCACHED_MAX_BUFFER 8196 +#define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */ +#define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ +#define MEMCACHED_PREFIX_KEY_MAX_SIZE 128 +#define MEMCACHED_VERSION_STRING_LENGTH 24 diff --git a/libmemcached-1.0/memcached.h b/libmemcached-1.0/memcached.h index f97d333a..fba30674 100644 --- a/libmemcached-1.0/memcached.h +++ b/libmemcached-1.0/memcached.h @@ -49,14 +49,38 @@ #include #include #include -#include + +#include +#include + +#include +#include +#include +#include +#include +#include + #include + #include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + #include -#include #include #include -#include // Everything above this line must be in the order specified. #include @@ -85,89 +109,7 @@ #include #include -struct memcached_st { - /** - @note these are static and should not change without a call to behavior. - */ - struct { - bool is_purging:1; - bool is_processing_input:1; - bool is_time_for_rebuild:1; - } state; - - struct { - // Everything below here is pretty static. - bool auto_eject_hosts:1; - bool binary_protocol:1; - bool buffer_requests:1; - bool hash_with_namespace:1; - bool no_block:1; // Don't block - bool no_reply:1; - bool randomize_replica_read:1; - bool support_cas:1; - bool tcp_nodelay:1; - bool use_sort_hosts:1; - bool use_udp:1; - bool verify_key:1; - bool tcp_keepalive:1; - } flags; - - memcached_server_distribution_t distribution; - hashkit_st hashkit; - struct { - unsigned int version; - } server_info; - uint32_t number_of_hosts; - memcached_server_st *servers; - memcached_server_st *last_disconnected_server; - int32_t snd_timeout; - int32_t rcv_timeout; - uint32_t server_failure_limit; - uint32_t io_msg_watermark; - uint32_t io_bytes_watermark; - uint32_t io_key_prefetch; - uint32_t tcp_keepidle; - int32_t poll_timeout; - int32_t connect_timeout; // How long we will wait on connect() before we will timeout - int32_t retry_timeout; - int send_size; - int recv_size; - void *user_data; - uint64_t query_id; - uint32_t number_of_replicas; - memcached_result_st result; - - struct { - bool weighted; - uint32_t continuum_count; // Ketama - uint32_t continuum_points_counter; // Ketama - time_t next_distribution_rebuild; // Ketama - memcached_continuum_item_st *continuum; // Ketama - } ketama; - - struct memcached_virtual_bucket_t *virtual_bucket; - - struct memcached_allocator_t allocators; - - memcached_clone_fn on_clone; - memcached_cleanup_fn on_cleanup; - memcached_trigger_key_fn get_key_failure; - memcached_trigger_delete_key_fn delete_trigger; - memcached_callback_st *callbacks; - struct memcached_sasl_st sasl; - struct memcached_error_t *error_messages; - struct memcached_array_st *_namespace; - struct { - uint32_t initial_pool_size; - uint32_t max_pool_size; - int32_t version; // This is used by pool and others to determine if the memcached_st is out of date. - struct memcached_array_st *filename; - } configure; - struct { - bool is_allocated:1; - } options; - -}; +#include #ifdef __cplusplus extern "C" { diff --git a/libmemcached-1.0/platform.h b/libmemcached-1.0/platform.h index 19248283..763febaa 100644 --- a/libmemcached-1.0/platform.h +++ b/libmemcached-1.0/platform.h @@ -2,8 +2,8 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2006-2009 Brian Aker, Trond Norbye All rights reserved. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/libmemcached-1.0/result.h b/libmemcached-1.0/result.h index 41608b5b..a1f0aa96 100644 --- a/libmemcached-1.0/result.h +++ b/libmemcached-1.0/result.h @@ -2,8 +2,8 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,23 +35,9 @@ * */ -#pragma once +#include -struct memcached_result_st { - uint32_t item_flags; - time_t item_expiration; - size_t key_length; - uint64_t item_cas; - memcached_st *root; - memcached_string_st value; - uint64_t count; - char item_key[MEMCACHED_MAX_KEY]; - struct { - bool is_allocated:1; - bool is_initialized:1; - } options; - /* Add result callback function */ -}; +#pragma once #ifdef __cplusplus extern "C" { diff --git a/libmemcached-1.0/return.h b/libmemcached-1.0/return.h index e5788c50..28b4a97d 100644 --- a/libmemcached-1.0/return.h +++ b/libmemcached-1.0/return.h @@ -36,63 +36,6 @@ #pragma once -enum memcached_return_t { - MEMCACHED_SUCCESS, - MEMCACHED_FAILURE, - MEMCACHED_HOST_LOOKUP_FAILURE, // getaddrinfo() and getnameinfo() only - MEMCACHED_CONNECTION_FAILURE, - MEMCACHED_CONNECTION_BIND_FAILURE, // DEPRECATED, see MEMCACHED_HOST_LOOKUP_FAILURE - MEMCACHED_WRITE_FAILURE, - MEMCACHED_READ_FAILURE, - MEMCACHED_UNKNOWN_READ_FAILURE, - MEMCACHED_PROTOCOL_ERROR, - MEMCACHED_CLIENT_ERROR, - MEMCACHED_SERVER_ERROR, - MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE, // DEPRECATED - MEMCACHED_DATA_EXISTS, - MEMCACHED_DATA_DOES_NOT_EXIST, - MEMCACHED_NOTSTORED, - MEMCACHED_STORED, - MEMCACHED_NOTFOUND, - MEMCACHED_MEMORY_ALLOCATION_FAILURE, - MEMCACHED_PARTIAL_READ, - MEMCACHED_SOME_ERRORS, - MEMCACHED_NO_SERVERS, - MEMCACHED_END, - MEMCACHED_DELETED, - MEMCACHED_VALUE, - MEMCACHED_STAT, - MEMCACHED_ITEM, - MEMCACHED_ERRNO, - MEMCACHED_FAIL_UNIX_SOCKET, // DEPRECATED - MEMCACHED_NOT_SUPPORTED, - MEMCACHED_NO_KEY_PROVIDED, /* Deprecated. Use MEMCACHED_BAD_KEY_PROVIDED! */ - MEMCACHED_FETCH_NOTFINISHED, - MEMCACHED_TIMEOUT, - MEMCACHED_BUFFERED, - MEMCACHED_BAD_KEY_PROVIDED, - MEMCACHED_INVALID_HOST_PROTOCOL, - MEMCACHED_SERVER_MARKED_DEAD, - MEMCACHED_UNKNOWN_STAT_KEY, - MEMCACHED_E2BIG, - MEMCACHED_INVALID_ARGUMENTS, - MEMCACHED_KEY_TOO_BIG, - MEMCACHED_AUTH_PROBLEM, - MEMCACHED_AUTH_FAILURE, - MEMCACHED_AUTH_CONTINUE, - MEMCACHED_PARSE_ERROR, - MEMCACHED_PARSE_USER_ERROR, - MEMCACHED_DEPRECATED, - MEMCACHED_IN_PROGRESS, - MEMCACHED_SERVER_TEMPORARILY_DISABLED, - MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE, - MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ -}; - -#ifndef __cplusplus -typedef enum memcached_return_t memcached_return_t; -#endif - static inline bool memcached_success(memcached_return_t rc) { return (rc == MEMCACHED_BUFFERED || diff --git a/libmemcached-1.0/sasl.h b/libmemcached-1.0/sasl.h index 7749f98e..c3084217 100644 --- a/libmemcached-1.0/sasl.h +++ b/libmemcached-1.0/sasl.h @@ -67,11 +67,4 @@ sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr); } #endif -struct memcached_sasl_st { - sasl_callback_t *callbacks; - /* - ** Did we allocate data inside the callbacks, or did the user - ** supply that. - */ - bool is_allocated; -}; +#include diff --git a/libmemcached-1.0/server.h b/libmemcached-1.0/server.h index 40548112..74f32133 100644 --- a/libmemcached-1.0/server.h +++ b/libmemcached-1.0/server.h @@ -38,64 +38,7 @@ #pragma once -#ifndef WIN32 -#include -#endif - -#ifdef NI_MAXHOST -#define MEMCACHED_NI_MAXHOST NI_MAXHOST -#else -#define MEMCACHED_NI_MAXHOST 1025 -#endif - -enum memcached_server_state_t { - MEMCACHED_SERVER_STATE_NEW, // fd == -1, no address lookup has been done - MEMCACHED_SERVER_STATE_ADDRINFO, // ADDRRESS information has been gathered - MEMCACHED_SERVER_STATE_IN_PROGRESS, - MEMCACHED_SERVER_STATE_CONNECTED, - MEMCACHED_SERVER_STATE_IN_TIMEOUT -}; - -struct memcached_server_st { - struct { - bool is_allocated:1; - bool is_initialized:1; - bool is_shutting_down:1; - bool is_dead:1; - } options; - uint32_t number_of_hosts; - uint32_t cursor_active; - in_port_t port; - memcached_socket_t fd; - uint32_t io_bytes_sent; /* # bytes sent since last read */ - uint32_t server_failure_counter; - uint64_t server_failure_counter_query_id; - uint32_t weight; - uint32_t version; - enum memcached_server_state_t state; - struct { - uint32_t read; - uint32_t write; - } io_wait_count; - uint8_t major_version; // Default definition of UINT8_MAX means that it has not been set. - uint8_t micro_version; // ditto - uint8_t minor_version; // ditto - memcached_connection_t type; - char *read_ptr; - size_t read_buffer_length; - size_t read_data_length; - size_t write_buffer_offset; - struct addrinfo *address_info; - struct addrinfo *address_info_next; - time_t next_retry; - memcached_st *root; - uint64_t limit_maxbytes; - struct memcached_error_t *error_messages; - char read_buffer[MEMCACHED_MAX_BUFFER]; - char write_buffer[MEMCACHED_MAX_BUFFER]; - char hostname[MEMCACHED_NI_MAXHOST]; -}; - +#include #ifdef __cplusplus extern "C" { diff --git a/libmemcached-1.0/stats.h b/libmemcached-1.0/stats.h index f2d064a6..708064f1 100644 --- a/libmemcached-1.0/stats.h +++ b/libmemcached-1.0/stats.h @@ -35,36 +35,9 @@ * */ -#pragma once +#include -struct memcached_stat_st { - unsigned long connection_structures; - unsigned long curr_connections; - unsigned long curr_items; - pid_t pid; - unsigned long pointer_size; - unsigned long rusage_system_microseconds; - unsigned long rusage_system_seconds; - unsigned long rusage_user_microseconds; - unsigned long rusage_user_seconds; - unsigned long threads; - unsigned long time; - unsigned long total_connections; - unsigned long total_items; - unsigned long uptime; - unsigned long long bytes; - unsigned long long bytes_read; - unsigned long long bytes_written; - unsigned long long cmd_get; - unsigned long long cmd_set; - unsigned long long evictions; - unsigned long long get_hits; - unsigned long long get_misses; - unsigned long long limit_maxbytes; - char version[MEMCACHED_VERSION_STRING_LENGTH]; - void *__future; // @todo create a new structure to place here for future usage - memcached_st *root; -}; +#pragma once #ifdef __cplusplus extern "C" { diff --git a/libmemcached-1.0/struct/allocator.h b/libmemcached-1.0/struct/allocator.h new file mode 100644 index 00000000..3ff6ade8 --- /dev/null +++ b/libmemcached-1.0/struct/allocator.h @@ -0,0 +1,46 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +struct memcached_allocator_t { + memcached_calloc_fn calloc; + memcached_free_fn free; + memcached_malloc_fn malloc; + memcached_realloc_fn realloc; + void *context; +}; diff --git a/libmemcached-1.0/struct/analysis.h b/libmemcached-1.0/struct/analysis.h new file mode 100644 index 00000000..09cccedc --- /dev/null +++ b/libmemcached-1.0/struct/analysis.h @@ -0,0 +1,51 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +struct memcached_analysis_st { + memcached_st *root; + uint32_t average_item_size; + uint32_t longest_uptime; + uint32_t least_free_server; + uint32_t most_consumed_server; + uint32_t oldest_server; + double pool_hit_ratio; + uint64_t most_used_bytes; + uint64_t least_remaining_bytes; +}; + diff --git a/libmemcached-1.0/struct/callback.h b/libmemcached-1.0/struct/callback.h new file mode 100644 index 00000000..21b96765 --- /dev/null +++ b/libmemcached-1.0/struct/callback.h @@ -0,0 +1,44 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +struct memcached_callback_st { + memcached_execute_fn *callback; + void *context; + uint32_t number_of_callback; +}; diff --git a/libmemcached-1.0/struct/include.am b/libmemcached-1.0/struct/include.am new file mode 100644 index 00000000..eff3c520 --- /dev/null +++ b/libmemcached-1.0/struct/include.am @@ -0,0 +1,15 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +nobase_include_HEADERS+= \ + libmemcached-1.0/struct/allocator.h \ + libmemcached-1.0/struct/analysis.h \ + libmemcached-1.0/struct/callback.h \ + libmemcached-1.0/struct/memcached.h \ + libmemcached-1.0/struct/result.h \ + libmemcached-1.0/struct/sasl.h \ + libmemcached-1.0/struct/server.h \ + libmemcached-1.0/struct/stat.h \ + libmemcached-1.0/struct/string.h + diff --git a/libmemcached-1.0/struct/memcached.h b/libmemcached-1.0/struct/memcached.h new file mode 100644 index 00000000..152f3103 --- /dev/null +++ b/libmemcached-1.0/struct/memcached.h @@ -0,0 +1,122 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * 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 + +struct memcached_st { + /** + @note these are static and should not change without a call to behavior. + */ + struct { + bool is_purging:1; + bool is_processing_input:1; + bool is_time_for_rebuild:1; + } state; + + struct { + // Everything below here is pretty static. + bool auto_eject_hosts:1; + bool binary_protocol:1; + bool buffer_requests:1; + bool hash_with_namespace:1; + bool no_block:1; // Don't block + bool no_reply:1; + bool randomize_replica_read:1; + bool support_cas:1; + bool tcp_nodelay:1; + bool use_sort_hosts:1; + bool use_udp:1; + bool verify_key:1; + bool tcp_keepalive:1; + } flags; + + memcached_server_distribution_t distribution; + hashkit_st hashkit; + struct { + unsigned int version; + } server_info; + uint32_t number_of_hosts; + memcached_server_st *servers; + memcached_server_st *last_disconnected_server; + int32_t snd_timeout; + int32_t rcv_timeout; + uint32_t server_failure_limit; + uint32_t io_msg_watermark; + uint32_t io_bytes_watermark; + uint32_t io_key_prefetch; + uint32_t tcp_keepidle; + int32_t poll_timeout; + int32_t connect_timeout; // How long we will wait on connect() before we will timeout + int32_t retry_timeout; + int send_size; + int recv_size; + void *user_data; + uint64_t query_id; + uint32_t number_of_replicas; + memcached_result_st result; + + struct { + bool weighted; + uint32_t continuum_count; // Ketama + uint32_t continuum_points_counter; // Ketama + time_t next_distribution_rebuild; // Ketama + memcached_continuum_item_st *continuum; // Ketama + } ketama; + + struct memcached_virtual_bucket_t *virtual_bucket; + + struct memcached_allocator_t allocators; + + memcached_clone_fn on_clone; + memcached_cleanup_fn on_cleanup; + memcached_trigger_key_fn get_key_failure; + memcached_trigger_delete_key_fn delete_trigger; + memcached_callback_st *callbacks; + struct memcached_sasl_st sasl; + struct memcached_error_t *error_messages; + struct memcached_array_st *_namespace; + struct { + uint32_t initial_pool_size; + uint32_t max_pool_size; + int32_t version; // This is used by pool and others to determine if the memcached_st is out of date. + struct memcached_array_st *filename; + } configure; + struct { + bool is_allocated:1; + } options; + +}; diff --git a/libmemcached-1.0/struct/result.h b/libmemcached-1.0/struct/result.h new file mode 100644 index 00000000..2b2f4996 --- /dev/null +++ b/libmemcached-1.0/struct/result.h @@ -0,0 +1,55 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +struct memcached_result_st { + uint32_t item_flags; + time_t item_expiration; + size_t key_length; + uint64_t item_cas; + struct memcached_st *root; + memcached_string_st value; + uint64_t count; + char item_key[MEMCACHED_MAX_KEY]; + struct { + bool is_allocated:1; + bool is_initialized:1; + } options; + /* Add result callback function */ +}; + diff --git a/libmemcached-1.0/struct/sasl.h b/libmemcached-1.0/struct/sasl.h new file mode 100644 index 00000000..da9eed38 --- /dev/null +++ b/libmemcached-1.0/struct/sasl.h @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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. + * + */ + +#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT +#include +#else +#define sasl_callback_t void +#endif + +#pragma once + +struct memcached_sasl_st { + sasl_callback_t *callbacks; + /* + ** Did we allocate data inside the callbacks, or did the user + ** supply that. + */ + bool is_allocated; +}; + diff --git a/libmemcached-1.0/struct/server.h b/libmemcached-1.0/struct/server.h new file mode 100644 index 00000000..183b3739 --- /dev/null +++ b/libmemcached-1.0/struct/server.h @@ -0,0 +1,97 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifndef WIN32 +#include +#endif + +#ifdef NI_MAXHOST +#define MEMCACHED_NI_MAXHOST NI_MAXHOST +#else +#define MEMCACHED_NI_MAXHOST 1025 +#endif + +enum memcached_server_state_t { + MEMCACHED_SERVER_STATE_NEW, // fd == -1, no address lookup has been done + MEMCACHED_SERVER_STATE_ADDRINFO, // ADDRRESS information has been gathered + MEMCACHED_SERVER_STATE_IN_PROGRESS, + MEMCACHED_SERVER_STATE_CONNECTED, + MEMCACHED_SERVER_STATE_IN_TIMEOUT +}; + +struct memcached_server_st { + struct { + bool is_allocated:1; + bool is_initialized:1; + bool is_shutting_down:1; + bool is_dead:1; + } options; + uint32_t number_of_hosts; + uint32_t cursor_active; + in_port_t port; + memcached_socket_t fd; + uint32_t io_bytes_sent; /* # bytes sent since last read */ + uint32_t server_failure_counter; + uint64_t server_failure_counter_query_id; + uint32_t weight; + uint32_t version; + enum memcached_server_state_t state; + struct { + uint32_t read; + uint32_t write; + } io_wait_count; + uint8_t major_version; // Default definition of UINT8_MAX means that it has not been set. + uint8_t micro_version; // ditto + uint8_t minor_version; // ditto + memcached_connection_t type; + char *read_ptr; + size_t read_buffer_length; + size_t read_data_length; + size_t write_buffer_offset; + struct addrinfo *address_info; + struct addrinfo *address_info_next; + time_t next_retry; + struct memcached_st *root; + uint64_t limit_maxbytes; + struct memcached_error_t *error_messages; + char read_buffer[MEMCACHED_MAX_BUFFER]; + char write_buffer[MEMCACHED_MAX_BUFFER]; + char hostname[MEMCACHED_NI_MAXHOST]; +}; diff --git a/libmemcached-1.0/struct/stat.h b/libmemcached-1.0/struct/stat.h new file mode 100644 index 00000000..acd4e21f --- /dev/null +++ b/libmemcached-1.0/struct/stat.h @@ -0,0 +1,68 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +struct memcached_stat_st { + unsigned long connection_structures; + unsigned long curr_connections; + unsigned long curr_items; + pid_t pid; + unsigned long pointer_size; + unsigned long rusage_system_microseconds; + unsigned long rusage_system_seconds; + unsigned long rusage_user_microseconds; + unsigned long rusage_user_seconds; + unsigned long threads; + unsigned long time; + unsigned long total_connections; + unsigned long total_items; + unsigned long uptime; + unsigned long long bytes; + unsigned long long bytes_read; + unsigned long long bytes_written; + unsigned long long cmd_get; + unsigned long long cmd_set; + unsigned long long evictions; + unsigned long long get_hits; + unsigned long long get_misses; + unsigned long long limit_maxbytes; + char version[MEMCACHED_VERSION_STRING_LENGTH]; + void *__future; // @todo create a new structure to place here for future usage + memcached_st *root; +}; + diff --git a/libmemcached-1.0/string.h b/libmemcached-1.0/struct/string.h similarity index 98% rename from libmemcached-1.0/string.h rename to libmemcached-1.0/struct/string.h index 88a09f6a..9edb637a 100644 --- a/libmemcached-1.0/string.h +++ b/libmemcached-1.0/struct/string.h @@ -51,7 +51,7 @@ struct memcached_string_st { char *end; char *string; size_t current_size; - memcached_st *root; + struct memcached_st *root; struct { bool is_allocated:1; bool is_initialized:1; diff --git a/tests/c_sasl_test.c b/libmemcached-1.0/t/c_sasl_test.c similarity index 97% rename from tests/c_sasl_test.c rename to libmemcached-1.0/t/c_sasl_test.c index 18e3f422..8a7c4e3d 100644 --- a/tests/c_sasl_test.c +++ b/libmemcached-1.0/t/c_sasl_test.c @@ -49,6 +49,11 @@ int main(void) { memcached_st *memc= memcached_create(NULL); + + if (memc == NULL) + { + return EXIT_FAILURE; + } memcached_free(memc); return EXIT_SUCCESS; diff --git a/libmemcached-1.0/t/c_test.c b/libmemcached-1.0/t/c_test.c new file mode 100644 index 00000000..009014ee --- /dev/null +++ b/libmemcached-1.0/t/c_test.c @@ -0,0 +1,61 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached C test app + * + * Copyright (C) 2011 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. + * + */ + +/* + * @file @brief C dummy test, aka testing C linking, etc + */ + +#include + +#include + +int main(void) +{ + (void)memcached_success(MEMCACHED_SUCCESS); + (void)memcached_failed(MEMCACHED_SUCCESS); + (void)memcached_continue(MEMCACHED_SUCCESS); + + memcached_st *memc= memcached_create(NULL); + + if (memc == NULL) + { + return EXIT_FAILURE; + } + memcached_free(memc); + + return EXIT_SUCCESS; +} + diff --git a/libmemcached-1.0/t/cc_test.cc b/libmemcached-1.0/t/cc_test.cc new file mode 100644 index 00000000..71ee8c30 --- /dev/null +++ b/libmemcached-1.0/t/cc_test.cc @@ -0,0 +1,62 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached C++ test app + * + * Copyright (C) 2011 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. + * + */ + +/* + * @file @brief C dummy test, aka testing C linking, etc + */ + +#include + +#include + +int main(void) +{ + (void)memcached_success(MEMCACHED_SUCCESS); + (void)memcached_failed(MEMCACHED_SUCCESS); + (void)memcached_continue(MEMCACHED_SUCCESS); + + memcached_st *memc= memcached_create(NULL); + + if (memc == NULL) + { + return EXIT_FAILURE; + } + + memcached_free(memc); + + return EXIT_SUCCESS; +} + diff --git a/libmemcached-1.0/t/include.am b/libmemcached-1.0/t/include.am new file mode 100644 index 00000000..96705114 --- /dev/null +++ b/libmemcached-1.0/t/include.am @@ -0,0 +1,32 @@ +# vim:ft=automake +# Copyright (C) 2011 Data Differential +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# included from Top Level Makefile.am +# All paths should be given relative to the root + +LIBMEMCACHED_1_0_TEST_PATH= libmemcached-1.0/t + +# Test linking with C application +libmemcached_1_0_t_c_test_SOURCES= libmemcached-1.0/t/c_test.c +libmemcached_1_0_t_c_test_LDADD= libmemcached/libmemcached.la +libmemcached_1_0_t_c_test_DEPENDENCIES= libmemcached/libmemcached.la +check_PROGRAMS+= libmemcached-1.0/t/c_test +noinst_PROGRAMS+= libmemcached-1.0/t/c_test + +# Test linking with C++ application +libmemcached_1_0_t_cc_test_SOURCES= libmemcached-1.0/t/cc_test.cc +libmemcached_1_0_t_cc_test_LDADD= libmemcached/libmemcached.la +libmemcached_1_0_t_cc_test_DEPENDENCIES= libmemcached/libmemcached.la +check_PROGRAMS+= libmemcached-1.0/t/cc_test +noinst_PROGRAMS+= libmemcached-1.0/t/cc_test + +# Test linking with C application/SASL include +libmemcached_1_0_t_c_sasl_test_SOURCES= libmemcached-1.0/t/c_sasl_test.c +libmemcached_1_0_t_c_sasl_test_LDADD= libmemcached/libmemcached.la +libmemcached_1_0_t_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la +check_PROGRAMS+= libmemcached-1.0/t/c_sasl_test +noinst_PROGRAMS+= libmemcached-1.0/t/c_sasl_test diff --git a/libmemcached-1.0/triggers.h b/libmemcached-1.0/triggers.h new file mode 100644 index 00000000..b331429e --- /dev/null +++ b/libmemcached-1.0/triggers.h @@ -0,0 +1,64 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef memcached_return_t (*memcached_clone_fn)(memcached_st *destination, const memcached_st *source); +typedef memcached_return_t (*memcached_cleanup_fn)(const memcached_st *ptr); + +/** + Trigger functions. +*/ +typedef memcached_return_t (*memcached_trigger_key_fn)(const memcached_st *ptr, + const char *key, size_t key_length, + memcached_result_st *result); +typedef memcached_return_t (*memcached_trigger_delete_key_fn)(const memcached_st *ptr, + const char *key, size_t key_length); + +typedef memcached_return_t (*memcached_dump_fn)(const memcached_st *ptr, + const char *key, + size_t key_length, + void *context); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.0/types.h b/libmemcached-1.0/types.h index 2781321e..18ac99c2 100644 --- a/libmemcached-1.0/types.h +++ b/libmemcached-1.0/types.h @@ -80,62 +80,3 @@ typedef struct memcached_string_t memcached_string_t; typedef struct memcached_continuum_item_st memcached_continuum_item_st; #endif - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef memcached_return_t (*memcached_clone_fn)(memcached_st *destination, const memcached_st *source); -typedef memcached_return_t (*memcached_cleanup_fn)(const memcached_st *ptr); - -/** - Memory allocation functions. -*/ -typedef void (*memcached_free_fn)(const memcached_st *ptr, void *mem, void *context); -typedef void *(*memcached_malloc_fn)(const memcached_st *ptr, const size_t size, void *context); -typedef void *(*memcached_realloc_fn)(const memcached_st *ptr, void *mem, const size_t size, void *context); -typedef void *(*memcached_calloc_fn)(const memcached_st *ptr, size_t nelem, const size_t elsize, void *context); - - -typedef memcached_return_t (*memcached_execute_fn)(const memcached_st *ptr, memcached_result_st *result, void *context); -typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_instance_st server, void *context); -typedef memcached_return_t (*memcached_stat_fn)(memcached_server_instance_st server, - const char *key, size_t key_length, - const char *value, size_t value_length, - void *context); - -/** - Trigger functions. -*/ -typedef memcached_return_t (*memcached_trigger_key_fn)(const memcached_st *ptr, - const char *key, size_t key_length, - memcached_result_st *result); -typedef memcached_return_t (*memcached_trigger_delete_key_fn)(const memcached_st *ptr, - const char *key, size_t key_length); - -typedef memcached_return_t (*memcached_dump_fn)(const memcached_st *ptr, - const char *key, - size_t key_length, - void *context); - -#ifdef __cplusplus -} -#endif - -/** - @note The following definitions are just here for backwards compatibility. -*/ -typedef memcached_return_t memcached_return; -typedef memcached_server_distribution_t memcached_server_distribution; -typedef memcached_behavior_t memcached_behavior; -typedef memcached_callback_t memcached_callback; -typedef memcached_hash_t memcached_hash; -typedef memcached_connection_t memcached_connection; -typedef memcached_clone_fn memcached_clone_func; -typedef memcached_cleanup_fn memcached_cleanup_func; -typedef memcached_execute_fn memcached_execute_function; -typedef memcached_server_fn memcached_server_function; -typedef memcached_trigger_key_fn memcached_trigger_key; -typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key; -typedef memcached_dump_fn memcached_dump_func; diff --git a/libmemcached-1.0/constants.h b/libmemcached-1.0/types/behavior.h similarity index 54% rename from libmemcached-1.0/constants.h rename to libmemcached-1.0/types/behavior.h index 9c8ab643..192b89e4 100644 --- a/libmemcached-1.0/constants.h +++ b/libmemcached-1.0/types/behavior.h @@ -2,8 +2,8 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,41 +38,6 @@ #pragma once -/* Public defines */ -#define MEMCACHED_DEFAULT_PORT 11211 -#define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ -#define MEMCACHED_MAX_BUFFER 8196 -#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_STRIDE 4 -#define MEMCACHED_DEFAULT_TIMEOUT 5000 -#define MEMCACHED_DEFAULT_CONNECT_TIMEOUT 4000 -#define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */ -#define MEMCACHED_PREFIX_KEY_MAX_SIZE 128 -#define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU -#define MEMCACHED_VERSION_STRING_LENGTH 24 -#define MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH 20 -#define MEMCACHED_SERVER_FAILURE_LIMIT 5 -#define MEMCACHED_SERVER_FAILURE_RETRY_TIMEOUT 2 - - -enum memcached_server_distribution_t { - MEMCACHED_DISTRIBUTION_MODULA, - MEMCACHED_DISTRIBUTION_CONSISTENT, - MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA, - MEMCACHED_DISTRIBUTION_RANDOM, - MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY, - MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED, - MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET, - MEMCACHED_DISTRIBUTION_CONSISTENT_MAX -}; - -#ifndef __cplusplus -typedef enum memcached_server_distribution_t memcached_server_distribution_t; -#endif - enum memcached_behavior_t { MEMCACHED_BEHAVIOR_NO_BLOCK, MEMCACHED_BEHAVIOR_TCP_NODELAY, @@ -116,52 +81,3 @@ enum memcached_behavior_t { #ifndef __cplusplus typedef enum memcached_behavior_t memcached_behavior_t; #endif - -enum memcached_callback_t { - MEMCACHED_CALLBACK_PREFIX_KEY = 0, - MEMCACHED_CALLBACK_USER_DATA = 1, - MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2, - MEMCACHED_CALLBACK_CLONE_FUNCTION = 3, - MEMCACHED_CALLBACK_GET_FAILURE = 7, - MEMCACHED_CALLBACK_DELETE_TRIGGER = 8, - MEMCACHED_CALLBACK_MAX, - MEMCACHED_CALLBACK_NAMESPACE= MEMCACHED_CALLBACK_PREFIX_KEY -}; - -#ifndef __cplusplus -typedef enum memcached_callback_t memcached_callback_t; -#endif - -enum memcached_hash_t { - MEMCACHED_HASH_DEFAULT= 0, - MEMCACHED_HASH_MD5, - MEMCACHED_HASH_CRC, - MEMCACHED_HASH_FNV1_64, - MEMCACHED_HASH_FNV1A_64, - MEMCACHED_HASH_FNV1_32, - MEMCACHED_HASH_FNV1A_32, - MEMCACHED_HASH_HSIEH, - MEMCACHED_HASH_MURMUR, - MEMCACHED_HASH_JENKINS, - MEMCACHED_HASH_CUSTOM, - MEMCACHED_HASH_MAX -}; - -#ifndef __cplusplus -typedef enum memcached_hash_t memcached_hash_t; -#endif - -enum memcached_connection_t { - MEMCACHED_CONNECTION_TCP, - MEMCACHED_CONNECTION_UDP, - MEMCACHED_CONNECTION_UNIX_SOCKET -}; - -enum { - MEMCACHED_CONNECTION_UNKNOWN= 0, - MEMCACHED_CONNECTION_MAX= 0 -}; - -#ifndef __cplusplus -typedef enum memcached_connection_t memcached_connection_t; -#endif diff --git a/libmemcached-1.0/types/callback.h b/libmemcached-1.0/types/callback.h new file mode 100644 index 00000000..d5481f50 --- /dev/null +++ b/libmemcached-1.0/types/callback.h @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +enum memcached_callback_t { + MEMCACHED_CALLBACK_PREFIX_KEY = 0, + MEMCACHED_CALLBACK_USER_DATA = 1, + MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2, + MEMCACHED_CALLBACK_CLONE_FUNCTION = 3, + MEMCACHED_CALLBACK_GET_FAILURE = 7, + MEMCACHED_CALLBACK_DELETE_TRIGGER = 8, + MEMCACHED_CALLBACK_MAX, + MEMCACHED_CALLBACK_NAMESPACE= MEMCACHED_CALLBACK_PREFIX_KEY +}; + +#ifndef __cplusplus +typedef enum memcached_callback_t memcached_callback_t; +#endif diff --git a/libmemcached-1.0/types/connection.h b/libmemcached-1.0/types/connection.h new file mode 100644 index 00000000..d2a072b7 --- /dev/null +++ b/libmemcached-1.0/types/connection.h @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +enum memcached_connection_t { + MEMCACHED_CONNECTION_TCP, + MEMCACHED_CONNECTION_UDP, + MEMCACHED_CONNECTION_UNIX_SOCKET +}; + +#ifndef __cplusplus +typedef enum memcached_connection_t memcached_connection_t; +#endif diff --git a/libmemcached-1.0/types/hash.h b/libmemcached-1.0/types/hash.h new file mode 100644 index 00000000..7651eb1a --- /dev/null +++ b/libmemcached-1.0/types/hash.h @@ -0,0 +1,58 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +enum memcached_hash_t { + MEMCACHED_HASH_DEFAULT= 0, + MEMCACHED_HASH_MD5, + MEMCACHED_HASH_CRC, + MEMCACHED_HASH_FNV1_64, + MEMCACHED_HASH_FNV1A_64, + MEMCACHED_HASH_FNV1_32, + MEMCACHED_HASH_FNV1A_32, + MEMCACHED_HASH_HSIEH, + MEMCACHED_HASH_MURMUR, + MEMCACHED_HASH_JENKINS, + MEMCACHED_HASH_CUSTOM, + MEMCACHED_HASH_MAX +}; + +#ifndef __cplusplus +typedef enum memcached_hash_t memcached_hash_t; +#endif diff --git a/libmemcached-1.0/types/include.am b/libmemcached-1.0/types/include.am new file mode 100644 index 00000000..d102c313 --- /dev/null +++ b/libmemcached-1.0/types/include.am @@ -0,0 +1,9 @@ +# vim:ft=automake + +nobase_include_HEADERS+= \ + libmemcached-1.0/types/behavior.h \ + libmemcached-1.0/types/callback.h \ + libmemcached-1.0/types/connection.h \ + libmemcached-1.0/types/hash.h \ + libmemcached-1.0/types/return.h \ + libmemcached-1.0/types/server_distribution.h diff --git a/libmemcached-1.0/types/return.h b/libmemcached-1.0/types/return.h new file mode 100644 index 00000000..e57442e4 --- /dev/null +++ b/libmemcached-1.0/types/return.h @@ -0,0 +1,94 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 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 + +enum memcached_return_t { + MEMCACHED_SUCCESS, + MEMCACHED_FAILURE, + MEMCACHED_HOST_LOOKUP_FAILURE, // getaddrinfo() and getnameinfo() only + MEMCACHED_CONNECTION_FAILURE, + MEMCACHED_CONNECTION_BIND_FAILURE, // DEPRECATED, see MEMCACHED_HOST_LOOKUP_FAILURE + MEMCACHED_WRITE_FAILURE, + MEMCACHED_READ_FAILURE, + MEMCACHED_UNKNOWN_READ_FAILURE, + MEMCACHED_PROTOCOL_ERROR, + MEMCACHED_CLIENT_ERROR, + MEMCACHED_SERVER_ERROR, + MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE, // DEPRECATED + MEMCACHED_DATA_EXISTS, + MEMCACHED_DATA_DOES_NOT_EXIST, + MEMCACHED_NOTSTORED, + MEMCACHED_STORED, + MEMCACHED_NOTFOUND, + MEMCACHED_MEMORY_ALLOCATION_FAILURE, + MEMCACHED_PARTIAL_READ, + MEMCACHED_SOME_ERRORS, + MEMCACHED_NO_SERVERS, + MEMCACHED_END, + MEMCACHED_DELETED, + MEMCACHED_VALUE, + MEMCACHED_STAT, + MEMCACHED_ITEM, + MEMCACHED_ERRNO, + MEMCACHED_FAIL_UNIX_SOCKET, // DEPRECATED + MEMCACHED_NOT_SUPPORTED, + MEMCACHED_NO_KEY_PROVIDED, /* Deprecated. Use MEMCACHED_BAD_KEY_PROVIDED! */ + MEMCACHED_FETCH_NOTFINISHED, + MEMCACHED_TIMEOUT, + MEMCACHED_BUFFERED, + MEMCACHED_BAD_KEY_PROVIDED, + MEMCACHED_INVALID_HOST_PROTOCOL, + MEMCACHED_SERVER_MARKED_DEAD, + MEMCACHED_UNKNOWN_STAT_KEY, + MEMCACHED_E2BIG, + MEMCACHED_INVALID_ARGUMENTS, + MEMCACHED_KEY_TOO_BIG, + MEMCACHED_AUTH_PROBLEM, + MEMCACHED_AUTH_FAILURE, + MEMCACHED_AUTH_CONTINUE, + MEMCACHED_PARSE_ERROR, + MEMCACHED_PARSE_USER_ERROR, + MEMCACHED_DEPRECATED, + MEMCACHED_IN_PROGRESS, + MEMCACHED_SERVER_TEMPORARILY_DISABLED, + MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE, + MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ +}; + +#ifndef __cplusplus +typedef enum memcached_return_t memcached_return_t; +#endif diff --git a/libmemcached-1.0/types/server_distribution.h b/libmemcached-1.0/types/server_distribution.h new file mode 100644 index 00000000..95e129f6 --- /dev/null +++ b/libmemcached-1.0/types/server_distribution.h @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +enum memcached_server_distribution_t { + MEMCACHED_DISTRIBUTION_MODULA, + MEMCACHED_DISTRIBUTION_CONSISTENT, + MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA, + MEMCACHED_DISTRIBUTION_RANDOM, + MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY, + MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED, + MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET, + MEMCACHED_DISTRIBUTION_CONSISTENT_MAX +}; + +#ifndef __cplusplus +typedef enum memcached_server_distribution_t memcached_server_distribution_t; +#endif diff --git a/libmemcached-1.2/allocators.h b/libmemcached-1.2/allocators.h new file mode 100644 index 00000000..0fd7bef6 --- /dev/null +++ b/libmemcached-1.2/allocators.h @@ -0,0 +1,54 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_set_memory_allocators(memcached_st *ptr, + memcached_malloc_fn mem_malloc, + memcached_free_fn mem_free, + memcached_realloc_fn mem_realloc, + memcached_calloc_fn mem_calloc, + void *context); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/auto.h b/libmemcached-1.2/auto.h new file mode 100644 index 00000000..13e0218d --- /dev/null +++ b/libmemcached-1.2/auto.h @@ -0,0 +1,111 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API + memcached_return_t memcached_increment(memcached_st *ptr, + const char *key, size_t key_length, + uint32_t offset, + uint64_t *value); +LIBMEMCACHED_API + memcached_return_t memcached_decrement(memcached_st *ptr, + const char *key, size_t key_length, + uint32_t offset, + uint64_t *value); + +LIBMEMCACHED_API + memcached_return_t memcached_increment_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + uint64_t offset, + uint64_t *value); + +LIBMEMCACHED_API + memcached_return_t memcached_decrement_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + uint64_t offset, + uint64_t *value); + +LIBMEMCACHED_API + memcached_return_t memcached_increment_with_initial(memcached_st *ptr, + const char *key, + size_t key_length, + uint64_t offset, + uint64_t initial, + time_t expiration, + uint64_t *value); + +LIBMEMCACHED_API + memcached_return_t memcached_decrement_with_initial(memcached_st *ptr, + const char *key, + size_t key_length, + uint64_t offset, + uint64_t initial, + time_t expiration, + uint64_t *value); + +LIBMEMCACHED_API + memcached_return_t memcached_increment_with_initial_by_key(memcached_st *ptr, + const char *group_key, + size_t group_key_length, + const char *key, + size_t key_length, + uint64_t offset, + uint64_t initial, + time_t expiration, + uint64_t *value); + +LIBMEMCACHED_API + memcached_return_t memcached_decrement_with_initial_by_key(memcached_st *ptr, + const char *group_key, + size_t group_key_length, + const char *key, + size_t key_length, + uint64_t offset, + uint64_t initial, + time_t expiration, + uint64_t *value); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/behavior.h b/libmemcached-1.2/behavior.h new file mode 100644 index 00000000..3ccefc0f --- /dev/null +++ b/libmemcached-1.2/behavior.h @@ -0,0 +1,83 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_behavior_set(memcached_st *ptr, const memcached_behavior_t flag, uint64_t data); + +LIBMEMCACHED_API +uint64_t memcached_behavior_get(memcached_st *ptr, const memcached_behavior_t flag); + +LIBMEMCACHED_API +memcached_return_t memcached_behavior_set_distribution(memcached_st *ptr, memcached_server_distribution_t type); + +LIBMEMCACHED_API +memcached_server_distribution_t memcached_behavior_get_distribution(memcached_st *ptr); + +LIBMEMCACHED_API +memcached_return_t memcached_behavior_set_key_hash(memcached_st *ptr, memcached_hash_t type); + +LIBMEMCACHED_API +memcached_hash_t memcached_behavior_get_key_hash(memcached_st *ptr); + +LIBMEMCACHED_API +memcached_return_t memcached_behavior_set_distribution_hash(memcached_st *ptr, memcached_hash_t type); + +LIBMEMCACHED_API +memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr); + +LIBMEMCACHED_API + const char *libmemcached_string_behavior(const memcached_behavior_t flag); + +LIBMEMCACHED_API + const char *libmemcached_string_distribution(const memcached_server_distribution_t flag); + +LIBMEMCACHED_API + memcached_return_t memcached_bucket_set(memcached_st *self, + const uint32_t *host_map, + const uint32_t *forward_map, + const uint32_t buckets, + const uint32_t replicas); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/callback.h b/libmemcached-1.2/callback.h new file mode 100644 index 00000000..ddd39aeb --- /dev/null +++ b/libmemcached-1.2/callback.h @@ -0,0 +1,50 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_callback_set(memcached_st *ptr, + const memcached_callback_t flag, + const void *data); +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/configure.h.in b/libmemcached-1.2/configure.h.in index 7b48be2a..167c4f23 100644 --- a/libmemcached-1.2/configure.h.in +++ b/libmemcached-1.2/configure.h.in @@ -2,8 +2,8 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2006-2009 Brian Aker, Trond Norbye All rights reserved. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/libmemcached-1.2/delete.h b/libmemcached-1.2/delete.h new file mode 100644 index 00000000..f01659cb --- /dev/null +++ b/libmemcached-1.2/delete.h @@ -0,0 +1,57 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_delete(memcached_st *ptr, const char *key, size_t key_length, + time_t unused); + +LIBMEMCACHED_API +memcached_return_t memcached_delete_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + time_t unused); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/dump.h b/libmemcached-1.2/dump.h new file mode 100644 index 00000000..9cf3c2d7 --- /dev/null +++ b/libmemcached-1.2/dump.h @@ -0,0 +1,50 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 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 + + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_dump(memcached_st *ptr, memcached_dump_fn *function, void *context, uint32_t number_of_callbacks); + + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/error.h b/libmemcached-1.2/error.h index 52cc759f..6b2a581b 100644 --- a/libmemcached-1.2/error.h +++ b/libmemcached-1.2/error.h @@ -48,12 +48,11 @@ LIBMEMCACHED_API memcached_return_t memcached_last_error(memcached_st *); LIBMEMCACHED_API - const char *memcached_server_last_error_message(memcached_instance_st *); + const char *memcached_server_last_error_message(memcached_server_instance_st ptr); LIBMEMCACHED_API - memcached_return_t memcached_server_last_error(memcached_instance_st *); + memcached_return_t memcached_server_last_error(memcached_server_instance_st ptr); #ifdef __cplusplus } // extern "C" #endif - diff --git a/libmemcached-1.2/exist.h b/libmemcached-1.2/exist.h new file mode 100644 index 00000000..4147c3de --- /dev/null +++ b/libmemcached-1.2/exist.h @@ -0,0 +1,52 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +memcached_return_t memcached_exist(memcached_st *memc, const char *key, size_t key_length); + +memcached_return_t memcached_exist_by_key(memcached_st *memc, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libmemcached-1.2/fetch.h b/libmemcached-1.2/fetch.h new file mode 100644 index 00000000..2c26d39d --- /dev/null +++ b/libmemcached-1.2/fetch.h @@ -0,0 +1,53 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_fetch_execute(memcached_st *ptr, + memcached_execute_fn *callback, + void *context, + uint32_t number_of_callbacks); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/flush.h b/libmemcached-1.2/flush.h new file mode 100644 index 00000000..f38e3c03 --- /dev/null +++ b/libmemcached-1.2/flush.h @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_flush(memcached_st *ptr, time_t expiration); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/flush_buffers.h b/libmemcached-1.2/flush_buffers.h new file mode 100644 index 00000000..42484b91 --- /dev/null +++ b/libmemcached-1.2/flush_buffers.h @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_flush_buffers(memcached_st *mem); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/get.h b/libmemcached-1.2/get.h new file mode 100644 index 00000000..bd49aeb6 --- /dev/null +++ b/libmemcached-1.2/get.h @@ -0,0 +1,102 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Public defines */ +LIBMEMCACHED_API +char *memcached_get(memcached_st *ptr, + const char *key, size_t key_length, + size_t *value_length, + uint32_t *flags, + memcached_return_t *error); + +LIBMEMCACHED_API +memcached_return_t memcached_mget(memcached_st *ptr, + const char * const *keys, + const size_t *key_length, + size_t number_of_keys); + +LIBMEMCACHED_API +char *memcached_get_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + size_t *value_length, + uint32_t *flags, + memcached_return_t *error); + +LIBMEMCACHED_API +memcached_return_t memcached_mget_by_key(memcached_st *ptr, + const char *group_key, + size_t group_key_length, + const char * const *keys, + const size_t *key_length, + const size_t number_of_keys); + +LIBMEMCACHED_API +memcached_result_st *memcached_fetch_result(memcached_st *ptr, + memcached_result_st *result, + memcached_return_t *error); + +LIBMEMCACHED_API +memcached_return_t memcached_mget_execute(memcached_st *ptr, + const char * const *keys, + const size_t *key_length, + const size_t number_of_keys, + memcached_execute_fn *callback, + void *context, + const uint32_t number_of_callbacks); + +LIBMEMCACHED_API +memcached_return_t memcached_mget_execute_by_key(memcached_st *ptr, + const char *group_key, + size_t group_key_length, + const char * const *keys, + const size_t *key_length, + size_t number_of_keys, + memcached_execute_fn *callback, + void *context, + const uint32_t number_of_callbacks); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/hash.h b/libmemcached-1.2/hash.h new file mode 100644 index 00000000..a9b7d25f --- /dev/null +++ b/libmemcached-1.2/hash.h @@ -0,0 +1,52 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +const hashkit_st *memcached_get_hashkit(const memcached_st *ptr); + +LIBMEMCACHED_API +memcached_return_t memcached_set_hashkit(memcached_st *ptr, hashkit_st *hashk); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/include.am b/libmemcached-1.2/include.am index fa537505..fb319bcd 100644 --- a/libmemcached-1.2/include.am +++ b/libmemcached-1.2/include.am @@ -1,12 +1,45 @@ # vim:ft=automake # included from Top Level Makefile.am # All paths should be given relative to the root +# -# This is not a public interface yet. +include libmemcached-1.2/t/include.am EXTRA_DIST+= \ libmemcached-1.2/configure.h.in -noinst_HEADERS+= \ - libmemcached-1.2/memcached.h - +nobase_include_HEADERS+= \ + libmemcached-1.2/allocators.h \ + libmemcached-1.2/auto.h \ + libmemcached-1.2/behavior.h \ + libmemcached-1.2/callback.h \ + libmemcached-1.2/configure.h \ + libmemcached-1.2/constants.h \ + libmemcached-1.2/delete.h \ + libmemcached-1.2/dump.h \ + libmemcached-1.2/error.h \ + libmemcached-1.2/exist.h \ + libmemcached-1.2/exception.hpp \ + libmemcached-1.2/fetch.h \ + libmemcached-1.2/flush.h \ + libmemcached-1.2/flush_buffers.h \ + libmemcached-1.2/get.h \ + libmemcached-1.2/hash.h \ + libmemcached-1.2/memcached.h \ + libmemcached-1.2/memcached.hpp \ + libmemcached-1.2/options.h \ + libmemcached-1.2/parse.h \ + libmemcached-1.2/quit.h \ + libmemcached-1.2/return.h \ + libmemcached-1.2/platform.h \ + libmemcached-1.2/result.h \ + libmemcached-1.2/sasl.h \ + libmemcached-1.2/server.h \ + libmemcached-1.2/stats.h \ + libmemcached-1.2/storage.h \ + libmemcached-1.2/strerror.h \ + libmemcached-1.2/touch.h \ + libmemcached-1.2/types.h \ + libmemcached-1.2/verbosity.h \ + libmemcached-1.2/version.h \ + libmemcached-1.2/visibility.h diff --git a/libmemcached-1.2/memcached.h b/libmemcached-1.2/memcached.h index ef2adf24..eeb3a8b1 100644 --- a/libmemcached-1.2/memcached.h +++ b/libmemcached-1.2/memcached.h @@ -2,7 +2,8 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -46,12 +47,54 @@ #endif #include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include + +// Everything above this line must be in the order specified. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { #endif +LIBMEMCACHED_API +void memcached_servers_reset(memcached_st *ptr); + +LIBMEMCACHED_API +memcached_st *memcached_create(memcached_st *ptr); + LIBMEMCACHED_API memcached_st *memcached(const char *string, size_t string_length); @@ -59,7 +102,13 @@ LIBMEMCACHED_API void memcached_free(memcached_st *ptr); LIBMEMCACHED_API -memcached_st *memcached_clone(memcached_st *destination, const memcached_st *source); +memcached_return_t memcached_reset(memcached_st *ptr); + +LIBMEMCACHED_API +void memcached_reset_last_disconnected_server(memcached_st *ptr); + +LIBMEMCACHED_API +memcached_st *memcached_clone(memcached_st *clone, const memcached_st *ptr); LIBMEMCACHED_API void *memcached_get_user_data(const memcached_st *ptr); @@ -67,6 +116,18 @@ void *memcached_get_user_data(const memcached_st *ptr); LIBMEMCACHED_API void *memcached_set_user_data(memcached_st *ptr, void *data); +LIBMEMCACHED_API +memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source); + +LIBMEMCACHED_API +memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key); + +LIBMEMCACHED_API +uint32_t memcached_server_count(const memcached_st *); + +LIBMEMCACHED_API +uint64_t memcached_query_id(const memcached_st *); + #ifdef __cplusplus } // extern "C" #endif diff --git a/libmemcached-1.2/options.h b/libmemcached-1.2/options.h new file mode 100644 index 00000000..f5a6e06d --- /dev/null +++ b/libmemcached-1.2/options.h @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API + memcached_return_t libmemcached_check_configuration(const char *option_string, size_t length, char *error_buffer, size_t error_buffer_size); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/platform.h b/libmemcached-1.2/platform.h new file mode 100644 index 00000000..763febaa --- /dev/null +++ b/libmemcached-1.2/platform.h @@ -0,0 +1,56 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + + +#ifdef WIN32 + +#include +#include +typedef short in_port_t; +typedef SOCKET memcached_socket_t; +#else +typedef int memcached_socket_t; +#include +#include +#include +#include +#include +#include + +#endif /* WIN32 */ diff --git a/libmemcached-1.2/result.h b/libmemcached-1.2/result.h new file mode 100644 index 00000000..4f7da4d2 --- /dev/null +++ b/libmemcached-1.2/result.h @@ -0,0 +1,67 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Result Struct */ +LIBMEMCACHED_API +void memcached_result_free(memcached_result_st *result); + +const char *memcached_result_key_value(const memcached_result_st *self); + +LIBMEMCACHED_API +size_t memcached_result_key_length(const memcached_result_st *self); + +LIBMEMCACHED_API +const char *memcached_result_value(const memcached_result_st *self); + +LIBMEMCACHED_API +size_t memcached_result_length(const memcached_result_st *self); + +LIBMEMCACHED_API +uint32_t memcached_result_flags(const memcached_result_st *self); + +LIBMEMCACHED_API +uint64_t memcached_result_cas(const memcached_result_st *self); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libmemcached-1.2/return.h b/libmemcached-1.2/return.h new file mode 100644 index 00000000..e5788c50 --- /dev/null +++ b/libmemcached-1.2/return.h @@ -0,0 +1,130 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 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 + +enum memcached_return_t { + MEMCACHED_SUCCESS, + MEMCACHED_FAILURE, + MEMCACHED_HOST_LOOKUP_FAILURE, // getaddrinfo() and getnameinfo() only + MEMCACHED_CONNECTION_FAILURE, + MEMCACHED_CONNECTION_BIND_FAILURE, // DEPRECATED, see MEMCACHED_HOST_LOOKUP_FAILURE + MEMCACHED_WRITE_FAILURE, + MEMCACHED_READ_FAILURE, + MEMCACHED_UNKNOWN_READ_FAILURE, + MEMCACHED_PROTOCOL_ERROR, + MEMCACHED_CLIENT_ERROR, + MEMCACHED_SERVER_ERROR, + MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE, // DEPRECATED + MEMCACHED_DATA_EXISTS, + MEMCACHED_DATA_DOES_NOT_EXIST, + MEMCACHED_NOTSTORED, + MEMCACHED_STORED, + MEMCACHED_NOTFOUND, + MEMCACHED_MEMORY_ALLOCATION_FAILURE, + MEMCACHED_PARTIAL_READ, + MEMCACHED_SOME_ERRORS, + MEMCACHED_NO_SERVERS, + MEMCACHED_END, + MEMCACHED_DELETED, + MEMCACHED_VALUE, + MEMCACHED_STAT, + MEMCACHED_ITEM, + MEMCACHED_ERRNO, + MEMCACHED_FAIL_UNIX_SOCKET, // DEPRECATED + MEMCACHED_NOT_SUPPORTED, + MEMCACHED_NO_KEY_PROVIDED, /* Deprecated. Use MEMCACHED_BAD_KEY_PROVIDED! */ + MEMCACHED_FETCH_NOTFINISHED, + MEMCACHED_TIMEOUT, + MEMCACHED_BUFFERED, + MEMCACHED_BAD_KEY_PROVIDED, + MEMCACHED_INVALID_HOST_PROTOCOL, + MEMCACHED_SERVER_MARKED_DEAD, + MEMCACHED_UNKNOWN_STAT_KEY, + MEMCACHED_E2BIG, + MEMCACHED_INVALID_ARGUMENTS, + MEMCACHED_KEY_TOO_BIG, + MEMCACHED_AUTH_PROBLEM, + MEMCACHED_AUTH_FAILURE, + MEMCACHED_AUTH_CONTINUE, + MEMCACHED_PARSE_ERROR, + MEMCACHED_PARSE_USER_ERROR, + MEMCACHED_DEPRECATED, + MEMCACHED_IN_PROGRESS, + MEMCACHED_SERVER_TEMPORARILY_DISABLED, + MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE, + MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ +}; + +#ifndef __cplusplus +typedef enum memcached_return_t memcached_return_t; +#endif + +static inline bool memcached_success(memcached_return_t rc) +{ + return (rc == MEMCACHED_BUFFERED || + rc == MEMCACHED_DELETED || + rc == MEMCACHED_END || + rc == MEMCACHED_ITEM || + rc == MEMCACHED_STAT || + rc == MEMCACHED_STORED || + rc == MEMCACHED_SUCCESS || + rc == MEMCACHED_VALUE); +} + +static inline bool memcached_failed(memcached_return_t rc) +{ + return (rc != MEMCACHED_SUCCESS && + rc != MEMCACHED_END && + rc != MEMCACHED_STORED && + rc != MEMCACHED_STAT && + rc != MEMCACHED_DELETED && + rc != MEMCACHED_BUFFERED && + rc != MEMCACHED_VALUE); +} + +static inline bool memcached_fatal(memcached_return_t rc) +{ + return (rc != MEMCACHED_SUCCESS && + rc != MEMCACHED_END && + rc != MEMCACHED_STORED && + rc != MEMCACHED_STAT && + rc != MEMCACHED_DELETED && + rc != MEMCACHED_BUFFERED && + rc != MEMCACHED_VALUE); +} + +#define memcached_continue(__memcached_return_t) ((__memcached_return_t) == MEMCACHED_IN_PROGRESS) diff --git a/libmemcached-1.2/sasl.h b/libmemcached-1.2/sasl.h new file mode 100644 index 00000000..6cbaec3f --- /dev/null +++ b/libmemcached-1.2/sasl.h @@ -0,0 +1,77 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT +#include +#else +#define sasl_callback_t void +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +void memcached_set_sasl_callbacks(memcached_st *ptr, + const sasl_callback_t *callbacks); + +LIBMEMCACHED_API +memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr, + const char *username, + const char *password); + +LIBMEMCACHED_API +memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr); + + +LIBMEMCACHED_API +sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr); + +#ifdef __cplusplus +} +#endif + +struct memcached_sasl_st { + sasl_callback_t *callbacks; + /* + ** Did we allocate data inside the callbacks, or did the user + ** supply that. + */ + bool is_allocated; +}; diff --git a/libmemcached-1.2/server.h b/libmemcached-1.2/server.h new file mode 100644 index 00000000..7359effd --- /dev/null +++ b/libmemcached-1.2/server.h @@ -0,0 +1,87 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_server_cursor(const memcached_st *ptr, + const memcached_server_fn *callback, + void *context, + uint32_t number_of_callbacks); + +LIBMEMCACHED_API + memcached_server_instance_st memcached_server_by_key(memcached_st *ptr, + const char *key, + size_t key_length, + memcached_return_t *error); + +LIBMEMCACHED_API +memcached_return_t memcached_server_add_unix_socket(memcached_st *ptr, + const char *filename); +LIBMEMCACHED_API +memcached_return_t memcached_server_add(memcached_st *ptr, + const char *hostname, in_port_t port); + +LIBMEMCACHED_API +memcached_return_t memcached_server_add_unix_socket_with_weight(memcached_st *ptr, + const char *filename, + uint32_t weight); +LIBMEMCACHED_API +memcached_return_t memcached_server_add_with_weight(memcached_st *ptr, const char *hostname, + in_port_t port, + uint32_t weight); + +/** + Operations on Single Servers. +*/ +LIBMEMCACHED_API +const char *memcached_server_name(const memcached_server_instance_st self); + +LIBMEMCACHED_API +in_port_t memcached_server_port(const memcached_server_instance_st self); + +LIBMEMCACHED_API +const char *memcached_server_type(const memcached_server_instance_st ptr); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libmemcached-1.2/stats.h b/libmemcached-1.2/stats.h new file mode 100644 index 00000000..ebba16f8 --- /dev/null +++ b/libmemcached-1.2/stats.h @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_stat_execute(memcached_st *memc, const char *args, memcached_stat_fn func, void *context); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libmemcached-1.2/storage.h b/libmemcached-1.2/storage.h new file mode 100644 index 00000000..5c0c2cba --- /dev/null +++ b/libmemcached-1.2/storage.h @@ -0,0 +1,131 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +/* All of the functions for adding data to the server */ +LIBMEMCACHED_API +memcached_return_t memcached_set(memcached_st *ptr, const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); +LIBMEMCACHED_API +memcached_return_t memcached_add(memcached_st *ptr, const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); +LIBMEMCACHED_API +memcached_return_t memcached_replace(memcached_st *ptr, const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); +LIBMEMCACHED_API +memcached_return_t memcached_append(memcached_st *ptr, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); +LIBMEMCACHED_API +memcached_return_t memcached_prepend(memcached_st *ptr, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); +LIBMEMCACHED_API +memcached_return_t memcached_cas(memcached_st *ptr, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags, + uint64_t cas); + +LIBMEMCACHED_API +memcached_return_t memcached_set_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); + +LIBMEMCACHED_API +memcached_return_t memcached_add_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); + +LIBMEMCACHED_API +memcached_return_t memcached_replace_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); + +LIBMEMCACHED_API +memcached_return_t memcached_prepend_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); + +LIBMEMCACHED_API +memcached_return_t memcached_append_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags); + +LIBMEMCACHED_API +memcached_return_t memcached_cas_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + const char *value, size_t value_length, + time_t expiration, + uint32_t flags, + uint64_t cas); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/strerror.h b/libmemcached-1.2/strerror.h new file mode 100644 index 00000000..b6ec12d3 --- /dev/null +++ b/libmemcached-1.2/strerror.h @@ -0,0 +1,50 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +const char *memcached_strerror(memcached_st *not_used, memcached_return_t rc); + +#ifdef __cplusplus +} +#endif diff --git a/tests/c_test.c b/libmemcached-1.2/t/c_test.c similarity index 100% rename from tests/c_test.c rename to libmemcached-1.2/t/c_test.c diff --git a/libmemcached-1.2/t/cc_test.cc b/libmemcached-1.2/t/cc_test.cc new file mode 100644 index 00000000..e8960f4c --- /dev/null +++ b/libmemcached-1.2/t/cc_test.cc @@ -0,0 +1,56 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached C test app + * + * Copyright (C) 2011 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. + * + */ + +/* + * @file @brief C dummy test, aka testing C linking, etc + */ + +#include + +#include + +int main(void) +{ + (void)memcached_success(MEMCACHED_SUCCESS); + (void)memcached_failed(MEMCACHED_SUCCESS); + (void)memcached_continue(MEMCACHED_SUCCESS); + + memcached_st *memc= memcached_create(NULL); + memcached_free(memc); + + return EXIT_SUCCESS; +} + diff --git a/libmemcached-1.2/t/include.am b/libmemcached-1.2/t/include.am new file mode 100644 index 00000000..6c11f2de --- /dev/null +++ b/libmemcached-1.2/t/include.am @@ -0,0 +1,8 @@ +# vim:ft=automake + +# Test linking with C application +libmemcached_1_2_c_test_SOURCES= libmemcached-1.2/t/c_test.c +libmemcached_1_2_c_test_LDADD= libmemcached/libmemcached.la +libmemcached_1_2_c_test_DEPENDENCIES= libmemcached/libmemcached.la +check_PROGRAMS+= libmemcached-1.2/t/c_test +noinst_PROGRAMS+= libmemcached-1.2/t/c_test diff --git a/libmemcached-1.2/touch.h b/libmemcached-1.2/touch.h new file mode 100644 index 00000000..631d3fdb --- /dev/null +++ b/libmemcached-1.2/touch.h @@ -0,0 +1,59 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + + +LIBMEMCACHED_API +memcached_return_t memcached_touch(memcached_st *ptr, + const char *key, size_t key_length, + time_t expiration); + +LIBMEMCACHED_API +memcached_return_t memcached_touch_by_key(memcached_st *ptr, + const char *group_key, size_t group_key_length, + const char *key, size_t key_length, + time_t expiration); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/types.h b/libmemcached-1.2/types.h new file mode 100644 index 00000000..a342e9e5 --- /dev/null +++ b/libmemcached-1.2/types.h @@ -0,0 +1,78 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +struct memcached_st; +struct memcached_result_st; +struct memcached_array_st; +struct memcached_error_t; + +// All of the flavors of memcache_server_st +struct memcached_server_st; +typedef const struct memcached_server_st *memcached_server_instance_st; +typedef struct memcached_server_st *memcached_server_list_st; + +struct memcached_callback_st; + +// The following two structures are internal, and never exposed to users. +struct memcached_string_st; +struct memcached_string_t; +struct memcached_continuum_item_st; + +#else + +typedef struct memcached_st memcached_st; +typedef struct memcached_result_st memcached_result_st; +typedef struct memcached_array_st memcached_array_st; +typedef struct memcached_error_t memcached_error_t; + +// All of the flavors of memcache_server_st +typedef struct memcached_server_st memcached_server_st; +typedef const struct memcached_server_st *memcached_server_instance_st; +typedef struct memcached_server_st *memcached_server_list_st; + +typedef struct memcached_callback_st memcached_callback_st; + +// The following two structures are internal, and never exposed to users. +typedef struct memcached_string_st memcached_string_st; +typedef struct memcached_string_t memcached_string_t; +typedef struct memcached_continuum_item_st memcached_continuum_item_st; + +#endif diff --git a/libmemcached-1.2/verbosity.h b/libmemcached-1.2/verbosity.h new file mode 100644 index 00000000..3882592e --- /dev/null +++ b/libmemcached-1.2/verbosity.h @@ -0,0 +1,50 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_verbosity(memcached_st *ptr, uint32_t verbosity); + + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/version.h b/libmemcached-1.2/version.h new file mode 100644 index 00000000..bfda1632 --- /dev/null +++ b/libmemcached-1.2/version.h @@ -0,0 +1,52 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.comAker + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_return_t memcached_version(memcached_st *ptr); + +LIBMEMCACHED_API +const char * memcached_lib_version(void); + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-1.2/visibility.h b/libmemcached-1.2/visibility.h new file mode 100644 index 00000000..168281b5 --- /dev/null +++ b/libmemcached-1.2/visibility.h @@ -0,0 +1,87 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +/** + * + * LIBMEMCACHED_API is used for the public API symbols. It either DLL imports or + * DLL exports (or does nothing for static build). + * + * LIBMEMCACHED_LOCAL is used for non-api symbols. + */ + +#if defined(BUILDING_LIBMEMCACHEDINTERNAL) +# if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY +# define LIBMEMCACHED_API __attribute__ ((visibility("default"))) +# define LIBMEMCACHED_LOCAL __attribute__ ((visibility("default"))) +# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) +# define LIBMEMCACHED_API __global +# define LIBMEMCACHED_LOCAL __global +# elif defined(_MSC_VER) +# define LIBMEMCACHED_API extern __declspec(dllexport) +# define LIBMEMCACHED_LOCAL extern __declspec(dllexport) +# else +# define LIBMEMCACHED_API +# define LIBMEMCACHED_LOCAL +# endif +#else +# if defined(BUILDING_LIBMEMCACHED) +# if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY +# define LIBMEMCACHED_API __attribute__ ((visibility("default"))) +# define LIBMEMCACHED_LOCAL __attribute__ ((visibility("hidden"))) +# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) +# define LIBMEMCACHED_API __global +# define LIBMEMCACHED_LOCAL __hidden +# elif defined(_MSC_VER) +# define LIBMEMCACHED_API extern __declspec(dllexport) +# define LIBMEMCACHED_LOCAL +# else +# define LIBMEMCACHED_API +# define LIBMEMCACHED_LOCAL +# endif /* defined(HAVE_VISIBILITY) */ +# else /* defined(BUILDING_LIBMEMCACHED) */ +# if defined(_MSC_VER) +# define LIBMEMCACHED_API extern __declspec(dllimport) +# define LIBMEMCACHED_LOCAL +# else +# define LIBMEMCACHED_API +# define LIBMEMCACHED_LOCAL +# endif /* defined(_MSC_VER) */ +# endif /* defined(BUILDING_LIBMEMCACHED) */ +#endif /* defined(BUILDING_LIBMEMCACHEDINTERNAL) */ diff --git a/libmemcached-2.0/configure.h.in b/libmemcached-2.0/configure.h.in new file mode 100644 index 00000000..56ec61f2 --- /dev/null +++ b/libmemcached-2.0/configure.h.in @@ -0,0 +1,51 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +@LIBMEMCACHED_WITH_SASL_SUPPORT@ + +#define LIBMEMCACHED_VERSION_STRING "@VERSION@" +#define LIBMEMCACHED_VERSION_HEX @PANDORA_HEX_VERSION@ + +#ifdef __cplusplus +} +#endif diff --git a/libmemcached-2.0/error.h b/libmemcached-2.0/error.h new file mode 100644 index 00000000..52cc759f --- /dev/null +++ b/libmemcached-2.0/error.h @@ -0,0 +1,59 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * LibMemcached + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * 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 + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API + const char *memcached_last_error_message(memcached_st *); + +LIBMEMCACHED_API + memcached_return_t memcached_last_error(memcached_st *); + +LIBMEMCACHED_API + const char *memcached_server_last_error_message(memcached_instance_st *); + +LIBMEMCACHED_API + memcached_return_t memcached_server_last_error(memcached_instance_st *); + +#ifdef __cplusplus +} // extern "C" +#endif + diff --git a/libmemcached-2.0/include.am b/libmemcached-2.0/include.am new file mode 100644 index 00000000..fa537505 --- /dev/null +++ b/libmemcached-2.0/include.am @@ -0,0 +1,12 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +# This is not a public interface yet. + +EXTRA_DIST+= \ + libmemcached-1.2/configure.h.in + +noinst_HEADERS+= \ + libmemcached-1.2/memcached.h + diff --git a/libmemcached-2.0/memcached.h b/libmemcached-2.0/memcached.h new file mode 100644 index 00000000..ef2adf24 --- /dev/null +++ b/libmemcached-2.0/memcached.h @@ -0,0 +1,72 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 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 + +#include +#include +#include + + +#if !defined(__cplusplus) +# include +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +LIBMEMCACHED_API +memcached_st *memcached(const char *string, size_t string_length); + +LIBMEMCACHED_API +void memcached_free(memcached_st *ptr); + +LIBMEMCACHED_API +memcached_st *memcached_clone(memcached_st *destination, const memcached_st *source); + +LIBMEMCACHED_API +void *memcached_get_user_data(const memcached_st *ptr); + +LIBMEMCACHED_API +void *memcached_set_user_data(memcached_st *ptr, void *data); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libmemcached/analyze.cc b/libmemcached/analyze.cc index ec534a3b..576b6a6b 100644 --- a/libmemcached/analyze.cc +++ b/libmemcached/analyze.cc @@ -1,4 +1,4 @@ -#include "common.h" +#include static void calc_largest_consumption(memcached_analysis_st *result, const uint32_t server_num, @@ -65,16 +65,17 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, { uint64_t total_items= 0, total_bytes= 0; uint64_t total_get_cmds= 0, total_get_hits= 0; - uint32_t server_count, x; - memcached_analysis_st *result; + uint32_t server_count; if (not memc or not memc_stat) + { return NULL; + } *error= MEMCACHED_SUCCESS; server_count= memcached_server_count(memc); - result= (memcached_analysis_st*)calloc(memcached_server_count(memc), - sizeof(memcached_analysis_st)); + memcached_analysis_st *result= (memcached_analysis_st*)calloc(memcached_server_count(memc), + sizeof(memcached_analysis_st)); if (not result) { @@ -84,7 +85,7 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, result->root= memc; - for (x= 0; x < server_count; x++) + for (uint32_t x= 0; x < server_count; x++) { calc_largest_consumption(result, x, memc_stat[x].bytes); calc_oldest_node(result, x, memc_stat[x].uptime); diff --git a/libmemcached/memory.h b/libmemcached/memory.h index 89ad6984..e59eabbe 100644 --- a/libmemcached/memory.h +++ b/libmemcached/memory.h @@ -36,6 +36,8 @@ #pragma once +#include + static inline void libmemcached_free(const memcached_st *self, void *mem) { if (self) diff --git a/libtest/memcached.cc b/libtest/memcached.cc index daf6787c..05f43975 100644 --- a/libtest/memcached.cc +++ b/libtest/memcached.cc @@ -298,7 +298,7 @@ bool Memcached::build(int argc, const char *argv[]) arg_buffer << " -u root "; } - arg_buffer << " -l 127.0.0.1 "; + arg_buffer << " -l localhost "; arg_buffer << " -m 128 "; arg_buffer << " -M "; diff --git a/tests/hash_plus.cc b/tests/hash_plus.cc index fada2a6f..778ec220 100644 --- a/tests/hash_plus.cc +++ b/tests/hash_plus.cc @@ -14,7 +14,7 @@ using namespace libtest; -#include "hash_results.h" +#include "tests/hash_results.h" static test_return_t exists_test(void *) { diff --git a/tests/include.am b/tests/include.am index 2673ea24..35b0a913 100644 --- a/tests/include.am +++ b/tests/include.am @@ -23,6 +23,7 @@ EXTRA_DIST+= \ noinst_HEADERS+= \ tests/exist.h \ + tests/hash_results.h \ tests/libmemcached_world.h # Cycle should always run first @@ -134,20 +135,6 @@ tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memdump tests_memdump_LDADD= libtest/libtest.la $(TESTS_LDADDS) check_PROGRAMS+= tests/memdump noinst_PROGRAMS+= tests/memdump - -# Test linking with C application -tests_c_test_SOURCES= tests/c_test.c -tests_c_test_LDADD= libmemcached/libmemcached.la -tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la -check_PROGRAMS+=tests/c_test -noinst_PROGRAMS+=tests/c_test - -# Test linking with C application/SASL include -tests_c_sasl_test_SOURCES= tests/c_sasl_test.c -tests_c_sasl_test_LDADD= libmemcached/libmemcached.la -tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la -check_PROGRAMS+=tests/c_sasl_test -noinst_PROGRAMS+=tests/c_sasl_test test: check -- 2.30.2