├── libmemcached ├── csl │ ├── parser.am │ ├── include.am │ └── common.h ├── memcached │ ├── README.txt │ └── vbucket.h ├── parse.h ├── protocol │ └── include.am ├── libmemcached_probes.d ├── util │ └── include.am ├── exception.hpp ├── util.h ├── backtrace.hpp └── internal.h ├── libtest ├── run.gdb ├── is_local.cc ├── libtool.hpp ├── core.h ├── is_pid.hpp ├── version.h.in ├── is_local.hpp ├── blobslap_worker.h ├── socket.hpp ├── cmdline.h ├── strerror.h ├── get.h ├── gearmand.h ├── binaries.h ├── collection.h ├── failed.h ├── string.hpp ├── core.cc ├── port.h ├── killpid.h ├── skiptest.cc ├── strerror.cc ├── error.h ├── socket.cc ├── callbacks.h ├── stats.h ├── runner.h ├── runner.cc ├── memcached.h ├── libtool.cc ├── binaries.cc ├── cmdline.cc ├── signal.h ├── test.hpp ├── common.h └── port.cc ├── tests ├── output_plus.res ├── storage.h ├── namespace.h └── server_add.h ├── docs ├── images │ ├── btree_item_structure.png │ ├── list_item_structure.png │ └── set_item_structure.png ├── 09-other-API.md ├── 10-appendix.md ├── test_faq.md └── man │ ├── libhashkit.3 │ ├── memerror.1 │ ├── memdump.1 │ ├── hashkit_value.3 │ ├── memrm.1 │ ├── memcached_last_error_message.3 │ ├── memcached_verbosity.3 │ ├── memstat.1 │ ├── memflush.1 │ └── libmemcachedutil.3 ├── .quickly ├── devtools ├── maketags.sh └── clean-whitespace.pl ├── AUTHORS ├── example ├── memcached_light.h ├── storage.h └── include.am ├── poll ├── include.am ├── poll.h └── poll.c ├── config ├── autorun.sh └── version.pl ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── feature-refactoring-request.md │ └── bug_report.md └── workflows │ └── CI.yml ├── libhashkit ├── behavior.cc ├── configure.h.in ├── behavior.h ├── strerror.h ├── digest.h ├── strerror.cc ├── common.h ├── one_at_a_time.cc ├── function.h ├── visibility.h ├── algorithm.cc ├── digest.cc ├── hsieh.cc ├── murmur.cc └── has.h ├── support ├── libmemcached.pc.in ├── set_benchmark.sh └── include.am ├── m4 ├── memaslap.m4 ├── pandora_run_cpplint.m4 ├── pandora_version.m4 ├── gearmand.m4 ├── pandora_extensions.m4 ├── memcached.m4 ├── enable_utillib.m4 ├── memcached_engine.m4 ├── byteorder.m4 ├── pandora_clock_gettime.m4 ├── memcached_sasl.m4 ├── pandora_with_valgrind.m4 ├── deprecated.m4 ├── fnv.m4 ├── pandora_header_assert.m4 ├── hsieh.m4 ├── murmur.m4 ├── eagain.m4 ├── pandora_fdatasync.m4 ├── pandora_with_r.m4 ├── pandora_check_compiler_version.m4 ├── pandora_cxx_demangle.m4 ├── pandora_stack_direction.m4 ├── pandora_use_pipe.m4 ├── pandora_flex.m4 ├── pandora_swig.m4 ├── pandora_bison.m4 ├── pandora_have_gcc_atomics.m4 ├── pandora_have_libbdb.m4 ├── protocol_binary.m4 ├── bottom.m4 ├── pandora_with_python.m4 ├── pandora_have_innodb.m4 ├── pandora_have_libpqxx.m4 ├── pandora_have_thrift.m4 ├── pandora_have_libvbucket.m4 ├── pandora_have_libhashkit.m4 ├── pandora_have_libsqlite3.m4 ├── pandora_have_libz.m4 ├── pandora_have_libavahi.m4 ├── pandora_have_libpq.m4 ├── pandora_have_libhaildb.m4 ├── pandora_have_libcassandra.m4 ├── pandora_have_libdl.m4 ├── pandora_cstdint.m4 ├── pandora_with_python3.m4 ├── pandora_cinttypes.m4 ├── pandora_have_libaio.m4 ├── pandora_with_gettext.m4 ├── pandora_have_libuuid.m4 ├── pandora_have_libxml2.m4 ├── pandora_with_php.m4 ├── pandora_with_lua.m4 └── pandora_have_libevent.m4 ├── win32 ├── include.am └── wrappers.h ├── PATENTS ├── util ├── include.am └── signal.hpp ├── clients ├── ms_sigsegv.h ├── generator.h ├── execute.h ├── client_options.h ├── ms_stats.h └── utilities.h ├── arcus ├── include.am └── sample.c ├── libmemcachedinternal ├── util │ └── include.am └── include.am ├── AUTHORS-libmemcached └── LICENSE-libmemcached /libmemcached/csl/parser.am: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /libtest/run.gdb: -------------------------------------------------------------------------------- 1 | set environment LIBTEST_IN_GDB=1 2 | run 3 | -------------------------------------------------------------------------------- /tests/output_plus.res: -------------------------------------------------------------------------------- 1 | servers localhost:11221, 2 | localhost : 11221 3 | 4 | 5 | retvalue 1 6 | -------------------------------------------------------------------------------- /docs/images/btree_item_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naver/arcus-c-client/HEAD/docs/images/btree_item_structure.png -------------------------------------------------------------------------------- /docs/images/list_item_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naver/arcus-c-client/HEAD/docs/images/list_item_structure.png -------------------------------------------------------------------------------- /docs/images/set_item_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/naver/arcus-c-client/HEAD/docs/images/set_item_structure.png -------------------------------------------------------------------------------- /.quickly: -------------------------------------------------------------------------------- 1 | project = libmemcached 2 | version = 0.4.2 3 | template = pandora-build 4 | project-type = library 5 | pandora-version = 0.175 6 | -------------------------------------------------------------------------------- /devtools/maketags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | find ../ -name "*[chp]" > ./cscope.files 3 | ctags --extra=+q -L ./cscope.files -f ./tags 4 | rm ./cscope.files 5 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Hoonmin Kim (harebox) ; 2 | YeaSol Kim (ngleader) ; 3 | Hyongyoub Kim 4 | -------------------------------------------------------------------------------- /example/memcached_light.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | #ifndef MEMCACHED_LIGHT_H 3 | #define MEMCACHED_LIGHT_H 4 | 5 | extern void initialize_interface_v0_handler(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /poll/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | noinst_HEADERS+= poll/poll.h 5 | 6 | if BUILD_POLL 7 | libmemcached_libmemcached_la_SOURCES += poll/poll.c 8 | endif 9 | -------------------------------------------------------------------------------- /config/autorun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit immediately if a command exits with a non-zero status. 4 | set -e 5 | 6 | if [[ -d .git || -f .git || ! -f m4/version.m4 ]] 7 | then 8 | perl config/version.pl 9 | fi 10 | 11 | autoreconf --install --force --verbose -Wall 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### 🔗 Related Issue 2 | 3 | 4 | - 5 | 6 | ### ⌨️ What I did 7 | 8 | 9 | - 10 | -------------------------------------------------------------------------------- /libhashkit/behavior.cc: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #include 10 | -------------------------------------------------------------------------------- /support/libmemcached.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libmemcached 7 | URL: http://libmemcachd.org/ 8 | Description: libmemcached C/C++ library. 9 | Version: @VERSION@ 10 | Libs: -L${libdir} -lmemcached -lmemcachedutil 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /m4/memaslap.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([ENABLE_MEMASLAP], 2 | [AC_ARG_ENABLE([memaslap], 3 | [AS_HELP_STRING([--enable-memaslap], 4 | [build with memaslap tool. @<:@default=off@:>@])], 5 | [ac_cv_enable_memaslap=yes], 6 | [ac_cv_enable_memaslap=no]) 7 | 8 | AM_CONDITIONAL([BUILD_MEMASLAP], [test "$ac_cv_enable_memaslap" = "yes"]) 9 | ]) 10 | -------------------------------------------------------------------------------- /support/set_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | src/memslap --concurrency=5 --execute-number=5000 --servers=localhost --test=set --flush 4 | src/memslap --concurrency=5 --execute-number=5000 --non-blocking --servers=localhost --test=set --flush 5 | src/memslap --concurrency=5 --execute-number=5000 --non-blocking --tcp-nodelay --servers=localhost --test=set --flush 6 | -------------------------------------------------------------------------------- /m4/pandora_run_cpplint.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([PANDORA_RUN_CPPLINT],[ 7 | m4_syscmd([python config/make-lint.py]) 8 | ]) 9 | -------------------------------------------------------------------------------- /support/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | EXTRA_DIST+= \ 6 | support/libmemcached.spec \ 7 | support/libmemcached-fc.spec.in \ 8 | support/set_benchmark.sh 9 | 10 | pkgconfigdir = $(libdir)/pkgconfig 11 | pkgconfig_DATA = support/libmemcached.pc 12 | -------------------------------------------------------------------------------- /libmemcached/memcached/README.txt: -------------------------------------------------------------------------------- 1 | For your convenience libmemcached contains a copy of protocol_binary.h so that 2 | you may compile libmemcached without having a memcached server with support 3 | for the binary protocol installed on your computer. Please do not modify this 4 | fine, but replace it with a fresh copy from a new distribution if they are 5 | out of sync. 6 | 7 | Trond Norbye 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-refactoring-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature/Refactoring request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### 🔍 Description 11 | 12 | 13 | - 14 | 15 | ### ⏰ Implementation Idea 16 | 17 | 18 | - 19 | -------------------------------------------------------------------------------- /win32/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | noinst_HEADERS+= win32/wrappers.h 5 | 6 | if BUILD_WIN32_WRAPPERS 7 | libmemcached_libmemcached_la_LDFLAGS+=-no-undefined 8 | libmemcached_libmemcachedprotocol_la_LDFLAGS+=-no-undefined 9 | libmemcached_libmemcachedutil_la_LDFLAGS+=-no-undefined 10 | libhashkit_libhashkit_la_LDFLAGS+=-no-undefined 11 | endif 12 | -------------------------------------------------------------------------------- /PATENTS: -------------------------------------------------------------------------------- 1 | Arcus has patents on the implementation of b+tree smget operation like below. 2 | 3 | | Nation | Number | Title | Status | 4 | | ------------- | --------------- | ------------------- | ---------- | 5 | | United States | 13/474,382 | Multiple Range Scan | registered | 6 | | Korea | 10-2011-0054384 | Multiple Range Scan | applied | 7 | | Japan | 2012-092668 | Multiple Range Scan | applied | 8 | -------------------------------------------------------------------------------- /m4/pandora_version.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([PANDORA_VERSION],[ 7 | 8 | PANDORA_HEX_VERSION=`echo $VERSION | sed 's|[\-a-z0-9]*$||' | \ 9 | awk -F. '{printf "0x%0.2d%0.3d%0.3d", $[]1, $[]2, $[]3}'` 10 | AC_SUBST([PANDORA_HEX_VERSION]) 11 | ]) 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### ⛔ What happened? 11 | 12 | - 13 | 14 | ### 🎯 Reproduction Steps 15 | 16 | 17 | - 18 | 19 | ### 💡 Expected Behavior / Solution 20 | 21 | 22 | - 23 | -------------------------------------------------------------------------------- /libhashkit/configure.h.in: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009-2010 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #ifndef __LIBHASHKIT_CONFIGURE_H_IN__ 10 | #define __LIBHASHKIT_CONFIGURE_H_IN__ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif /* __LIBHASHKIT_CONFIGURE_H_IN__ */ 21 | -------------------------------------------------------------------------------- /libhashkit/behavior.h: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | /** 10 | * @file 11 | * @brief HashKit Header 12 | */ 13 | 14 | #ifndef __LIBHASHKIT_BEHAVIOR_H__ 15 | #define __LIBHASHKIT_BEHAVIOR_H__ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* __LIBHASHKIT_BEHAVIOR_H__ */ 27 | -------------------------------------------------------------------------------- /libhashkit/strerror.h: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #ifndef HASHKIT_STRERROR_H 10 | #define HASHKIT_STRERROR_H 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | HASHKIT_API 17 | const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* HASHKIT_STRERROR_H */ 24 | -------------------------------------------------------------------------------- /m4/gearmand.m4: -------------------------------------------------------------------------------- 1 | AX_WITH_PROG(GEARMAND_BINARY,gearmand) 2 | AS_IF([test -f "$ac_cv_path_GEARMAND_BINARY"], 3 | [ 4 | AC_DEFINE([HAVE_GEARMAND_BINARY], [1], [If Gearmand binary is available]) 5 | AC_DEFINE_UNQUOTED([GEARMAND_BINARY], "$ac_cv_path_GEARMAND_BINARY", [Name of the gearmand binary used in make test]) 6 | ], 7 | [ 8 | AC_DEFINE([HAVE_GEARMAND_BINARY], [0], [If Gearmand binary is available]) 9 | AC_DEFINE([GEARMAND_BINARY], [0], [Name of the gearmand binary used in make test]) 10 | ]) 11 | 12 | -------------------------------------------------------------------------------- /m4/pandora_extensions.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([PANDORA_EXTENSIONS],[ 7 | 8 | m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], 9 | [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], 10 | [AC_REQUIRE([AC_GNU_SOURCE])]) 11 | 12 | ]) 13 | 14 | AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],[ 15 | AC_REQUIRE([PANDORA_EXTENSIONS]) 16 | ]) 17 | -------------------------------------------------------------------------------- /util/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # DataDifferential Utility Library 3 | # Copyright (C) 2011 Data Differential 4 | # All rights reserved. 5 | # 6 | # Use and distribution licensed under the BSD license. See 7 | # the COPYING file in the parent directory for full text. 8 | # 9 | # Included from Top Level Makefile.am 10 | # All paths should be given relative to the root 11 | 12 | 13 | noinst_HEADERS+= \ 14 | util/daemon.hpp \ 15 | util/instance.hpp \ 16 | util/logfile.hpp \ 17 | util/operation.hpp \ 18 | util/signal.hpp \ 19 | util/string.hpp \ 20 | util/pidfile.hpp 21 | -------------------------------------------------------------------------------- /m4/memcached.m4: -------------------------------------------------------------------------------- 1 | AX_WITH_PROG(MEMCACHED_BINARY,memcached) 2 | ac_cv_path_MEMCACHED_BINARY=$MEMCACHED_BINARY 3 | AS_IF([test -f "$ac_cv_path_MEMCACHED_BINARY"], 4 | [ 5 | AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available]) 6 | AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$ac_cv_path_MEMCACHED_BINARY", [Name of the memcached binary used in make test]) 7 | ], 8 | [ 9 | AC_DEFINE([HAVE_MEMCACHED_BINARY], [0], [If Memcached binary is available]) 10 | AC_DEFINE([MEMCACHED_BINARY], [0], [Name of the memcached binary used in make test]) 11 | ]) 12 | -------------------------------------------------------------------------------- /devtools/clean-whitespace.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use FindBin qw($Bin); 4 | 5 | chdir "$Bin/.." or die; 6 | my @files = `git ls-files` or die; 7 | 8 | foreach my $f (@files) { 9 | chomp($f); 10 | next if $f =~ /\.(png|m4)$/; 11 | open(my $fh, $f) or die; 12 | my $before = do { local $/; <$fh>; }; 13 | close ($fh); 14 | my $after = $before; 15 | $after =~ s/\t/ /g unless $f =~ /\.(ac|am)$/; 16 | $after =~ s/ +$//mg; 17 | $after .= "\n" unless $after =~ /\n$/; 18 | next if $after eq $before; 19 | open(my $fh, ">$f") or die; 20 | print $fh $after; 21 | close($fh); 22 | } 23 | -------------------------------------------------------------------------------- /m4/enable_utillib.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([ENABLE_UTILLIB],[ 2 | AC_ARG_ENABLE([utils], 3 | [AS_HELP_STRING([--disable-utils], 4 | [Disable libmemcachedutils @<:@default=on@:>@])], 5 | [BUILD_UTILLIB="$enableval"], 6 | [BUILD_UTILLIB="yes"]) 7 | 8 | if test "x$BUILD_UTILLIB" = "xyes"; then 9 | if test x"$ax_pthread_ok" != "xyes"; then 10 | AC_MSG_ERROR([Sorry you need POSIX thread library to build libmemcachedutil.]) 11 | fi 12 | AC_DEFINE([HAVE_LIBMEMCACHEDUTIL], [1], [Enables libmemcachedutil Support]) 13 | fi 14 | 15 | AM_CONDITIONAL([BUILD_LIBMEMCACHEDUTIL],[test "x$BUILD_UTILLIB" = "xyes"]) 16 | ]) 17 | -------------------------------------------------------------------------------- /libmemcached/parse.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2010 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: Work with fetching results 9 | * 10 | */ 11 | 12 | #ifndef __LIBMEMCACHED_PARSE_H__ 13 | #define __LIBMEMCACHED_PARSE_H__ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | LIBMEMCACHED_API 20 | memcached_server_list_st memcached_servers_parse(const char *server_strings); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* __LIBMEMCACHED_PARSE_H__ */ 27 | -------------------------------------------------------------------------------- /m4/memcached_engine.m4: -------------------------------------------------------------------------------- 1 | AX_WITH_PROG(MEMCACHED_ENGINE,memcached_engine) 2 | ac_cv_path_MEMCACHED_ENGINE=$MEMCACHED_ENGINE 3 | AS_IF([test -f "$ac_cv_path_MEMCACHED_ENGINE"], 4 | [ 5 | AC_DEFINE([HAVE_MEMCACHED_ENGINE], [1], [If Memcached engine object is available]) 6 | AC_DEFINE_UNQUOTED([MEMCACHED_ENGINE], "$ac_cv_path_MEMCACHED_ENGINE", [Name of the memcached engine object used in make test]) 7 | ], 8 | [ 9 | AC_DEFINE([HAVE_MEMCACHED_ENGINE], [0], [If Memcached engine object is available]) 10 | AC_DEFINE([MEMCACHED_ENGINE], [0], [Name of the memcached engine object used in make test]) 11 | ]) 12 | -------------------------------------------------------------------------------- /m4/byteorder.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([DETECT_BYTEORDER], 2 | [ 3 | AC_REQUIRE([AC_C_BIGENDIAN]) 4 | AC_CACHE_CHECK([for htonll], [ac_cv_have_htonll], 5 | [AC_TRY_LINK([ 6 | #include 7 | #include 8 | #include 9 | ], [ 10 | return htonll(0); 11 | ], 12 | [ ac_cv_have_htonll=yes ], 13 | [ ac_cv_have_htonll=no ]) 14 | ]) 15 | AS_IF([test "x$ac_cv_have_htonll" = "xyes"],[ 16 | AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])]) 17 | 18 | AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$ac_cv_have_htonll" = "xno"]) 19 | ]) 20 | -------------------------------------------------------------------------------- /clients/ms_sigsegv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ms_sigsegv.h 3 | * Author: Mingqiang Zhuang 4 | * 5 | * Created on March 15, 2009 6 | * 7 | * (c) Copyright 2009, Schooner Information Technology, Inc. 8 | * http://www.schoonerinfotech.com/ 9 | * 10 | */ 11 | #ifndef MS_SIGSEGV_H 12 | #define MS_SIGSEGV_H 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* redirect signal seg */ 19 | int ms_setup_sigsegv(void); 20 | 21 | 22 | /* redirect signal pipe */ 23 | int ms_setup_sigpipe(void); 24 | 25 | 26 | /* redirect signal int */ 27 | int ms_setup_sigint(void); 28 | 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* end of MS_SIGSEGV_H */ 35 | -------------------------------------------------------------------------------- /libmemcached/csl/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | DISTCLEANFILES+= \ 6 | libmemcached/csl/parser.output 7 | 8 | noinst_HEADERS+= \ 9 | libmemcached/csl/common.h \ 10 | libmemcached/csl/context.h \ 11 | libmemcached/csl/parser.h \ 12 | libmemcached/csl/scanner.h \ 13 | libmemcached/csl/server.h \ 14 | libmemcached/csl/symbol.h 15 | 16 | libmemcached_libmemcached_la_SOURCES+= \ 17 | libmemcached/csl/context.cc \ 18 | libmemcached/csl/parser.cc \ 19 | libmemcached/csl/scanner.cc 20 | 21 | include libmemcached/csl/parser.am 22 | -------------------------------------------------------------------------------- /m4/pandora_clock_gettime.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Monty Taylor 2 | dnl This file is free software; Monty Taylor 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for clock_gettime 8 | #-------------------------------------------------------------------- 9 | 10 | AC_DEFUN([PANDORA_CLOCK_GETTIME],[ 11 | AC_SEARCH_LIBS([clock_gettime],[rt]) 12 | AS_IF([test "x${ac_cv_search_clock_gettime}" != "xno"],[ 13 | AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Have a working clock_gettime function]) 14 | ]) 15 | ]) 16 | -------------------------------------------------------------------------------- /m4/memcached_sasl.m4: -------------------------------------------------------------------------------- 1 | AX_WITH_PROG(MEMCACHED_SASL_BINARY,memcached_sasl) 2 | $ac_cv_path_MEMCACHED_SASL_BINARY=$MEMCACHED_SASL_BINARY 3 | AS_IF([test -f "$ac_cv_path_MEMCACHED_SASL_BINARY"], 4 | [ 5 | AC_DEFINE([HAVE_MEMCACHED_SASL_BINARY], [1], [Name of the memcached_sasl binary used in make test]) 6 | AC_DEFINE_UNQUOTED([MEMCACHED_SASL_BINARY], "$ac_cv_path_MEMCACHED_SASL_BINARY", [Name of the memcached_sasl binary used in make test]) 7 | ], 8 | [ 9 | AC_DEFINE([HAVE_MEMCACHED_SASL_BINARY], [0], [Name of the memcached_sasl binary used in make test]) 10 | AC_DEFINE([MEMCACHED_SASL_BINARY], [0], [Name of the memcached_sasl binary used in make test]) 11 | ]) 12 | -------------------------------------------------------------------------------- /tests/storage.h: -------------------------------------------------------------------------------- 1 | #ifndef __TESTS_STORAGE_H__ 2 | #define __TESTS_STORAGE_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | LIBTEST_LOCAL 9 | test_return_t mset_and_get_test(memcached_st *mc); 10 | 11 | LIBTEST_LOCAL 12 | test_return_t madd_and_get_test(memcached_st *mc); 13 | 14 | LIBTEST_LOCAL 15 | test_return_t mreplace_and_get_test(memcached_st *mc); 16 | 17 | LIBTEST_LOCAL 18 | test_return_t mprepend_and_get_test(memcached_st *mc); 19 | 20 | LIBTEST_LOCAL 21 | test_return_t mappend_and_get_test(memcached_st *mc); 22 | 23 | LIBTEST_LOCAL 24 | test_return_t mcas_and_get_test(memcached_st *mc); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif /* __TESTS_STORAGE_H__ */ 31 | -------------------------------------------------------------------------------- /m4/pandora_with_valgrind.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Brian Aker 2 | dnl This file is free software; Brian Aker 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([PANDORA_WITH_VALGRIND],[ 7 | 8 | AC_ARG_WITH([valgrind], 9 | [AS_HELP_STRING([--with-valgrind], 10 | [Add additional valgrind code for testing with valgrind.])], 11 | [with_valgrind=yes], 12 | [with_valgrind=no]) 13 | AM_CONDITIONAL(HAVE_VALGRIND,[test "x${with_valgrind}" = "xyes"]) 14 | AS_IF([test "x$with_valgrind" = "xyes"], 15 | AC_DEFINE([HAVE_VALGRIND],[1], 16 | [Add additional valgrind code for testing with valgrind.])) 17 | ]) 18 | -------------------------------------------------------------------------------- /arcus/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | ARCUS_LDADD= \ 6 | libmemcached/libmemcached.la \ 7 | libmemcached/libmemcachedutil.la 8 | 9 | # Multi-Threaded Example 10 | 11 | noinst_PROGRAMS+= arcus/multi_threaded 12 | arcus_multi_threaded_SOURCES= arcus/multi_threaded.c 13 | 14 | arcus_multi_threaded_LDFLAGS= -g -O0 15 | arcus_multi_threaded_LDADD= $(ARCUS_LDADD) 16 | arcus_multi_threaded_DEPENDENCIES= $(ARCUS_LDADD) 17 | 18 | # Multi-Process Example 19 | 20 | noinst_PROGRAMS+= arcus/multi_process 21 | arcus_multi_process_SOURCES= arcus/multi_process.c 22 | 23 | arcus_multi_process_LDFLAGS= -g -O0 24 | arcus_multi_process_LDADD= $(ARCUS_LDADD) 25 | arcus_multi_process_DEPENDENCIES= $(ARCUS_LDADD) 26 | -------------------------------------------------------------------------------- /example/storage.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | #ifndef STORAGE_H 3 | #define STORAGE_H 4 | 5 | struct item { 6 | uint64_t cas; 7 | void* key; 8 | size_t nkey; 9 | void* data; 10 | size_t size; 11 | uint32_t flags; 12 | time_t exp; 13 | }; 14 | 15 | bool initialize_storage(void); 16 | void shutdown_storage(void); 17 | 18 | void update_cas(struct item* item); 19 | void put_item(struct item* item); 20 | struct item* get_item(const void* key, size_t nkey); 21 | struct item* create_item(const void* key, size_t nkey, const void *data, 22 | size_t size, uint32_t flags, time_t exp); 23 | bool delete_item(const void* key, size_t nkey); 24 | void flush(uint32_t when); 25 | void release_item(struct item* item); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /example/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | if HAVE_LIBEVENT 6 | noinst_PROGRAMS += example/memcached_light 7 | endif 8 | 9 | noinst_HEADERS+= \ 10 | example/byteorder.h \ 11 | example/memcached_light.h \ 12 | example/storage.h 13 | 14 | example_memcached_light_SOURCES= \ 15 | example/byteorder.cc \ 16 | example/interface_v0.c \ 17 | example/interface_v1.c \ 18 | example/memcached_light.c 19 | 20 | example_memcached_light_LDADD= libmemcached/libmemcachedprotocol.la \ 21 | $(LIBINNODB) $(LTLIBEVENT) 22 | 23 | if HAVE_LIBINNODB 24 | example_memcached_light_SOURCES+= example/storage_innodb.c 25 | else 26 | example_memcached_light_SOURCES+= example/storage.c 27 | endif 28 | -------------------------------------------------------------------------------- /m4/deprecated.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: deprecated 3 | dnl --------------------------------------------------------------------------- 4 | AC_DEFUN([ENABLE_DEPRECATED],[ 5 | AC_ARG_ENABLE([deprecated], 6 | [AS_HELP_STRING([--enable-deprecated], 7 | [Enable deprecated interface @<:@default=off@:>@])], 8 | [ac_enable_deprecated="$enableval"], 9 | [ac_enable_deprecated="no"]) 10 | 11 | AS_IF([test "$ac_enable_deprecated" = "yes"], 12 | [DEPRECATED="#define MEMCACHED_ENABLE_DEPRECATED 1"]) 13 | AC_SUBST([DEPRECATED]) 14 | ]) 15 | dnl --------------------------------------------------------------------------- 16 | dnl End Macro: deprecated 17 | dnl --------------------------------------------------------------------------- 18 | -------------------------------------------------------------------------------- /m4/fnv.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: ENABLE_FNV64_HASH 3 | dnl --------------------------------------------------------------------------- 4 | AC_DEFUN([ENABLE_FNV64_HASH], 5 | [AC_ARG_ENABLE([fnv64_hash], 6 | [AS_HELP_STRING([--disable-fnv64_hash], 7 | [build with support for fnv64 hashing. @<:@default=on@:>@])], 8 | [ac_cv_enable_fnv64_hash=no], 9 | [ac_cv_enable_fnv64_hash=yes]) 10 | 11 | AS_IF([test "$ac_cv_enable_fnv64_hash" = "yes"], 12 | [AC_DEFINE([HAVE_FNV64_HASH], [1], [Enables fnv64 hashing support])]) 13 | ]) 14 | dnl --------------------------------------------------------------------------- 15 | dnl End Macro: ENABLE_FNV64_HASH 16 | dnl --------------------------------------------------------------------------- 17 | -------------------------------------------------------------------------------- /libhashkit/digest.h: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2010 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #ifndef __LIBHASHKIT_DIGEST_H__ 10 | #define __LIBHASHKIT_DIGEST_H__ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | HASHKIT_API 17 | uint32_t hashkit_digest(const hashkit_st *self, const char *key, size_t key_length); 18 | 19 | /** 20 | This is a utility function provided so that you can directly access hashes with a hashkit_st. 21 | */ 22 | 23 | HASHKIT_API 24 | uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algorithm_t hash_algorithm); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif /* __LIBHASHKIT_DIGEST_H__ */ 31 | -------------------------------------------------------------------------------- /libhashkit/strerror.cc: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #include 10 | 11 | const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc) 12 | { 13 | (void)ptr; 14 | switch (rc) 15 | { 16 | case HASHKIT_SUCCESS: return "SUCCESS"; 17 | case HASHKIT_FAILURE: return "FAILURE"; 18 | case HASHKIT_MEMORY_ALLOCATION_FAILURE: return "MEMORY ALLOCATION FAILURE"; 19 | case HASHKIT_INVALID_ARGUMENT: return "INVALID ARGUMENT"; 20 | case HASHKIT_INVALID_HASH: return "INVALID hashkit_hash_algorithm_t"; 21 | case HASHKIT_MAXIMUM_RETURN: 22 | default: 23 | return "INVALID hashkit_return_t"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /libmemcached/memcached/vbucket.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | #ifndef MEMCACHED_VBUCKET_H 3 | #define MEMCACHED_VBUCKET_H 1 4 | 5 | #ifdef __cplusplus 6 | extern "C" 7 | { 8 | #endif 9 | 10 | typedef enum { 11 | vbucket_state_active = 1, /**< Actively servicing a vbucket. */ 12 | vbucket_state_replica, /**< Servicing a vbucket as a replica only. */ 13 | vbucket_state_pending, /**< Pending active. */ 14 | vbucket_state_dead /**< Not in use, pending deletion. */ 15 | } vbucket_state_t; 16 | 17 | #define is_valid_vbucket_state_t(state) \ 18 | (state == vbucket_state_active || \ 19 | state == vbucket_state_replica || \ 20 | state == vbucket_state_pending || \ 21 | state == vbucket_state_dead) 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /libhashkit/common.h: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #ifndef __LIBHASHKIT_COMMON_H__ 10 | #define __LIBHASHKIT_COMMON_H__ 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | HASHKIT_LOCAL 27 | void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result); 28 | 29 | HASHKIT_LOCAL 30 | int update_continuum(hashkit_st *hashkit); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* __LIBHASHKIT_COMMON_H__ */ 37 | -------------------------------------------------------------------------------- /m4/pandora_header_assert.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | dnl PANDORA_HEADER_ASSERT 7 | dnl ---------------- 8 | dnl Check whether to enable assertions. 9 | AC_DEFUN([PANDORA_HEADER_ASSERT], 10 | [ 11 | AC_CHECK_HEADERS(assert.h) 12 | AC_MSG_CHECKING([whether to enable assertions]) 13 | AC_ARG_ENABLE([assert], 14 | [AS_HELP_STRING([--disable-assert], 15 | [Turn off assertions])], 16 | [ac_cv_assert="no"], 17 | [ac_cv_assert="yes"]) 18 | AC_MSG_RESULT([$ac_cv_assert]) 19 | 20 | AS_IF([test "$ac_cv_assert" = "no"], 21 | [AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])]) 22 | ]) 23 | 24 | -------------------------------------------------------------------------------- /docs/09-other-API.md: -------------------------------------------------------------------------------- 1 | # Other API 2 | 3 | 본 절에서는 아래의 나머지 API들을 설명한다. 4 | 5 | - [Flush](09-other-API.md#flush) 6 | 7 | 8 | ## Flush 9 | 10 | ARCUS는 cache server에 있는 모든 items 또는 특정 prefix의 items을 flush(or delete)하는 기능을 제공한다. 11 | 전자의 함수는 모든 items을 flush하고 후자의 함수는 특정 prefix의 items을 flush한다. 12 | 13 | ```c 14 | memcached_return_t 15 | memcached_flush(memcached_st *ptr, time_t expiration) 16 | 17 | memcached_return_t 18 | memcached_flush_by_prefix(memcached_st *ptr, 19 | const char *prefix, size_t prefix_length, 20 | time_t expiration) 21 | ``` 22 | 23 | - prefix, prefix_length: flush할 prefix 정보 24 | - expiration: delayed flush할 시에 지연할 시간(단위: 초)를 나타낸다. 25 | 26 | **특정 prefix의 모든 items을 삭제하므로 그 사용에 주의하여야 한다.** 27 | **특히, prefix를 명시하지 않는 flush 함수는 cache node의 모든 items을 삭제하므로 공용으로 사용하는 cloud에선 각별히 주의해야 한다.** 28 | 29 | -------------------------------------------------------------------------------- /libhashkit/one_at_a_time.cc: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | /* 10 | This has is Jenkin's "One at A time Hash". 11 | http://en.wikipedia.org/wiki/Jenkins_hash_function 12 | */ 13 | 14 | #include 15 | 16 | uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context) 17 | { 18 | const char *ptr= key; 19 | uint32_t value= 0; 20 | (void)context; 21 | 22 | while (key_length--) 23 | { 24 | uint32_t val= (uint32_t) *ptr++; 25 | value += val; 26 | value += (value << 10); 27 | value ^= (value >> 6); 28 | } 29 | value += (value << 3); 30 | value ^= (value >> 11); 31 | value += (value << 15); 32 | 33 | return value; 34 | } 35 | -------------------------------------------------------------------------------- /clients/generator.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2006-2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: 9 | * 10 | */ 11 | 12 | /* 13 | Code to generate data to be pushed into memcached 14 | */ 15 | 16 | #ifndef __CLIENTS_GENERATOR_H__ 17 | #define __CLIENTS_GENERATOR_H__ 18 | 19 | typedef struct pairs_st pairs_st; 20 | 21 | struct pairs_st { 22 | char *key; 23 | size_t key_length; 24 | char *value; 25 | size_t value_length; 26 | }; 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | pairs_st *pairs_generate(uint64_t number_of, size_t value_length); 33 | void pairs_free(pairs_st *pairs); 34 | 35 | #ifdef __cplusplus 36 | } // extern "C" 37 | #endif 38 | 39 | #endif /* __CLIENTS_GENERATOR_H__ */ 40 | -------------------------------------------------------------------------------- /poll/poll.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2010 Brian Aker, Trond Norbye 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: Implementation of poll by using select 9 | * 10 | */ 11 | #ifndef POLL_POLL_H 12 | #define POLL_POLL_H 1 13 | 14 | #ifdef WIN32 15 | #include 16 | #endif 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | typedef struct pollfd 23 | { 24 | #ifdef WIN32 25 | SOCKET fd; 26 | #else 27 | int fd; 28 | #endif 29 | short events; 30 | short revents; 31 | } pollfd_t; 32 | 33 | typedef int nfds_t; 34 | 35 | #define POLLIN 0x0001 36 | #define POLLOUT 0x0004 37 | #define POLLERR 0x0008 38 | 39 | int poll(struct pollfd fds[], nfds_t nfds, int tmo); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /docs/10-appendix.md: -------------------------------------------------------------------------------- 1 | # Appendix 2 | 3 | ## 문제 해결 4 | 5 | 32-bit 환경에서는 ./configure 옵션에 다음을 추가한다. 6 | 7 | ``` 8 | --disable-64bit CFLAGS="-O2 -march=i686" 9 | ``` 10 | 11 | GCC3, GCC4가 함께 설치된 환경에서는 ./configure 옵션에 다음을 추가한다. 12 | 13 | ``` 14 | CC=gcc4 CXX=g++4 15 | ``` 16 | 17 | 멀티프로세스 샘플($SRC/arcus/multi_process)이 "Cannot create proxy lock : No space left on device" 메시지와 함께 실행되지 않는다면 다음 명령을 실행한다. USERID는 사용자 계정으로 대치한다. 18 | 19 | ``` 20 | $ for i in `ipcs -s | awk '/USERID/ {print $2}'`; do (ipcrm -s $i); done 21 | ``` 22 | 23 | ## 설치 확인 : 샘플 프로그램을 정적 링크하기 24 | 25 | (sample applications can be found in $SRC/arcus) 26 | 27 | ``` 28 | $ g++ multi_threaded.cc /usr/lib64/libm.a /usr/local/lib/libmemcached.a /usr/local/lib/libmemcachedutil.a /usr/local/lib/libzookeeper_mt.a /usr/local/lib/libapr-1.a \ 29 | -o multi_threaded -I. -I/usr/local/include -I/usr/local/include/c-client-src -pthread --static 30 | ``` 31 | -------------------------------------------------------------------------------- /m4/hsieh.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: ENABLE_HSIEH_HASH 3 | dnl --------------------------------------------------------------------------- 4 | AC_DEFUN([ENABLE_HSIEH_HASH], 5 | [AC_ARG_ENABLE([hsieh_hash], 6 | [AS_HELP_STRING([--enable-hsieh_hash], 7 | [build with support for hsieh hashing. @<:@default=off@:>@])], 8 | [ac_cv_enable_hsieh_hash=yes], 9 | [ac_cv_enable_hsieh_hash=no]) 10 | 11 | AS_IF([test "$ac_cv_enable_hsieh_hash" = "yes"], 12 | [AC_DEFINE([HAVE_HSIEH_HASH], [1], [Enables hsieh hashing support])]) 13 | 14 | AM_CONDITIONAL([INCLUDE_HSIEH_SRC], [test "$ac_cv_enable_hsieh_hash" = "yes"]) 15 | ]) 16 | dnl --------------------------------------------------------------------------- 17 | dnl End Macro: ENABLE_HSIEH_HASH 18 | dnl --------------------------------------------------------------------------- 19 | -------------------------------------------------------------------------------- /m4/murmur.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: ENABLE_MURMUR_HASH 3 | dnl --------------------------------------------------------------------------- 4 | AC_DEFUN([ENABLE_MURMUR_HASH], 5 | [AC_ARG_ENABLE([murmur_hash], 6 | [AS_HELP_STRING([--disable-murmur_hash], 7 | [build with support for murmur hashing. @<:@default=on@:>@])], 8 | [ac_cv_enable_murmur_hash=no], 9 | [ac_cv_enable_murmur_hash=yes]) 10 | 11 | AS_IF([test "$ac_cv_enable_murmur_hash" = "yes"], 12 | [AC_DEFINE([HAVE_MURMUR_HASH], [1], [Enables murmur hashing support])]) 13 | 14 | AM_CONDITIONAL([INCLUDE_MURMUR_SRC], [test "$ac_cv_enable_murmur_hash" = "yes"]) 15 | ]) 16 | dnl --------------------------------------------------------------------------- 17 | dnl End Macro: ENABLE_MURMUR_HASH 18 | dnl --------------------------------------------------------------------------- 19 | -------------------------------------------------------------------------------- /m4/eagain.m4: -------------------------------------------------------------------------------- 1 | # 2 | # Some platforms define EWOULDBLOCK == EAGAIN, causing our switch for error 3 | # codes to be illegal (POSIX.1-2001 allows both return codes from recv, so 4 | # we need to test both if they differ...) 5 | # 6 | AC_DEFUN([DETECT_EAGAIN], 7 | [ 8 | AC_CACHE_CHECK([if EWOULDBLOCK == EAGAIN],[av_cv_eagain_ewouldblock], 9 | [AC_TRY_COMPILE([ 10 | #include 11 | ], [ 12 | int error = EAGAIN; 13 | switch (error) 14 | { 15 | case EAGAIN: 16 | case EWOULDBLOCK: 17 | error = 1; 18 | break; 19 | default: 20 | error = 0; 21 | } 22 | ], 23 | [ av_cv_eagain_ewouldblock=no ], 24 | [ av_cv_eagain_ewouldblock=yes ]) 25 | ]) 26 | AS_IF([test "x$ac_cv_eagain_ewouldblock" = "xyes"],[ 27 | AC_DEFINE([USE_EAGAIN], [1], [Define to true if you need to test for eagain])]) 28 | ]) 29 | -------------------------------------------------------------------------------- /clients/execute.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2006-2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: 9 | * 10 | */ 11 | 12 | #ifndef __CLIENTS_EXECUTE_H__ 13 | #define __CLIENTS_EXECUTE_H__ 14 | 15 | #include 16 | 17 | #include "libmemcached/memcached.h" 18 | #include "clients/generator.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | unsigned int execute_set(memcached_st *memc, pairs_st *pairs, unsigned int number_of); 25 | unsigned int execute_get(memcached_st *memc, pairs_st *pairs, unsigned int number_of); 26 | unsigned int execute_mget(memcached_st *memc, const char * const *keys, size_t *key_length, 27 | unsigned int number_of); 28 | 29 | #ifdef __cplusplus 30 | } // extern "C" 31 | #endif 32 | 33 | #endif /* __CLIENTS_EXECUTE_H__ */ 34 | -------------------------------------------------------------------------------- /m4/pandora_fdatasync.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for a working fdatasync call 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([PANDORA_WORKING_FDATASYNC],[ 12 | AC_CACHE_CHECK([working fdatasync],[ac_cv_func_fdatasync],[ 13 | AC_LANG_PUSH(C++) 14 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 15 | #include 16 | ]],[[ 17 | fdatasync(4); 18 | ]])], 19 | [ac_cv_func_fdatasync=yes], 20 | [ac_cv_func_fdatasync=no]) 21 | AC_LANG_POP() 22 | ]) 23 | AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"], 24 | [AC_DEFINE([HAVE_FDATASYNC],[1],[If the system has a working fdatasync])]) 25 | ]) 26 | -------------------------------------------------------------------------------- /m4/pandora_with_r.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystems 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | AC_DEFUN([PANDORA_WITH_R],[ 13 | dnl Check for GNU R 14 | AC_ARG_WITH([r], 15 | [AS_HELP_STRING([--with-r], 16 | [Build R Bindings @<:@default=yes@:>@])], 17 | [with_r=$withval], 18 | [with_r=yes]) 19 | 20 | AS_IF([test "x$with_r" != "xno"],[ 21 | 22 | PKG_CHECK_MODULES([R], [libR], [ 23 | with_r=yes 24 | ],[ 25 | with_r=no 26 | ]) 27 | 28 | AC_SUBST(R_CFLAGS) 29 | AC_SUBST(R_LIBS) 30 | ]) 31 | AM_CONDITIONAL(BUILD_R, test "$with_r" = "yes") 32 | 33 | ]) 34 | -------------------------------------------------------------------------------- /libmemcachedinternal/util/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | # This noinst lib contains things we want to be ABI private but still want to 6 | # either use in client programs or be able to test in test cases These symbols 7 | # will not be exposed in the shipped .so 8 | noinst_LTLIBRARIES+= libmemcachedinternal/libmemcachedutilinternal.la 9 | 10 | libmemcachedinternal_libmemcachedutilinternal_la_SOURCES= $(libmemcached_libmemcachedutil_la_SOURCES) 11 | libmemcachedinternal_libmemcachedutilinternal_la_CXXFLAGS= \ 12 | ${AM_CXXFLAGS} \ 13 | ${NO_CONVERSION} \ 14 | -DBUILDING_LIBMEMCACHEDINTERNAL 15 | libmemcachedinternal_libmemcachedutilinternal_la_CXXFLAGS+= ${PTHREAD_CFLAGS} 16 | libmemcachedinternal_libmemcachedutilinternal_la_LIBADD= libmemcachedinternal/libmemcachedinternal.la ${PTHREAD_LIBS} 17 | libmemcachedinternal_libmemcachedutilinternal_la_DEPENDENCIES= libmemcachedinternal/libmemcachedinternal.la 18 | 19 | 20 | -------------------------------------------------------------------------------- /clients/client_options.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2006-2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: 9 | * 10 | */ 11 | 12 | #ifndef __CLIENTS_CLIENT_OPTIONS_H__ 13 | #define __CLIENTS_CLIENT_OPTIONS_H__ 14 | 15 | typedef struct memcached_help_text_st memcached_help_text_st; 16 | 17 | enum memcached_options { 18 | OPT_SERVERS= 's', 19 | OPT_VERSION= 'V', 20 | OPT_HELP= 'h', 21 | OPT_VERBOSE= 'v', 22 | OPT_DEBUG= 'd', 23 | OPT_ANALYZE= 'a', 24 | OPT_FLAG= 257, 25 | OPT_EXPIRE, 26 | OPT_SET, 27 | OPT_REPLACE, 28 | OPT_ADD, 29 | OPT_SLAP_EXECUTE_NUMBER, 30 | OPT_SLAP_INITIAL_LOAD, 31 | OPT_SLAP_TEST, 32 | OPT_SLAP_CONCURRENCY, 33 | OPT_SLAP_NON_BLOCK, 34 | OPT_SLAP_TCP_NODELAY, 35 | OPT_FLUSH, 36 | OPT_HASH, 37 | OPT_BINARY, 38 | OPT_UDP, 39 | OPT_USERNAME, 40 | OPT_PASSWD, 41 | OPT_STAT_ARGS, 42 | OPT_QUIET, 43 | OPT_FILE= 'f' 44 | }; 45 | 46 | #endif /* __CLIENTS_CLIENT_OPTIONS_H__ */ 47 | -------------------------------------------------------------------------------- /AUTHORS-libmemcached: -------------------------------------------------------------------------------- 1 | Brian Aker, brian@tangent.org -- Client Library, Tools 2 | Mark Atwood, -- Tools, Docs 3 | Patrick Galbraith, -- C++ Interface 4 | Padraig O'Sullivan, -- C++ Interface (current one) 5 | Tim Bunce, -- Docs 6 | Trond Norbye, trond.norbye@gmail.com -- Binary protocol, Misc 7 | Yin Chen, -- Ketama Work 8 | Toru Maesaka, dev@torum.net -- Stats analysis 9 | Eric Lambert, -- UDP work 10 | Monty Taylor, -- Build Releated (Pandora) 11 | Mingqiang Zhuang, Schooner Information Technology, Inc. -- Rewrite of memslap 12 | Eirik A. Nygaard - IO Patch 13 | Cal Heldenbrand - Awesome feedback on performance 14 | Dustin Sallings - Insight into protocol 15 | Tobias Luetke - Performance Feedback 16 | Andre Cruz - Help with getting the CRC Hash function to match other connectors 17 | Brian Pontz - Hsieh hash 18 | Tim Bunce - Perl Driver work and feedback on API 19 | Kevin Dalley - Bug Fixes 20 | Patrick Galbraith - work on C++ interface 21 | Ross McFarland - Idea for sorting servers. 22 | Marcelo Fernandez - TCP/IP timeout pieces 23 | Yin Chen - Ketama support/weighted support 24 | Monty Taylor - Debian Packages, Cleanup work for configure 25 | -------------------------------------------------------------------------------- /m4/pandora_check_compiler_version.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | 7 | AC_DEFUN([PANDORA_CHECK_C_VERSION],[ 8 | 9 | dnl Print version of C compiler 10 | AC_MSG_CHECKING("C Compiler version--$GCC") 11 | AS_IF([test "$GCC" = "yes"],[ 12 | CC_VERSION=`$CC --version | sed 1q` 13 | ],[AS_IF([test "$SUNCC" = "yes"],[ 14 | CC_VERSION=`$CC -V 2>&1 | sed 1q` 15 | ],[ 16 | CC_VERSION="" 17 | ]) 18 | ]) 19 | AC_MSG_RESULT("$CC_VERSION") 20 | AC_SUBST(CC_VERSION) 21 | ]) 22 | 23 | 24 | AC_DEFUN([PANDORA_CHECK_CXX_VERSION], [ 25 | dnl Print version of CXX compiler 26 | AC_MSG_CHECKING("C++ Compiler version") 27 | AS_IF([test "$GCC" = "yes"],[ 28 | CXX_VERSION=`$CXX --version | sed 1q` 29 | ],[AS_IF([test "$SUNCC" = "yes"],[ 30 | CXX_VERSION=`$CXX -V 2>&1 | sed 1q` 31 | ],[ 32 | CXX_VERSION="" 33 | ]) 34 | ]) 35 | AC_MSG_RESULT("$CXX_VERSION") 36 | AC_SUBST(CXX_VERSION) 37 | ]) 38 | -------------------------------------------------------------------------------- /libtest/is_local.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | 24 | 25 | namespace libtest { 26 | 27 | bool test_is_local() 28 | { 29 | return (getenv("LIBTEST_LOCAL")); 30 | } 31 | 32 | } // namespace libtest 33 | 34 | -------------------------------------------------------------------------------- /docs/test_faq.md: -------------------------------------------------------------------------------- 1 | ## Test 2 | - 전체 테스트를 수행하는 방법 3 | ``` 4 | make test 5 | ``` 6 | - 개별 테스트를 수행하는 방법 7 | ``` 8 | make check TESTS='testname' 9 | ``` 10 | - 예시 11 | ``` 12 | make check TESTS='libtest/unittest' // 1개 테스트 수행 13 | make check TESTS='libtest/unittest tests/cycle' // 2개 테스트 수행 14 | ``` 15 | - 테스트 실패 케이스 16 | - 예시 1 17 | ``` 18 | make check TESTS='libtest/unittest tests/testplus tests/failure' 19 | 20 | CXXLD libtest/unittest 21 | FAIL: libtest/unittest 22 | CXXLD tests/testplus 23 | FAIL: tests/testplus 24 | CXXLD tests/failure 25 | FAIL: tests/failure 26 | 27 | # TOTAL: 3 28 | # PASS: 0 29 | # SKIP: 0 30 | # XFAIL: 0 31 | # FAIL: 3 32 | # XPASS: 0 33 | # ERROR: 0 34 | ``` 35 | - Test를 수행하는 머신에 11211 포트를 사용하는 memcached 노드가 실행 중일 때 발생 36 | - libtest/unittest와 tests/failure에서 11211 포트를 사용하는 memcached 노드를 kill 시도하는데, kill이 실패하면 테스트 실패 37 | - tests/testplus에서 11211 포트를 사용하는 memcached 노드가 띄워져 있지 않다는 전제 하에 연산 수행 실패 결과를 받아와야 하는데, 해당 노드가 띄워져 있으면 연산 수행 성공 결과를 받아와 테스트 실패 38 | -------------------------------------------------------------------------------- /libtest/libtool.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_LIBTOOL_HPP__ 23 | #define __LIBTEST_LIBTOOL_HPP__ 24 | 25 | namespace libtest { 26 | 27 | const char *libtool(void); 28 | 29 | } 30 | 31 | #endif /* __LIBTEST_LIBTOOL_HPP__ */ 32 | -------------------------------------------------------------------------------- /m4/pandora_cxx_demangle.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | dnl Check for all of the headers and libs that Drizzle needs. We check all 7 | dnl of these for plugins too, to ensure that all of the appropriate defines 8 | dnl are set. 9 | 10 | AC_DEFUN([PANDORA_CXX_DEMANGLE],[ 11 | AC_LANG_PUSH([C++]) 12 | save_CXXFLAGS="${CXXFLAGS}" 13 | CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" 14 | AC_CHECK_HEADERS(cxxabi.h) 15 | AC_CACHE_CHECK([checking for abi::__cxa_demangle], pandora_cv_cxa_demangle, 16 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ 17 | char *foo= 0; int bar= 0; 18 | foo= abi::__cxa_demangle(foo, foo, 0, &bar); 19 | ]])],[pandora_cv_cxa_demangle=yes],[pandora_cv_cxa_demangle=no])]) 20 | CXXFLAGS="${save_CXXFLAGS}" 21 | AC_LANG_POP() 22 | 23 | AS_IF([test "x$pandora_cv_cxa_demangle" = xyes],[ 24 | AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1, 25 | [Define to 1 if you have the `abi::__cxa_demangle' function.]) 26 | ]) 27 | ]) 28 | -------------------------------------------------------------------------------- /m4/pandora_stack_direction.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems 2 | dnl This file is free software; Sun Microsystems 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check what direction the stack runs in 8 | #-------------------------------------------------------------------- 9 | 10 | AC_DEFUN([PANDORA_STACK_DIRECTION],[ 11 | AC_REQUIRE([AC_FUNC_ALLOCA]) 12 | AC_CACHE_CHECK([stack direction], [ac_cv_c_stack_direction],[ 13 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 14 | #include 15 | int find_stack_direction () 16 | { 17 | static char *addr = 0; 18 | auto char dummy; 19 | if (addr == 0) 20 | { 21 | addr = &dummy; 22 | return find_stack_direction (); 23 | } 24 | else 25 | return (&dummy > addr) ? 1 : -1; 26 | } 27 | ]],[[ 28 | exit (find_stack_direction() < 0); 29 | ]])],[ 30 | ac_cv_c_stack_direction=1 31 | ],[ 32 | ac_cv_c_stack_direction=-1 33 | ]) 34 | ]) 35 | AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) 36 | ]) 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /m4/pandora_use_pipe.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystem 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | dnl 12 | dnl Test if we can Use -pipe to avoid making temp files during the compile. 13 | dnl Should speed up compile on slower disks 14 | 15 | AC_DEFUN([PANDORA_USE_PIPE],[ 16 | 17 | AS_IF([test "$GCC" = "yes"],[ 18 | AC_CACHE_CHECK([for working -pipe], [pandora_cv_use_pipe], [ 19 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 20 | #include 21 | 22 | int main(int argc, char** argv) 23 | { 24 | (void) argc; (void) argv; 25 | return 0; 26 | } 27 | ]])], 28 | [pandora_cv_use_pipe=yes], 29 | [pandora_cv_use_pipe=no]) 30 | ]) 31 | AS_IF([test "$pandora_cv_use_pipe" = "yes"],[ 32 | AM_CFLAGS="-pipe ${AM_CFLAGS}" 33 | AM_CXXFLAGS="-pipe ${AM_CXXFLAGS}" 34 | ]) 35 | ]) 36 | ]) 37 | -------------------------------------------------------------------------------- /libtest/core.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_CORE_H__ 24 | #define __LIBTEST_CORE_H__ 25 | 26 | namespace libtest { 27 | 28 | LIBTEST_API 29 | void create_core(void); 30 | 31 | } // namespace libtest 32 | 33 | #endif /* __LIBTEST_CORE_H__ */ 34 | -------------------------------------------------------------------------------- /libtest/is_pid.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_IS_PID_HPP__ 23 | #define __LIBTEST_IS_PID_HPP__ 24 | 25 | static inline bool is_pid_valid(const pid_t pid) 26 | { 27 | return (pid > 1) ? true : false; 28 | } 29 | 30 | #endif /* __LIBTEST_IS_PID_HPP__ */ 31 | -------------------------------------------------------------------------------- /libtest/version.h.in: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_VERSION_H_IN__ 24 | #define __LIBTEST_VERSION_H_IN__ 25 | 26 | #define LIBTEST_VERSION_STRING "@VERSION@" 27 | #define LIBTEST_VERSION_HEX @HEX_VERSION@ 28 | 29 | #endif /* __LIBTEST_VERSION_H_IN__ */ 30 | -------------------------------------------------------------------------------- /libtest/is_local.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_IS_LOCAL_HPP__ 23 | #define __LIBTEST_IS_LOCAL_HPP__ 24 | 25 | namespace libtest { 26 | 27 | LIBTEST_API 28 | bool test_is_local(); 29 | 30 | } // namespace libtest 31 | 32 | #endif /* __LIBTEST_IS_LOCAL_HPP__ */ 33 | -------------------------------------------------------------------------------- /libmemcached/protocol/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | 6 | lib_LTLIBRARIES+= libmemcached/libmemcachedprotocol.la 7 | libmemcached_libmemcachedprotocol_la_SOURCES= \ 8 | libmemcached/byteorder.cc \ 9 | libmemcached/protocol/ascii_handler.c \ 10 | libmemcached/protocol/binary_handler.c \ 11 | libmemcached/protocol/cache.c \ 12 | libmemcached/protocol/pedantic.c \ 13 | libmemcached/protocol/protocol_handler.c 14 | 15 | libmemcached_libmemcachedprotocol_la_CFLAGS= \ 16 | ${AM_CFLAGS} \ 17 | ${NO_CONVERSION} \ 18 | -DBUILDING_LIBMEMCACHED 19 | libmemcached_libmemcachedprotocol_la_CFLAGS+= ${PTHREAD_CFLAGS} 20 | 21 | libmemcached_libmemcachedprotocol_la_CXXFLAGS= \ 22 | ${AM_CXXFLAGS} \ 23 | -DBUILDING_LIBMEMCACHED 24 | libmemcached_libmemcachedprotocol_la_CXXFLAGS+= ${PTHREAD_CFLAGS} 25 | 26 | libmemcached_libmemcachedprotocol_la_LIBADD= ${PTHREAD_LIBS} 27 | libmemcached_libmemcachedprotocol_la_LDFLAGS= ${AM_LDFLAGS} 28 | libmemcached_libmemcachedprotocol_la_LDFLAGS+= -version-info ${MEMCACHED_PROTOCAL_LIBRARY_VERSION} 29 | -------------------------------------------------------------------------------- /libtest/blobslap_worker.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_BLOBSLAP_WORKER_H__ 23 | #define __LIBTEST_BLOBSLAP_WORKER_H__ 24 | 25 | namespace libtest { 26 | 27 | Server *build_blobslap_worker(in_port_t try_port); 28 | 29 | } 30 | 31 | #endif /* __LIBTEST_BLOBSLAP_WORKER_H__ */ 32 | -------------------------------------------------------------------------------- /libmemcached/libmemcached_probes.d: -------------------------------------------------------------------------------- 1 | provider libmemcached { 2 | probe memcached_delete_start(); 3 | probe memcached_delete_end(); 4 | probe memcached_increment_with_initial_start(); 5 | probe memcached_increment_with_initial_end(); 6 | probe memcached_decrement_with_initial_start(); 7 | probe memcached_decrement_with_initial_end(); 8 | probe memcached_increment_start(); 9 | probe memcached_increment_end(); 10 | probe memcached_decrement_start(); 11 | probe memcached_decrement_end(); 12 | probe memcached_flush_start(); 13 | probe memcached_flush_end(); 14 | probe memcached_set_start(); 15 | probe memcached_set_end(); 16 | probe memcached_add_start(); 17 | probe memcached_add_end(); 18 | probe memcached_replace_start(); 19 | probe memcached_replace_end(); 20 | probe memcached_get_start(); 21 | probe memcached_get_end(); 22 | probe memcached_mget_start(); 23 | probe memcached_mget_end(); 24 | probe memcached_connect_start(); 25 | probe memcached_connect_end(); 26 | probe memcached_server_add_start(); 27 | probe memcached_server_add_end(); 28 | }; 29 | -------------------------------------------------------------------------------- /libtest/socket.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_SOCKET_HPP__ 23 | #define __LIBTEST_SOCKET_HPP__ 24 | 25 | namespace libtest { 26 | 27 | const char *default_socket(); 28 | 29 | void set_default_socket(const char *socket); 30 | 31 | } // namespace libtest 32 | 33 | #endif /* __LIBTEST_SOCKET_HPP__ */ 34 | -------------------------------------------------------------------------------- /libtest/cmdline.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_CMDLINE_H__ 23 | #define __LIBTEST_CMDLINE_H__ 24 | 25 | namespace libtest { 26 | 27 | bool exec_cmdline(const std::string& executable, const char *args[]); 28 | 29 | const char *gearmand_binary(); 30 | 31 | } 32 | 33 | #endif /* __LIBTEST_CMDLINE_H__ */ 34 | -------------------------------------------------------------------------------- /libmemcached/util/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | nobase_include_HEADERS+= \ 6 | libmemcached/memcached_util.h \ 7 | libmemcached/util.h \ 8 | libmemcached/util/flush.h \ 9 | libmemcached/util/pid.h \ 10 | libmemcached/util/ping.h \ 11 | libmemcached/util/pool.h \ 12 | libmemcached/util/version.h 13 | lib_LTLIBRARIES+= libmemcached/libmemcachedutil.la 14 | 15 | libmemcached_libmemcachedutil_la_SOURCES= \ 16 | libmemcached/backtrace.cc \ 17 | libmemcached/util/flush.cc \ 18 | libmemcached/util/pid.cc \ 19 | libmemcached/util/ping.cc \ 20 | libmemcached/util/pool.cc \ 21 | libmemcached/util/version.cc 22 | libmemcached_libmemcachedutil_la_CXXFLAGS= \ 23 | ${AM_CXXFLAGS} \ 24 | ${NO_CONVERSION} \ 25 | -DBUILDING_LIBMEMCACHED 26 | libmemcached_libmemcachedutil_la_CXXFLAGS+= ${PTHREAD_CFLAGS} 27 | libmemcached_libmemcachedutil_la_LIBADD= libmemcached/libmemcached.la 28 | libmemcached_libmemcachedutil_la_LIBADD+= ${PTHREAD_LIBS} 29 | libmemcached_libmemcachedutil_la_LDFLAGS= ${AM_LDFLAGS} -version-info ${MEMCACHED_UTIL_LIBRARY_VERSION} 30 | libmemcached_libmemcachedutil_la_DEPENDENCIES= libmemcached/libmemcached.la 31 | 32 | -------------------------------------------------------------------------------- /libtest/strerror.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_STRERROR_H__ 23 | #define __LIBTEST_STRERROR_H__ 24 | 25 | namespace libtest { 26 | 27 | /** 28 | @note Friendly print function for errors. 29 | */ 30 | LIBTEST_API 31 | const char *test_strerror(test_return_t code); 32 | 33 | } // namespace libtest 34 | 35 | #endif /* __LIBTEST_STRERROR_H__ */ 36 | -------------------------------------------------------------------------------- /libtest/get.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_GET_H__ 24 | #define __LIBTEST_GET_H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* How we make all of this work :) */ 31 | LIBTEST_API 32 | void get_world(Framework *world); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* __LIBTEST_GET_H__ */ 39 | -------------------------------------------------------------------------------- /libtest/gearmand.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_GEARMAND_H__ 24 | #define __LIBTEST_GEARMAND_H__ 25 | 26 | #include 27 | 28 | namespace libtest { struct Server; } 29 | 30 | namespace libtest { 31 | 32 | libtest::Server *build_gearmand(const char *hostname, in_port_t try_port); 33 | 34 | } 35 | 36 | #endif /* __LIBTEST_GEARMAND_H__ */ 37 | -------------------------------------------------------------------------------- /libmemcachedinternal/include.am: -------------------------------------------------------------------------------- 1 | # vim:ft=automake 2 | # included from Top Level Makefile.am 3 | # All paths should be given relative to the root 4 | 5 | # This noinst lib contains things we want to be ABI private but still want to 6 | # either use in client programs or be able to test in test cases These symbols 7 | # will not be exposed in the shipped .so 8 | noinst_LTLIBRARIES+= libmemcachedinternal/libmemcachedinternal.la 9 | 10 | libmemcachedinternal_libmemcachedinternal_la_SOURCES= $(libmemcached_libmemcached_la_SOURCES) 11 | libmemcachedinternal_libmemcachedinternal_la_CFLAGS= \ 12 | ${AM_CFLAGS} \ 13 | ${NO_CONVERSION} \ 14 | -DBUILDING_LIBMEMCACHEDINTERNAL 15 | libmemcachedinternal_libmemcachedinternal_la_CPPFLAGS= \ 16 | ${AM_CPPFLAGS} \ 17 | ${NO_CONVERSION} \ 18 | -DBUILDING_LIBMEMCACHEDINTERNAL 19 | libmemcachedinternal_libmemcachedinternal_la_CXXFLAGS= \ 20 | ${AM_CXXFLAGS} \ 21 | ${NO_CONVERSION} \ 22 | -DBUILDING_LIBMEMCACHEDINTERNAL 23 | libmemcachedinternal_libmemcachedinternal_la_LDFLAGS= ${AM_LDFLAGS} 24 | libmemcachedinternal_libmemcachedinternal_la_LIBADD= $(libmemcached_libmemcached_la_LIBADD) 25 | libmemcachedinternal_libmemcachedinternal_la_DEPENDENCIES= $(libmemcached_libmemcached_la_DEPENDENCIES) 26 | -------------------------------------------------------------------------------- /m4/pandora_flex.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Monty Taylor 2 | dnl Copyright (C) 2010 Hartmut Holzgraefe 3 | dnl This file is free software; Monty Taylor and Hartmut Holzgraefe 4 | dnl give unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([_PANDORA_SEARCH_FLEX],[ 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for flex 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_CHECK_PROGS([LEX], ['flex'], [:]) 14 | AS_IF([test "x$LEX" = "x:"],[ 15 | pandora_have_flex=no 16 | LEX='if test -f "$@"; then echo "WARNING: no proper flex binary found, ignoring changes to $<"; exit 0; else echo "ERROR: no proper flex binary found"; exit 1; fi;' 17 | ],[ 18 | pandora_have_flex=yes 19 | ]) 20 | 21 | AM_CONDITIONAL(HAVE_FLEX, [test "x${pandora_have_flex}" = "xyes"]) 22 | ]) 23 | 24 | AC_DEFUN([PANDORA_HAVE_FLEX],[ 25 | AC_REQUIRE([_PANDORA_SEARCH_FLEX]) 26 | ]) 27 | 28 | AC_DEFUN([PANDORA_REQUIRE_FLEX],[ 29 | AC_REQUIRE([PANDORA_HAVE_FLEX]) 30 | AS_IF([test "x${pandora_have_flex}" = "xno" -a "$pandora_building_from_bzr" = "yes"], 31 | AC_MSG_ERROR(["flex is required for ${PACKAGE} to build from a bzr branch"]) 32 | ) 33 | ]) 34 | -------------------------------------------------------------------------------- /m4/pandora_swig.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystem 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | AC_DEFUN([PANDORA_SWIG],[ 13 | 14 | AC_PROG_SWIG(1.3.31) 15 | 16 | AC_DEFINE_UNQUOTED([SWIG_TYPE_TABLE], 17 | [$PACKAGE], 18 | [Type Table name for SWIG symbol table]) 19 | 20 | dnl Have to hard-code /usr/local/include and /usr/include into the path. 21 | dnl I hate this. Why is swig sucking me 22 | SWIG="$SWIG \${DEFS} -I\${top_srcdir} -I\${top_builddir} -I/usr/local/include -I/usr/include" 23 | AC_SUBST([SWIG]) 24 | 25 | 26 | ]) 27 | 28 | AC_DEFUN([PANDORA_SWIG_PYTHON3],[ 29 | AC_REQUIRE([PANDORA_SWIG]) 30 | AS_IF([test "x$SWIG" != "x"],[ 31 | AC_CACHE_CHECK([if swig supports Python3], 32 | [ac_cv_swig_has_python3_], 33 | [ 34 | AS_IF([$SWIG -python -help 2>&1 | grep py3 > /dev/null], 35 | [ac_cv_swig_has_python3_=yes], 36 | [ac_cv_swig_has_python3_=no]) 37 | ]) 38 | ]) 39 | ]) 40 | -------------------------------------------------------------------------------- /libtest/binaries.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_BINARIES_H__ 23 | #define __LIBTEST_BINARIES_H__ 24 | 25 | namespace libtest { 26 | 27 | LIBTEST_API 28 | bool has_memcached_binary(); 29 | 30 | LIBTEST_API 31 | bool has_memcached_sasl_binary(); 32 | 33 | LIBTEST_API 34 | bool has_gearmand_binary(); 35 | 36 | } // namespace libtest 37 | 38 | #endif /* __LIBTEST_BINARIES_H__ */ 39 | -------------------------------------------------------------------------------- /libhashkit/function.h: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2010 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #ifndef HASHKIT_FUNCTION_H 10 | #define HASHKIT_FUNCTION_H 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /** 17 | This sets/gets the default function we will be using. 18 | */ 19 | HASHKIT_API 20 | hashkit_return_t hashkit_set_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm); 21 | 22 | HASHKIT_API 23 | hashkit_return_t hashkit_set_custom_function(hashkit_st *hash, hashkit_hash_fn function, void *context); 24 | 25 | HASHKIT_API 26 | hashkit_hash_algorithm_t hashkit_get_function(const hashkit_st *hash); 27 | 28 | /** 29 | This sets/gets the function we use for distribution. 30 | */ 31 | HASHKIT_API 32 | hashkit_return_t hashkit_set_distribution_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm); 33 | 34 | HASHKIT_API 35 | hashkit_return_t hashkit_set_custom_distribution_function(hashkit_st *self, hashkit_hash_fn function, void *context); 36 | 37 | HASHKIT_API 38 | hashkit_hash_algorithm_t hashkit_get_distribution_function(const hashkit_st *self); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* HASHKIT_FUNCTION_H */ 45 | -------------------------------------------------------------------------------- /libtest/collection.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_COLLECTION_H__ 24 | #define __LIBTEST_COLLECTION_H__ 25 | 26 | /** 27 | A structure which describes a collection of test cases. 28 | */ 29 | struct collection_st { 30 | const char *name; 31 | test_callback_fn *pre; 32 | test_callback_fn *post; 33 | struct test_st *tests; 34 | }; 35 | 36 | #endif /* __LIBTEST_COLLECTION_H__ */ 37 | -------------------------------------------------------------------------------- /m4/pandora_bison.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Monty Taylor 2 | dnl Copyright (C) 2010 Hartmut Holzgraefe 3 | dnl This file is free software; Monty Taylor and Hartmut Holzgraefe 4 | dnl give unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([_PANDORA_SEARCH_BISON],[ 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for bison 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_CHECK_PROGS([YACC], ['bison -y'], [:]) 14 | AS_IF([test "x$YACC" = "x:"],[ 15 | pandora_have_bison=no 16 | YACC='if test -f "$@"; then echo "WARNING: no proper bison binary found, ignoring changes to $<"; exit 0; else echo "ERROR: no proper bison binary found"; exit 1; fi;' 17 | ],[ 18 | pandora_have_bison=yes 19 | ]) 20 | 21 | AM_CONDITIONAL(HAVE_BISON, [test "x${pandora_have_bison}" = "xyes"]) 22 | ]) 23 | 24 | AC_DEFUN([PANDORA_HAVE_BISON],[ 25 | AC_REQUIRE([_PANDORA_SEARCH_BISON]) 26 | ]) 27 | 28 | AC_DEFUN([PANDORA_REQUIRE_BISON],[ 29 | AC_REQUIRE([PANDORA_HAVE_BISON]) 30 | AS_IF([test "x${pandora_have_bison}" = "xno" -a "$pandora_building_from_bzr" = "yes"], 31 | AC_MSG_ERROR(["bison is required for ${PACKAGE} to build from a bzr branch"]) 32 | ) 33 | ]) 34 | -------------------------------------------------------------------------------- /m4/pandora_have_gcc_atomics.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for GCC Atomic Support 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[ 12 | 13 | AC_CACHE_CHECK( 14 | [whether the compiler provides atomic builtins], 15 | [ac_cv_gcc_atomic_builtins], 16 | [AC_LINK_IFELSE( 17 | [AC_LANG_PROGRAM([],[[ 18 | int foo= -10; int bar= 10; 19 | if (!__sync_fetch_and_add(&foo, bar) || foo) 20 | return -1; 21 | bar= __sync_lock_test_and_set(&foo, bar); 22 | if (bar || foo != 10) 23 | return -1; 24 | bar= __sync_val_compare_and_swap(&bar, foo, 15); 25 | if (bar) 26 | return -1; 27 | return 0; 28 | ]])], 29 | [ac_cv_gcc_atomic_builtins=yes], 30 | [ac_cv_gcc_atomic_builtins=no])]) 31 | 32 | AS_IF([test "x$ac_cv_gcc_atomic_builtins" = "xyes"],[ 33 | AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1, 34 | [Define to 1 if compiler provides atomic builtins.]) 35 | ]) 36 | 37 | ]) 38 | -------------------------------------------------------------------------------- /libtest/failed.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_FAILED_H__ 23 | #define __LIBTEST_FAILED_H__ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | LIBTEST_INTERNAL_API 30 | void push_failed_test(const char *collection, const char *test); 31 | 32 | LIBTEST_INTERNAL_API 33 | void print_failed_test(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* __LIBTEST_FAILED_H__ */ 40 | -------------------------------------------------------------------------------- /m4/pandora_have_libbdb.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBBDB],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for bekerely db 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libbdb], 14 | [AS_HELP_STRING([--disable-libbdb], 15 | [Build with libbdb support @<:@default=on@:>@])], 16 | [ac_enable_libbdb="$enableval"], 17 | [ac_enable_libbdb="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libbdb" = "xyes"],[ 20 | AC_LIB_HAVE_LINKFLAGS(db,,[ 21 | #include 22 | ],[ 23 | const char *test= DB_VERSION_STRING; 24 | ]) 25 | ],[ 26 | ac_cv_libbdb="no" 27 | ]) 28 | 29 | AM_CONDITIONAL(HAVE_LIBBDB, [test "x${ac_cv_libbdb}" = "xyes"]) 30 | ]) 31 | 32 | AC_DEFUN([PANDORA_HAVE_LIBBDB],[ 33 | AC_REQUIRE([_PANDORA_SEARCH_LIBBDB]) 34 | ]) 35 | 36 | AC_DEFUN([PANDORA_REQUIRE_LIBBDB],[ 37 | AC_REQUIRE([_PANDORA_SEARCH_LIBBDB]) 38 | AS_IF([test "x${ac_cv_libbdb}" = "xno"], 39 | AC_MSG_ERROR([libbdb is required for ${PACKAGE}])) 40 | ]) 41 | -------------------------------------------------------------------------------- /libtest/string.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_STRING_HPP__ 24 | #define __LIBTEST_STRING_HPP__ 25 | 26 | #include "util/string.hpp" 27 | 28 | #define test_literal_param util_literal_param 29 | #define test_literal_param_size util_literal_param_size 30 | #define test_string_make_from_cstr util_string_make_from_cstr 31 | #define test_array_length util_array_length 32 | 33 | #endif /* __LIBTEST_STRING_HPP__ */ 34 | -------------------------------------------------------------------------------- /m4/protocol_binary.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: PROTOCOL_BINARY_TEST 3 | dnl --------------------------------------------------------------------------- 4 | 5 | AC_DEFUN([PROTOCOL_BINARY_TEST], 6 | [ 7 | AC_CACHE_CHECK([for supported struct padding], [ac_cv_supported_struct_padding], [ 8 | AC_LANG_PUSH([C]) 9 | save_CFLAGS="$CFLAGS" 10 | CFLAGS="$CFLAGS -I${srcdir}" 11 | AC_TRY_COMPILE([ 12 | #include 13 | #include "libmemcached/memcached/protocol_binary.h" 14 | ], [ 15 | protocol_binary_request_set request; 16 | int a = 1; 17 | switch (a) { 18 | case sizeof(request): 19 | case sizeof(request.bytes): 20 | break; 21 | default: 22 | a = 2; 23 | } 24 | ], 25 | [ ac_cv_supported_struct_padding=no ], 26 | [ ac_cv_supported_struct_padding=yes ]) 27 | CFLAGS="$save_CFLAGS" 28 | AC_LANG_POP 29 | ]) 30 | AS_IF([test "x$ac_cv_supported_struct_padding" = "xno"],[ 31 | AC_MSG_ERROR([Unsupported struct padding done by compiler.])]) 32 | ]) 33 | 34 | dnl --------------------------------------------------------------------------- 35 | dnl End Macro: PROTOCOL_BINARY_TEST 36 | dnl --------------------------------------------------------------------------- 37 | -------------------------------------------------------------------------------- /libtest/core.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | 24 | 25 | namespace libtest { 26 | 27 | void create_core(void) 28 | { 29 | if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL) 30 | { 31 | pid_t pid= fork(); 32 | 33 | if (pid == 0) 34 | { 35 | abort(); 36 | } 37 | else 38 | { 39 | while (waitpid(pid, NULL, 0) != pid) {}; 40 | } 41 | } 42 | } 43 | 44 | } // namespace libtest 45 | -------------------------------------------------------------------------------- /m4/bottom.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([CONFIG_EXTRA], [ 2 | 3 | AH_BOTTOM([ 4 | 5 | #if defined(__cplusplus) 6 | #include CSTDINT_H 7 | #include CINTTYPES_H 8 | #else 9 | #include 10 | #include 11 | #endif 12 | 13 | #if !defined(HAVE_ULONG) && !defined(__USE_MISC) 14 | # define HAVE_ULONG 1 15 | typedef unsigned long int ulong; 16 | #endif 17 | 18 | ]) 19 | 20 | AH_BOTTOM([ 21 | #ifdef WIN32 22 | #define _WIN32_WINNT 0x0501 23 | #endif 24 | 25 | /* To hide the platform differences between MS Windows and Unix, I am 26 | * going to use the Microsoft way and #define the Microsoft-specific 27 | * functions to the unix way. Microsoft use a separate subsystem for sockets, 28 | * but Unix normally just use a filedescriptor on the same functions. It is 29 | * a lot easier to map back to the unix way with macros than going the other 30 | * way without side effect ;-) 31 | */ 32 | #ifdef WIN32 33 | #include "win32/wrappers.h" 34 | #define get_socket_errno() WSAGetLastError() 35 | #else 36 | #define INVALID_SOCKET -1 37 | #define SOCKET_ERROR -1 38 | #define closesocket(a) close(a) 39 | #define get_socket_errno() errno 40 | #endif 41 | 42 | #ifndef HAVE_MSG_NOSIGNAL 43 | #define MSG_NOSIGNAL 0 44 | #endif 45 | 46 | #ifndef HAVE_MSG_DONTWAIT 47 | #define MSG_DONTWAIT 0 48 | #endif 49 | 50 | #ifndef HAVE_MSG_MORE 51 | #define MSG_MORE 0 52 | #endif 53 | 54 | ]) 55 | ])dnl CONFIG_EXTRA 56 | -------------------------------------------------------------------------------- /m4/pandora_with_python.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystems 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | 13 | AC_DEFUN([PANDORA_WITH_PYTHON], [ 14 | 15 | AC_ARG_WITH([python], 16 | [AS_HELP_STRING([--with-python], 17 | [Build Python Bindings @<:@default=yes@:>@])], 18 | [with_python=$withval 19 | python_requested=$withval 20 | ], 21 | [with_python=yes 22 | python_requested=no 23 | ]) 24 | 25 | AS_IF([test "x$with_python" != "xno"],[ 26 | AS_IF([test "x$with_python" != "xyes"],[PYTHON=$with_python]) 27 | AM_PATH_PYTHON([2.4],,[with_python="no"]) 28 | AC_PYTHON_DEVEL() 29 | AS_IF([test "x$pythonexists" = "xno"],[with_python="no"]) 30 | ]) 31 | AS_IF([test "x$with_python" = "xno" -a "$python_requested" = "yes"],[ 32 | AC_MSG_ERROR([Python support was explicity requested, but Python support 33 | was not found. Please correct your build environment and try 34 | again]) 35 | ]) 36 | AM_CONDITIONAL(BUILD_PYTHON, [test "$with_python" = "yes"]) 37 | ]) 38 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "develop" ] 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Install Arcus C Client Dependency Packages 19 | run: sudo apt-get install -qq build-essential libtool 20 | - name: Cache Arcus Server Directory 21 | id: arcus-cache 22 | uses: actions/cache@v4 23 | with: 24 | path: ~/arcus 25 | key: ${{runner.os}}-arcus 26 | - name: Install Arcus Server 27 | if: steps.arcus-cache.outputs.cache-hit != 'true' 28 | run: | 29 | git clone https://github.com/naver/arcus-memcached 30 | cd arcus-memcached 31 | ./deps/install.sh $HOME/arcus 32 | ./config/autorun.sh 33 | ./configure --prefix=$HOME/arcus 34 | make CFLAGS+="-Wno-error" && make install 35 | - name: Build Arcus C Client 36 | run: | 37 | ./config/autorun.sh 38 | ./configure --with-memcached=$HOME/arcus/bin/memcached \ 39 | --with-memcached_engine=$HOME/arcus/lib/default_engine.so 40 | make 41 | - name: Test ARCUS C Client 42 | run: make test 43 | -------------------------------------------------------------------------------- /m4/pandora_have_innodb.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems 2 | dnl This file is free software; Sun Microsystems 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBINNODB],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libinnodb 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libinnodb], 14 | [AS_HELP_STRING([--disable-libinnodb], 15 | [Build with libinnodb support @<:@default=on@:>@])], 16 | [ac_enable_libinnodb="$enableval"], 17 | [ac_enable_libinnodb="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libinnodb" = "xyes"],[ 20 | AC_LIB_HAVE_LINKFLAGS(innodb,,[ 21 | #include 22 | ],[ 23 | ib_u64_t 24 | ib_api_version(void); 25 | ]) 26 | ],[ 27 | ac_cv_libinnodb="no" 28 | ]) 29 | 30 | AM_CONDITIONAL(HAVE_LIBINNODB, [test "x${ac_cv_libinnodb}" = "xyes"]) 31 | ]) 32 | 33 | AC_DEFUN([PANDORA_HAVE_LIBINNODB],[ 34 | AC_REQUIRE([_PANDORA_SEARCH_LIBINNODB]) 35 | ]) 36 | 37 | AC_DEFUN([PANDORA_REQUIRE_LIBINNODB],[ 38 | AC_REQUIRE([PANDORA_HAVE_LIBINNODB]) 39 | AS_IF([test "x${ac_cv_libinnodb}" = "xno"], 40 | AC_MSG_ERROR([libinnodb is required for ${PACKAGE}])) 41 | ]) 42 | -------------------------------------------------------------------------------- /m4/pandora_have_libpqxx.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Padraig O'Sullivan 2 | dnl This file is free software; 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBPQXX],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libpqxx 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libpqxx], 14 | [AS_HELP_STRING([--disable-libpqxx], 15 | [Build with libpqxx support @<:@default=on@:>@])], 16 | [ac_enable_libpqxx="$enableval"], 17 | [ac_enable_libpqxx="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libpqxx" = "xyes"],[ 20 | AC_LANG_PUSH([C++]) 21 | AC_LIB_HAVE_LINKFLAGS(pqxx,,[ 22 | #include 23 | ],[ 24 | pqxx::connection conn("dbname=test"); 25 | ]) 26 | AC_LANG_POP() 27 | ],[ 28 | ac_cv_libpqxx="no" 29 | ]) 30 | 31 | AM_CONDITIONAL(HAVE_LIBPQXX, [test "x${ac_cv_libpqxx}" = "xyes"]) 32 | 33 | ]) 34 | 35 | AC_DEFUN([PANDORA_HAVE_LIBPQXX],[ 36 | AC_REQUIRE([_PANDORA_SEARCH_LIBPQXX]) 37 | ]) 38 | 39 | AC_DEFUN([PANDORA_REQUIRE_LIBPQXX],[ 40 | AC_REQUIRE([PANDORA_HAVE_LIBPQXX]) 41 | AS_IF([test "x$ac_cv_libpqxx" = "xno"],[ 42 | AC_MSG_ERROR([libpqxx is required for ${PACKAGE}]) 43 | ]) 44 | ]) 45 | -------------------------------------------------------------------------------- /m4/pandora_have_thrift.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Padraig O'Sullivan 2 | dnl This file is free software; Padraig O'Sullivan 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_THRIFT],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for thrift 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([thrift], 14 | [AS_HELP_STRING([--disable-thrift], 15 | [Build with thrift support @<:@default=on@:>@])], 16 | [ac_enable_thrift="$enableval"], 17 | [ac_enable_thrift="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_thrift" = "xyes"],[ 20 | AC_LANG_PUSH(C++) 21 | AC_LIB_HAVE_LINKFLAGS(thrift,,[ 22 | #include 23 | ],[ 24 | apache::thrift::TOutput test_output; 25 | ]) 26 | AC_LANG_POP() 27 | ],[ 28 | ac_cv_thrift="no" 29 | ]) 30 | 31 | AM_CONDITIONAL(HAVE_THRIFT, [test "x${ac_cv_thrift}" = "xyes"]) 32 | 33 | ]) 34 | 35 | AC_DEFUN([PANDORA_HAVE_THRIFT],[ 36 | AC_REQUIRE([_PANDORA_SEARCH_THRIFT]) 37 | ]) 38 | 39 | AC_DEFUN([PANDORA_REQUIRE_THRIFT],[ 40 | AC_REQUIRE([PANDORA_HAVE_THRIFT]) 41 | AS_IF([test x$ac_cv_thrift= xno],[ 42 | AC_MSG_ERROR([thrift required for ${PACKAGE}]) 43 | ]) 44 | ]) 45 | 46 | -------------------------------------------------------------------------------- /libtest/port.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | /* 24 | Structures for generic tests. 25 | */ 26 | 27 | #ifndef __LIBTEST_PORT_H__ 28 | #define __LIBTEST_PORT_H__ 29 | 30 | namespace libtest { 31 | 32 | LIBTEST_API 33 | in_port_t default_port(); 34 | 35 | LIBTEST_API 36 | void set_default_port(in_port_t port); 37 | 38 | LIBTEST_API 39 | in_port_t max_port(); 40 | 41 | LIBTEST_API 42 | void set_max_port(in_port_t port); 43 | 44 | } // namespace libtest 45 | 46 | #endif /* __LIBTEST_PORT_H__ */ 47 | -------------------------------------------------------------------------------- /m4/pandora_have_libvbucket.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 NorthScale 2 | dnl This file is free software; NorthScale 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBVBUCKET],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libvbucket 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libvbucket], 14 | [AS_HELP_STRING([--disable-libvbucket], 15 | [Build with libvbucket support @<:@default=on@:>@])], 16 | [ac_enable_libvbucket="$enableval"], 17 | [ac_enable_libvbucket="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libvbucket" = "xyes"],[ 20 | AC_LIB_HAVE_LINKFLAGS(vbucket,,[ 21 | #include 22 | ],[ 23 | VBUCKET_CONFIG_HANDLE config = vbucket_config_parse_file(NULL); 24 | ]) 25 | ],[ 26 | ac_cv_libvbucket="no" 27 | ]) 28 | 29 | AM_CONDITIONAL(HAVE_LIBVBUCKET, [test "x${ac_cv_libvbucket}" = "xyes"]) 30 | ]) 31 | 32 | AC_DEFUN([PANDORA_HAVE_LIBVBUCKET],[ 33 | AC_REQUIRE([_PANDORA_SEARCH_LIBVBUCKET]) 34 | ]) 35 | 36 | AC_DEFUN([PANDORA_REQUIRE_LIBVBUCKET],[ 37 | AC_REQUIRE([PANDORA_HAVE_LIBVBUCKET]) 38 | AS_IF([test x$ac_cv_libvbucket = xno], 39 | AC_MSG_ERROR([libvbucket is required for ${PACKAGE}])) 40 | ]) 41 | -------------------------------------------------------------------------------- /libtest/killpid.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_KILLPID_H__ 24 | #define __LIBTEST_KILLPID_H__ 25 | 26 | 27 | bool kill_pid(pid_t pid_arg); 28 | 29 | bool kill_file(const std::string &filename); 30 | 31 | bool check_pid(const std::string &filename); 32 | 33 | pid_t get_pid_from_file(const std::string &filename, std::stringstream& error_message); 34 | 35 | static inline bool check_pid(pid_t pid_arg) 36 | { 37 | return (pid_arg > 1); 38 | } 39 | 40 | #endif /* __LIBTEST_KILLPID_H__ */ 41 | -------------------------------------------------------------------------------- /m4/pandora_have_libhashkit.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 NorthScale 2 | dnl This file is free software; NorthScale 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBHASHKIT],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libhashkit 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libhashkit], 14 | [AS_HELP_STRING([--disable-libhashkit], 15 | [Build with libhashkit support @<:@default=on@:>@])], 16 | [ac_enable_libhashkit="$enableval"], 17 | [ac_enable_libhashkit="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libhashkit" = "xyes"],[ 20 | AC_LIB_HAVE_LINKFLAGS(hashkit,,[ 21 | #include 22 | ],[ 23 | hashkit_st foo; 24 | hashkit_st *kit = hashkit_create(&foo); 25 | hashkit_free(kit); 26 | ]) 27 | ],[ 28 | ac_cv_libhashkit="no" 29 | ]) 30 | 31 | AM_CONDITIONAL(HAVE_LIBHASHKIT, [test "x${ac_cv_libhashkit}" = "xyes"]) 32 | ]) 33 | 34 | AC_DEFUN([PANDORA_HAVE_LIBHASHKIT],[ 35 | AC_REQUIRE([_PANDORA_SEARCH_LIBHASHKIT]) 36 | ]) 37 | 38 | AC_DEFUN([PANDORA_REQUIRE_LIBHASHKIT],[ 39 | AC_REQUIRE([PANDORA_HAVE_LIBHASHKIT]) 40 | AS_IF([test x$ac_cv_libhashkit = xno], 41 | AC_MSG_ERROR([libhashkit is required for ${PACKAGE}])) 42 | ]) 43 | -------------------------------------------------------------------------------- /m4/pandora_have_libsqlite3.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBSQLITE3],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libsqlite3 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libsqlite3], 14 | [AS_HELP_STRING([--disable-libsqlite3], 15 | [Build with libsqlite3 support @<:@default=on@:>@])], 16 | [ac_enable_libsqlite3="$enableval"], 17 | [ac_enable_libsqlite3="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libsqlite3" = "xyes"],[ 20 | AC_LIB_HAVE_LINKFLAGS(sqlite3,,[ 21 | #include 22 | #include 23 | ],[ 24 | sqlite3 *db; 25 | sqlite3_open(NULL, &db); 26 | ]) 27 | ],[ 28 | ac_cv_libsqlite3="no" 29 | ]) 30 | 31 | AM_CONDITIONAL(HAVE_LIBSQLITE3, [test "x${ac_cv_libsqlite3}" = "xyes"]) 32 | ]) 33 | 34 | AC_DEFUN([PANDORA_HAVE_LIBSQLITE3],[ 35 | AC_REQUIRE([_PANDORA_SEARCH_LIBSQLITE3]) 36 | ]) 37 | 38 | AC_DEFUN([PANDORA_REQUIRE_LIBSQLITE3],[ 39 | AC_REQUIRE([_PANDORA_SEARCH_LIBSQLITE3]) 40 | AS_IF([test "x${ac_cv_libsqlite3}" = "xno"], 41 | AC_MSG_ERROR([libsqlite3 is required for ${PACKAGE}])) 42 | ]) 43 | -------------------------------------------------------------------------------- /libtest/skiptest.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | using namespace libtest; 31 | 32 | 33 | collection_st collection[] ={ 34 | {0, 0, 0, 0} 35 | }; 36 | 37 | static void *world_create(server_startup_st&, test_return_t& rc) 38 | { 39 | rc= TEST_SKIPPED; 40 | 41 | return NULL; 42 | } 43 | 44 | void get_world(Framework *world) 45 | { 46 | world->collections= collection; 47 | world->_create= world_create; 48 | } 49 | -------------------------------------------------------------------------------- /m4/pandora_have_libz.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for libz 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([_PANDORA_SEARCH_LIBZ],[ 12 | AC_REQUIRE([AC_LIB_PREFIX]) 13 | 14 | AC_LIB_HAVE_LINKFLAGS(z,, 15 | [ 16 | #include 17 | ],[ 18 | crc32(0, Z_NULL, 0); 19 | ]) 20 | 21 | AM_CONDITIONAL(HAVE_LIBZ, [test "x${ac_cv_libz}" = "xyes"]) 22 | ]) 23 | 24 | AC_DEFUN([_PANDORA_HAVE_LIBZ],[ 25 | 26 | AC_ARG_ENABLE([libz], 27 | [AS_HELP_STRING([--disable-libz], 28 | [Build with libz support @<:@default=on@:>@])], 29 | [ac_enable_libz="$enableval"], 30 | [ac_enable_libz="yes"]) 31 | 32 | _PANDORA_SEARCH_LIBZ 33 | ]) 34 | 35 | 36 | AC_DEFUN([PANDORA_HAVE_LIBZ],[ 37 | AC_REQUIRE([_PANDORA_HAVE_LIBZ]) 38 | ]) 39 | 40 | AC_DEFUN([_PANDORA_REQUIRE_LIBZ],[ 41 | ac_enable_libz="yes" 42 | _PANDORA_SEARCH_LIBZ 43 | 44 | AS_IF([test x$ac_cv_libz = xno],[ 45 | AC_MSG_ERROR([libz is required for ${PACKAGE}. On Debian this can be found in zlib1g-dev. On RedHat this can be found in zlib-devel.]) 46 | ]) 47 | ]) 48 | 49 | AC_DEFUN([PANDORA_REQUIRE_LIBZ],[ 50 | AC_REQUIRE([_PANDORA_REQUIRE_LIBZ]) 51 | ]) 52 | -------------------------------------------------------------------------------- /libtest/strerror.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | 24 | namespace libtest { 25 | 26 | const char *test_strerror(test_return_t code) 27 | { 28 | switch (code) { 29 | case TEST_SUCCESS: 30 | return "ok"; 31 | 32 | case TEST_FAILURE: 33 | return "failed"; 34 | 35 | case TEST_MEMORY_ALLOCATION_FAILURE: 36 | return "memory allocation"; 37 | 38 | case TEST_SKIPPED: 39 | return "skipped"; 40 | 41 | case TEST_FATAL: 42 | break; 43 | } 44 | 45 | return "failed"; 46 | } 47 | 48 | } // namespace libtest 49 | -------------------------------------------------------------------------------- /m4/pandora_have_libavahi.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBAVAHI],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libavahi 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libavahi], 14 | [AS_HELP_STRING([--disable-libavahi], 15 | [Build with libavahi support @<:@default=on@:>@])], 16 | [ac_enable_libavahi="$enableval"], 17 | [ac_enable_libavahi="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libavahi" = "xyes"],[ 20 | AC_LIB_HAVE_LINKFLAGS(avahi-client,avahi-common,[ 21 | #include 22 | #include 23 | ],[ 24 | AvahiSimplePoll *simple_poll= avahi_simple_poll_new(); 25 | ]) 26 | ],[ 27 | ac_cv_libavahi="no" 28 | ]) 29 | 30 | AM_CONDITIONAL(HAVE_LIBAVAHI, [test "x${ac_cv_libavahi}" = "xyes"]) 31 | ]) 32 | 33 | AC_DEFUN([PANDORA_HAVE_LIBAVAHI],[ 34 | AC_REQUIRE([_PANDORA_SEARCH_LIBAVAHI]) 35 | ]) 36 | 37 | AC_DEFUN([PANDORA_REQUIRE_LIBAVAHI],[ 38 | AC_REQUIRE([_PANDORA_SEARCH_LIBAVAHI]) 39 | AS_IF([test "x${ac_cv_libavahi}" = "xno"], 40 | AC_MSG_ERROR([libavahi is required for ${PACKAGE}])) 41 | ]) 42 | -------------------------------------------------------------------------------- /libtest/error.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_ERROR_H__ 24 | #define __LIBTEST_ERROR_H__ 25 | 26 | enum test_return_t { 27 | TEST_SUCCESS, 28 | TEST_FAILURE, 29 | TEST_MEMORY_ALLOCATION_FAILURE, 30 | TEST_SKIPPED, 31 | TEST_FATAL // Collection should not be continued 32 | }; 33 | 34 | 35 | static inline bool test_success(test_return_t rc) 36 | { 37 | return (rc == TEST_SUCCESS); 38 | } 39 | 40 | static inline bool test_failed(test_return_t rc) 41 | { 42 | return (rc != TEST_SUCCESS); 43 | } 44 | 45 | #endif /* __LIBTEST_ERROR_H__ */ 46 | -------------------------------------------------------------------------------- /libtest/socket.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright 2010-2014 NAVER Corp. 6 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 3 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #include 24 | 25 | static char global_socket[1024] = { 0 }; 26 | 27 | namespace libtest { 28 | 29 | const char *default_socket() 30 | { 31 | if (global_socket[0] == 0) 32 | { 33 | return NULL; 34 | } 35 | return global_socket; 36 | } 37 | 38 | void set_default_socket(const char *socket) 39 | { 40 | if (socket && strlen(socket) < sizeof(global_socket)) 41 | { 42 | strncpy(global_socket, socket, sizeof(global_socket)); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /m4/pandora_have_libpq.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBPQ],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libpq 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libpq], 14 | [AS_HELP_STRING([--disable-libpq], 15 | [Build with libpq support @<:@default=on@:>@])], 16 | [ac_enable_libpq="$enableval"], 17 | [ac_enable_libpq="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libpq" = "xyes"],[ 20 | AC_CHECK_HEADERS([libpq-fe.h]) 21 | AC_LIB_HAVE_LINKFLAGS(pq,,[ 22 | #ifdef HAVE_LIBPQ_FE_H 23 | # include 24 | #else 25 | # include 26 | #endif 27 | ], [ 28 | PGconn *conn; 29 | conn = PQconnectdb(NULL); 30 | ]) 31 | ],[ 32 | ac_cv_libpq="no" 33 | ]) 34 | 35 | AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"]) 36 | ]) 37 | 38 | AC_DEFUN([PANDORA_HAVE_LIBPQ],[ 39 | AC_REQUIRE([_PANDORA_SEARCH_LIBPQ]) 40 | ]) 41 | 42 | AC_DEFUN([PANDORA_REQUIRE_LIBPQ],[ 43 | AC_REQUIRE([PANDORA_HAVE_LIBPQ]) 44 | AS_IF([test "x${ac_cv_libpq}" = "xno"], 45 | AC_MSG_ERROR([libpq is required for ${PACKAGE}])) 46 | ]) 47 | -------------------------------------------------------------------------------- /libmemcached/exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Summary: Exceptions for the C++ interface 3 | * 4 | * Copy: See Copyright for the status of this software. 5 | * 6 | */ 7 | 8 | /** 9 | * @file 10 | * @brief Exception declarations 11 | */ 12 | 13 | #ifndef __LIBMEMCACHED_EXCEPTION_HPP__ 14 | #define __LIBMEMCACHED_EXCEPTION_HPP__ 15 | 16 | #include 17 | #include 18 | 19 | namespace memcache 20 | { 21 | class Exception : public std::runtime_error 22 | { 23 | public: 24 | Exception(const std::string& msg, int in_errno) 25 | : 26 | std::runtime_error(msg), 27 | _errno(in_errno) 28 | {} 29 | 30 | Exception(const char *msg, int in_errno) 31 | : 32 | std::runtime_error(std::string(msg)), 33 | _errno(in_errno) {} 34 | 35 | virtual ~Exception() throw() {} 36 | 37 | int getErrno() const 38 | { 39 | return _errno; 40 | } 41 | 42 | private: 43 | int _errno; 44 | }; 45 | 46 | class Warning : public Exception 47 | { 48 | public: 49 | Warning(const std::string& msg, int in_errno) : Exception(msg, in_errno) {} 50 | Warning(const char *msg, int in_errno) : Exception(msg, in_errno) {} 51 | }; 52 | 53 | class Error : public Exception 54 | { 55 | public: 56 | Error(const std::string& msg, int in_errno) : Exception(msg, in_errno) {} 57 | Error(const char *msg, int in_errno) : Exception(msg, in_errno) {} 58 | virtual ~Error() throw() {} 59 | }; 60 | 61 | } /* namespace libmemcached */ 62 | 63 | #endif /* __LIBMEMCACHED_EXCEPTION_HPP__ */ 64 | -------------------------------------------------------------------------------- /m4/pandora_have_libhaildb.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBHAILDB],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libhaildb 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libhaildb], 14 | [AS_HELP_STRING([--disable-libhaildb], 15 | [Build with libhaildb support @<:@default=on@:>@])], 16 | [ac_enable_libhaildb="$enableval"], 17 | [ac_enable_libhaildb="yes"]) 18 | 19 | 20 | AS_IF([test "x$ac_enable_libhaildb" = "xyes"],[ 21 | AC_LIB_HAVE_LINKFLAGS(haildb,,[ 22 | #include 23 | ],[ 24 | ib_update_table_statistics(NULL); 25 | ]) 26 | AS_IF([test "x${ac_cv_libhaildb}" = "xyes"],[ 27 | AC_DEFINE([HAVE_HAILDB_H],[1],[Do we have haildb.h]) 28 | ]) 29 | ],[ 30 | ac_cv_libhaildb="no" 31 | ]) 32 | AM_CONDITIONAL(HAVE_LIBHAILDB, [test "x${ac_cv_libhaildb}" = "xyes"]) 33 | ]) 34 | 35 | AC_DEFUN([PANDORA_HAVE_LIBHAILDB],[ 36 | AC_REQUIRE([_PANDORA_SEARCH_LIBHAILDB]) 37 | ]) 38 | 39 | AC_DEFUN([PANDORA_REQUIRE_LIBHAILDB],[ 40 | AC_REQUIRE([PANDORA_HAVE_LIBHAILDB]) 41 | AS_IF([test "x${ac_cv_libhaildb}" = "xno"], 42 | AC_MSG_ERROR([libhaildb 2.3.2 or later is required for ${PACKAGE}])) 43 | ]) 44 | -------------------------------------------------------------------------------- /m4/pandora_have_libcassandra.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2010 Padraig O'Sullivan 2 | dnl This file is free software; 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | AC_DEFUN([_PANDORA_SEARCH_LIBCASSANDRA],[ 7 | AC_REQUIRE([AC_LIB_PREFIX]) 8 | 9 | dnl -------------------------------------------------------------------- 10 | dnl Check for libcassandra 11 | dnl -------------------------------------------------------------------- 12 | 13 | AC_ARG_ENABLE([libcassandra], 14 | [AS_HELP_STRING([--disable-libcassandra], 15 | [Build with libcassandra support @<:@default=on@:>@])], 16 | [ac_enable_libcassandra="$enableval"], 17 | [ac_enable_libcassandra="yes"]) 18 | 19 | AS_IF([test "x$ac_enable_libcassandra" = "xyes"],[ 20 | AC_LANG_PUSH([C++]) 21 | AC_LIB_HAVE_LINKFLAGS(cassandra,[thrift],[ 22 | #include 23 | ],[ 24 | libcassandra::CassandraFactory fact("localhost", 9306); 25 | ]) 26 | AC_LANG_POP() 27 | ],[ 28 | ac_cv_libcassandra="no" 29 | ]) 30 | 31 | AM_CONDITIONAL(HAVE_LIBCASSANDRA, [test "x${ac_cv_libcassandra}" = "xyes"]) 32 | 33 | ]) 34 | 35 | AC_DEFUN([PANDORA_HAVE_LIBCASSANDRA],[ 36 | AC_REQUIRE([_PANDORA_SEARCH_LIBCASSANDRA]) 37 | ]) 38 | 39 | AC_DEFUN([PANDORA_REQUIRE_LIBCASSANDRA],[ 40 | AC_REQUIRE([PANDORA_HAVE_LIBCASSANDRA]) 41 | AS_IF([test "x$ac_cv_libcassandra" = "xno"],[ 42 | AC_MSG_ERROR([libcassandra is required for ${PACKAGE}]) 43 | ]) 44 | ]) 45 | -------------------------------------------------------------------------------- /m4/pandora_have_libdl.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for libdl 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([_PANDORA_SEARCH_LIBDL],[ 12 | 13 | save_LIBS="$LIBS" 14 | LIBS="" 15 | AC_CHECK_LIB(dl,dlopen) 16 | AC_CHECK_FUNCS(dlopen) 17 | LIBDL_LIBS="$LIBS" 18 | LIBS="${save_LIBS}" 19 | AC_SUBST(LIBDL_LIBS) 20 | 21 | AM_CONDITIONAL(HAVE_LIBDL, [test "x${ac_cv_func_dlopen}" = "xyes"]) 22 | ]) 23 | 24 | AC_DEFUN([_PANDORA_HAVE_LIBDL],[ 25 | 26 | AC_ARG_ENABLE([libdl], 27 | [AS_HELP_STRING([--disable-libdl], 28 | [Build with libdl support @<:@default=on@:>@])], 29 | [ac_enable_libdl="$enableval"], 30 | [ac_enable_libdl="yes"]) 31 | 32 | _PANDORA_SEARCH_LIBDL 33 | ]) 34 | 35 | 36 | AC_DEFUN([PANDORA_HAVE_LIBDL],[ 37 | AC_REQUIRE([_PANDORA_HAVE_LIBDL]) 38 | ]) 39 | 40 | AC_DEFUN([_PANDORA_REQUIRE_LIBDL],[ 41 | ac_enable_libdl="yes" 42 | _PANDORA_SEARCH_LIBDL 43 | 44 | AS_IF([test "$ac_cv_func_dlopen" != "yes"],[ 45 | AC_MSG_ERROR([libdl/dlopen() is required for ${PACKAGE}. On Debian this can be found in libc6-dev. On RedHat this can be found in glibc-devel.]) 46 | ]) 47 | ]) 48 | 49 | AC_DEFUN([PANDORA_REQUIRE_LIBDL],[ 50 | AC_REQUIRE([_PANDORA_REQUIRE_LIBDL]) 51 | ]) 52 | -------------------------------------------------------------------------------- /docs/man/libhashkit.3: -------------------------------------------------------------------------------- 1 | .TH "LIBHASHKIT" "3" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | libhashkit \- libhashkit Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | .nf 35 | .ft C 36 | cc [ flag ... ] file ... \-lhashkit 37 | 38 | #include 39 | .ft P 40 | .fi 41 | .SH DESCRIPTION 42 | .sp 43 | libhashkit is a small and thread\-safe client library that provides a collection of useful hashing algorithm. libhashkit is distributed with libmemcached. 44 | .SH HOME 45 | .sp 46 | To find out more information please check: 47 | \fI\%http://libmemcached.org/\fP 48 | .SH SEE ALSO 49 | .sp 50 | \fIlibhashkit(3)\fP 51 | .SH AUTHOR 52 | Brian Aker 53 | .SH COPYRIGHT 54 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 55 | .\" Generated by docutils manpage writer. 56 | .\" 57 | . 58 | -------------------------------------------------------------------------------- /libtest/callbacks.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_CALLBACKS_H__ 24 | #define __LIBTEST_CALLBACKS_H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | typedef void* (test_callback_create_fn)(libtest::server_startup_st&, test_return_t&); 31 | typedef bool test_callback_destroy_fn(void *); 32 | typedef enum test_return_t (test_callback_fn)(void *); 33 | typedef enum test_return_t (test_callback_runner_fn)(test_callback_fn*, void *); 34 | typedef enum test_return_t (test_callback_error_fn)(const test_return_t, void *); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* __LIBTEST_CALLBACKS_H__ */ 41 | -------------------------------------------------------------------------------- /libtest/stats.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_STATS_H__ 24 | #define __LIBTEST_STATS_H__ 25 | 26 | struct Stats { 27 | int32_t collection_success; 28 | int32_t collection_skipped; 29 | int32_t collection_failed; 30 | int32_t collection_total; 31 | 32 | uint32_t success; 33 | uint32_t skipped; 34 | uint32_t failed; 35 | uint32_t total; 36 | 37 | Stats() : 38 | collection_success(0), 39 | collection_skipped(0), 40 | collection_failed(0), 41 | collection_total(0), 42 | success(0), 43 | skipped(0), 44 | failed(0), 45 | total(0) 46 | { } 47 | }; 48 | 49 | #endif /* __LIBTEST_STATS_H__ */ 50 | -------------------------------------------------------------------------------- /libtest/runner.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #ifndef __LIBTEST_RUNNER_H__ 24 | #define __LIBTEST_RUNNER_H__ 25 | 26 | 27 | namespace libtest { 28 | 29 | /** 30 | Structure which houses the actual callers for the test cases contained in 31 | the collections. 32 | */ 33 | class Runner { 34 | public: 35 | virtual test_return_t run(test_callback_fn* func, void *object); 36 | virtual test_return_t pre(test_callback_fn* func, void *object); 37 | virtual test_return_t post(test_callback_fn* func, void *object); 38 | 39 | Runner(); 40 | 41 | virtual ~Runner() { } 42 | }; 43 | 44 | } // namespace Runner 45 | 46 | #endif /* __LIBTEST_RUNNER_H__ */ 47 | -------------------------------------------------------------------------------- /m4/pandora_cstdint.m4: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 Sun Microsystems, Inc. 2 | # This file is free software; Sun Microsystems, Inc. 3 | # gives unlimited permission to copy and/or distribute it, 4 | # with or without modifications, as long as this notice is preserved. 5 | 6 | # We check two things: where the include file is for cstdint. We 7 | # include AC_TRY_COMPILE for all the combinations we've seen in the 8 | # wild. We define one of HAVE_CSTDINT or HAVE_TR1_CSTDINT or 9 | # HAVE_BOOST_CSTDINT depending 10 | # on location. 11 | 12 | AC_DEFUN([PANDORA_CXX_CSTDINT], 13 | [AC_MSG_CHECKING(the location of cstdint) 14 | AC_LANG_PUSH(C++) 15 | save_CXXFLAGS="${CXXFLAGS}" 16 | CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" 17 | ac_cv_cxx_cstdint="" 18 | for location in tr1/cstdint boost/cstdint cstdint; do 19 | if test -z "$ac_cv_cxx_cstdint"; then 20 | AC_TRY_COMPILE([#include <$location>], 21 | [uint32_t t], 22 | [ac_cv_cxx_cstdint="<$location>";]) 23 | fi 24 | done 25 | AC_LANG_POP() 26 | CXXFLAGS="${save_CXXFLAGS}" 27 | if test -n "$ac_cv_cxx_cstdint"; then 28 | AC_MSG_RESULT([$ac_cv_cxx_cstdint]) 29 | else 30 | AC_DEFINE([__STDC_CONSTANT_MACROS],[1],[Use STDC Constant Macros in C++]) 31 | AC_DEFINE([__STDC_FORMAT_MACROS],[1],[Use STDC Format Macros in C++]) 32 | ac_cv_cxx_cstdint="" 33 | AC_MSG_RESULT() 34 | AC_MSG_WARN([Could not find a cstdint header.]) 35 | fi 36 | AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint, 37 | [the location of ]) 38 | ]) 39 | -------------------------------------------------------------------------------- /clients/ms_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ms_stats.h 3 | * Author: Mingqiang Zhuang 4 | * 5 | * Created on March 25, 2009 6 | * 7 | * (c) Copyright 2009, Schooner Information Technology, Inc. 8 | * http://www.schoonerinfotech.com/ 9 | * 10 | */ 11 | #ifndef MS_STAT_H 12 | #define MS_STAT_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* statistic structure of response time */ 26 | typedef struct 27 | { 28 | char *name; 29 | uint64_t total_time; 30 | uint64_t min_time; 31 | uint64_t max_time; 32 | uint64_t get_miss; 33 | uint64_t dist[65]; 34 | double squares; 35 | double log_product; 36 | 37 | uint64_t period_min_time; 38 | uint64_t period_max_time; 39 | uint64_t pre_get_miss; 40 | uint64_t pre_events; 41 | uint64_t pre_total_time; 42 | uint64_t pre_squares; 43 | double pre_log_product; 44 | } ms_stat_t; 45 | 46 | /* initialize statistic */ 47 | void ms_init_stats(ms_stat_t *stat, const char *name); 48 | 49 | 50 | /* record one event */ 51 | void ms_record_event(ms_stat_t *stat, uint64_t time, int get_miss); 52 | 53 | 54 | /* dump the statistics */ 55 | void ms_dump_stats(ms_stat_t *stat); 56 | 57 | 58 | /* dump the format statistics */ 59 | void ms_dump_format_stats(ms_stat_t *stat, 60 | int run_time, 61 | int freq, 62 | int obj_size); 63 | 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* MS_STAT_H */ 70 | -------------------------------------------------------------------------------- /libhashkit/visibility.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Summary: interface for HashKit functions 3 | * Description: visibitliy macros for HashKit library 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in this directory for full text. 7 | * 8 | * Author: Monty Taylor 9 | */ 10 | 11 | /** 12 | * @file 13 | * @brief Visibility control macros 14 | */ 15 | 16 | #ifndef __LIBHASHKIT_VISIBILITY_H__ 17 | #define __LIBHASHKIT_VISIBILITY_H__ 18 | 19 | /** 20 | * 21 | * HASHKIT_API is used for the public API symbols. It either DLL imports or 22 | * DLL exports (or does nothing for static build). 23 | * 24 | * HASHKIT_LOCAL is used for non-api symbols. 25 | */ 26 | 27 | #if defined(BUILDING_HASHKIT) 28 | # if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY 29 | # define HASHKIT_API __attribute__ ((visibility("default"))) 30 | # define HASHKIT_LOCAL __attribute__ ((visibility("hidden"))) 31 | # elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) 32 | # define HASHKIT_API __global 33 | # define HASHKIT_LOCAL __hidden 34 | # elif defined(_MSC_VER) 35 | # define HASHKIT_API extern __declspec(dllexport) 36 | # define HASHKIT_LOCAL 37 | # else 38 | # define HASHKIT_API 39 | # define HASHKIT_LOCAL 40 | # endif /* defined(HAVE_VISIBILITY) */ 41 | #else /* defined(BUILDING_HASHKIT) */ 42 | # if defined(_MSC_VER) 43 | # define HASHKIT_API extern __declspec(dllimport) 44 | # define HASHKIT_LOCAL 45 | # else 46 | # define HASHKIT_API 47 | # define HASHKIT_LOCAL 48 | # endif /* defined(_MSC_VER) */ 49 | #endif /* defined(BUILDING_HASHKIT) */ 50 | 51 | #endif /* __LIBHASHKIT_VISIBILITY_H__ */ 52 | -------------------------------------------------------------------------------- /m4/pandora_with_python3.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystems 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | AC_DEFUN([PANDORA_WITH_PYTHON3], [ 13 | 14 | AC_REQUIRE([PANDORA_SWIG]) 15 | 16 | AC_ARG_WITH([python3], 17 | [AS_HELP_STRING([--with-python3], 18 | [Build Python3 Bindings @<:@default=yes@:>@])],[ 19 | with_python3=$withval 20 | python3_requested=$withval 21 | ],[ 22 | with_python3=yes 23 | python3_requested=no 24 | ]) 25 | 26 | AS_IF([test "x$ac_cv_swig_has_python3_" != "xyes"],[ 27 | with_python3=no 28 | ],[ 29 | AS_IF([test "x$with_python3" != "xno"],[ 30 | AS_IF([test "x$with_python3" != "xyes"], 31 | [PYTHON3=$with_python3],[ 32 | AC_PATH_PROG([PYTHON3],[python3],[no]) 33 | PANDORA_PYTHON3_DEVEL() 34 | AS_IF([test "x$python3exists" = "xno"],[with_python="no"]) 35 | ]) 36 | ]) 37 | ]) 38 | AS_IF([test "x$with_python3" = "xno" -a "$python3_requested" = "yes"],[ 39 | AC_MSG_ERROR([Python3 support was explicity requested, but Python3 support 40 | was not found. Please correct your build environment and try 41 | again]) 42 | ]) 43 | AM_CONDITIONAL(BUILD_PYTHON3, [test "$with_python3" = "yes"]) 44 | ]) 45 | -------------------------------------------------------------------------------- /m4/pandora_cinttypes.m4: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 Sun Microsystems, Inc. 2 | # This file is free software; Sun Microsystems, Inc. 3 | # gives unlimited permission to copy and/or distribute it, 4 | # with or without modifications, as long as this notice is preserved. 5 | 6 | # We check two things: where the include file is for cinttypes. We 7 | # include AC_TRY_COMPILE for all the combinations we've seen in the 8 | # wild. We define one of HAVE_CINTTYPES or HAVE_TR1_CINTTYPES or 9 | # HAVE_BOOST_CINTTYPES depending 10 | # on location. 11 | 12 | AC_DEFUN([PANDORA_CXX_CINTTYPES], 13 | [AC_REQUIRE([PANDORA_CXX_CSTDINT]) 14 | AC_MSG_CHECKING(the location of cinttypes) 15 | AC_LANG_PUSH(C++) 16 | save_CXXFLAGS="${CXXFLAGS}" 17 | CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}" 18 | ac_cv_cxx_cinttypes="" 19 | for location in tr1/cinttypes boost/cinttypes cinttypes; do 20 | if test -z "$ac_cv_cxx_cinttypes"; then 21 | AC_TRY_COMPILE([#include $ac_cv_cxx_cstdint; 22 | #include <$location>], 23 | [uint32_t foo= UINT32_C(1)], 24 | [ac_cv_cxx_cinttypes="<$location>";]) 25 | fi 26 | done 27 | AC_LANG_POP() 28 | CXXFLAGS="${save_CXXFLAGS}" 29 | if test -n "$ac_cv_cxx_cinttypes"; then 30 | AC_MSG_RESULT([$ac_cv_cxx_cinttypes]) 31 | else 32 | ac_cv_cxx_cinttypes="" 33 | AC_MSG_RESULT() 34 | AC_MSG_WARN([Could not find a cinttypes header.]) 35 | fi 36 | AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++]) 37 | AC_DEFINE_UNQUOTED(CINTTYPES_H,$ac_cv_cxx_cinttypes, 38 | [the location of ]) 39 | ]) 40 | -------------------------------------------------------------------------------- /win32/wrappers.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2010 Brian Aker, Trond Norbye 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: "Implementation" of the function we don't have on windows 9 | * to avoid a bunch of ifdefs in the rest of the code 10 | * 11 | */ 12 | #ifndef WIN32_WRAPPERS_H 13 | #define WIN32_WRAPPERS_H 1 14 | 15 | #include 16 | 17 | /* 18 | * One of the Windows headers define interface as a macro, but that 19 | * is causing problems with the member named "interface" in some of the 20 | * structs. 21 | */ 22 | #undef interface 23 | 24 | #undef malloc 25 | #undef realloc 26 | 27 | 28 | /* 29 | * WinSock use a separate range for error codes. Let's just map to the 30 | * WinSock ones. 31 | */ 32 | #define EADDRINUSE WSAEADDRINUSE 33 | #define EWOULDBLOCK WSAEWOULDBLOCK 34 | #define EINPROGRESS WSAEINPROGRESS 35 | #define EALREADY WSAEALREADY 36 | #define EISCONN WSAEISCONN 37 | #define ENOTCONN WSAENOTCONN 38 | #define ENOBUFS WSAENOBUFS 39 | #define SHUT_RDWR SD_BOTH 40 | 41 | /* EAI_SYSTEM isn't defined anywhere... just set it to... 11? */ 42 | #define EAI_SYSTEM 11 43 | 44 | /* Best effort mapping of functions to alternative functions */ 45 | #define index(a,b) strchr(a,b) 46 | #define rindex(a,b) strrchr(a,b) 47 | #define random() rand() 48 | #define srandom(a) while (false) {} 49 | #define kill(a, b) while (false) {} 50 | #define fork() (-1) 51 | #define waitpid(a,b,c) (-1) 52 | #define fnmatch(a,b,c) (-1) 53 | #define sleep(a) Sleep(a*1000) 54 | 55 | #endif /* WIN32_WRAPPERS_H */ 56 | -------------------------------------------------------------------------------- /libtest/runner.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include 24 | 25 | namespace libtest { 26 | 27 | Runner::Runner() 28 | { 29 | } 30 | 31 | test_return_t Runner::run(test_callback_fn* func, void *object) 32 | { 33 | if (func) 34 | { 35 | return func(object); 36 | } 37 | 38 | return TEST_SUCCESS; 39 | } 40 | 41 | test_return_t Runner::pre(test_callback_fn* func, void *object) 42 | { 43 | if (func) 44 | { 45 | return func(object); 46 | } 47 | 48 | return TEST_SUCCESS; 49 | } 50 | 51 | test_return_t Runner::post(test_callback_fn* func, void *object) 52 | { 53 | if (func) 54 | { 55 | return func(object); 56 | } 57 | 58 | return TEST_SUCCESS; 59 | } 60 | 61 | } // namespace libtest 62 | -------------------------------------------------------------------------------- /libtest/memcached.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __LIBTEST_MEMCACHED_H__ 23 | #define __LIBTEST_MEMCACHED_H__ 24 | 25 | namespace libtest { 26 | 27 | libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port); 28 | 29 | libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port); 30 | 31 | libtest::Server *build_memcached_sasl(const std::string& hostname, const in_port_t try_port, const std::string& username, const std::string& password); 32 | 33 | libtest::Server *build_memcached_sasl_socket(const std::string& socket_file, const in_port_t try_port, const std::string& username, const std::string& password); 34 | 35 | } 36 | 37 | #endif /* __LIBTEST_MEMCACHED_H__ */ 38 | -------------------------------------------------------------------------------- /m4/pandora_have_libaio.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2011 Andrew Hutchings 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for libaio 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([_PANDORA_SEARCH_LIBAIO],[ 12 | AC_REQUIRE([AC_LIB_PREFIX]) 13 | 14 | AC_CHECK_HEADERS(libaio.h) 15 | AC_LIB_HAVE_LINKFLAGS(aio,, 16 | [ 17 | #include 18 | ], 19 | [ 20 | int aio_cmd= IO_CMD_PREAD; 21 | ]) 22 | 23 | AM_CONDITIONAL(HAVE_LIBAIO, [test "x${ac_cv_libaio}" = "xyes"]) 24 | 25 | AS_IF([test "x${ac_cv_libaio}" = "xyes"],[ 26 | AC_DEFINE([LINUX_NATIVE_AIO], [1], [Enabel libaio support in InnoDB]) 27 | ]) 28 | ]) 29 | 30 | AC_DEFUN([_PANDORA_HAVE_LIBAIO],[ 31 | 32 | AC_ARG_ENABLE([libaio], 33 | [AS_HELP_STRING([--disable-libaio], 34 | [Build with libaio support @<:@default=on@:>@])], 35 | [ac_enable_libaio="$enableval"], 36 | [ac_enable_libaio="yes"]) 37 | 38 | _PANDORA_SEARCH_LIBAIO 39 | ]) 40 | 41 | 42 | AC_DEFUN([PANDORA_HAVE_LIBAIO],[ 43 | AC_REQUIRE([_PANDORA_HAVE_LIBAIO]) 44 | ]) 45 | 46 | AC_DEFUN([_PANDORA_REQUIRE_LIBAIO],[ 47 | ac_enable_libaio="yes" 48 | _PANDORA_SEARCH_LIBAIO 49 | AS_IF([test "x$ac_cv_header_libaio_h" = "xno"],[ 50 | AC_MSG_ERROR([Couldn't find libaio.h. On Debian this can be found in libaio-dev. On Redhat this can be found in libaio-devel.]) 51 | ]) 52 | ]) 53 | 54 | AC_DEFUN([PANDORA_REQUIRE_LIBAIO],[ 55 | AC_REQUIRE([_PANDORA_REQUIRE_LIBAIO]) 56 | ]) 57 | -------------------------------------------------------------------------------- /LICENSE-libmemcached: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2011, Data Differential (http://datadifferential.com/) 4 | Copyright (c) 2007-2010, TangentOrg (Brian Aker) 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above 15 | copyright notice, this list of conditions and the following disclaimer 16 | in the documentation and/or other materials provided with the 17 | distribution. 18 | 19 | * Neither the name of TangentOrg nor the names of its 20 | contributors may be used to endorse or promote products derived from 21 | this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | -------------------------------------------------------------------------------- /config/version.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # arcus-c-client : Arcus C client 4 | # Copyright 2010-2014 NAVER Corp. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | use warnings; 20 | use strict; 21 | 22 | # LIBMEMCACHED VERSION 23 | my $libmemcached_version = "0.53"; 24 | 25 | # ARCUS VERSION 26 | # (e.g. 1.6.0_3_g15cc2db) 27 | my $arcus_describe = `git describe`; 28 | chomp $arcus_describe; 29 | 30 | unless ($arcus_describe =~ m/^\d+\.\d+\.\d+/) { 31 | write_file('m4/version.m4', "m4_define([VERSION_NUMBER], [1.15.0-unknown])\n"); 32 | exit; 33 | } 34 | 35 | $arcus_describe =~ s/-/_/g; 36 | 37 | my @arcus_versions = split /_/, $arcus_describe; 38 | 39 | if (scalar @arcus_versions > 1) { 40 | # discard commit number 41 | pop(@arcus_versions); 42 | } 43 | 44 | my $arcus_version = join('-', @arcus_versions); 45 | 46 | # VERSION_NUMBER 47 | #my $version = $libmemcached_version."-arcus-".$arcus_version; 48 | write_file('m4/version.m4', "m4_define([VERSION_NUMBER], [$arcus_version])\n"); 49 | 50 | sub write_file { 51 | my $file = shift; 52 | my $data = shift; 53 | open(my $fh, "> $file") or die "Can't open $file: $!"; 54 | print $fh $data; 55 | close($fh); 56 | } 57 | -------------------------------------------------------------------------------- /m4/pandora_with_gettext.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystems 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | AC_DEFUN([PANDORA_WITH_GETTEXT],[ 13 | 14 | 15 | m4_syscmd([if test -d po ; then 16 | echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.stamp 17 | PACKAGE=$(grep ^AC_INIT configure.ac | cut -f2-3 -d[ | cut -f1 -d]) 18 | for f in $(find . | grep -v "${PACKAGE}-" | egrep '\.(cc|c|h|yy)$' | cut -c3- | sort) 19 | do 20 | if grep gettext.h "$f" | grep include >/dev/null 2>&1 21 | then 22 | echo "$f" >> po/POTFILES.in.stamp 23 | fi 24 | done 25 | if diff po/POTFILES.in.stamp po/POTFILES.in >/dev/null 2>&1 26 | then 27 | rm po/POTFILES.in.stamp 28 | else 29 | mv po/POTFILES.in.stamp po/POTFILES.in 30 | fi 31 | fi]) 32 | 33 | m4_if(m4_substr(m4_esyscmd(test -d po && echo 0),0,1),0, [ 34 | AM_GNU_GETTEXT(external, need-formatstring-macros) 35 | AM_GNU_GETTEXT_VERSION([0.17]) 36 | AS_IF([test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"],[ 37 | AM_PATH_PROG_WITH_TEST([GMSGMERGE], gmsgmerge, 38 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) 39 | MSGMERGE="${GMSGMERGE}" 40 | ]) 41 | AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"]) 42 | ]) 43 | 44 | ]) 45 | -------------------------------------------------------------------------------- /docs/man/memerror.1: -------------------------------------------------------------------------------- 1 | .TH "MEMERROR" "1" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memerror \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | Translates a memcached error code into a string 35 | .SH SYNOPSIS 36 | .sp 37 | memerror [options] [error code] 38 | .SH DESCRIPTION 39 | .sp 40 | \fBmemerror\fP translates an error code from libmemcached(3) into a human 41 | readable string. 42 | .SH OPTIONS 43 | .sp 44 | For a full list of operations run the tool with option: 45 | .INDENT 0.0 46 | .TP 47 | .B \-\-help 48 | .UNINDENT 49 | .SH HOME 50 | .sp 51 | To find out more infoerroration please check: 52 | \fI\%http://libmemcached.org/\fP 53 | .SH AUTHOR 54 | .sp 55 | Brian Aker, <\fI\%brian@tangent.org\fP> 56 | .SH SEE ALSO 57 | .sp 58 | \fImemcached(1)\fP \fIlibmemcached(3)\fP 59 | .SH AUTHOR 60 | Brian Aker 61 | .SH COPYRIGHT 62 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 63 | .\" Generated by docutils manpage writer. 64 | .\" 65 | . 66 | -------------------------------------------------------------------------------- /libtest/libtool.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | char _libtool[1024]= { 0 }; 26 | 27 | namespace libtest { 28 | 29 | const char *libtool(void) 30 | { 31 | if (_libtool[0]) 32 | { 33 | std::string libtool_buffer; 34 | if (getenv("srcdir")) 35 | { 36 | libtool_buffer+= getenv("srcdir"); 37 | libtool_buffer+= "/"; 38 | } 39 | else 40 | { 41 | libtool_buffer+= "./"; 42 | } 43 | 44 | libtool_buffer+= "libtool"; 45 | if (access(libtool_buffer.c_str(), R_OK | W_OK | X_OK)) 46 | { 47 | return NULL; 48 | } 49 | 50 | libtool_buffer+= " --mode=execute "; 51 | 52 | snprintf(_libtool, sizeof(_libtool), "%s", libtool_buffer.c_str()); 53 | } 54 | 55 | return _libtool; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /m4/pandora_have_libuuid.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for libuuid 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([_PANDORA_SEARCH_LIBUUID],[ 12 | AC_REQUIRE([AC_LIB_PREFIX]) 13 | 14 | dnl Do this by hand. Need to check for uuid/uuid.h, but uuid may or may 15 | dnl not be a lib is weird. 16 | AC_CHECK_HEADERS(uuid/uuid.h) 17 | AC_LIB_HAVE_LINKFLAGS(uuid,, 18 | [ 19 | #include 20 | ], 21 | [ 22 | uuid_t uout; 23 | uuid_generate(uout); 24 | ]) 25 | 26 | AM_CONDITIONAL(HAVE_LIBUUID, [test "x${ac_cv_libuuid}" = "xyes"]) 27 | ]) 28 | 29 | AC_DEFUN([_PANDORA_HAVE_LIBUUID],[ 30 | 31 | AC_ARG_ENABLE([libuuid], 32 | [AS_HELP_STRING([--disable-libuuid], 33 | [Build with libuuid support @<:@default=on@:>@])], 34 | [ac_enable_libuuid="$enableval"], 35 | [ac_enable_libuuid="yes"]) 36 | 37 | _PANDORA_SEARCH_LIBUUID 38 | ]) 39 | 40 | 41 | AC_DEFUN([PANDORA_HAVE_LIBUUID],[ 42 | AC_REQUIRE([_PANDORA_HAVE_LIBUUID]) 43 | ]) 44 | 45 | AC_DEFUN([_PANDORA_REQUIRE_LIBUUID],[ 46 | ac_enable_libuuid="yes" 47 | _PANDORA_SEARCH_LIBUUID 48 | AS_IF([test "x$ac_cv_header_uuid_uuid_h" = "xno"],[ 49 | AC_MSG_ERROR([Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On RHEL 4 this can be found in e2fsprogs-devel and Fedora/RHEL 6 in libuuid-devel.]) 50 | ]) 51 | ]) 52 | 53 | AC_DEFUN([PANDORA_REQUIRE_LIBUUID],[ 54 | AC_REQUIRE([_PANDORA_REQUIRE_LIBUUID]) 55 | ]) 56 | -------------------------------------------------------------------------------- /libtest/binaries.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | #include 24 | 25 | namespace libtest { 26 | 27 | bool has_gearmand_binary() 28 | { 29 | #if defined(HAVE_GEARMAND_BINARY) && HAVE_GEARMAND_BINARY 30 | if (access(GEARMAND_BINARY,R_OK|X_OK) == 0) 31 | { 32 | return true; 33 | } 34 | #endif 35 | 36 | return false; 37 | } 38 | 39 | bool has_memcached_binary() 40 | { 41 | #if defined(HAVE_MEMCACHED_BINARY) && HAVE_MEMCACHED_BINARY 42 | if (access(MEMCACHED_BINARY,R_OK|X_OK) == 0) 43 | { 44 | return true; 45 | } 46 | #endif 47 | 48 | return false; 49 | } 50 | 51 | bool has_memcached_sasl_binary() 52 | { 53 | #if defined(HAVE_MEMCACHED_SASL_BINARY) && HAVE_MEMCACHED_SASL_BINARY 54 | if (access(MEMCACHED_SASL_BINARY, R_OK|X_OK) == 0) 55 | { 56 | return true; 57 | } 58 | #endif 59 | 60 | return false; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /docs/man/memdump.1: -------------------------------------------------------------------------------- 1 | .TH "MEMDUMP" "1" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memdump \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | Dump a list of keys from a server. 35 | .SH SYNOPSIS 36 | .sp 37 | memdump [options] 38 | .SH DESCRIPTION 39 | .sp 40 | \fBmemdump\fP dumps a list of "keys" from all servers that 41 | it is told to fetch from. Because memcached does not guarentee to 42 | provide all keys it is not possible to get a complete "dump". 43 | .SH OPTIONS 44 | .sp 45 | For a full list of operations run the tool with option: 46 | .INDENT 0.0 47 | .TP 48 | .B \-\-help 49 | .UNINDENT 50 | .SH HOME 51 | .sp 52 | To find out more information please check: 53 | \fI\%http://libmemcached.org/\fP 54 | .SH AUTHOR 55 | .sp 56 | Brian Aker, <\fI\%brian@tangent.org\fP> 57 | .SH SEE ALSO 58 | .sp 59 | \fImemcached(1)\fP \fIlibmemcached(3)\fP 60 | .SH AUTHOR 61 | Brian Aker 62 | .SH COPYRIGHT 63 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 64 | .\" Generated by docutils manpage writer. 65 | .\" 66 | . 67 | -------------------------------------------------------------------------------- /libhashkit/algorithm.cc: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2006-2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #include 10 | 11 | uint32_t libhashkit_one_at_a_time(const char *key, size_t key_length) 12 | { 13 | return hashkit_one_at_a_time(key, key_length, NULL); 14 | } 15 | 16 | uint32_t libhashkit_fnv1_64(const char *key, size_t key_length) 17 | { 18 | return hashkit_fnv1_64(key, key_length, NULL); 19 | } 20 | 21 | uint32_t libhashkit_fnv1a_64(const char *key, size_t key_length) 22 | { 23 | return hashkit_fnv1a_64(key, key_length, NULL); 24 | } 25 | 26 | uint32_t libhashkit_fnv1_32(const char *key, size_t key_length) 27 | { 28 | return hashkit_fnv1_32(key, key_length, NULL); 29 | } 30 | 31 | uint32_t libhashkit_fnv1a_32(const char *key, size_t key_length) 32 | { 33 | return hashkit_fnv1a_32(key, key_length, NULL); 34 | } 35 | 36 | uint32_t libhashkit_crc32(const char *key, size_t key_length) 37 | { 38 | return hashkit_crc32(key, key_length, NULL); 39 | } 40 | 41 | uint32_t libhashkit_hsieh(const char *key, size_t key_length) 42 | { 43 | return hashkit_hsieh(key, key_length, NULL); 44 | } 45 | 46 | uint32_t libhashkit_murmur(const char *key, size_t key_length) 47 | { 48 | return hashkit_murmur(key, key_length, NULL); 49 | } 50 | 51 | uint32_t libhashkit_jenkins(const char *key, size_t key_length) 52 | { 53 | return hashkit_jenkins(key, key_length, NULL); 54 | } 55 | 56 | uint32_t libhashkit_md5(const char *key, size_t key_length) 57 | { 58 | return hashkit_md5(key, key_length, NULL); 59 | } 60 | 61 | void libhashkit_md5_signature(const unsigned char *key, size_t length, unsigned char *result) 62 | { 63 | md5_signature(key, (uint32_t)length, result); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /m4/pandora_have_libxml2.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | dnl Provides support for finding libxml2. 7 | dnl LIBXML2_CFLAGS will be set, in addition to LIBXML2 and LTLIBXML2 8 | 9 | AC_DEFUN([_PANDORA_SEARCH_LIBXML2],[ 10 | AC_REQUIRE([AC_LIB_PREFIX]) 11 | 12 | dnl -------------------------------------------------------------------- 13 | dnl Check for libxml2 14 | dnl -------------------------------------------------------------------- 15 | 16 | AC_ARG_ENABLE([libxml2], 17 | [AS_HELP_STRING([--disable-libxml2], 18 | [Build with libxml2 support @<:@default=on@:>@])], 19 | [ac_enable_libxml2="$enableval"], 20 | [ac_enable_libxml2="yes"]) 21 | 22 | AS_IF([test "x$ac_enable_libxml2" = "xyes"],[ 23 | AC_LIB_HAVE_LINKFLAGS(xml2,,[ 24 | #include 25 | ],[ 26 | const char *test= LIBXML_DOTTED_VERSION; 27 | ]) 28 | ],[ 29 | ac_cv_libxml2="no" 30 | ]) 31 | 32 | AS_IF([test "${ac_cv_libxml2}" = "no" -a "${ac_enable_libxml2}" = "yes"],[ 33 | 34 | PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [ 35 | ac_cv_libxml2=yes 36 | LTLIBXML2=${LIBXML2_LIBS} 37 | LIBXML2=${LIBXML2_LIBS} 38 | ],[]) 39 | ]) 40 | 41 | AM_CONDITIONAL(HAVE_LIBXML2, [test "${ac_cv_libxml2}" = "yes"]) 42 | ]) 43 | 44 | AC_DEFUN([PANDORA_HAVE_LIBXML2],[ 45 | AC_REQUIRE([_PANDORA_SEARCH_LIBXML2]) 46 | ]) 47 | 48 | AC_DEFUN([PANDORA_REQUIRE_LIBXML2],[ 49 | AC_REQUIRE([_PANDORA_SEARCH_LIBXML2]) 50 | AS_IF([test "x${ac_cv_libxml2}" = "xno"], 51 | AC_MSG_ERROR([libxml2 is required for ${PACKAGE}. On Debian systems this is found in libxml2-dev. On RedHat, libxml2-devel.])) 52 | ]) 53 | -------------------------------------------------------------------------------- /clients/utilities.h: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2006-2009 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: 9 | * 10 | */ 11 | 12 | #ifndef __CLIENTS_UTILITIES_H__ 13 | #define __CLIENTS_UTILITIES_H__ 14 | 15 | #include 16 | #include 17 | #include "libmemcached/watchpoint.h" 18 | #include "client_options.h" 19 | 20 | #if TIME_WITH_SYS_TIME 21 | # include 22 | # include 23 | #else 24 | # if HAVE_SYS_TIME_H 25 | # include 26 | # else 27 | # include 28 | # endif 29 | #endif 30 | 31 | #ifdef __sun 32 | /* For some odd reason the option struct on solaris defines the argument 33 | * as char* and not const char* 34 | */ 35 | #define OPTIONSTRING char* 36 | #else 37 | #define OPTIONSTRING const char* 38 | #endif 39 | 40 | typedef struct memcached_programs_help_st memcached_programs_help_st; 41 | 42 | struct memcached_programs_help_st 43 | { 44 | char *not_used_yet; 45 | }; 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | char *strdup_cleanup(const char *str); 52 | void cleanup(void); 53 | long int timedif(struct timeval a, struct timeval b); 54 | void version_command(const char *command_name); 55 | void help_command(const char *command_name, const char *description, 56 | const struct option *long_options, 57 | memcached_programs_help_st *options); 58 | void process_hash_option(memcached_st *memc, char *opt_hash); 59 | bool initialize_sasl(memcached_st *memc, char *user, char *password); 60 | void shutdown_sasl(void); 61 | void initialize_sockets(void); 62 | void close_stdio(void); 63 | 64 | #ifdef __cplusplus 65 | } // extern "C" 66 | #endif 67 | 68 | #endif /* __CLIENTS_UTILITIES_H__ */ 69 | -------------------------------------------------------------------------------- /libtest/cmdline.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | 24 | using namespace libtest; 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace libtest { 31 | 32 | bool exec_cmdline(const std::string& executable, const char *args[]) 33 | { 34 | std::stringstream arg_buffer; 35 | 36 | arg_buffer << libtool(); 37 | 38 | if (getenv("PWD")) 39 | { 40 | arg_buffer << getenv("PWD"); 41 | arg_buffer << "/"; 42 | } 43 | 44 | arg_buffer << executable; 45 | for (const char **ptr= args; *ptr; ++ptr) 46 | { 47 | arg_buffer << " " << *ptr; 48 | } 49 | 50 | #if 0 51 | arg_buffer << " > /dev/null 2>&1"; 52 | #endif 53 | 54 | if (system(arg_buffer.str().c_str()) == -1) 55 | { 56 | return false; 57 | } 58 | 59 | return true; 60 | } 61 | 62 | const char *gearmand_binary() 63 | { 64 | return GEARMAND_BINARY; 65 | } 66 | 67 | } // namespace exec_cmdline 68 | -------------------------------------------------------------------------------- /libtest/signal.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | 24 | #ifndef __LIBTEST_SIGNAL_H__ 25 | #define __LIBTEST_SIGNAL_H__ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | enum shutdown_t { 32 | SHUTDOWN_RUNNING, 33 | SHUTDOWN_GRACEFUL, 34 | SHUTDOWN_FORCED 35 | }; 36 | 37 | namespace libtest { 38 | 39 | class SignalThread { 40 | sigset_t set; 41 | sem_t lock; 42 | uint64_t magic_memory; 43 | volatile shutdown_t __shutdown; 44 | pthread_mutex_t shutdown_mutex; 45 | pthread_t thread; 46 | 47 | public: 48 | 49 | SignalThread(); 50 | 51 | void test(); 52 | void post(); 53 | bool setup(); 54 | 55 | int wait(int& sig) 56 | { 57 | return sigwait(&set, &sig); 58 | } 59 | 60 | ~SignalThread(); 61 | 62 | void set_shutdown(shutdown_t arg); 63 | bool is_shutdown(); 64 | shutdown_t get_shutdown(); 65 | }; 66 | 67 | } // namespace libtest 68 | 69 | #endif /* __LIBTEST_SIGNAL_H__ */ 70 | -------------------------------------------------------------------------------- /poll/poll.c: -------------------------------------------------------------------------------- 1 | /* LibMemcached 2 | * Copyright (C) 2010 Brian Aker, Trond Norbye 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | * 8 | * Summary: Implementation of poll by using select 9 | * 10 | */ 11 | #include "config.h" 12 | #include 13 | #include 14 | 15 | int poll(struct pollfd fds[], nfds_t nfds, int tmo) 16 | { 17 | fd_set readfds, writefds, errorfds; 18 | FD_ZERO(&readfds); 19 | FD_ZERO(&writefds); 20 | FD_ZERO(&errorfds); 21 | 22 | int maxfd= 0; 23 | 24 | for (nfds_t x= 0; x < nfds; ++x) 25 | { 26 | if (fds[x].events & (POLLIN | POLLOUT)) 27 | { 28 | #ifndef WIN32 29 | if (fds[x].fd > maxfd) 30 | { 31 | maxfd= fds[x].fd; 32 | } 33 | #endif 34 | if (fds[x].events & POLLIN) 35 | { 36 | FD_SET(fds[x].fd, &readfds); 37 | } 38 | if (fds[x].events & POLLOUT) 39 | { 40 | FD_SET(fds[x].fd, &writefds); 41 | } 42 | } 43 | } 44 | 45 | struct timeval timeout= { .tv_sec = tmo / 1000, 46 | .tv_usec= (tmo % 1000) * 1000 }; 47 | struct timeval *tp= &timeout; 48 | if (tmo == -1) 49 | { 50 | tp= NULL; 51 | } 52 | int ret= select(maxfd + 1, &readfds, &writefds, &errorfds, tp); 53 | if (ret <= 0) 54 | { 55 | return ret; 56 | } 57 | 58 | /* Iterate through all of them because I need to clear the revent map */ 59 | for (nfds_t x= 0; x < nfds; ++x) 60 | { 61 | fds[x].revents= 0; 62 | if (FD_ISSET(fds[x].fd, &readfds)) 63 | { 64 | fds[x].revents |= POLLIN; 65 | } 66 | if (FD_ISSET(fds[x].fd, &writefds)) 67 | { 68 | fds[x].revents |= POLLOUT; 69 | } 70 | if (FD_ISSET(fds[x].fd, &errorfds)) 71 | { 72 | fds[x].revents |= POLLERR; 73 | } 74 | } 75 | 76 | return ret; 77 | } 78 | -------------------------------------------------------------------------------- /libhashkit/digest.cc: -------------------------------------------------------------------------------- 1 | /* HashKit 2 | * Copyright (C) 2010 Brian Aker 3 | * All rights reserved. 4 | * 5 | * Use and distribution licensed under the BSD license. See 6 | * the COPYING file in the parent directory for full text. 7 | */ 8 | 9 | #include 10 | 11 | uint32_t hashkit_digest(const hashkit_st *self, const char *key, size_t key_length) 12 | { 13 | return self->base_hash.function(key, key_length, self->base_hash.context); 14 | } 15 | 16 | uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algorithm_t hash_algorithm) 17 | { 18 | switch (hash_algorithm) 19 | { 20 | case HASHKIT_HASH_DEFAULT: 21 | return libhashkit_one_at_a_time(key, key_length); 22 | case HASHKIT_HASH_MD5: 23 | return libhashkit_md5(key, key_length); 24 | case HASHKIT_HASH_CRC: 25 | return libhashkit_crc32(key, key_length); 26 | case HASHKIT_HASH_FNV1_64: 27 | return libhashkit_fnv1_64(key, key_length); 28 | case HASHKIT_HASH_FNV1A_64: 29 | return libhashkit_fnv1a_64(key, key_length); 30 | case HASHKIT_HASH_FNV1_32: 31 | return libhashkit_fnv1_32(key, key_length); 32 | case HASHKIT_HASH_FNV1A_32: 33 | return libhashkit_fnv1a_32(key, key_length); 34 | case HASHKIT_HASH_HSIEH: 35 | #ifdef HAVE_HSIEH_HASH 36 | return libhashkit_hsieh(key, key_length); 37 | #else 38 | return 1; 39 | #endif 40 | case HASHKIT_HASH_MURMUR: 41 | #ifdef HAVE_MURMUR_HASH 42 | return libhashkit_murmur(key, key_length); 43 | #else 44 | return 1; 45 | #endif 46 | case HASHKIT_HASH_JENKINS: 47 | return libhashkit_jenkins(key, key_length); 48 | case HASHKIT_HASH_CUSTOM: 49 | case HASHKIT_HASH_MAX: 50 | default: 51 | if (DEBUG) 52 | { 53 | fprintf(stderr, "hashkit_hash_t was extended but libhashkit_generate_value was not updated\n"); 54 | fflush(stderr); 55 | assert(0); 56 | } 57 | break; 58 | } 59 | 60 | return 1; 61 | } 62 | -------------------------------------------------------------------------------- /m4/pandora_with_php.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystems 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | 13 | AC_DEFUN([PANDORA_WITH_PHP],[ 14 | 15 | AC_ARG_WITH([php], 16 | [AS_HELP_STRING([--with-php], 17 | [Build NDB/PHP @<:@default=no@:>@])], 18 | [with_php=$withval], 19 | [with_php=no]) 20 | 21 | AS_IF([test "x$with_php" != "xno"],[ 22 | dnl We explicitly requested PHP build. Fail on too-young SWIG. 23 | AS_IF([test "x$SWIG_CAN_BUILD_PHP" != "xyes"], 24 | [AC_MSG_ERROR("Your version of SWIG is too young to build NDB/PHP. >=1.3.33 is required!")]) 25 | AS_IF([test "x$with_php" != "xyes"], 26 | [ac_check_php_config=$with_php], 27 | [ac_check_php_config="php-config php-config5"]) 28 | AC_CHECK_PROGS(PHP_CONFIG, [$ac_check_php_config]) 29 | ]) 30 | 31 | AS_IF([test "x$PHP_CONFIG" != "x"],[ 32 | PHP_CFLAGS=`$PHP_CONFIG --includes` 33 | PHP_CPPFLAGS=`$PHP_CONFIG --includes` 34 | PHP_LDFLAGS=`$PHP_CONFIG --ldflags` 35 | PHP_EXTDIR=`$PHP_CONFIG --extension-dir` 36 | strip_php_prefix=`$PHP_CONFIG --prefix | sed 's/\//./g'` 37 | PHP_ARCH_DIR=`echo $PHP_EXTDIR | sed "s/$strip_php_prefix//"` 38 | ],[ 39 | PHP_CFLAGS= 40 | PHP_CPPFLAGS= 41 | PHP_LDFLAGS= 42 | PHP_EXTDIR= 43 | PHP_ARCH_DIR= 44 | with_php=no 45 | ]) 46 | 47 | AC_SUBST(PHP_CFLAGS) 48 | AC_SUBST(PHP_CPPFLAGS) 49 | AC_SUBST(PHP_LDFLAGS) 50 | AC_SUBST(PHP_EXTDIR) 51 | AC_SUBST(PHP_ARCH_DIR) 52 | 53 | AM_CONDITIONAL(BUILD_PHP, test "$with_php" = "yes") 54 | 55 | ]) 56 | 57 | -------------------------------------------------------------------------------- /libtest/test.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | /* 24 | Structures for generic tests. 25 | */ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | -------------------------------------------------------------------------------- /docs/man/hashkit_value.3: -------------------------------------------------------------------------------- 1 | .TH "HASHKIT_VALUE" "3" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | hashkit_value \- libhashkit Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | Generate a value for the given key 35 | .SH SYNOPSIS 36 | .sp 37 | #include 38 | .INDENT 0.0 39 | .TP 40 | .B uint32_t hashkit_value(hashkit_st *hash, const char *key, size_t key_length); 41 | .UNINDENT 42 | .sp 43 | Compile and link with \-lhashkit 44 | .SH DESCRIPTION 45 | .sp 46 | The \fBhashkit_value()\fP function generates a 32\-bit hash value from the 47 | given key and key_length. The hash argument is an initialized hashkit 48 | object, and distribution type and hash function is used from this 49 | object while generating the value. 50 | .SH RETURN VALUE 51 | .sp 52 | A 32\-bit hash value. 53 | .SH HOME 54 | .sp 55 | To find out more information please check: 56 | \fI\%http://libmemcached.org/\fP 57 | .SH SEE ALSO 58 | .sp 59 | \fIhashkit_create(3)\fP \fIhashkit_set_distribution(3)\fP \fIhashkit_set_hash_fn(3)\fP 60 | .SH AUTHOR 61 | Brian Aker 62 | .SH COPYRIGHT 63 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 64 | .\" Generated by docutils manpage writer. 65 | .\" 66 | . 67 | -------------------------------------------------------------------------------- /m4/pandora_with_lua.m4: -------------------------------------------------------------------------------- 1 | dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- 2 | dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 3 | dnl 4 | dnl pandora-build: A pedantic build system 5 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 6 | dnl This file is free software; Sun Microsystems 7 | dnl gives unlimited permission to copy and/or distribute it, 8 | dnl with or without modifications, as long as this notice is preserved. 9 | dnl 10 | dnl From Monty Taylor 11 | 12 | AC_DEFUN([PANDORA_WITH_LUA],[ 13 | dnl Check for lua 14 | AC_ARG_WITH([lua], 15 | [AS_HELP_STRING([--with-lua], 16 | [Build Lua Bindings @<:@default=yes@:>@])], 17 | [with_lua=$withval], 18 | [with_lua=yes]) 19 | 20 | AS_IF([test "x$with_lua" != "xno"],[ 21 | AS_IF([test "x$with_lua" = "xyes"], 22 | [LUAPC=lua], 23 | [LUAPC=$with_lua]) 24 | 25 | PKG_CHECK_MODULES([LUA], $LUAPC >= 5.1, [ 26 | AC_DEFINE([HAVE_LUA], [1], [liblua]) 27 | AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) 28 | with_lua=yes 29 | ],[ 30 | LUAPC=lua5.1 31 | PKG_CHECK_MODULES([LUA], $LUAPC >= 5.1, [ 32 | AC_DEFINE([HAVE_LUA], [1], [liblua]) 33 | AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) 34 | with_lua=yes 35 | ],[ 36 | AC_DEFINE([HAVE_LUA],["x"],["x"]) 37 | with_lua=no 38 | ]) 39 | ]) 40 | 41 | AC_CACHE_CHECK([for LUA installation location],[pandora_cv_lua_archdir],[ 42 | AS_IF([test "$prefix" = "NONE"],[ 43 | pandora_cv_lua_archdir=`${PKG_CONFIG} --define-variable=prefix=${ac_default_prefix} --variable=INSTALL_CMOD ${LUAPC}` 44 | ],[ 45 | pandora_cv_lua_archdir=`${PKG_CONFIG} --define-variable=prefix=${prefix} --variable=INSTALL_CMOD ${LUAPC}` 46 | ]) 47 | ]) 48 | LUA_ARCHDIR="${pandora_cv_lua_archdir}" 49 | AC_SUBST(LUA_ARCHDIR) 50 | AC_SUBST(LUA_CFLAGS) 51 | AC_SUBST(LUA_LIBS) 52 | ]) 53 | AM_CONDITIONAL(BUILD_LUA, test "$with_lua" = "yes") 54 | 55 | ]) 56 | -------------------------------------------------------------------------------- /libtest/common.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /* 23 | Common include file for libtest 24 | */ 25 | 26 | #ifndef __LIBTEST_COMMON_H__ 27 | #define __LIBTEST_COMMON_H__ 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #ifdef HAVE_SYS_TYPES_H 38 | #include 39 | #endif 40 | 41 | #ifdef HAVE_SYS_TIME_H 42 | #include 43 | #endif 44 | 45 | #ifdef HAVE_SYS_WAIT_H 46 | #include 47 | #endif 48 | 49 | #ifdef HAVE_SYS_RESOURCE_H 50 | #include 51 | #endif 52 | 53 | #ifdef HAVE_FNMATCH_H 54 | #include 55 | #endif 56 | 57 | #include 58 | 59 | #include 60 | 61 | #include 62 | #include 63 | #include 64 | 65 | #include 66 | #include 67 | #include 68 | #include 69 | 70 | #endif /* __LIBTEST_COMMON_H__ */ 71 | -------------------------------------------------------------------------------- /docs/man/memrm.1: -------------------------------------------------------------------------------- 1 | .TH "MEMRM" "1" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memrm \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | memrm \- Remove a key(s) from a collection of memcached servers 35 | .SH SYNOPSIS 36 | .sp 37 | memrm [options] [key] 38 | .SH DESCRIPTION 39 | .sp 40 | \fBmemrm\fP removes items, specified by key, from memcached(1) servers. 41 | .SH OPTIONS 42 | .sp 43 | You can specify servers via the option: 44 | .INDENT 0.0 45 | .TP 46 | .B \-\-servers 47 | .UNINDENT 48 | .sp 49 | or via the environment variable: 50 | .INDENT 0.0 51 | .TP 52 | .B \(gaMEMCACHED_SERVERS\(ga 53 | .UNINDENT 54 | .sp 55 | For a full list of operations run the tool with the 56 | .INDENT 0.0 57 | .TP 58 | .B \-\-help 59 | .UNINDENT 60 | .SH HOME 61 | .sp 62 | To find out more information please check: 63 | \fI\%http://libmemcached.org/\fP 64 | .SH AUTHOR 65 | .sp 66 | Brian Aker, <\fI\%brian@tangent.org\fP> 67 | .sp 68 | Mark Atwood, <\fI\%mark@fallenpegasus.com\fP> 69 | .SH SEE ALSO 70 | .sp 71 | \fImemcached(1)\fP \fIlibmemcached(3)\fP 72 | .SH AUTHOR 73 | Brian Aker 74 | .SH COPYRIGHT 75 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 76 | .\" Generated by docutils manpage writer. 77 | .\" 78 | . 79 | -------------------------------------------------------------------------------- /docs/man/memcached_last_error_message.3: -------------------------------------------------------------------------------- 1 | .TH "MEMCACHED_LAST_ERROR_MESSAGE" "3" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memcached_last_error_message \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .SH SYNOPSIS 34 | .sp 35 | #include 36 | .INDENT 0.0 37 | .TP 38 | .B const char *memcached_last_error_message(memcached_st *); 39 | .UNINDENT 40 | .sp 41 | Compile and link with \-lmemcached 42 | .SH DESCRIPTION 43 | .sp 44 | \fBmemcached_last_error_message()\fP is used to return the last error 45 | message that the server responded too. If this error came from a specific 46 | server, its hostname and port will be provided in the error message. 47 | .SH RETURN 48 | .sp 49 | memcached_last_error_message() returns a const char* which does not need to be 50 | de\-allocated. If no error has occurred then it will return NULL. 51 | .SH HOME 52 | .sp 53 | To find out more information please check: 54 | \fI\%http://libmemcached.org/\fP 55 | .SH SEE ALSO 56 | .sp 57 | \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP 58 | .SH AUTHOR 59 | Brian Aker 60 | .SH COPYRIGHT 61 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 62 | .\" Generated by docutils manpage writer. 63 | .\" 64 | . 65 | -------------------------------------------------------------------------------- /libmemcached/csl/common.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * Configure Scripting Language 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * * The names of its contributors may not be used to endorse or 21 | * promote products derived from this software without specific prior 22 | * written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | #ifndef __LIBMEMCACHED_CSL_COMMON_H__ 39 | #define __LIBMEMCACHED_CSL_COMMON_H__ 40 | 41 | #include 42 | 43 | #endif /* __LIBMEMCACHED_CSL_COMMON_H__ */ 44 | -------------------------------------------------------------------------------- /tests/namespace.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * Libmemcached 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * * The names of its contributors may not be used to endorse or 21 | * promote products derived from this software without specific prior 22 | * written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | #ifndef __TESTS_NAMESPACE_H__ 39 | #define __TESTS_NAMESPACE_H__ 40 | 41 | LIBTEST_LOCAL 42 | test_return_t memcached_increment_namespace(memcached_st *memc); 43 | 44 | #endif /* __TESTS_NAMESPACE_H__ */ 45 | -------------------------------------------------------------------------------- /libmemcached/util.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * Libmemcached library 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * Copyright (C) 2006-2009 Brian Aker All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * * The names of its contributors may not be used to endorse or 21 | * promote products derived from this software without specific prior 22 | * written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | #ifndef __LIBMEMCACHED_UTIL_H__ 39 | #define __LIBMEMCACHED_UTIL_H__ 40 | 41 | #include 42 | 43 | #endif /* __LIBMEMCACHED_UTIL_H__ */ 44 | -------------------------------------------------------------------------------- /docs/man/memcached_verbosity.3: -------------------------------------------------------------------------------- 1 | .TH "MEMCACHED_VERBOSITY" "3" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memcached_verbosity \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | Modifiy verbosity of servers 35 | .SH SYNOPSIS 36 | .sp 37 | #include 38 | .INDENT 0.0 39 | .TP 40 | .B memcached_return_t memcached_verbosity (memcached_st *ptr, unsigned int verbosity); 41 | .UNINDENT 42 | .sp 43 | Compile and link with \-lmemcached 44 | .SH DESCRIPTION 45 | .sp 46 | \fBmemcached_verbosity()\fP modifies the "verbosity" of the 47 | memcached(1) servers referenced in the \fBmemcached_st\fP parameter. 48 | .SH RETURN 49 | .sp 50 | A value of type \fBmemcached_return_t\fP is returned. 51 | .sp 52 | On success that value will be \fBMEMCACHED_SUCCESS\fP. 53 | .sp 54 | Use \fBmemcached_strerror()\fP to translate this value to a printable string. 55 | .SH HOME 56 | .sp 57 | To find out more information please check: 58 | \fI\%http://libmemcached.org/\fP 59 | .SH SEE ALSO 60 | .sp 61 | \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP 62 | .SH AUTHOR 63 | Brian Aker 64 | .SH COPYRIGHT 65 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 66 | .\" Generated by docutils manpage writer. 67 | .\" 68 | . 69 | -------------------------------------------------------------------------------- /docs/man/memstat.1: -------------------------------------------------------------------------------- 1 | .TH "MEMSTAT" "1" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memstat \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | memstat \- Display the operating status of a single or group of memcached servers 35 | .SH SYNOPSIS 36 | .sp 37 | memstat [options] 38 | .SH DESCRIPTION 39 | .sp 40 | \fBmemstat\fP dumps the state of memcached(1) servers. 41 | It displays all data to stdout. 42 | .SH OPTIONS 43 | .sp 44 | You can specify servers via the option: 45 | .INDENT 0.0 46 | .TP 47 | .B \-\-servers 48 | .UNINDENT 49 | .sp 50 | or via the environment variable: 51 | .INDENT 0.0 52 | .TP 53 | .B \(aqMEMCACHED_SERVERS, \-\-args\(aq 54 | .UNINDENT 55 | .sp 56 | which can be used to specify the "argument" sent to the stats command (ie slab, size, items, etc..). 57 | .sp 58 | For a full list of operations run the tool with: 59 | .INDENT 0.0 60 | .TP 61 | .B \-\-help 62 | .UNINDENT 63 | .SH HOME 64 | .sp 65 | To find out more information please check: 66 | \fI\%http://libmemcached.org/\fP 67 | .SH SEE ALSO 68 | .sp 69 | \fImemcached(1)\fP \fIlibmemcached(3)\fP 70 | .SH AUTHOR 71 | Brian Aker 72 | .SH COPYRIGHT 73 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 74 | .\" Generated by docutils manpage writer. 75 | .\" 76 | . 77 | -------------------------------------------------------------------------------- /docs/man/memflush.1: -------------------------------------------------------------------------------- 1 | .TH "MEMFLUSH" "1" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | memflush \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | Reset a server or list of servers 35 | .SH SYNOPSIS 36 | .sp 37 | memflush [options] 38 | .SH DESCRIPTION 39 | .sp 40 | \fBmemflush\fP resets the contents of memcached(1) servers. 41 | This means that all data in the specified servers will be deleted. 42 | .SH OPTIONS 43 | .sp 44 | You can specify servers via the option: 45 | .INDENT 0.0 46 | .TP 47 | .B \-\-servers 48 | .UNINDENT 49 | .sp 50 | or via the environment variable: 51 | .INDENT 0.0 52 | .TP 53 | .B \(gaMEMCACHED_SERVERS\(ga 54 | .UNINDENT 55 | .sp 56 | For a full list of operations run the tool with option: 57 | .INDENT 0.0 58 | .TP 59 | .B \-\-help 60 | .UNINDENT 61 | .SH HOME 62 | .sp 63 | To find out more information please check: 64 | \fI\%http://libmemcached.org/\fP 65 | .SH AUTHOR 66 | .sp 67 | Brian Aker, <\fI\%brian@tangent.org\fP> 68 | .sp 69 | Mark Atwood <\fI\%mark@fallenpegasus.com\fP> 70 | .SH SEE ALSO 71 | .sp 72 | \fImemcached(1)\fP \fIlibmemcached(3)\fP 73 | .SH AUTHOR 74 | Brian Aker 75 | .SH COPYRIGHT 76 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 77 | .\" Generated by docutils manpage writer. 78 | .\" 79 | . 80 | -------------------------------------------------------------------------------- /libmemcached/backtrace.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libmcachedd client library. 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * * The names of its contributors may not be used to endorse or 21 | * promote products derived from this software without specific prior 22 | * written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | #ifndef __LIBMEMCACHED_BACKTRACE_HPP__ 39 | #define __LIBMEMCACHED_BACKTRACE_HPP__ 40 | 41 | LIBMEMCACHED_LOCAL 42 | void custom_backtrace(void); 43 | 44 | #endif /* __LIBMEMCACHED_BACKTRACE_HPP__ */ 45 | -------------------------------------------------------------------------------- /arcus/sample.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "libmemcached/memcached.h" 5 | 6 | /* No error checking/handling to minimize clutter. */ 7 | 8 | int 9 | main(int argc, char *argv[]) 10 | { 11 | memcached_st *mc; 12 | memcached_coll_create_attrs_st attr; 13 | const char *key = "this_is_key"; 14 | size_t key_length = strlen(key); 15 | const uint64_t bkey = 123; /* b+tree element's key */ 16 | const char *value = "helloworld"; 17 | memcached_coll_result_st result; 18 | 19 | /* Create the memcached object */ 20 | if (NULL == (mc = memcached_create(NULL))) 21 | return -1; 22 | 23 | /* Add the server's address */ 24 | if (MEMCACHED_SUCCESS != memcached_server_add(mc, "127.0.0.1", 11211)) 25 | return -1; 26 | 27 | /* Create a b+tree key and then insert an element in one call. */ 28 | memcached_coll_create_attrs_init(&attr, 20 /* flags */, 100 /* exptime */, 29 | 4000 /* maxcount */); 30 | if (MEMCACHED_SUCCESS != memcached_bop_insert(mc, key, key_length, 31 | bkey, 32 | NULL /* eflag */, 0 /* eflag length */, 33 | (const char*)value, (size_t)strlen(value)+1 /* include NULL */, 34 | &attr /* automatically create the b+tree key */)) 35 | return -1; 36 | printf("Created a b+tree key and inserted an element.\n"); 37 | 38 | /* Get the element */ 39 | if (NULL == memcached_coll_result_create(mc, &result)) 40 | return -1; 41 | if (MEMCACHED_SUCCESS != memcached_bop_get(mc, key, key_length, bkey, 42 | NULL /* no eflags filters */, 43 | false /* do not delete the element */, 44 | false /* do not delete the empty key */, 45 | &result)) 46 | return -1; 47 | 48 | /* Print */ 49 | printf("Retrieved the element. value=%s\n", 50 | memcached_coll_result_get_value(&result, 0)); 51 | memcached_coll_result_free(&result); 52 | 53 | /* Delete the b+tree */ 54 | if (MEMCACHED_SUCCESS != memcached_delete(mc, key, key_length, 0)) 55 | return -1; 56 | 57 | /* Free the memcached object */ 58 | memcached_free(mc); 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /libhashkit/hsieh.cc: -------------------------------------------------------------------------------- 1 | /* By Paul Hsieh (C) 2004, 2005. Covered under the Paul Hsieh 2 | * derivative license. 3 | * See: http://www.azillionmonkeys.com/qed/weblicense.html for license 4 | * details. 5 | * http://www.azillionmonkeys.com/qed/hash.html 6 | */ 7 | 8 | #include 9 | 10 | #undef get16bits 11 | #if (defined(__GNUC__) && defined(__i386__)) 12 | #define get16bits(d) (*((const uint16_t *) (d))) 13 | #endif 14 | 15 | #if !defined (get16bits) 16 | #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\ 17 | +(uint32_t)(((const uint8_t *)(d))[0]) ) 18 | #endif 19 | 20 | #ifdef HAVE_HSIEH_HASH 21 | uint32_t hashkit_hsieh(const char *key, size_t key_length, void *) 22 | { 23 | uint32_t hash = 0, tmp; 24 | int rem; 25 | 26 | if (key_length <= 0 || key == NULL) 27 | return 0; 28 | 29 | rem = key_length & 3; 30 | key_length >>= 2; 31 | 32 | /* Main loop */ 33 | for (;key_length > 0; key_length--) 34 | { 35 | hash += get16bits (key); 36 | tmp = (get16bits (key+2) << 11) ^ hash; 37 | hash = (hash << 16) ^ tmp; 38 | key += 2*sizeof (uint16_t); 39 | hash += hash >> 11; 40 | } 41 | 42 | /* Handle end cases */ 43 | switch (rem) 44 | { 45 | case 3: hash += get16bits (key); 46 | hash ^= hash << 16; 47 | hash ^= (uint32_t)key[sizeof (uint16_t)] << 18; 48 | hash += hash >> 11; 49 | break; 50 | case 2: hash += get16bits (key); 51 | hash ^= hash << 11; 52 | hash += hash >> 17; 53 | break; 54 | case 1: hash += (unsigned char)(*key); 55 | hash ^= hash << 10; 56 | hash += hash >> 1; 57 | default: 58 | break; 59 | } 60 | 61 | /* Force "avalanching" of final 127 bits */ 62 | hash ^= hash << 3; 63 | hash += hash >> 5; 64 | hash ^= hash << 4; 65 | hash += hash >> 17; 66 | hash ^= hash << 25; 67 | hash += hash >> 6; 68 | 69 | return hash; 70 | } 71 | #else 72 | uint32_t hashkit_hsieh(const char *, size_t , void *) 73 | { 74 | return 0; 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /m4/pandora_have_libevent.m4: -------------------------------------------------------------------------------- 1 | dnl Copyright (C) 2009 Sun Microsystems, Inc. 2 | dnl This file is free software; Sun Microsystems, Inc. 3 | dnl gives unlimited permission to copy and/or distribute it, 4 | dnl with or without modifications, as long as this notice is preserved. 5 | 6 | #-------------------------------------------------------------------- 7 | # Check for libevent 8 | #-------------------------------------------------------------------- 9 | 10 | 11 | AC_DEFUN([_PANDORA_SEARCH_LIBEVENT],[ 12 | AC_REQUIRE([AC_LIB_PREFIX]) 13 | 14 | AC_LIB_HAVE_LINKFLAGS(event,, 15 | [ 16 | #include 17 | #include 18 | #include 19 | #include 20 | ],[ 21 | struct bufferevent bev; 22 | bufferevent_settimeout(&bev, 1, 1); 23 | event_init(); 24 | event_loop(EVLOOP_ONCE); 25 | ]) 26 | 27 | AM_CONDITIONAL(HAVE_LIBEVENT, [test "x${ac_cv_libevent}" = "xyes"]) 28 | 29 | AS_IF([test "x${ac_cv_libevent}" = "xyes"],[ 30 | save_LIBS="${LIBS}" 31 | LIBS="${LIBS} ${LTLIBEVENT}" 32 | AC_CHECK_FUNCS(event_base_new) 33 | AC_CHECK_FUNCS(event_base_free) 34 | AC_CHECK_FUNCS(event_base_get_method) 35 | LIBS="$save_LIBS" 36 | ]) 37 | ]) 38 | 39 | AC_DEFUN([_PANDORA_HAVE_LIBEVENT],[ 40 | 41 | AC_ARG_ENABLE([libevent], 42 | [AS_HELP_STRING([--disable-libevent], 43 | [Build with libevent support @<:@default=on@:>@])], 44 | [ac_enable_libevent="$enableval"], 45 | [ac_enable_libevent="yes"]) 46 | 47 | _PANDORA_SEARCH_LIBEVENT 48 | ]) 49 | 50 | 51 | AC_DEFUN([PANDORA_HAVE_LIBEVENT],[ 52 | AC_REQUIRE([_PANDORA_HAVE_LIBEVENT]) 53 | ]) 54 | 55 | AC_DEFUN([_PANDORA_REQUIRE_LIBEVENT],[ 56 | ac_enable_libevent="yes" 57 | _PANDORA_SEARCH_LIBEVENT 58 | 59 | AS_IF([test x$ac_cv_libevent = xno],[ 60 | AC_MSG_ERROR([libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel.]) 61 | ]) 62 | ]) 63 | 64 | AC_DEFUN([PANDORA_REQUIRE_LIBEVENT],[ 65 | AC_REQUIRE([_PANDORA_REQUIRE_LIBEVENT]) 66 | ]) 67 | -------------------------------------------------------------------------------- /util/signal.hpp: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | 23 | 24 | #ifndef __UTIL_SIGNAL_HPP__ 25 | #define __UTIL_SIGNAL_HPP__ 26 | 27 | #include 28 | #include 29 | 30 | namespace datadifferential { 31 | namespace util { 32 | 33 | enum shutdown_t { 34 | SHUTDOWN_RUNNING, 35 | SHUTDOWN_GRACEFUL, 36 | SHUTDOWN_FORCED 37 | }; 38 | 39 | class SignalThread { 40 | bool _exit_on_signal; 41 | sigset_t set; 42 | sem_t lock; 43 | uint64_t magic_memory; 44 | volatile shutdown_t __shutdown; 45 | pthread_mutex_t shutdown_mutex; 46 | pthread_t thread; 47 | 48 | public: 49 | 50 | SignalThread(bool exit_on_signal_arg= false); 51 | 52 | void test(); 53 | void post(); 54 | bool setup(); 55 | 56 | bool exit_on_signal() 57 | { 58 | return _exit_on_signal; 59 | } 60 | 61 | int wait(int& sig) 62 | { 63 | return sigwait(&set, &sig); 64 | } 65 | 66 | ~SignalThread(); 67 | 68 | void set_shutdown(shutdown_t arg); 69 | bool is_shutdown(); 70 | shutdown_t get_shutdown(); 71 | }; 72 | 73 | } /* namespace util */ 74 | } /* namespace datadifferential */ 75 | 76 | #endif /* __UTIL_SIGNAL_HPP__ */ 77 | -------------------------------------------------------------------------------- /libtest/port.cc: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * libtest 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 3 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | #ifndef __INTEL_COMPILER 42 | #pragma GCC diagnostic ignored "-Wold-style-cast" 43 | #endif 44 | 45 | using namespace libtest; 46 | 47 | static in_port_t global_port= 0; 48 | static in_port_t global_max_port= 0; 49 | 50 | namespace libtest { 51 | 52 | in_port_t default_port() 53 | { 54 | return global_port; 55 | } 56 | 57 | void set_default_port(in_port_t port) 58 | { 59 | global_port= port; 60 | } 61 | 62 | in_port_t max_port() 63 | { 64 | return global_max_port; 65 | } 66 | 67 | void set_max_port(in_port_t port) 68 | { 69 | if (port > global_max_port) 70 | { 71 | global_max_port= port; 72 | } 73 | 74 | global_max_port= port; 75 | } 76 | 77 | } // namespace libtest 78 | -------------------------------------------------------------------------------- /tests/server_add.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * Libmemcached Client and Server 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * * The names of its contributors may not be used to endorse or 21 | * promote products derived from this software without specific prior 22 | * written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | #ifndef __TESTS_SERVER_ADD_H__ 39 | #define __TESTS_SERVER_ADD_H__ 40 | 41 | test_return_t memcached_server_add_null_test(memcached_st*); 42 | test_return_t memcached_server_add_empty_test(memcached_st*); 43 | 44 | #endif /* __TESTS_SERVER_ADD_H__ */ 45 | -------------------------------------------------------------------------------- /libhashkit/murmur.cc: -------------------------------------------------------------------------------- 1 | /* 2 | "Murmur" hash provided by Austin, tanjent@gmail.com 3 | http://murmurhash.googlepages.com/ 4 | 5 | Note - This code makes a few assumptions about how your machine behaves - 6 | 7 | 1. We can read a 4-byte value from any address without crashing 8 | 2. sizeof(int) == 4 9 | 10 | And it has a few limitations - 11 | 1. It will not work incrementally. 12 | 2. It will not produce the same results on little-endian and big-endian 13 | machines. 14 | 15 | Updated to murmur2 hash - BP 16 | */ 17 | 18 | #include 19 | 20 | #ifdef HAVE_MURMUR_HASH 21 | 22 | uint32_t hashkit_murmur(const char *key, size_t length, void *context) 23 | { 24 | /* 25 | 'm' and 'r' are mixing constants generated offline. They're not 26 | really 'magic', they just happen to work well. 27 | */ 28 | 29 | const unsigned int m= 0x5bd1e995; 30 | const uint32_t seed= (0xdeadbeef * (uint32_t)length); 31 | const int r= 24; 32 | 33 | 34 | // Initialize the hash to a 'random' value 35 | 36 | uint32_t h= seed ^ (uint32_t)length; 37 | 38 | // Mix 4 bytes at a time into the hash 39 | 40 | const unsigned char * data= (const unsigned char *)key; 41 | (void)context; 42 | 43 | while(length >= 4) 44 | { 45 | unsigned int k = *(unsigned int *)data; 46 | 47 | k *= m; 48 | k ^= k >> r; 49 | k *= m; 50 | 51 | h *= m; 52 | h ^= k; 53 | 54 | data += 4; 55 | length -= 4; 56 | } 57 | 58 | // Handle the last few bytes of the input array 59 | 60 | switch(length) 61 | { 62 | case 3: h ^= ((uint32_t)data[2]) << 16; /* fall through */ 63 | case 2: h ^= ((uint32_t)data[1]) << 8; /* fall through */ 64 | case 1: h ^= data[0]; 65 | h *= m; 66 | default: break; 67 | }; 68 | 69 | /* 70 | Do a few final mixes of the hash to ensure the last few bytes are 71 | well-incorporated. 72 | */ 73 | 74 | h ^= h >> 13; 75 | h *= m; 76 | h ^= h >> 15; 77 | 78 | return h; 79 | } 80 | 81 | #else 82 | uint32_t hashkit_murmur(const char *, size_t , void *) 83 | { 84 | return 0; 85 | } 86 | #endif 87 | -------------------------------------------------------------------------------- /docs/man/libmemcachedutil.3: -------------------------------------------------------------------------------- 1 | .TH "LIBMEMCACHEDUTIL" "3" "September 28, 2011" "0.53" "libmemcached" 2 | .SH NAME 3 | libmemcachedutil \- libmemcached Documentation 4 | . 5 | .nr rst2man-indent-level 0 6 | . 7 | .de1 rstReportMargin 8 | \\$1 \\n[an-margin] 9 | level \\n[rst2man-indent-level] 10 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] 11 | - 12 | \\n[rst2man-indent0] 13 | \\n[rst2man-indent1] 14 | \\n[rst2man-indent2] 15 | .. 16 | .de1 INDENT 17 | .\" .rstReportMargin pre: 18 | . RS \\$1 19 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] 20 | . nr rst2man-indent-level +1 21 | .\" .rstReportMargin post: 22 | .. 23 | .de UNINDENT 24 | . RE 25 | .\" indent \\n[an-margin] 26 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] 27 | .nr rst2man-indent-level -1 28 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] 29 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u 30 | .. 31 | .\" Man page generated from reStructeredText. 32 | . 33 | .sp 34 | Utility library for libmemcached 35 | .SH SYNOPSIS 36 | .sp 37 | .nf 38 | .ft C 39 | cc [ flag ... ] file ... \-lmemcachedutil 40 | 41 | #include 42 | .ft P 43 | .fi 44 | .SH DESCRIPTION 45 | .sp 46 | \fBlibmemcachedutil\fP is a small and thread\-safe client library that 47 | provides extra functionality built on top of \fBlibmemcached\fP. 48 | .SH THREADS 49 | .sp 50 | Do not try to access an instance of \fBmemcached_st\fP from multiple threads 51 | at the same time. If you want to access memcached from multiple threads 52 | you should either clone the \fBmemcached_st\fP, or use the memcached pool 53 | implementation. see \fBmemcached_pool_create()\fP. 54 | .SH HOME 55 | .sp 56 | To find out more information please check: 57 | \fI\%http://libmemcached.org/\fP 58 | .SH SEE ALSO 59 | .sp 60 | \fIlibmemcached(3)\fP \fImemcached_pool_create(3)\fP \fImemcached_pool_destroy(3)\fP \fImemcached_pool_pop(3)\fP \fImemcached_pool_push(3)\fP 61 | .SH AUTHOR 62 | Brian Aker 63 | .SH COPYRIGHT 64 | 2011, Brian Aker DataDifferential, http://datadifferential.com/ 65 | .\" Generated by docutils manpage writer. 66 | .\" 67 | . 68 | -------------------------------------------------------------------------------- /libhashkit/has.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * Libmemcached library 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are 9 | * met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * * Redistributions in binary form must reproduce the above 15 | * copyright notice, this list of conditions and the following disclaimer 16 | * in the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * * The names of its contributors may not be used to endorse or 20 | * promote products derived from this software without specific prior 21 | * written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | */ 36 | 37 | #ifndef __LIBHASHKIT_HAS_H__ 38 | #define __LIBHASHKIT_HAS_H__ 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | HASHKIT_API 45 | bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* __LIBHASHKIT_HAS_H__ */ 52 | -------------------------------------------------------------------------------- /libmemcached/internal.h: -------------------------------------------------------------------------------- 1 | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 | * 3 | * Libmemcached library 4 | * 5 | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 | * Copyright (C) 2006-2009 Brian Aker All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are 10 | * met: 11 | * 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * * Redistributions in binary form must reproduce the above 16 | * copyright notice, this list of conditions and the following disclaimer 17 | * in the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * * The names of its contributors may not be used to endorse or 21 | * promote products derived from this software without specific prior 22 | * written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | #ifndef __LIBMEMCACHED_INTERNAL_H__ 39 | #define __LIBMEMCACHED_INTERNAL_H__ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* __LIBMEMCACHED_INTERNAL_H__ */ 50 | --------------------------------------------------------------------------------