From fee8381b6b80398fcb6893860400ead6a598f15b Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Sun, 2 Oct 2011 11:02:19 -0700 Subject: [PATCH] Create version 1.0 directory structure. --- .bzrignore | 5 +- Makefile.am | 3 + clients/utilities.cc | 6 +- clients/utilities.h | 5 +- configure.ac | 4 +- example/interface_v0.c | 6 +- example/interface_v1.c | 2 +- example/memcached_light.c | 2 +- {libhashkit => libhashkit-1.0}/algorithm.h | 0 {libhashkit => libhashkit-1.0}/behavior.h | 0 {libhashkit => libhashkit-1.0}/configure.h.in | 0 {libhashkit => libhashkit-1.0}/digest.h | 0 {libhashkit => libhashkit-1.0}/function.h | 5 +- {libhashkit => libhashkit-1.0}/has.h | 0 libhashkit-1.0/hashkit.h | 93 +++ {libhashkit => libhashkit-1.0}/hashkit.hpp | 0 libhashkit-1.0/include.am | 19 + .../str_algorithm.h | 0 {libhashkit => libhashkit-1.0}/strerror.h | 5 +- {libhashkit => libhashkit-1.0}/types.h | 0 {libhashkit => libhashkit-1.0}/visibility.h | 0 libhashkit/common.h | 1 + libhashkit/hashkit.h | 58 +- libhashkit/include.am | 14 - libhashkit/is.h | 43 ++ .../allocators.h | 0 {libmemcached => libmemcached-1.0}/analyze.h | 0 {libmemcached => libmemcached-1.0}/auto.h | 0 .../basic_string.h | 0 {libmemcached => libmemcached-1.0}/behavior.h | 0 {libmemcached => libmemcached-1.0}/callback.h | 0 .../configure.h.in | 0 .../constants.h | 0 {libmemcached => libmemcached-1.0}/delete.h | 0 {libmemcached => libmemcached-1.0}/dump.h | 0 {libmemcached => libmemcached-1.0}/error.h | 0 .../exception.hpp | 0 {libmemcached => libmemcached-1.0}/exist.h | 0 {libmemcached => libmemcached-1.0}/fetch.h | 0 {libmemcached => libmemcached-1.0}/flush.h | 0 .../flush_buffers.h | 0 {libmemcached => libmemcached-1.0}/get.h | 0 {libmemcached => libmemcached-1.0}/hash.h | 0 libmemcached-1.0/include.am | 44 ++ libmemcached-1.0/memcached.h | 216 ++++++ .../memcached.hpp | 4 +- {libmemcached => libmemcached-1.0}/options.h | 0 {libmemcached => libmemcached-1.0}/parse.h | 0 {libmemcached => libmemcached-1.0}/platform.h | 0 {libmemcached => libmemcached-1.0}/quit.h | 0 {libmemcached => libmemcached-1.0}/result.h | 0 {libmemcached => libmemcached-1.0}/return.h | 0 {libmemcached => libmemcached-1.0}/sasl.h | 0 {libmemcached => libmemcached-1.0}/server.h | 0 .../server_list.h | 0 {libmemcached => libmemcached-1.0}/stats.h | 0 {libmemcached => libmemcached-1.0}/storage.h | 0 {libmemcached => libmemcached-1.0}/strerror.h | 0 {libmemcached => libmemcached-1.0}/string.h | 2 - {libmemcached => libmemcached-1.0}/types.h | 0 .../verbosity.h | 0 {libmemcached => libmemcached-1.0}/version.h | 0 .../visibility.h | 0 libmemcached/common.h | 3 +- libmemcached/csl/common.h | 1 + libmemcached/csl/symbol.h | 4 +- libmemcached/error.hpp | 2 +- libmemcached/include.am | 55 +- libmemcached/memcached.h | 180 +---- libmemcached/memcached_util.h | 6 +- libmemcached/namespace.h | 2 +- libmemcached/protocol/cache.c | 2 +- libmemcached/protocol/common.h | 3 +- libmemcached/server.hpp | 2 - libmemcached/util.h | 4 +- libmemcached/util/include.am | 8 - .../callback.h | 6 +- libmemcachedprotocol-0.0/include.am | 7 + libmemcachedprotocol-0.0/protocol_binary.h | 726 ++++++++++++++++++ .../protocol_handler.h | 8 +- libmemcachedprotocol-0.0/vbucket.h | 26 + .../util => libmemcachedutil-1.0}/flush.h | 0 libmemcachedutil-1.0/include.am | 13 + .../util => libmemcachedutil-1.0}/pid.h | 0 .../util => libmemcachedutil-1.0}/ping.h | 0 .../util => libmemcachedutil-1.0}/pool.h | 0 libmemcachedutil-1.0/util.h | 44 ++ .../util => libmemcachedutil-1.0}/version.h | 0 support/libmemcached.spec.in | 1 - tests/atomsmasher.cc | 7 +- tests/failure.cc | 2 +- tests/hashkit_functions.cc | 3 +- tests/parser.cc | 4 +- tests/plus.cpp | 2 +- 94 files changed, 1290 insertions(+), 368 deletions(-) rename {libhashkit => libhashkit-1.0}/algorithm.h (100%) rename {libhashkit => libhashkit-1.0}/behavior.h (100%) rename {libhashkit => libhashkit-1.0}/configure.h.in (100%) rename {libhashkit => libhashkit-1.0}/digest.h (100%) rename {libhashkit => libhashkit-1.0}/function.h (92%) rename {libhashkit => libhashkit-1.0}/has.h (100%) create mode 100644 libhashkit-1.0/hashkit.h rename {libhashkit => libhashkit-1.0}/hashkit.hpp (100%) create mode 100644 libhashkit-1.0/include.am rename {libhashkit => libhashkit-1.0}/str_algorithm.h (100%) rename {libhashkit => libhashkit-1.0}/strerror.h (80%) rename {libhashkit => libhashkit-1.0}/types.h (100%) rename {libhashkit => libhashkit-1.0}/visibility.h (100%) create mode 100644 libhashkit/is.h rename {libmemcached => libmemcached-1.0}/allocators.h (100%) rename {libmemcached => libmemcached-1.0}/analyze.h (100%) rename {libmemcached => libmemcached-1.0}/auto.h (100%) rename {libmemcached => libmemcached-1.0}/basic_string.h (100%) rename {libmemcached => libmemcached-1.0}/behavior.h (100%) rename {libmemcached => libmemcached-1.0}/callback.h (100%) rename {libmemcached => libmemcached-1.0}/configure.h.in (100%) rename {libmemcached => libmemcached-1.0}/constants.h (100%) rename {libmemcached => libmemcached-1.0}/delete.h (100%) rename {libmemcached => libmemcached-1.0}/dump.h (100%) rename {libmemcached => libmemcached-1.0}/error.h (100%) rename {libmemcached => libmemcached-1.0}/exception.hpp (100%) rename {libmemcached => libmemcached-1.0}/exist.h (100%) rename {libmemcached => libmemcached-1.0}/fetch.h (100%) rename {libmemcached => libmemcached-1.0}/flush.h (100%) rename {libmemcached => libmemcached-1.0}/flush_buffers.h (100%) rename {libmemcached => libmemcached-1.0}/get.h (100%) rename {libmemcached => libmemcached-1.0}/hash.h (100%) create mode 100644 libmemcached-1.0/include.am create mode 100644 libmemcached-1.0/memcached.h rename {libmemcached => libmemcached-1.0}/memcached.hpp (99%) rename {libmemcached => libmemcached-1.0}/options.h (100%) rename {libmemcached => libmemcached-1.0}/parse.h (100%) rename {libmemcached => libmemcached-1.0}/platform.h (100%) rename {libmemcached => libmemcached-1.0}/quit.h (100%) rename {libmemcached => libmemcached-1.0}/result.h (100%) rename {libmemcached => libmemcached-1.0}/return.h (100%) rename {libmemcached => libmemcached-1.0}/sasl.h (100%) rename {libmemcached => libmemcached-1.0}/server.h (100%) rename {libmemcached => libmemcached-1.0}/server_list.h (100%) rename {libmemcached => libmemcached-1.0}/stats.h (100%) rename {libmemcached => libmemcached-1.0}/storage.h (100%) rename {libmemcached => libmemcached-1.0}/strerror.h (100%) rename {libmemcached => libmemcached-1.0}/string.h (98%) rename {libmemcached => libmemcached-1.0}/types.h (100%) rename {libmemcached => libmemcached-1.0}/verbosity.h (100%) rename {libmemcached => libmemcached-1.0}/version.h (100%) rename {libmemcached => libmemcached-1.0}/visibility.h (100%) rename {libmemcached/protocol => libmemcachedprotocol-0.0}/callback.h (99%) create mode 100644 libmemcachedprotocol-0.0/include.am create mode 100644 libmemcachedprotocol-0.0/protocol_binary.h rename {libmemcached => libmemcachedprotocol-0.0}/protocol_handler.h (97%) create mode 100644 libmemcachedprotocol-0.0/vbucket.h rename {libmemcached/util => libmemcachedutil-1.0}/flush.h (100%) create mode 100644 libmemcachedutil-1.0/include.am rename {libmemcached/util => libmemcachedutil-1.0}/pid.h (100%) rename {libmemcached/util => libmemcachedutil-1.0}/ping.h (100%) rename {libmemcached/util => libmemcachedutil-1.0}/pool.h (100%) create mode 100644 libmemcachedutil-1.0/util.h rename {libmemcached/util => libmemcachedutil-1.0}/version.h (100%) diff --git a/.bzrignore b/.bzrignore index 763623e5..3333d5f8 100644 --- a/.bzrignore +++ b/.bzrignore @@ -73,9 +73,9 @@ docs/linkcheck/ docs/man/* docs/text example/memcached_light -libhashkit/configure.h +libhashkit-1.0/configure.h libmemcached-?.??/ -libmemcached/configure.h +libmemcached-1.0/configure.h libmemcached/dtrace_probes.h libmemcached/generated_probes.h libmemcached/memcached_configure.h @@ -136,3 +136,4 @@ tests/memstat tests/memcat clients/memexist tests/memexist +libmemcached/configure.h diff --git a/Makefile.am b/Makefile.am index 2ecc8f2c..8a95b8c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,9 @@ include clients/include.am include docs/include.am include example/include.am include libhashkit/include.am +include libmemcached-1.0/include.am +include libhashkit-1.0/include.am +include libmemcachedprotocol-0.0/include.am include libmemcached/include.am include libmemcached/util/include.am include libmemcached/protocol/include.am diff --git a/clients/utilities.cc b/clients/utilities.cc index 58717a94..79f2f2ae 100644 --- a/clients/utilities.cc +++ b/clients/utilities.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -101,10 +102,11 @@ static const char *lookup_help(memcached_options option) case OPT_PASSWD: return "Password to use for SASL authentication"; case OPT_FILE: return "Path to file in which to save result"; case OPT_STAT_ARGS: return "Argument for statistics"; - default: WATCHPOINT_ASSERT(0); + default: + break; }; - WATCHPOINT_ASSERT(0); + assert(0); return "forgot to document this function :)"; } diff --git a/clients/utilities.h b/clients/utilities.h index 0bac61a7..d036bccc 100644 --- a/clients/utilities.h +++ b/clients/utilities.h @@ -12,9 +12,8 @@ #pragma once #include -#include -#include "libmemcached/watchpoint.h" -#include "client_options.h" +#include +#include "clients/client_options.h" #if TIME_WITH_SYS_TIME # include diff --git a/configure.ac b/configure.ac index b00ea9e5..fe346180 100644 --- a/configure.ac +++ b/configure.ac @@ -183,8 +183,8 @@ SOCKET_SEND_FLAGS AC_CONFIG_FILES([ Makefile docs/conf.py - libhashkit/configure.h - libmemcached/configure.h + libhashkit-1.0/configure.h + libmemcached-1.0/configure.h support/libmemcached.pc support/libmemcached.spec support/libmemcached-fc.spec diff --git a/example/interface_v0.c b/example/interface_v0.c index 1a847ccf..37c8a79a 100644 --- a/example/interface_v0.c +++ b/example/interface_v0.c @@ -16,10 +16,10 @@ #include #include -#include +#include #include -#include "storage.h" -#include "memcached_light.h" +#include "example/storage.h" +#include "example/memcached_light.h" static protocol_binary_response_status noop_command_handler(const void *cookie, protocol_binary_request_header *header, diff --git a/example/interface_v1.c b/example/interface_v1.c index 4fbfed5c..88cb59f6 100644 --- a/example/interface_v1.c +++ b/example/interface_v1.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include "storage.h" diff --git a/example/memcached_light.c b/example/memcached_light.c index 0249ac6c..6a650bba 100644 --- a/example/memcached_light.c +++ b/example/memcached_light.c @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include "storage.h" #include "memcached_light.h" diff --git a/libhashkit/algorithm.h b/libhashkit-1.0/algorithm.h similarity index 100% rename from libhashkit/algorithm.h rename to libhashkit-1.0/algorithm.h diff --git a/libhashkit/behavior.h b/libhashkit-1.0/behavior.h similarity index 100% rename from libhashkit/behavior.h rename to libhashkit-1.0/behavior.h diff --git a/libhashkit/configure.h.in b/libhashkit-1.0/configure.h.in similarity index 100% rename from libhashkit/configure.h.in rename to libhashkit-1.0/configure.h.in diff --git a/libhashkit/digest.h b/libhashkit-1.0/digest.h similarity index 100% rename from libhashkit/digest.h rename to libhashkit-1.0/digest.h diff --git a/libhashkit/function.h b/libhashkit-1.0/function.h similarity index 92% rename from libhashkit/function.h rename to libhashkit-1.0/function.h index 56fcc795..215d978b 100644 --- a/libhashkit/function.h +++ b/libhashkit-1.0/function.h @@ -6,8 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#ifndef HASHKIT_FUNCTION_H -#define HASHKIT_FUNCTION_H +#pragma once #ifdef __cplusplus extern "C" { @@ -40,5 +39,3 @@ hashkit_hash_algorithm_t hashkit_get_distribution_function(const hashkit_st *sel #ifdef __cplusplus } #endif - -#endif /* HASHKIT_FUNCTION_H */ diff --git a/libhashkit/has.h b/libhashkit-1.0/has.h similarity index 100% rename from libhashkit/has.h rename to libhashkit-1.0/has.h diff --git a/libhashkit-1.0/hashkit.h b/libhashkit-1.0/hashkit.h new file mode 100644 index 00000000..97af9866 --- /dev/null +++ b/libhashkit-1.0/hashkit.h @@ -0,0 +1,93 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * HashKit library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2009-2010 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 + + +#if !defined(__cplusplus) +# include +#endif +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct hashkit_st +{ + struct hashkit_function_st { + hashkit_hash_fn function; + void *context; + } base_hash, distribution_hash; + + struct { + bool is_base_same_distributed:1; + } flags; + + struct { + bool is_allocated:1; + } options; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HASHKIT_API +hashkit_st *hashkit_create(hashkit_st *hash); + +HASHKIT_API +hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *ptr); + +HASHKIT_API +bool hashkit_compare(const hashkit_st *first, const hashkit_st *second); + +HASHKIT_API +void hashkit_free(hashkit_st *hash); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libhashkit/hashkit.hpp b/libhashkit-1.0/hashkit.hpp similarity index 100% rename from libhashkit/hashkit.hpp rename to libhashkit-1.0/hashkit.hpp diff --git a/libhashkit-1.0/include.am b/libhashkit-1.0/include.am new file mode 100644 index 00000000..b9f7da0d --- /dev/null +++ b/libhashkit-1.0/include.am @@ -0,0 +1,19 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root +# + +nobase_include_HEADERS+= \ + libhashkit-1.0/algorithm.h \ + libhashkit-1.0/behavior.h \ + libhashkit-1.0/configure.h \ + libhashkit-1.0/digest.h \ + libhashkit-1.0/function.h \ + libhashkit-1.0/has.h \ + libhashkit-1.0/hashkit.h \ + libhashkit-1.0/hashkit.hpp \ + libhashkit-1.0/strerror.h \ + libhashkit-1.0/str_algorithm.h \ + libhashkit-1.0/types.h \ + libhashkit-1.0/visibility.h + diff --git a/libhashkit/str_algorithm.h b/libhashkit-1.0/str_algorithm.h similarity index 100% rename from libhashkit/str_algorithm.h rename to libhashkit-1.0/str_algorithm.h diff --git a/libhashkit/strerror.h b/libhashkit-1.0/strerror.h similarity index 80% rename from libhashkit/strerror.h rename to libhashkit-1.0/strerror.h index 3d6a908d..0785f0cc 100644 --- a/libhashkit/strerror.h +++ b/libhashkit-1.0/strerror.h @@ -6,8 +6,7 @@ * the COPYING file in the parent directory for full text. */ -#ifndef HASHKIT_STRERROR_H -#define HASHKIT_STRERROR_H +#pragma once #ifdef __cplusplus extern "C" { @@ -19,5 +18,3 @@ HASHKIT_API #ifdef __cplusplus } #endif - -#endif /* HASHKIT_STRERROR_H */ diff --git a/libhashkit/types.h b/libhashkit-1.0/types.h similarity index 100% rename from libhashkit/types.h rename to libhashkit-1.0/types.h diff --git a/libhashkit/visibility.h b/libhashkit-1.0/visibility.h similarity index 100% rename from libhashkit/visibility.h rename to libhashkit-1.0/visibility.h diff --git a/libhashkit/common.h b/libhashkit/common.h index 5cf8b9f5..4a239768 100644 --- a/libhashkit/common.h +++ b/libhashkit/common.h @@ -17,6 +17,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/libhashkit/hashkit.h b/libhashkit/hashkit.h index ad13ec51..692d5915 100644 --- a/libhashkit/hashkit.h +++ b/libhashkit/hashkit.h @@ -3,7 +3,6 @@ * HashKit library * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ - * Copyright (C) 2009-2010 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 @@ -38,59 +37,4 @@ #pragma once - -#if !defined(__cplusplus) -# include -#endif -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct hashkit_st -{ - struct hashkit_function_st { - hashkit_hash_fn function; - void *context; - } base_hash, distribution_hash; - - struct { - bool is_base_same_distributed:1; - } flags; - - struct { - bool is_allocated:1; - } options; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -HASHKIT_API -hashkit_st *hashkit_create(hashkit_st *hash); - -HASHKIT_API -hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *ptr); - -HASHKIT_API -bool hashkit_compare(const hashkit_st *first, const hashkit_st *second); - -HASHKIT_API -void hashkit_free(hashkit_st *hash); - -#define hashkit_is_allocated(__object) ((__object)->options.is_allocated) -#define hashkit_is_initialized(__object) ((__object)->options.is_initialized) - -#ifdef __cplusplus -} // extern "C" -#endif +#include diff --git a/libhashkit/include.am b/libhashkit/include.am index 72fec057..7798f79a 100644 --- a/libhashkit/include.am +++ b/libhashkit/include.am @@ -15,20 +15,6 @@ EXTRA_DIST+= \ libhashkit/configure.h.in -nobase_include_HEADERS+= \ - libhashkit/algorithm.h \ - libhashkit/behavior.h \ - libhashkit/configure.h \ - libhashkit/digest.h \ - libhashkit/function.h \ - libhashkit/has.h \ - libhashkit/hashkit.h \ - libhashkit/hashkit.hpp \ - libhashkit/strerror.h \ - libhashkit/str_algorithm.h \ - libhashkit/types.h \ - libhashkit/visibility.h - noinst_HEADERS+= \ libhashkit/common.h diff --git a/libhashkit/is.h b/libhashkit/is.h new file mode 100644 index 00000000..e8e57722 --- /dev/null +++ b/libhashkit/is.h @@ -0,0 +1,43 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * HashKit 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 + +#define hashkit_is_allocated(__object) ((__object)->options.is_allocated) +#define hashkit_is_initialized(__object) ((__object)->options.is_initialized) + diff --git a/libmemcached/allocators.h b/libmemcached-1.0/allocators.h similarity index 100% rename from libmemcached/allocators.h rename to libmemcached-1.0/allocators.h diff --git a/libmemcached/analyze.h b/libmemcached-1.0/analyze.h similarity index 100% rename from libmemcached/analyze.h rename to libmemcached-1.0/analyze.h diff --git a/libmemcached/auto.h b/libmemcached-1.0/auto.h similarity index 100% rename from libmemcached/auto.h rename to libmemcached-1.0/auto.h diff --git a/libmemcached/basic_string.h b/libmemcached-1.0/basic_string.h similarity index 100% rename from libmemcached/basic_string.h rename to libmemcached-1.0/basic_string.h diff --git a/libmemcached/behavior.h b/libmemcached-1.0/behavior.h similarity index 100% rename from libmemcached/behavior.h rename to libmemcached-1.0/behavior.h diff --git a/libmemcached/callback.h b/libmemcached-1.0/callback.h similarity index 100% rename from libmemcached/callback.h rename to libmemcached-1.0/callback.h diff --git a/libmemcached/configure.h.in b/libmemcached-1.0/configure.h.in similarity index 100% rename from libmemcached/configure.h.in rename to libmemcached-1.0/configure.h.in diff --git a/libmemcached/constants.h b/libmemcached-1.0/constants.h similarity index 100% rename from libmemcached/constants.h rename to libmemcached-1.0/constants.h diff --git a/libmemcached/delete.h b/libmemcached-1.0/delete.h similarity index 100% rename from libmemcached/delete.h rename to libmemcached-1.0/delete.h diff --git a/libmemcached/dump.h b/libmemcached-1.0/dump.h similarity index 100% rename from libmemcached/dump.h rename to libmemcached-1.0/dump.h diff --git a/libmemcached/error.h b/libmemcached-1.0/error.h similarity index 100% rename from libmemcached/error.h rename to libmemcached-1.0/error.h diff --git a/libmemcached/exception.hpp b/libmemcached-1.0/exception.hpp similarity index 100% rename from libmemcached/exception.hpp rename to libmemcached-1.0/exception.hpp diff --git a/libmemcached/exist.h b/libmemcached-1.0/exist.h similarity index 100% rename from libmemcached/exist.h rename to libmemcached-1.0/exist.h diff --git a/libmemcached/fetch.h b/libmemcached-1.0/fetch.h similarity index 100% rename from libmemcached/fetch.h rename to libmemcached-1.0/fetch.h diff --git a/libmemcached/flush.h b/libmemcached-1.0/flush.h similarity index 100% rename from libmemcached/flush.h rename to libmemcached-1.0/flush.h diff --git a/libmemcached/flush_buffers.h b/libmemcached-1.0/flush_buffers.h similarity index 100% rename from libmemcached/flush_buffers.h rename to libmemcached-1.0/flush_buffers.h diff --git a/libmemcached/get.h b/libmemcached-1.0/get.h similarity index 100% rename from libmemcached/get.h rename to libmemcached-1.0/get.h diff --git a/libmemcached/hash.h b/libmemcached-1.0/hash.h similarity index 100% rename from libmemcached/hash.h rename to libmemcached-1.0/hash.h diff --git a/libmemcached-1.0/include.am b/libmemcached-1.0/include.am new file mode 100644 index 00000000..edac5e71 --- /dev/null +++ b/libmemcached-1.0/include.am @@ -0,0 +1,44 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + + +nobase_include_HEADERS+= \ + 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/configure.h \ + libmemcached-1.0/constants.h \ + libmemcached-1.0/delete.h \ + libmemcached-1.0/dump.h \ + libmemcached-1.0/error.h \ + libmemcached-1.0/exist.h \ + libmemcached-1.0/exception.hpp \ + 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/memcached.h \ + libmemcached-1.0/memcached.hpp \ + libmemcached-1.0/options.h \ + libmemcached-1.0/parse.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/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/types.h \ + libmemcached-1.0/verbosity.h \ + libmemcached-1.0/version.h \ + libmemcached-1.0/visibility.h + diff --git a/libmemcached-1.0/memcached.h b/libmemcached-1.0/memcached.h new file mode 100644 index 00000000..d459d2c5 --- /dev/null +++ b/libmemcached-1.0/memcached.h @@ -0,0 +1,216 @@ +/* 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 + +#include +#include +#include + + +#if !defined(__cplusplus) +# include +#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 + +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; + +}; + +#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); + +LIBMEMCACHED_API +void memcached_free(memcached_st *ptr); + +LIBMEMCACHED_API +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); + +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/memcached.hpp b/libmemcached-1.0/memcached.hpp similarity index 99% rename from libmemcached/memcached.hpp rename to libmemcached-1.0/memcached.hpp index 8c5ca934..66d62524 100644 --- a/libmemcached/memcached.hpp +++ b/libmemcached-1.0/memcached.hpp @@ -14,8 +14,10 @@ #pragma once -#include +#include +#if 0 #include +#endif #include diff --git a/libmemcached/options.h b/libmemcached-1.0/options.h similarity index 100% rename from libmemcached/options.h rename to libmemcached-1.0/options.h diff --git a/libmemcached/parse.h b/libmemcached-1.0/parse.h similarity index 100% rename from libmemcached/parse.h rename to libmemcached-1.0/parse.h diff --git a/libmemcached/platform.h b/libmemcached-1.0/platform.h similarity index 100% rename from libmemcached/platform.h rename to libmemcached-1.0/platform.h diff --git a/libmemcached/quit.h b/libmemcached-1.0/quit.h similarity index 100% rename from libmemcached/quit.h rename to libmemcached-1.0/quit.h diff --git a/libmemcached/result.h b/libmemcached-1.0/result.h similarity index 100% rename from libmemcached/result.h rename to libmemcached-1.0/result.h diff --git a/libmemcached/return.h b/libmemcached-1.0/return.h similarity index 100% rename from libmemcached/return.h rename to libmemcached-1.0/return.h diff --git a/libmemcached/sasl.h b/libmemcached-1.0/sasl.h similarity index 100% rename from libmemcached/sasl.h rename to libmemcached-1.0/sasl.h diff --git a/libmemcached/server.h b/libmemcached-1.0/server.h similarity index 100% rename from libmemcached/server.h rename to libmemcached-1.0/server.h diff --git a/libmemcached/server_list.h b/libmemcached-1.0/server_list.h similarity index 100% rename from libmemcached/server_list.h rename to libmemcached-1.0/server_list.h diff --git a/libmemcached/stats.h b/libmemcached-1.0/stats.h similarity index 100% rename from libmemcached/stats.h rename to libmemcached-1.0/stats.h diff --git a/libmemcached/storage.h b/libmemcached-1.0/storage.h similarity index 100% rename from libmemcached/storage.h rename to libmemcached-1.0/storage.h diff --git a/libmemcached/strerror.h b/libmemcached-1.0/strerror.h similarity index 100% rename from libmemcached/strerror.h rename to libmemcached-1.0/strerror.h diff --git a/libmemcached/string.h b/libmemcached-1.0/string.h similarity index 98% rename from libmemcached/string.h rename to libmemcached-1.0/string.h index 01097a65..42d0e40a 100644 --- a/libmemcached/string.h +++ b/libmemcached-1.0/string.h @@ -37,8 +37,6 @@ #pragma once -#include - /** Strings are always under our control so we make some assumptions about them. diff --git a/libmemcached/types.h b/libmemcached-1.0/types.h similarity index 100% rename from libmemcached/types.h rename to libmemcached-1.0/types.h diff --git a/libmemcached/verbosity.h b/libmemcached-1.0/verbosity.h similarity index 100% rename from libmemcached/verbosity.h rename to libmemcached-1.0/verbosity.h diff --git a/libmemcached/version.h b/libmemcached-1.0/version.h similarity index 100% rename from libmemcached/version.h rename to libmemcached-1.0/version.h diff --git a/libmemcached/visibility.h b/libmemcached-1.0/visibility.h similarity index 100% rename from libmemcached/visibility.h rename to libmemcached-1.0/visibility.h diff --git a/libmemcached/common.h b/libmemcached/common.h index 6de9bbd1..f4956e87 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -67,10 +67,9 @@ #include #endif -#include +#include #include #include -#include #include diff --git a/libmemcached/csl/common.h b/libmemcached/csl/common.h index 9c39bb0d..325d36fe 100644 --- a/libmemcached/csl/common.h +++ b/libmemcached/csl/common.h @@ -38,4 +38,5 @@ #pragma once #include +#include diff --git a/libmemcached/csl/symbol.h b/libmemcached/csl/symbol.h index ed917da7..423d93f3 100644 --- a/libmemcached/csl/symbol.h +++ b/libmemcached/csl/symbol.h @@ -37,9 +37,7 @@ #pragma once -#include -#include -#include +#include union YYSTYPE { diff --git a/libmemcached/error.hpp b/libmemcached/error.hpp index 252101ac..c2cdcc51 100644 --- a/libmemcached/error.hpp +++ b/libmemcached/error.hpp @@ -35,7 +35,7 @@ * */ -#include +#include #pragma once diff --git a/libmemcached/include.am b/libmemcached/include.am index c29da787..5ae58507 100644 --- a/libmemcached/include.am +++ b/libmemcached/include.am @@ -12,6 +12,7 @@ EXTRA_DIST+= \ libmemcached/memcached/README.txt noinst_HEADERS+= \ + libmemcached/array.h \ libmemcached/assert.hpp \ libmemcached/backtrace.hpp \ libmemcached/byteorder.h \ @@ -26,62 +27,20 @@ noinst_HEADERS+= \ libmemcached/is.h \ libmemcached/libmemcached_probes.h \ libmemcached/memory.h \ + libmemcached/namespace.h \ libmemcached/options.hpp \ + libmemcached/memcached/protocol_binary.h \ + libmemcached/memcached/vbucket.h \ libmemcached/protocol/ascii_handler.h \ libmemcached/protocol/binary_handler.h \ + libmemcached/protocol/cache.h \ libmemcached/protocol/common.h \ libmemcached/response.h \ libmemcached/server.hpp \ libmemcached/server_instance.h \ libmemcached/string.hpp \ - libmemcached/virtual_bucket.h - -nobase_include_HEADERS+= \ - libmemcached/allocators.h \ - libmemcached/analyze.h \ - libmemcached/array.h \ - libmemcached/auto.h \ - libmemcached/basic_string.h \ - libmemcached/behavior.h \ - libmemcached/callback.h \ - libmemcached/configure.h \ - libmemcached/constants.h \ - libmemcached/delete.h \ - libmemcached/dump.h \ - libmemcached/error.h \ - libmemcached/exist.h \ - libmemcached/exception.hpp \ - libmemcached/fetch.h \ - libmemcached/flush.h \ - libmemcached/flush_buffers.h \ - libmemcached/get.h \ - libmemcached/hash.h \ - libmemcached/memcached.h \ - libmemcached/memcached.hpp \ - libmemcached/memcached/protocol_binary.h \ - libmemcached/memcached/vbucket.h \ - libmemcached/options.h \ - libmemcached/parse.h \ - libmemcached/namespace.h \ - libmemcached/protocol/cache.h \ - libmemcached/protocol/callback.h \ - libmemcached/protocol_handler.h \ - libmemcached/quit.h \ - libmemcached/return.h \ - libmemcached/platform.h \ - libmemcached/result.h \ - libmemcached/sasl.h \ - libmemcached/server.h \ - libmemcached/server_list.h \ - libmemcached/stats.h \ - libmemcached/storage.h \ - libmemcached/strerror.h \ - libmemcached/string.h \ - libmemcached/types.h \ - libmemcached/verbosity.h \ - libmemcached/version.h \ - libmemcached/visibility.h \ - libmemcached/watchpoint.h + libmemcached/virtual_bucket.h \ + libmemcached/watchpoint.h lib_LTLIBRARIES+= libmemcached/libmemcached.la libmemcached_libmemcached_la_CFLAGS= -DBUILDING_LIBMEMCACHED diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 9309d8b9..9a1f1812 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -3,7 +3,6 @@ * 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 @@ -37,181 +36,4 @@ #pragma once -#include -#include -#include - - -#if !defined(__cplusplus) -# include -#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 - -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; - -}; - -#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); - -LIBMEMCACHED_API -void memcached_free(memcached_st *ptr); - -LIBMEMCACHED_API -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); - -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 +#include diff --git a/libmemcached/memcached_util.h b/libmemcached/memcached_util.h index c0a4620a..8e952beb 100644 --- a/libmemcached/memcached_util.h +++ b/libmemcached/memcached_util.h @@ -37,9 +37,5 @@ #pragma once +#include -#include -#include -#include -#include -#include diff --git a/libmemcached/namespace.h b/libmemcached/namespace.h index 015c024d..04622571 100644 --- a/libmemcached/namespace.h +++ b/libmemcached/namespace.h @@ -44,7 +44,7 @@ extern "C" { LIBMEMCACHED_LOCAL memcached_return_t memcached_set_namespace(memcached_st *self, const char *str, size_t length); -LIBMEMCACHED_API +LIBMEMCACHED_LOCAL const char * memcached_get_namespace(memcached_st *self); #ifdef __cplusplus diff --git a/libmemcached/protocol/cache.c b/libmemcached/protocol/cache.c index f92fdec1..f7e3bc06 100644 --- a/libmemcached/protocol/cache.c +++ b/libmemcached/protocol/cache.c @@ -43,7 +43,7 @@ #include #endif -#include "cache.h" +#include #ifndef NDEBUG const uint64_t redzone_pattern = 0xdeadbeefcafebabe; diff --git a/libmemcached/protocol/common.h b/libmemcached/protocol/common.h index 808a6086..e8df93e9 100644 --- a/libmemcached/protocol/common.h +++ b/libmemcached/protocol/common.h @@ -42,8 +42,7 @@ #endif #include -#include -#include +#include #include /* diff --git a/libmemcached/server.hpp b/libmemcached/server.hpp index 8cfcbdba..b5f31f66 100644 --- a/libmemcached/server.hpp +++ b/libmemcached/server.hpp @@ -37,8 +37,6 @@ #pragma once -#include - #ifdef HAVE_SYS_TIME_H #include #endif diff --git a/libmemcached/util.h b/libmemcached/util.h index d771d241..03ed6da5 100644 --- a/libmemcached/util.h +++ b/libmemcached/util.h @@ -3,7 +3,6 @@ * 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 @@ -37,4 +36,5 @@ #pragma once -#include +#include + diff --git a/libmemcached/util/include.am b/libmemcached/util/include.am index 10f3b944..3aa95a5a 100644 --- a/libmemcached/util/include.am +++ b/libmemcached/util/include.am @@ -2,14 +2,6 @@ # included from Top Level Makefile.am # All paths should be given relative to the root -nobase_include_HEADERS+= \ - libmemcached/memcached_util.h \ - libmemcached/util.h \ - libmemcached/util/flush.h \ - libmemcached/util/pid.h \ - libmemcached/util/ping.h \ - libmemcached/util/pool.h \ - libmemcached/util/version.h lib_LTLIBRARIES+= libmemcached/libmemcachedutil.la libmemcached_libmemcachedutil_la_SOURCES= \ diff --git a/libmemcached/protocol/callback.h b/libmemcachedprotocol-0.0/callback.h similarity index 99% rename from libmemcached/protocol/callback.h rename to libmemcachedprotocol-0.0/callback.h index e7efaad7..90204113 100644 --- a/libmemcached/protocol/callback.h +++ b/libmemcachedprotocol-0.0/callback.h @@ -5,8 +5,8 @@ * * Author: Trond Norbye */ -#ifndef LIBMEMCACHEDPROTOCOL_CALLBACK_H -#define LIBMEMCACHEDPROTOCOL_CALLBACK_H + +#pragma once /** * Callback to send data back from a successful GET/GETQ/GETK/GETKQ command @@ -414,5 +414,3 @@ typedef struct { memcached_binary_protocol_callback_v1_st v1; } interface; } memcached_binary_protocol_callback_st; - -#endif diff --git a/libmemcachedprotocol-0.0/include.am b/libmemcachedprotocol-0.0/include.am new file mode 100644 index 00000000..0588b0a5 --- /dev/null +++ b/libmemcachedprotocol-0.0/include.am @@ -0,0 +1,7 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +nobase_include_HEADERS+= \ + libmemcachedprotocol-0.0/callback.h \ + libmemcachedprotocol-0.0/protocol_handler.h diff --git a/libmemcachedprotocol-0.0/protocol_binary.h b/libmemcachedprotocol-0.0/protocol_binary.h new file mode 100644 index 00000000..73cd35b1 --- /dev/null +++ b/libmemcachedprotocol-0.0/protocol_binary.h @@ -0,0 +1,726 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + * Copyright (c) <2008>, Sun Microsystems, Inc. + * 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. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ``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 SUN MICROSYSTEMS, INC. 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. + */ +/* + * Summary: Constants used by to implement the binary protocol. + * + * Copy: See Copyright for the status of this software. + * + * Author: Trond Norbye + */ + +#ifndef PROTOCOL_BINARY_H +#define PROTOCOL_BINARY_H + +#include + +/** + * \addtogroup Protocol + * @{ + */ + +/** + * This file contains definitions of the constants and packet formats + * defined in the binary specification. Please note that you _MUST_ remember + * to convert each multibyte field to / from network byte order to / from + * host order. + */ +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Definition of the legal "magic" values used in a packet. + * See section 3.1 Magic byte + */ + typedef enum { + PROTOCOL_BINARY_REQ = 0x80, + PROTOCOL_BINARY_RES = 0x81 + } protocol_binary_magic; + + /** + * Definition of the valid response status numbers. + * See section 3.2 Response Status + */ + typedef enum { + PROTOCOL_BINARY_RESPONSE_SUCCESS = 0x00, + PROTOCOL_BINARY_RESPONSE_KEY_ENOENT = 0x01, + PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS = 0x02, + PROTOCOL_BINARY_RESPONSE_E2BIG = 0x03, + PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04, + PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05, + PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06, + PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET = 0x07, + PROTOCOL_BINARY_RESPONSE_AUTH_ERROR = 0x20, + PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE = 0x21, + PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81, + PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82, + PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED = 0x83, + PROTOCOL_BINARY_RESPONSE_EINTERNAL = 0x84, + PROTOCOL_BINARY_RESPONSE_EBUSY = 0x85, + PROTOCOL_BINARY_RESPONSE_ETMPFAIL = 0x86 + } protocol_binary_response_status; + + /** + * Defintion of the different command opcodes. + * See section 3.3 Command Opcodes + */ + typedef enum { + PROTOCOL_BINARY_CMD_GET = 0x00, + PROTOCOL_BINARY_CMD_SET = 0x01, + PROTOCOL_BINARY_CMD_ADD = 0x02, + PROTOCOL_BINARY_CMD_REPLACE = 0x03, + PROTOCOL_BINARY_CMD_DELETE = 0x04, + PROTOCOL_BINARY_CMD_INCREMENT = 0x05, + PROTOCOL_BINARY_CMD_DECREMENT = 0x06, + PROTOCOL_BINARY_CMD_QUIT = 0x07, + PROTOCOL_BINARY_CMD_FLUSH = 0x08, + PROTOCOL_BINARY_CMD_GETQ = 0x09, + PROTOCOL_BINARY_CMD_NOOP = 0x0a, + PROTOCOL_BINARY_CMD_VERSION = 0x0b, + PROTOCOL_BINARY_CMD_GETK = 0x0c, + PROTOCOL_BINARY_CMD_GETKQ = 0x0d, + PROTOCOL_BINARY_CMD_APPEND = 0x0e, + PROTOCOL_BINARY_CMD_PREPEND = 0x0f, + PROTOCOL_BINARY_CMD_STAT = 0x10, + PROTOCOL_BINARY_CMD_SETQ = 0x11, + PROTOCOL_BINARY_CMD_ADDQ = 0x12, + PROTOCOL_BINARY_CMD_REPLACEQ = 0x13, + PROTOCOL_BINARY_CMD_DELETEQ = 0x14, + PROTOCOL_BINARY_CMD_INCREMENTQ = 0x15, + PROTOCOL_BINARY_CMD_DECREMENTQ = 0x16, + PROTOCOL_BINARY_CMD_QUITQ = 0x17, + PROTOCOL_BINARY_CMD_FLUSHQ = 0x18, + PROTOCOL_BINARY_CMD_APPENDQ = 0x19, + PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a, + PROTOCOL_BINARY_CMD_VERBOSITY = 0x1b, + PROTOCOL_BINARY_CMD_TOUCH = 0x1c, + PROTOCOL_BINARY_CMD_GAT = 0x1d, + PROTOCOL_BINARY_CMD_GATQ = 0x1e, + + PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20, + PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21, + PROTOCOL_BINARY_CMD_SASL_STEP = 0x22, + + /* These commands are used for range operations and exist within + * this header for use in other projects. Range operations are + * not expected to be implemented in the memcached server itself. + */ + PROTOCOL_BINARY_CMD_RGET = 0x30, + PROTOCOL_BINARY_CMD_RSET = 0x31, + PROTOCOL_BINARY_CMD_RSETQ = 0x32, + PROTOCOL_BINARY_CMD_RAPPEND = 0x33, + PROTOCOL_BINARY_CMD_RAPPENDQ = 0x34, + PROTOCOL_BINARY_CMD_RPREPEND = 0x35, + PROTOCOL_BINARY_CMD_RPREPENDQ = 0x36, + PROTOCOL_BINARY_CMD_RDELETE = 0x37, + PROTOCOL_BINARY_CMD_RDELETEQ = 0x38, + PROTOCOL_BINARY_CMD_RINCR = 0x39, + PROTOCOL_BINARY_CMD_RINCRQ = 0x3a, + PROTOCOL_BINARY_CMD_RDECR = 0x3b, + PROTOCOL_BINARY_CMD_RDECRQ = 0x3c, + /* End Range operations */ + + /* VBucket commands */ + PROTOCOL_BINARY_CMD_SET_VBUCKET = 0x3d, + PROTOCOL_BINARY_CMD_GET_VBUCKET = 0x3e, + PROTOCOL_BINARY_CMD_DEL_VBUCKET = 0x3f, + /* End VBucket commands */ + + /* TAP commands */ + PROTOCOL_BINARY_CMD_TAP_CONNECT = 0x40, + PROTOCOL_BINARY_CMD_TAP_MUTATION = 0x41, + PROTOCOL_BINARY_CMD_TAP_DELETE = 0x42, + PROTOCOL_BINARY_CMD_TAP_FLUSH = 0x43, + PROTOCOL_BINARY_CMD_TAP_OPAQUE = 0x44, + PROTOCOL_BINARY_CMD_TAP_VBUCKET_SET = 0x45, + PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_START = 0x46, + PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_END = 0x47, + /* End TAP */ + + PROTOCOL_BINARY_CMD_LAST_RESERVED = 0xef, + + /* Scrub the data */ + PROTOCOL_BINARY_CMD_SCRUB = 0xf0 + } protocol_binary_command; + + /** + * Definition of the data types in the packet + * See section 3.4 Data Types + */ + typedef enum { + PROTOCOL_BINARY_RAW_BYTES = 0x00 + } protocol_binary_datatypes; + + /** + * Definition of the header structure for a request packet. + * See section 2 + */ + typedef union { + struct { + uint8_t magic; + uint8_t opcode; + uint16_t keylen; + uint8_t extlen; + uint8_t datatype; + uint16_t vbucket; + uint32_t bodylen; + uint32_t opaque; + uint64_t cas; + } request; + uint8_t bytes[24]; + } protocol_binary_request_header; + + /** + * Definition of the header structure for a response packet. + * See section 2 + */ + typedef union { + struct { + uint8_t magic; + uint8_t opcode; + uint16_t keylen; + uint8_t extlen; + uint8_t datatype; + uint16_t status; + uint32_t bodylen; + uint32_t opaque; + uint64_t cas; + } response; + uint8_t bytes[24]; + } protocol_binary_response_header; + + /** + * Definition of a request-packet containing no extras + */ + union protocol_binary_request_no_extras { + struct { + protocol_binary_request_header header; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header)]; + }; + typedef union protocol_binary_request_no_extras protocol_binary_request_no_extras; + + /** + * Definition of a response-packet containing no extras + */ + typedef union { + struct { + protocol_binary_response_header header; + } message; + uint8_t bytes[sizeof(protocol_binary_response_header)]; + } protocol_binary_response_no_extras; + + /** + * Definition of the packet used by the get, getq, getk and getkq command. + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_get; + typedef protocol_binary_request_no_extras protocol_binary_request_getq; + typedef protocol_binary_request_no_extras protocol_binary_request_getk; + typedef protocol_binary_request_no_extras protocol_binary_request_getkq; + + /** + * Definition of the packet returned from a successful get, getq, getk and + * getkq. + * See section 4 + */ + typedef union { + struct { + protocol_binary_response_header header; + struct { + uint32_t flags; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_response_header) + 4]; + } protocol_binary_response_get; + + typedef protocol_binary_response_get protocol_binary_response_getq; + typedef protocol_binary_response_get protocol_binary_response_getk; + typedef protocol_binary_response_get protocol_binary_response_getkq; + + /** + * Definition of the packet used by the delete command + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_delete; + + /** + * Definition of the packet returned by the delete command + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_delete; + + /** + * Definition of the packet used by the flush command + * See section 4 + * Please note that the expiration field is optional, so remember to see + * check the header.bodysize to see if it is present. + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + uint32_t expiration; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; + } protocol_binary_request_flush; + + /** + * Definition of the packet returned by the flush command + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_flush; + + /** + * Definition of the packet used by set, add and replace + * See section 4 + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + uint32_t flags; + uint32_t expiration; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 8]; + } protocol_binary_request_set; + typedef protocol_binary_request_set protocol_binary_request_add; + typedef protocol_binary_request_set protocol_binary_request_replace; + + /** + * Definition of the packet returned by set, add and replace + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_set; + typedef protocol_binary_response_no_extras protocol_binary_response_add; + typedef protocol_binary_response_no_extras protocol_binary_response_replace; + + /** + * Definition of the noop packet + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_noop; + + /** + * Definition of the packet returned by the noop command + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_noop; + + /** + * Definition of the structure used by the increment and decrement + * command. + * See section 4 + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + uint64_t delta; + uint64_t initial; + uint32_t expiration; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 20]; + } protocol_binary_request_incr; + typedef protocol_binary_request_incr protocol_binary_request_decr; + + /** + * Definition of the response from an incr or decr command + * command. + * See section 4 + */ + typedef union { + struct { + protocol_binary_response_header header; + struct { + uint64_t value; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_response_header) + 8]; + } protocol_binary_response_incr; + typedef protocol_binary_response_incr protocol_binary_response_decr; + + /** + * Definition of the quit + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_quit; + + /** + * Definition of the packet returned by the quit command + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_quit; + + /** + * Definition of the packet used by append and prepend command + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_append; + typedef protocol_binary_request_no_extras protocol_binary_request_prepend; + + /** + * Definition of the packet returned from a successful append or prepend + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_append; + typedef protocol_binary_response_no_extras protocol_binary_response_prepend; + + /** + * Definition of the packet used by the version command + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_version; + + /** + * Definition of the packet returned from a successful version command + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_version; + + + /** + * Definition of the packet used by the stats command. + * See section 4 + */ + typedef protocol_binary_request_no_extras protocol_binary_request_stats; + + /** + * Definition of the packet returned from a successful stats command + * See section 4 + */ + typedef protocol_binary_response_no_extras protocol_binary_response_stats; + + /** + * Definition of the packet used by the verbosity command + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + uint32_t level; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; + } protocol_binary_request_verbosity; + + /** + * Definition of the packet returned from the verbosity command + */ + typedef protocol_binary_response_no_extras protocol_binary_response_verbosity; + + /** + * Definition of the packet used by the touch command. + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + uint32_t expiration; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; + } protocol_binary_request_touch; + + /** + * Definition of the packet returned from the touch command + */ + typedef protocol_binary_response_no_extras protocol_binary_response_touch; + + /** + * Definition of the packet used by the GAT(Q) command. + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + uint32_t expiration; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; + } protocol_binary_request_gat; + + typedef protocol_binary_request_gat protocol_binary_request_gatq; + + /** + * Definition of the packet returned from the GAT(Q) + */ + typedef protocol_binary_response_get protocol_binary_response_gat; + typedef protocol_binary_response_get protocol_binary_response_gatq; + + + /** + * Definition of a request for a range operation. + * See http://code.google.com/p/memcached/wiki/RangeOps + * + * These types are used for range operations and exist within + * this header for use in other projects. Range operations are + * not expected to be implemented in the memcached server itself. + */ + typedef union { + struct { + protocol_binary_response_header header; + struct { + uint16_t size; + uint8_t reserved; + uint8_t flags; + uint32_t max_results; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; + } protocol_binary_request_rangeop; + + typedef protocol_binary_request_rangeop protocol_binary_request_rget; + typedef protocol_binary_request_rangeop protocol_binary_request_rset; + typedef protocol_binary_request_rangeop protocol_binary_request_rsetq; + typedef protocol_binary_request_rangeop protocol_binary_request_rappend; + typedef protocol_binary_request_rangeop protocol_binary_request_rappendq; + typedef protocol_binary_request_rangeop protocol_binary_request_rprepend; + typedef protocol_binary_request_rangeop protocol_binary_request_rprependq; + typedef protocol_binary_request_rangeop protocol_binary_request_rdelete; + typedef protocol_binary_request_rangeop protocol_binary_request_rdeleteq; + typedef protocol_binary_request_rangeop protocol_binary_request_rincr; + typedef protocol_binary_request_rangeop protocol_binary_request_rincrq; + typedef protocol_binary_request_rangeop protocol_binary_request_rdecr; + typedef protocol_binary_request_rangeop protocol_binary_request_rdecrq; + + + /** + * Definition of tap commands + * See To be written + * + */ + + typedef union { + struct { + protocol_binary_request_header header; + struct { + /** + * flags is a bitmask used to set properties for the + * the connection. Please In order to be forward compatible + * you should set all undefined bits to 0. + * + * If the bit require extra userdata, it will be stored + * in the user-data field of the body (passed to the engine + * as enginespeciffic). That means that when you parse the + * flags and the engine-specific data, you have to work your + * way from bit 0 and upwards to find the correct offset for + * the data. + * + */ + uint32_t flags; + + /** + * Backfill age + * + * By using this flag you can limit the amount of data being + * transmitted. If you don't specify a backfill age, the + * server will transmit everything it contains. + * + * The first 8 bytes in the engine specific data contains + * the oldest entry (from epoc) you're interested in. + * Specifying a time in the future (for the server you are + * connecting to), will cause it to start streaming current + * changes. + */ +#define TAP_CONNECT_FLAG_BACKFILL 0x01 + /** + * Dump will cause the server to send the data stored on the + * server, but disconnect when the keys stored in the server + * are transmitted. + */ +#define TAP_CONNECT_FLAG_DUMP 0x02 + /** + * The body contains a list of 16 bits words in network byte + * order specifying the vbucket ids to monitor. The first 16 + * bit word contains the number of buckets. The number of 0 + * means "all buckets" + */ +#define TAP_CONNECT_FLAG_LIST_VBUCKETS 0x04 + /** + * The responsibility of the vbuckets is to be transferred + * over to the caller when all items are transferred. + */ +#define TAP_CONNECT_FLAG_TAKEOVER_VBUCKETS 0x08 + /** + * The tap consumer supports ack'ing of tap messages + */ +#define TAP_CONNECT_SUPPORT_ACK 0x10 + /** + * The tap consumer would prefer to just get the keys + * back. If the engine supports this it will set + * the TAP_FLAG_NO_VALUE flag in each of the + * tap packets returned. + */ +#define TAP_CONNECT_REQUEST_KEYS_ONLY 0x20 + /** + * The body contains a list of (vbucket_id, last_checkpoint_id) + * pairs. This provides the checkpoint support in TAP streams. + * The last checkpoint id represents the last checkpoint that + * was successfully persisted. + */ +#define TAP_CONNECT_CHECKPOINT 0x40 + /** + * The tap consumer is a registered tap client, which means that + * the tap server will maintain its checkpoint cursor permanently. + */ +#define TAP_CONNECT_REGISTERED_CLIENT 0x80 + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; + } protocol_binary_request_tap_connect; + + typedef union { + struct { + protocol_binary_request_header header; + struct { + struct { + uint16_t enginespecific_length; + /* + * The flag section support the following flags + */ + /** + * Request that the consumer send a response packet + * for this packet. The opaque field must be preserved + * in the response. + */ +#define TAP_FLAG_ACK 0x01 + /** + * The value for the key is not included in the packet + */ +#define TAP_FLAG_NO_VALUE 0x02 + uint16_t flags; + uint8_t ttl; + uint8_t res1; + uint8_t res2; + uint8_t res3; + } tap; + struct { + uint32_t flags; + uint32_t expiration; + } item; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 16]; + } protocol_binary_request_tap_mutation; + + typedef union { + struct { + protocol_binary_request_header header; + struct { + struct { + uint16_t enginespecific_length; + /** + * See the definition of the flags for + * protocol_binary_request_tap_mutation for a description + * of the available flags. + */ + uint16_t flags; + uint8_t ttl; + uint8_t res1; + uint8_t res2; + uint8_t res3; + } tap; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + 8]; + } protocol_binary_request_tap_no_extras; + + typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_delete; + typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_flush; + typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_opaque; + typedef protocol_binary_request_tap_no_extras protocol_binary_request_tap_vbucket_set; + + + /** + * Definition of the packet used by the scrub. + */ + typedef protocol_binary_request_no_extras protocol_binary_request_scrub; + + /** + * Definition of the packet returned from scrub. + */ + typedef protocol_binary_response_no_extras protocol_binary_response_scrub; + + + /** + * Definition of the packet used by set vbucket + */ + typedef union { + struct { + protocol_binary_request_header header; + struct { + vbucket_state_t state; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_request_header) + sizeof(vbucket_state_t)]; + } protocol_binary_request_set_vbucket; + /** + * Definition of the packet returned from set vbucket + */ + typedef protocol_binary_response_no_extras protocol_binary_response_set_vbucket; + /** + * Definition of the packet used by del vbucket + */ + typedef protocol_binary_request_no_extras protocol_binary_request_del_vbucket; + /** + * Definition of the packet returned from del vbucket + */ + typedef protocol_binary_response_no_extras protocol_binary_response_del_vbucket; + + /** + * Definition of the packet used by get vbucket + */ + typedef protocol_binary_request_no_extras protocol_binary_request_get_vbucket; + + /** + * Definition of the packet returned from get vbucket + */ + typedef union { + struct { + protocol_binary_response_header header; + struct { + vbucket_state_t state; + } body; + } message; + uint8_t bytes[sizeof(protocol_binary_response_header) + sizeof(vbucket_state_t)]; + } protocol_binary_response_get_vbucket; + + + /** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* PROTOCOL_BINARY_H */ diff --git a/libmemcached/protocol_handler.h b/libmemcachedprotocol-0.0/protocol_handler.h similarity index 97% rename from libmemcached/protocol_handler.h rename to libmemcachedprotocol-0.0/protocol_handler.h index 1eee5ca5..1930b026 100644 --- a/libmemcached/protocol_handler.h +++ b/libmemcachedprotocol-0.0/protocol_handler.h @@ -18,10 +18,10 @@ # include #endif -#include -#include -#include -#include +#include +#include +#include +#include /* Forward declarations */ /* diff --git a/libmemcachedprotocol-0.0/vbucket.h b/libmemcachedprotocol-0.0/vbucket.h new file mode 100644 index 00000000..c6c4d8ca --- /dev/null +++ b/libmemcachedprotocol-0.0/vbucket.h @@ -0,0 +1,26 @@ +/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +#ifndef MEMCACHED_VBUCKET_H +#define MEMCACHED_VBUCKET_H 1 + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef enum { + vbucket_state_active = 1, /**< Actively servicing a vbucket. */ + vbucket_state_replica, /**< Servicing a vbucket as a replica only. */ + vbucket_state_pending, /**< Pending active. */ + vbucket_state_dead /**< Not in use, pending deletion. */ +} vbucket_state_t; + +#define is_valid_vbucket_state_t(state) \ + (state == vbucket_state_active || \ + state == vbucket_state_replica || \ + state == vbucket_state_pending || \ + state == vbucket_state_dead) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/libmemcached/util/flush.h b/libmemcachedutil-1.0/flush.h similarity index 100% rename from libmemcached/util/flush.h rename to libmemcachedutil-1.0/flush.h diff --git a/libmemcachedutil-1.0/include.am b/libmemcachedutil-1.0/include.am new file mode 100644 index 00000000..c60028c7 --- /dev/null +++ b/libmemcachedutil-1.0/include.am @@ -0,0 +1,13 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + + +nobase_include_HEADERS+= \ + libmemcachedutil-1.0/flush.h \ + libmemcachedutil-1.0/memcached_util.h \ + libmemcachedutil-1.0/pid.h \ + libmemcachedutil-1.0/ping.h \ + libmemcachedutil-1.0/pool.h \ + libmemcachedutil-1.0/util.h \ + libmemcachedutil-1.0/version.h diff --git a/libmemcached/util/pid.h b/libmemcachedutil-1.0/pid.h similarity index 100% rename from libmemcached/util/pid.h rename to libmemcachedutil-1.0/pid.h diff --git a/libmemcached/util/ping.h b/libmemcachedutil-1.0/ping.h similarity index 100% rename from libmemcached/util/ping.h rename to libmemcachedutil-1.0/ping.h diff --git a/libmemcached/util/pool.h b/libmemcachedutil-1.0/pool.h similarity index 100% rename from libmemcached/util/pool.h rename to libmemcachedutil-1.0/pool.h diff --git a/libmemcachedutil-1.0/util.h b/libmemcachedutil-1.0/util.h new file mode 100644 index 00000000..09053a99 --- /dev/null +++ b/libmemcachedutil-1.0/util.h @@ -0,0 +1,44 @@ +/* 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 + +#include +#include +#include +#include +#include diff --git a/libmemcached/util/version.h b/libmemcachedutil-1.0/version.h similarity index 100% rename from libmemcached/util/version.h rename to libmemcachedutil-1.0/version.h diff --git a/support/libmemcached.spec.in b/support/libmemcached.spec.in index 64abfc32..077ffd22 100644 --- a/support/libmemcached.spec.in +++ b/support/libmemcached.spec.in @@ -173,7 +173,6 @@ you will need to install %{name}-devel. %{_includedir}/libmemcached/verbosity.h %{_includedir}/libmemcached/version.h %{_includedir}/libmemcached/visibility.h -%{_includedir}/libmemcached/watchpoint.h %{_libdir}/libhashkit.so %{_libdir}/libmemcached.so %{_libdir}/libmemcachedprotocol.so diff --git a/tests/atomsmasher.cc b/tests/atomsmasher.cc index eebe0f38..981819d2 100644 --- a/tests/atomsmasher.cc +++ b/tests/atomsmasher.cc @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -99,8 +98,7 @@ infinite: } else { - WATCHPOINT_ERROR(rc); - WATCHPOINT_ASSERT(rc); + test_compare(MEMCACHED_SUCCESS, rc); } } else @@ -112,8 +110,7 @@ infinite: 0, 0); if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED) { - WATCHPOINT_ERROR(rc); - WATCHPOINT_ASSERT(0); + test_compare(MEMCACHED_SUCCESS, rc); } } } diff --git a/tests/failure.cc b/tests/failure.cc index c616a262..cbc165e0 100644 --- a/tests/failure.cc +++ b/tests/failure.cc @@ -39,7 +39,7 @@ /* C++ interface test */ -#include +#include #include #include diff --git a/tests/hashkit_functions.cc b/tests/hashkit_functions.cc index 2d664e7c..6a823cdd 100644 --- a/tests/hashkit_functions.cc +++ b/tests/hashkit_functions.cc @@ -46,8 +46,9 @@ using namespace libtest; #include #include +#include -#include "hash_results.h" +#include "tests/hash_results.h" static hashkit_st global_hashk; diff --git a/tests/parser.cc b/tests/parser.cc index 898fdb54..9e0c0c95 100644 --- a/tests/parser.cc +++ b/tests/parser.cc @@ -99,11 +99,13 @@ static test_return_t __check_host(memcached_st *memc, const scanner_string_st &h } // Check and make sure the prefix_key is what we expect it to be -static test_return_t __check_namespace(memcached_st *memc, const scanner_string_st &arg) +static test_return_t __check_namespace(memcached_st *, const scanner_string_st &) { +#if 0 const char *_namespace = memcached_get_namespace(memc); test_true(_namespace); test_strcmp(_namespace, arg.c_str); +#endif return TEST_SUCCESS; } diff --git a/tests/plus.cpp b/tests/plus.cpp index 1b5631d1..d9d00ad1 100644 --- a/tests/plus.cpp +++ b/tests/plus.cpp @@ -40,7 +40,7 @@ /* C++ interface test */ -#include +#include #include #include -- 2.30.2