X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fcommon.h;h=8cedc5214b24f12b92d63e86b2bea7f0ce706850;hb=50532bea9eb770554e1e962d03b868987303acbe;hp=98072cb3138d4266994173ff4d59b63e1eadd838;hpb=d8dedbd561c7cb57daf4192fe57ce5e205bcadd7;p=awesomized%2Flibmemcached diff --git a/libmemcached/common.h b/libmemcached/common.h index 98072cb3..8cedc521 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -42,72 +42,138 @@ #pragma once -#include +#include #ifdef __cplusplus -#include -#include -#include -#include -#include +# include +# include +# include +# include +# include +# include +# include +# include #else -#include -#include -#include -#include +# ifdef HAVE_STDDEF_H +# include +# endif +# ifdef HAVE_STDLIB_H +# include +# endif +# ifdef HAVE_STDLIB_H +# include +# endif +# include +# ifdef HAVE_TIME_H +# include +# endif +# ifdef HAVE_ERRNO_H +# include +# endif +# ifdef HAVE_LIMITS_H +# include +# endif #endif -#include -#include -#include -#include -#include +#ifdef HAVE_SYS_UN_H +# include +#endif -#include -#include -#include -#include +#ifdef HAVE_SYS_TIME_H +# include +#endif -#ifdef __cplusplus -extern "C" { +#ifdef HAVE_FCNTL_H +# include +#endif + +#ifdef HAVE_SYS_TYPES_H +# include #endif -typedef struct memcached_server_st * memcached_server_write_instance_st; +#ifdef HAVE_UNISTD_H +# include +#endif -typedef memcached_return_t (*memcached_server_execute_fn)(memcached_st *ptr, memcached_server_write_instance_st server, void *context); +#ifdef HAVE_SYS_SOCKET_H +# include +#endif -LIBMEMCACHED_LOCAL -memcached_server_write_instance_st memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key); +#ifdef HAVE_STRINGS_H +# include +#endif -LIBMEMCACHED_LOCAL -memcached_return_t memcached_server_execute(memcached_st *ptr, - memcached_server_execute_fn callback, - void *context); -#ifdef __cplusplus -} // extern "C" +#ifdef HAVE_DLFCN_H +# include #endif +#if defined(_WIN32) +# include "libmemcached/windows.hpp" +#endif + +#include +#include "libmemcached/watchpoint.h" +#include "libmemcached/is.h" +typedef struct memcached_st Memcached; + +#ifdef HAVE_POLL_H +# include +#else +# include "libmemcached/poll.h" +#endif + +#ifdef __cplusplus +memcached_instance_st* memcached_instance_fetch(memcached_st *ptr, uint32_t server_key); +#endif /* These are private not to be installed headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* string value */ -struct memcached_continuum_item_st -{ - uint32_t index; - uint32_t value; -}; +#include "libmemcached/error.hpp" +#include "libmemcached/memory.h" +#include "libmemcached/io.h" +#ifdef __cplusplus +# include "libmemcached/string.hpp" +# include "libmemcachedprotocol-0.0/binary.h" +# include "libmemcached/io.hpp" +# include "libmemcached/udp.hpp" +# include "libmemcached/do.hpp" +# include "libmemcached/socket.hpp" +# include "libmemcached/connect.hpp" +# include "libmemcached/allocators.hpp" +# include "libmemcached/hash.hpp" +# include "libmemcached/quit.hpp" +# include "libmemcached/instance.hpp" +# include "libmemcached/server_instance.h" +# include "libmemcached/server.hpp" +# include "libmemcached/flag.hpp" +# include "libmemcached/behavior.hpp" +# include "libmemcached/sasl.hpp" +# include "libmemcached/server_list.hpp" +#endif + +#include "libmemcached/internal.h" +#include "libmemcached/array.h" +#include "libmemcached/libmemcached_probes.h" +#include "libmemcached/byteorder.h" +#include "libmemcached/initialize_query.h" + +#ifdef __cplusplus +# include "libmemcached/response.h" +# include "libmemcached/namespace.h" +#else +# include "libmemcached/virtual_bucket.h" +#endif + +#ifdef __cplusplus +# include "libmemcached/backtrace.hpp" +# include "libmemcached/assert.hpp" +# include "libmemcached/server.hpp" +# include "libmemcached/key.hpp" +# include "libmemcached/encoding_key.h" +# include "libmemcached/result.h" +# include "libmemcached/version.hpp" +#endif + +#include "libmemcached/continuum.hpp" #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) @@ -129,60 +195,28 @@ struct memcached_continuum_item_st extern "C" { #endif -LIBMEMCACHED_LOCAL -memcached_return_t memcached_connect(memcached_server_write_instance_st ptr); - -LIBMEMCACHED_LOCAL memcached_return_t run_distribution(memcached_st *ptr); -#define memcached_server_response_increment(A) (A)->cursor_active++ -#define memcached_server_response_decrement(A) (A)->cursor_active-- -#define memcached_server_response_reset(A) (A)->cursor_active=0 - -LIBMEMCACHED_LOCAL -void set_last_disconnected_host(memcached_server_write_instance_st ptr); - #ifdef __cplusplus -LIBMEMCACHED_LOCAL -memcached_return_t memcached_key_test(const memcached_st& memc, - const char * const *keys, - const size_t *key_length, - size_t number_of_keys); +static inline void memcached_server_response_increment(memcached_instance_st* instance) +{ + instance->events(POLLIN); + instance->cursor_active_++; +} #endif -LIBMEMCACHED_LOCAL -memcached_return_t memcached_purge(memcached_server_write_instance_st ptr); +#define memcached_server_response_decrement(A) (A)->cursor_active_-- +#define memcached_server_response_reset(A) (A)->cursor_active_=0 -LIBMEMCACHED_LOCAL -memcached_server_st *memcached_server_create_with(const memcached_st *memc, - memcached_server_write_instance_st host, - const char *hostname, - in_port_t port, - uint32_t weight, - memcached_connection_t type); +#define memcached_instance_response_increment(A) (A)->cursor_active_++ +#define memcached_instance_response_decrement(A) (A)->cursor_active_-- +#define memcached_instance_response_reset(A) (A)->cursor_active_=0 - -static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool binary) -{ - unlikely (key_length == 0) - { - return MEMCACHED_BAD_KEY_PROVIDED; - } - - if (binary) - { - unlikely (key_length > 0xffff) - return MEMCACHED_BAD_KEY_PROVIDED; - } - else - { - unlikely (key_length >= MEMCACHED_MAX_KEY) - return MEMCACHED_BAD_KEY_PROVIDED; - } - - return MEMCACHED_SUCCESS; +#ifdef __cplusplus } +#endif #ifdef __cplusplus -} +bool memcached_purge(memcached_instance_st*); +memcached_instance_st* memcached_instance_by_position(const memcached_st *ptr, uint32_t server_key); #endif