| constants.h | | constants.h | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * Copyright (C) 2006-2009 Brian Aker | | * Copyright (C) 2006-2009 Brian Aker | |
| * All rights reserved. | | * All rights reserved. | |
| * | | * | |
| * Use and distribution licensed under the BSD license. See | | * Use and distribution licensed under the BSD license. See | |
| * the COPYING file in the parent directory for full text. | | * the COPYING file in the parent directory for full text. | |
| * | | * | |
| * Summary: Constants for libmemcached | | * Summary: Constants for libmemcached | |
| * | | * | |
| */ | | */ | |
| | | | |
|
| | | #pragma once | |
| #ifndef __LIBMEMCACHED_CONSTANTS_H__ | | #ifndef __LIBMEMCACHED_CONSTANTS_H__ | |
| #define __LIBMEMCACHED_CONSTANTS_H__ | | #define __LIBMEMCACHED_CONSTANTS_H__ | |
| | | | |
| /* Public defines */ | | /* Public defines */ | |
| #define MEMCACHED_DEFAULT_PORT 11211 | | #define MEMCACHED_DEFAULT_PORT 11211 | |
| #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ | | #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ | |
| #define MEMCACHED_MAX_BUFFER 8196 | | #define MEMCACHED_MAX_BUFFER 8196 | |
| #define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */ | | #define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */ | |
| #define MEMCACHED_POINTS_PER_SERVER 100 | | #define MEMCACHED_POINTS_PER_SERVER 100 | |
| #define MEMCACHED_POINTS_PER_SERVER_KETAMA 160 | | #define MEMCACHED_POINTS_PER_SERVER_KETAMA 160 | |
| #define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This wo
uld then set max hosts to 100 */ | | #define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This wo
uld then set max hosts to 100 */ | |
| #define MEMCACHED_STRIDE 4 | | #define MEMCACHED_STRIDE 4 | |
| #define MEMCACHED_DEFAULT_TIMEOUT 5000 | | #define MEMCACHED_DEFAULT_TIMEOUT 5000 | |
| #define MEMCACHED_DEFAULT_CONNECT_TIMEOUT 4000 | | #define MEMCACHED_DEFAULT_CONNECT_TIMEOUT 4000 | |
| #define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should b
uild for in the continuum */ | | #define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should b
uild for in the continuum */ | |
| #define MEMCACHED_PREFIX_KEY_MAX_SIZE 128 | | #define MEMCACHED_PREFIX_KEY_MAX_SIZE 128 | |
| #define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU | | #define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU | |
| #define MEMCACHED_VERSION_STRING_LENGTH 24 | | #define MEMCACHED_VERSION_STRING_LENGTH 24 | |
| | | | |
|
| typedef enum { | | enum memcached_return_t { | |
| MEMCACHED_SUCCESS, | | MEMCACHED_SUCCESS, | |
| MEMCACHED_FAILURE, | | MEMCACHED_FAILURE, | |
| MEMCACHED_HOST_LOOKUP_FAILURE, | | MEMCACHED_HOST_LOOKUP_FAILURE, | |
| MEMCACHED_CONNECTION_FAILURE, | | MEMCACHED_CONNECTION_FAILURE, | |
| MEMCACHED_CONNECTION_BIND_FAILURE, | | MEMCACHED_CONNECTION_BIND_FAILURE, | |
| MEMCACHED_WRITE_FAILURE, | | MEMCACHED_WRITE_FAILURE, | |
| MEMCACHED_READ_FAILURE, | | MEMCACHED_READ_FAILURE, | |
| MEMCACHED_UNKNOWN_READ_FAILURE, | | MEMCACHED_UNKNOWN_READ_FAILURE, | |
| MEMCACHED_PROTOCOL_ERROR, | | MEMCACHED_PROTOCOL_ERROR, | |
| MEMCACHED_CLIENT_ERROR, | | MEMCACHED_CLIENT_ERROR, | |
| | | | |
| skipping to change at line 75 | | skipping to change at line 76 | |
| MEMCACHED_BAD_KEY_PROVIDED, | | MEMCACHED_BAD_KEY_PROVIDED, | |
| MEMCACHED_INVALID_HOST_PROTOCOL, | | MEMCACHED_INVALID_HOST_PROTOCOL, | |
| MEMCACHED_SERVER_MARKED_DEAD, | | MEMCACHED_SERVER_MARKED_DEAD, | |
| MEMCACHED_UNKNOWN_STAT_KEY, | | MEMCACHED_UNKNOWN_STAT_KEY, | |
| MEMCACHED_E2BIG, | | MEMCACHED_E2BIG, | |
| MEMCACHED_INVALID_ARGUMENTS, | | MEMCACHED_INVALID_ARGUMENTS, | |
| MEMCACHED_KEY_TOO_BIG, | | MEMCACHED_KEY_TOO_BIG, | |
| MEMCACHED_AUTH_PROBLEM, | | MEMCACHED_AUTH_PROBLEM, | |
| MEMCACHED_AUTH_FAILURE, | | MEMCACHED_AUTH_FAILURE, | |
| MEMCACHED_AUTH_CONTINUE, | | MEMCACHED_AUTH_CONTINUE, | |
|
| | | MEMCACHED_PARSE_ERROR, | |
| | | MEMCACHED_PARSE_USER_ERROR, | |
| | | MEMCACHED_DEPRECATED, | |
| MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ | | MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ | |
|
| } memcached_return_t; | | }; | |
| | | | |
|
| typedef enum { | | #ifndef __cplusplus | |
| | | typedef enum memcached_return_t memcached_return_t; | |
| | | #endif | |
| | | | |
| | | enum memcached_server_distribution_t { | |
| MEMCACHED_DISTRIBUTION_MODULA, | | MEMCACHED_DISTRIBUTION_MODULA, | |
| MEMCACHED_DISTRIBUTION_CONSISTENT, | | MEMCACHED_DISTRIBUTION_CONSISTENT, | |
| MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA, | | MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA, | |
| MEMCACHED_DISTRIBUTION_RANDOM, | | MEMCACHED_DISTRIBUTION_RANDOM, | |
| MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY, | | MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY, | |
|
| | | MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED, | |
| | | MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET, | |
| MEMCACHED_DISTRIBUTION_CONSISTENT_MAX | | MEMCACHED_DISTRIBUTION_CONSISTENT_MAX | |
|
| } memcached_server_distribution_t; | | }; | |
| | | | |
| | | #ifndef __cplusplus | |
| | | typedef enum memcached_server_distribution_t memcached_server_distribution_ | |
| | | t; | |
| | | #endif | |
| | | | |
| typedef enum { | | typedef enum { | |
| MEMCACHED_BEHAVIOR_NO_BLOCK, | | MEMCACHED_BEHAVIOR_NO_BLOCK, | |
| MEMCACHED_BEHAVIOR_TCP_NODELAY, | | MEMCACHED_BEHAVIOR_TCP_NODELAY, | |
| MEMCACHED_BEHAVIOR_HASH, | | MEMCACHED_BEHAVIOR_HASH, | |
| MEMCACHED_BEHAVIOR_KETAMA, | | MEMCACHED_BEHAVIOR_KETAMA, | |
| MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, | | MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, | |
| MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, | | MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, | |
| MEMCACHED_BEHAVIOR_CACHE_LOOKUPS, | | MEMCACHED_BEHAVIOR_CACHE_LOOKUPS, | |
| MEMCACHED_BEHAVIOR_SUPPORT_CAS, | | MEMCACHED_BEHAVIOR_SUPPORT_CAS, | |
| | | | |
| skipping to change at line 122 | | skipping to change at line 136 | |
| MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH, | | MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH, | |
| MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY, | | MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY, | |
| MEMCACHED_BEHAVIOR_NOREPLY, | | MEMCACHED_BEHAVIOR_NOREPLY, | |
| MEMCACHED_BEHAVIOR_USE_UDP, | | MEMCACHED_BEHAVIOR_USE_UDP, | |
| MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS, | | MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS, | |
| MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, | | MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, | |
| MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ, | | MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ, | |
| MEMCACHED_BEHAVIOR_CORK, | | MEMCACHED_BEHAVIOR_CORK, | |
| MEMCACHED_BEHAVIOR_TCP_KEEPALIVE, | | MEMCACHED_BEHAVIOR_TCP_KEEPALIVE, | |
| MEMCACHED_BEHAVIOR_TCP_KEEPIDLE, | | MEMCACHED_BEHAVIOR_TCP_KEEPIDLE, | |
|
| | | MEMCACHED_BEHAVIOR_LOAD_FROM_FILE, | |
| | | MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS, | |
| MEMCACHED_BEHAVIOR_MAX | | MEMCACHED_BEHAVIOR_MAX | |
| } memcached_behavior_t; | | } memcached_behavior_t; | |
| | | | |
| typedef enum { | | typedef enum { | |
| MEMCACHED_CALLBACK_PREFIX_KEY = 0, | | MEMCACHED_CALLBACK_PREFIX_KEY = 0, | |
| MEMCACHED_CALLBACK_USER_DATA = 1, | | MEMCACHED_CALLBACK_USER_DATA = 1, | |
| MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2, | | MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2, | |
| MEMCACHED_CALLBACK_CLONE_FUNCTION = 3, | | MEMCACHED_CALLBACK_CLONE_FUNCTION = 3, | |
| #ifdef MEMCACHED_ENABLE_DEPRECATED | | #ifdef MEMCACHED_ENABLE_DEPRECATED | |
| MEMCACHED_CALLBACK_MALLOC_FUNCTION = 4, | | MEMCACHED_CALLBACK_MALLOC_FUNCTION = 4, | |
| | | | |
End of changes. 8 change blocks. |
| 4 lines changed or deleted | | 21 lines changed or added | |
|
| memcached.h | | memcached.h | |
|
| /* LibMemcached | | /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | |
| * Copyright (C) 2006-2009 Brian Aker | | | |
| * All rights reserved. | | | |
| * | | * | |
|
| * Use and distribution licensed under the BSD license. See | | * Libmemcached library | |
| * the COPYING file in the parent directory for full text. | | | |
| * | | * | |
|
| * Summary: interface for memcached server | | * Copyright (C) 2011 Data Differential, http://datadifferential.com/ | |
| * Description: main include file for libmemcached | | * Copyright (C) 2006-2009 Brian Aker All rights reserved. | |
| | | * | |
| | | * Redistribution and use in source and binary forms, with or without | |
| | | * modification, are permitted provided that the following conditions are | |
| | | * met: | |
| | | * | |
| | | * * Redistributions of source code must retain the above copyright | |
| | | * notice, this list of conditions and the following disclaimer. | |
| | | * | |
| | | * * Redistributions in binary form must reproduce the above | |
| | | * copyright notice, this list of conditions and the following disclaimer | |
| | | * in the documentation and/or other materials provided with the | |
| | | * distribution. | |
| | | * | |
| | | * * The names of its contributors may not be used to endorse or | |
| | | * promote products derived from this software without specific prior | |
| | | * written permission. | |
| | | * | |
| | | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| | | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| | | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| | | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| | | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| | | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef __LIBMEMCACHED_MEMCACHED_H__ | | #ifndef __LIBMEMCACHED_MEMCACHED_H__ | |
| #define __LIBMEMCACHED_MEMCACHED_H__ | | #define __LIBMEMCACHED_MEMCACHED_H__ | |
| | | | |
| #include <inttypes.h> | | #include <inttypes.h> | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| | | | |
| #if !defined(__cplusplus) | | #if !defined(__cplusplus) | |
| # include <stdbool.h> | | # include <stdbool.h> | |
| #endif | | #endif | |
| | | | |
| #include <libmemcached/visibility.h> | | #include <libmemcached/visibility.h> | |
| #include <libmemcached/configure.h> | | #include <libmemcached/configure.h> | |
| #include <libmemcached/platform.h> | | #include <libmemcached/platform.h> | |
| #include <libmemcached/constants.h> | | #include <libmemcached/constants.h> | |
| #include <libmemcached/types.h> | | #include <libmemcached/types.h> | |
| #include <libmemcached/string.h> | | #include <libmemcached/string.h> | |
|
| | | #include <libmemcached/array.h> | |
| | | #include <libmemcached/error.h> | |
| #include <libmemcached/stats.h> | | #include <libmemcached/stats.h> | |
| #include <libhashkit/hashkit.h> | | #include <libhashkit/hashkit.h> | |
| // Everything above this line must be in the order specified. | | // Everything above this line must be in the order specified. | |
| #include <libmemcached/allocators.h> | | #include <libmemcached/allocators.h> | |
| #include <libmemcached/analyze.h> | | #include <libmemcached/analyze.h> | |
| #include <libmemcached/auto.h> | | #include <libmemcached/auto.h> | |
| #include <libmemcached/behavior.h> | | #include <libmemcached/behavior.h> | |
| #include <libmemcached/callback.h> | | #include <libmemcached/callback.h> | |
| #include <libmemcached/delete.h> | | #include <libmemcached/delete.h> | |
| #include <libmemcached/dump.h> | | #include <libmemcached/dump.h> | |
| #include <libmemcached/fetch.h> | | #include <libmemcached/fetch.h> | |
| #include <libmemcached/flush.h> | | #include <libmemcached/flush.h> | |
| #include <libmemcached/flush_buffers.h> | | #include <libmemcached/flush_buffers.h> | |
| #include <libmemcached/get.h> | | #include <libmemcached/get.h> | |
| #include <libmemcached/hash.h> | | #include <libmemcached/hash.h> | |
|
| | | #include <libmemcached/options.h> | |
| #include <libmemcached/parse.h> | | #include <libmemcached/parse.h> | |
| #include <libmemcached/quit.h> | | #include <libmemcached/quit.h> | |
| #include <libmemcached/result.h> | | #include <libmemcached/result.h> | |
| #include <libmemcached/server.h> | | #include <libmemcached/server.h> | |
| #include <libmemcached/server_list.h> | | #include <libmemcached/server_list.h> | |
| #include <libmemcached/storage.h> | | #include <libmemcached/storage.h> | |
| #include <libmemcached/strerror.h> | | #include <libmemcached/strerror.h> | |
| #include <libmemcached/verbosity.h> | | #include <libmemcached/verbosity.h> | |
| #include <libmemcached/version.h> | | #include <libmemcached/version.h> | |
| #include <libmemcached/sasl.h> | | #include <libmemcached/sasl.h> | |
| | | | |
| struct memcached_st { | | struct memcached_st { | |
| /** | | /** | |
| @note these are static and should not change without a call to behavior
. | | @note these are static and should not change without a call to behavior
. | |
| */ | | */ | |
| struct { | | struct { | |
| bool is_purging:1; | | bool is_purging:1; | |
| bool is_processing_input:1; | | bool is_processing_input:1; | |
| bool is_time_for_rebuild:1; | | bool is_time_for_rebuild:1; | |
| } state; | | } state; | |
|
| | | | |
| struct { | | struct { | |
| // Everything below here is pretty static. | | // Everything below here is pretty static. | |
| bool auto_eject_hosts:1; | | bool auto_eject_hosts:1; | |
| bool binary_protocol:1; | | bool binary_protocol:1; | |
| bool buffer_requests:1; | | bool buffer_requests:1; | |
|
| bool cork:1; | | | |
| bool hash_with_prefix_key:1; | | bool hash_with_prefix_key:1; | |
|
| bool ketama_weighted:1; | | | |
| bool no_block:1; // Don't block | | bool no_block:1; // Don't block | |
| bool no_reply:1; | | bool no_reply:1; | |
| bool randomize_replica_read:1; | | bool randomize_replica_read:1; | |
|
| bool reuse_memory:1; | | | |
| bool support_cas:1; | | bool support_cas:1; | |
| bool tcp_nodelay:1; | | bool tcp_nodelay:1; | |
|
| bool use_cache_lookups:1; | | | |
| bool use_sort_hosts:1; | | bool use_sort_hosts:1; | |
| bool use_udp:1; | | bool use_udp:1; | |
| bool verify_key:1; | | bool verify_key:1; | |
| bool tcp_keepalive:1; | | bool tcp_keepalive:1; | |
| } flags; | | } flags; | |
|
| | | | |
| memcached_server_distribution_t distribution; | | memcached_server_distribution_t distribution; | |
| hashkit_st hashkit; | | hashkit_st hashkit; | |
|
| uint32_t continuum_points_counter; // Ketama | | | |
| uint32_t number_of_hosts; | | uint32_t number_of_hosts; | |
| memcached_server_st *servers; | | memcached_server_st *servers; | |
| memcached_server_st *last_disconnected_server; | | memcached_server_st *last_disconnected_server; | |
| int32_t snd_timeout; | | int32_t snd_timeout; | |
| int32_t rcv_timeout; | | int32_t rcv_timeout; | |
| uint32_t server_failure_limit; | | uint32_t server_failure_limit; | |
| uint32_t io_msg_watermark; | | uint32_t io_msg_watermark; | |
| uint32_t io_bytes_watermark; | | uint32_t io_bytes_watermark; | |
| uint32_t io_key_prefetch; | | uint32_t io_key_prefetch; | |
| uint32_t tcp_keepidle; | | uint32_t tcp_keepidle; | |
|
| int cached_errno; | | | |
| int32_t poll_timeout; | | int32_t poll_timeout; | |
| int32_t connect_timeout; | | int32_t connect_timeout; | |
| int32_t retry_timeout; | | int32_t retry_timeout; | |
|
| uint32_t continuum_count; // Ketama | | | |
| int send_size; | | int send_size; | |
| int recv_size; | | int recv_size; | |
| void *user_data; | | void *user_data; | |
|
| time_t next_distribution_rebuild; // Ketama | | uint64_t query_id; | |
| size_t prefix_key_length; | | | |
| uint32_t number_of_replicas; | | uint32_t number_of_replicas; | |
| hashkit_st distribution_hashkit; | | hashkit_st distribution_hashkit; | |
| memcached_result_st result; | | memcached_result_st result; | |
|
| memcached_continuum_item_st *continuum; // Ketama | | | |
| | | struct { | |
| | | bool weighted; | |
| | | uint32_t continuum_count; // Ketama | |
| | | uint32_t continuum_points_counter; // Ketama | |
| | | time_t next_distribution_rebuild; // Ketama | |
| | | memcached_continuum_item_st *continuum; // Ketama | |
| | | } ketama; | |
| | | | |
| | | struct memcached_virtual_bucket_t *virtual_bucket; | |
| | | | |
| struct _allocators_st { | | struct _allocators_st { | |
| memcached_calloc_fn calloc; | | memcached_calloc_fn calloc; | |
| memcached_free_fn free; | | memcached_free_fn free; | |
| memcached_malloc_fn malloc; | | memcached_malloc_fn malloc; | |
| memcached_realloc_fn realloc; | | memcached_realloc_fn realloc; | |
| void *context; | | void *context; | |
| } allocators; | | } allocators; | |
| | | | |
| memcached_clone_fn on_clone; | | memcached_clone_fn on_clone; | |
| memcached_cleanup_fn on_cleanup; | | memcached_cleanup_fn on_cleanup; | |
| memcached_trigger_key_fn get_key_failure; | | memcached_trigger_key_fn get_key_failure; | |
| memcached_trigger_delete_key_fn delete_trigger; | | memcached_trigger_delete_key_fn delete_trigger; | |
| memcached_callback_st *callbacks; | | memcached_callback_st *callbacks; | |
| struct memcached_sasl_st sasl; | | struct memcached_sasl_st sasl; | |
|
| char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE]; | | struct memcached_error_t *error_messages; | |
| | | struct memcached_array_st *prefix_key; | |
| | | struct { | |
| | | uint32_t initial_pool_size; | |
| | | uint32_t max_pool_size; | |
| | | struct memcached_array_st *filename; | |
| | | } configure; | |
| struct { | | struct { | |
| bool is_allocated:1; | | bool is_allocated:1; | |
| } options; | | } options; | |
| | | | |
| }; | | }; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void memcached_servers_reset(memcached_st *ptr); | | void memcached_servers_reset(memcached_st *ptr); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_st *memcached_create(memcached_st *ptr); | | memcached_st *memcached_create(memcached_st *ptr); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| | | memcached_st *memcached(const char *string, size_t string_length); | |
| | | | |
| | | LIBMEMCACHED_API | |
| void memcached_free(memcached_st *ptr); | | void memcached_free(memcached_st *ptr); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| | | memcached_return_t memcached_reset(memcached_st *ptr); | |
| | | | |
| | | LIBMEMCACHED_API | |
| void memcached_reset_last_disconnected_server(memcached_st *ptr); | | void memcached_reset_last_disconnected_server(memcached_st *ptr); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_st *memcached_clone(memcached_st *clone, const memcached_st *ptr)
; | | memcached_st *memcached_clone(memcached_st *clone, const memcached_st *ptr)
; | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void *memcached_get_user_data(const memcached_st *ptr); | | void *memcached_get_user_data(const memcached_st *ptr); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void *memcached_set_user_data(memcached_st *ptr, void *data); | | void *memcached_set_user_data(memcached_st *ptr, void *data); | |
| | | | |
| skipping to change at line 172 | | skipping to change at line 215 | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_server_instance_st memcached_server_instance_by_position(const me
mcached_st *ptr, uint32_t server_key); | | memcached_server_instance_st memcached_server_instance_by_position(const me
mcached_st *ptr, uint32_t server_key); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| uint32_t memcached_server_count(const memcached_st *); | | uint32_t memcached_server_count(const memcached_st *); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } // extern "C" | | } // extern "C" | |
| #endif | | #endif | |
| | | | |
|
| #ifdef __cplusplus | | | |
| class Memcached : private memcached_st { | | | |
| public: | | | |
| | | | |
| Memcached() | | | |
| { | | | |
| memcached_create(this); | | | |
| } | | | |
| | | | |
| ~Memcached() | | | |
| { | | | |
| memcached_free(this); | | | |
| } | | | |
| | | | |
| Memcached(const Memcached& source) | | | |
| { | | | |
| memcached_clone(this, &source); | | | |
| } | | | |
| | | | |
| Memcached& operator=(const Memcached& source) | | | |
| { | | | |
| memcached_free(this); | | | |
| memcached_clone(this, &source); | | | |
| | | | |
| return *this; | | | |
| } | | | |
| }; | | | |
| #endif | | | |
| | | | |
| #endif /* __LIBMEMCACHED_MEMCACHED_H__ */ | | #endif /* __LIBMEMCACHED_MEMCACHED_H__ */ | |
| | | | |
End of changes. 20 change blocks. |
| 47 lines changed or deleted | | 61 lines changed or added | |
|
| protocol_binary.h | | protocol_binary.h | |
|
| | | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
*/ | |
| /* | | /* | |
| * Copyright (c) <2008>, Sun Microsystems, Inc. | | * Copyright (c) <2008>, Sun Microsystems, Inc. | |
| * All rights reserved. | | * All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions are m
et: | | * modification, are permitted provided that the following conditions are m
et: | |
| * * Redistributions of source code must retain the above copyright | | * * Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * * Redistributions in binary form must reproduce the above copyright | | * * Redistributions in binary form must reproduce the above copyright | |
| * notice, this list of conditions and the following disclaimer in th
e | | * notice, this list of conditions and the following disclaimer in th
e | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 39 | |
| * Summary: Constants used by to implement the binary protocol. | | * Summary: Constants used by to implement the binary protocol. | |
| * | | * | |
| * Copy: See Copyright for the status of this software. | | * Copy: See Copyright for the status of this software. | |
| * | | * | |
| * Author: Trond Norbye <trond.norbye@sun.com> | | * Author: Trond Norbye <trond.norbye@sun.com> | |
| */ | | */ | |
| | | | |
| #ifndef PROTOCOL_BINARY_H | | #ifndef PROTOCOL_BINARY_H | |
| #define PROTOCOL_BINARY_H | | #define PROTOCOL_BINARY_H | |
| | | | |
|
| | | #include "vbucket.h" | |
| | | | |
| /** | | /** | |
| * \addtogroup Protocol | | * \addtogroup Protocol | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * This file contains definitions of the constants and packet formats | | * This file contains definitions of the constants and packet formats | |
| * defined in the binary specification. Please note that you _MUST_ remembe
r | | * defined in the binary specification. Please note that you _MUST_ remembe
r | |
| * to convert each multibyte field to / from network byte order to / from | | * to convert each multibyte field to / from network byte order to / from | |
| * host order. | | * host order. | |
| | | | |
| skipping to change at line 75 | | skipping to change at line 78 | |
| * See section 3.2 Response Status | | * See section 3.2 Response Status | |
| */ | | */ | |
| typedef enum { | | typedef enum { | |
| PROTOCOL_BINARY_RESPONSE_SUCCESS = 0x00, | | PROTOCOL_BINARY_RESPONSE_SUCCESS = 0x00, | |
| PROTOCOL_BINARY_RESPONSE_KEY_ENOENT = 0x01, | | PROTOCOL_BINARY_RESPONSE_KEY_ENOENT = 0x01, | |
| PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS = 0x02, | | PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS = 0x02, | |
| PROTOCOL_BINARY_RESPONSE_E2BIG = 0x03, | | PROTOCOL_BINARY_RESPONSE_E2BIG = 0x03, | |
| PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04, | | PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04, | |
| PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05, | | PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05, | |
| PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06, | | PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06, | |
|
| | | PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET = 0x07, | |
| PROTOCOL_BINARY_RESPONSE_AUTH_ERROR = 0x20, | | PROTOCOL_BINARY_RESPONSE_AUTH_ERROR = 0x20, | |
| PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE = 0x21, | | PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE = 0x21, | |
| PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81, | | PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81, | |
| PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82, | | PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82, | |
|
| | | PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED = 0x83, | |
| PROTOCOL_BINARY_RESPONSE_PAUSE = 0xfe00, | | PROTOCOL_BINARY_RESPONSE_EINTERNAL = 0x84, | |
| PROTOCOL_BINARY_RESPONSE_EIO = 0xff00 | | PROTOCOL_BINARY_RESPONSE_EBUSY = 0x85, | |
| | | PROTOCOL_BINARY_RESPONSE_ETMPFAIL = 0x86 | |
| } protocol_binary_response_status; | | } protocol_binary_response_status; | |
| | | | |
| /** | | /** | |
| * Defintion of the different command opcodes. | | * Defintion of the different command opcodes. | |
| * See section 3.3 Command Opcodes | | * See section 3.3 Command Opcodes | |
| */ | | */ | |
| typedef enum { | | typedef enum { | |
| PROTOCOL_BINARY_CMD_GET = 0x00, | | PROTOCOL_BINARY_CMD_GET = 0x00, | |
| PROTOCOL_BINARY_CMD_SET = 0x01, | | PROTOCOL_BINARY_CMD_SET = 0x01, | |
| PROTOCOL_BINARY_CMD_ADD = 0x02, | | PROTOCOL_BINARY_CMD_ADD = 0x02, | |
| | | | |
| skipping to change at line 117 | | skipping to change at line 121 | |
| PROTOCOL_BINARY_CMD_SETQ = 0x11, | | PROTOCOL_BINARY_CMD_SETQ = 0x11, | |
| PROTOCOL_BINARY_CMD_ADDQ = 0x12, | | PROTOCOL_BINARY_CMD_ADDQ = 0x12, | |
| PROTOCOL_BINARY_CMD_REPLACEQ = 0x13, | | PROTOCOL_BINARY_CMD_REPLACEQ = 0x13, | |
| PROTOCOL_BINARY_CMD_DELETEQ = 0x14, | | PROTOCOL_BINARY_CMD_DELETEQ = 0x14, | |
| PROTOCOL_BINARY_CMD_INCREMENTQ = 0x15, | | PROTOCOL_BINARY_CMD_INCREMENTQ = 0x15, | |
| PROTOCOL_BINARY_CMD_DECREMENTQ = 0x16, | | PROTOCOL_BINARY_CMD_DECREMENTQ = 0x16, | |
| PROTOCOL_BINARY_CMD_QUITQ = 0x17, | | PROTOCOL_BINARY_CMD_QUITQ = 0x17, | |
| PROTOCOL_BINARY_CMD_FLUSHQ = 0x18, | | PROTOCOL_BINARY_CMD_FLUSHQ = 0x18, | |
| PROTOCOL_BINARY_CMD_APPENDQ = 0x19, | | PROTOCOL_BINARY_CMD_APPENDQ = 0x19, | |
| PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a, | | PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a, | |
|
| | | PROTOCOL_BINARY_CMD_VERBOSITY = 0x1b, | |
| | | PROTOCOL_BINARY_CMD_TOUCH = 0x1c, | |
| | | PROTOCOL_BINARY_CMD_GAT = 0x1d, | |
| | | PROTOCOL_BINARY_CMD_GATQ = 0x1e, | |
| | | | |
| PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20, | | PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20, | |
| PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21, | | PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21, | |
| PROTOCOL_BINARY_CMD_SASL_STEP = 0x22, | | PROTOCOL_BINARY_CMD_SASL_STEP = 0x22, | |
| | | | |
| /* These commands are used for range operations and exist within | | /* These commands are used for range operations and exist within | |
| * this header for use in other projects. Range operations are | | * this header for use in other projects. Range operations are | |
| * not expected to be implemented in the memcached server itself. | | * not expected to be implemented in the memcached server itself. | |
| */ | | */ | |
| PROTOCOL_BINARY_CMD_RGET = 0x30, | | PROTOCOL_BINARY_CMD_RGET = 0x30, | |
| | | | |
| skipping to change at line 138 | | skipping to change at line 146 | |
| PROTOCOL_BINARY_CMD_RSETQ = 0x32, | | PROTOCOL_BINARY_CMD_RSETQ = 0x32, | |
| PROTOCOL_BINARY_CMD_RAPPEND = 0x33, | | PROTOCOL_BINARY_CMD_RAPPEND = 0x33, | |
| PROTOCOL_BINARY_CMD_RAPPENDQ = 0x34, | | PROTOCOL_BINARY_CMD_RAPPENDQ = 0x34, | |
| PROTOCOL_BINARY_CMD_RPREPEND = 0x35, | | PROTOCOL_BINARY_CMD_RPREPEND = 0x35, | |
| PROTOCOL_BINARY_CMD_RPREPENDQ = 0x36, | | PROTOCOL_BINARY_CMD_RPREPENDQ = 0x36, | |
| PROTOCOL_BINARY_CMD_RDELETE = 0x37, | | PROTOCOL_BINARY_CMD_RDELETE = 0x37, | |
| PROTOCOL_BINARY_CMD_RDELETEQ = 0x38, | | PROTOCOL_BINARY_CMD_RDELETEQ = 0x38, | |
| PROTOCOL_BINARY_CMD_RINCR = 0x39, | | PROTOCOL_BINARY_CMD_RINCR = 0x39, | |
| PROTOCOL_BINARY_CMD_RINCRQ = 0x3a, | | PROTOCOL_BINARY_CMD_RINCRQ = 0x3a, | |
| PROTOCOL_BINARY_CMD_RDECR = 0x3b, | | PROTOCOL_BINARY_CMD_RDECR = 0x3b, | |
|
| PROTOCOL_BINARY_CMD_RDECRQ = 0x3c | | PROTOCOL_BINARY_CMD_RDECRQ = 0x3c, | |
| /* End Range operations */ | | /* End Range operations */ | |
| | | | |
|
| | | /* VBucket commands */ | |
| | | PROTOCOL_BINARY_CMD_SET_VBUCKET = 0x3d, | |
| | | PROTOCOL_BINARY_CMD_GET_VBUCKET = 0x3e, | |
| | | PROTOCOL_BINARY_CMD_DEL_VBUCKET = 0x3f, | |
| | | /* End VBucket commands */ | |
| | | | |
| | | /* TAP commands */ | |
| | | PROTOCOL_BINARY_CMD_TAP_CONNECT = 0x40, | |
| | | PROTOCOL_BINARY_CMD_TAP_MUTATION = 0x41, | |
| | | PROTOCOL_BINARY_CMD_TAP_DELETE = 0x42, | |
| | | PROTOCOL_BINARY_CMD_TAP_FLUSH = 0x43, | |
| | | PROTOCOL_BINARY_CMD_TAP_OPAQUE = 0x44, | |
| | | PROTOCOL_BINARY_CMD_TAP_VBUCKET_SET = 0x45, | |
| | | PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_START = 0x46, | |
| | | PROTOCOL_BINARY_CMD_TAP_CHECKPOINT_END = 0x47, | |
| | | /* End TAP */ | |
| | | | |
| | | PROTOCOL_BINARY_CMD_LAST_RESERVED = 0xef, | |
| | | | |
| | | /* Scrub the data */ | |
| | | PROTOCOL_BINARY_CMD_SCRUB = 0xf0 | |
| } protocol_binary_command; | | } protocol_binary_command; | |
| | | | |
| /** | | /** | |
| * Definition of the data types in the packet | | * Definition of the data types in the packet | |
| * See section 3.4 Data Types | | * See section 3.4 Data Types | |
| */ | | */ | |
| typedef enum { | | typedef enum { | |
| PROTOCOL_BINARY_RAW_BYTES = 0x00 | | PROTOCOL_BINARY_RAW_BYTES = 0x00 | |
| } protocol_binary_datatypes; | | } protocol_binary_datatypes; | |
| | | | |
| | | | |
| skipping to change at line 162 | | skipping to change at line 191 | |
| * Definition of the header structure for a request packet. | | * Definition of the header structure for a request packet. | |
| * See section 2 | | * See section 2 | |
| */ | | */ | |
| typedef union { | | typedef union { | |
| struct { | | struct { | |
| uint8_t magic; | | uint8_t magic; | |
| uint8_t opcode; | | uint8_t opcode; | |
| uint16_t keylen; | | uint16_t keylen; | |
| uint8_t extlen; | | uint8_t extlen; | |
| uint8_t datatype; | | uint8_t datatype; | |
|
| uint16_t reserved; | | uint16_t vbucket; | |
| uint32_t bodylen; | | uint32_t bodylen; | |
| uint32_t opaque; | | uint32_t opaque; | |
| uint64_t cas; | | uint64_t cas; | |
| } request; | | } request; | |
| uint8_t bytes[24]; | | uint8_t bytes[24]; | |
| } protocol_binary_request_header; | | } protocol_binary_request_header; | |
| | | | |
| /** | | /** | |
| * Definition of the header structure for a response packet. | | * Definition of the header structure for a response packet. | |
| * See section 2 | | * See section 2 | |
| | | | |
| skipping to change at line 393 | | skipping to change at line 422 | |
| */ | | */ | |
| typedef protocol_binary_request_no_extras protocol_binary_request_stats
; | | typedef protocol_binary_request_no_extras protocol_binary_request_stats
; | |
| | | | |
| /** | | /** | |
| * Definition of the packet returned from a successful stats command | | * Definition of the packet returned from a successful stats command | |
| * See section 4 | | * See section 4 | |
| */ | | */ | |
| typedef protocol_binary_response_no_extras protocol_binary_response_sta
ts; | | typedef protocol_binary_response_no_extras protocol_binary_response_sta
ts; | |
| | | | |
| /** | | /** | |
|
| | | * Definition of the packet used by the verbosity command | |
| | | */ | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | uint32_t level; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; | |
| | | } protocol_binary_request_verbosity; | |
| | | | |
| | | /** | |
| | | * Definition of the packet returned from the verbosity command | |
| | | */ | |
| | | typedef protocol_binary_response_no_extras protocol_binary_response_ver | |
| | | bosity; | |
| | | | |
| | | /** | |
| | | * Definition of the packet used by the touch command. | |
| | | */ | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | uint32_t expiration; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; | |
| | | } protocol_binary_request_touch; | |
| | | | |
| | | /** | |
| | | * Definition of the packet returned from the touch command | |
| | | */ | |
| | | typedef protocol_binary_response_no_extras protocol_binary_response_tou | |
| | | ch; | |
| | | | |
| | | /** | |
| | | * Definition of the packet used by the GAT(Q) command. | |
| | | */ | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | uint32_t expiration; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; | |
| | | } protocol_binary_request_gat; | |
| | | | |
| | | typedef protocol_binary_request_gat protocol_binary_request_gatq; | |
| | | | |
| | | /** | |
| | | * Definition of the packet returned from the GAT(Q) | |
| | | */ | |
| | | typedef protocol_binary_response_get protocol_binary_response_gat; | |
| | | typedef protocol_binary_response_get protocol_binary_response_gatq; | |
| | | | |
| | | /** | |
| * Definition of a request for a range operation. | | * Definition of a request for a range operation. | |
| * See http://code.google.com/p/memcached/wiki/RangeOps | | * See http://code.google.com/p/memcached/wiki/RangeOps | |
| * | | * | |
| * These types are used for range operations and exist within | | * These types are used for range operations and exist within | |
| * this header for use in other projects. Range operations are | | * this header for use in other projects. Range operations are | |
| * not expected to be implemented in the memcached server itself. | | * not expected to be implemented in the memcached server itself. | |
| */ | | */ | |
| typedef union { | | typedef union { | |
| struct { | | struct { | |
| protocol_binary_response_header header; | | protocol_binary_response_header header; | |
| | | | |
| skipping to change at line 428 | | skipping to change at line 514 | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rprepen
d; | | typedef protocol_binary_request_rangeop protocol_binary_request_rprepen
d; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rprepen
dq; | | typedef protocol_binary_request_rangeop protocol_binary_request_rprepen
dq; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rdelete
; | | typedef protocol_binary_request_rangeop protocol_binary_request_rdelete
; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rdelete
q; | | typedef protocol_binary_request_rangeop protocol_binary_request_rdelete
q; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rincr; | | typedef protocol_binary_request_rangeop protocol_binary_request_rincr; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rincrq; | | typedef protocol_binary_request_rangeop protocol_binary_request_rincrq; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rdecr; | | typedef protocol_binary_request_rangeop protocol_binary_request_rdecr; | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rdecrq; | | typedef protocol_binary_request_rangeop protocol_binary_request_rdecrq; | |
| | | | |
| /** | | /** | |
|
| | | * Definition of tap commands | |
| | | * See To be written | |
| | | * | |
| | | */ | |
| | | | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | /** | |
| | | * flags is a bitmask used to set properties for the | |
| | | * the connection. Please In order to be forward compatible | |
| | | * you should set all undefined bits to 0. | |
| | | * | |
| | | * If the bit require extra userdata, it will be stored | |
| | | * in the user-data field of the body (passed to the engine | |
| | | * as enginespeciffic). That means that when you parse the | |
| | | * flags and the engine-specific data, you have to work you | |
| | | r | |
| | | * way from bit 0 and upwards to find the correct offset fo | |
| | | r | |
| | | * the data. | |
| | | * | |
| | | */ | |
| | | uint32_t flags; | |
| | | | |
| | | /** | |
| | | * Backfill age | |
| | | * | |
| | | * By using this flag you can limit the amount of data bein | |
| | | g | |
| | | * transmitted. If you don't specify a backfill age, the | |
| | | * server will transmit everything it contains. | |
| | | * | |
| | | * The first 8 bytes in the engine specific data contains | |
| | | * the oldest entry (from epoc) you're interested in. | |
| | | * Specifying a time in the future (for the server you are | |
| | | * connecting to), will cause it to start streaming current | |
| | | * changes. | |
| | | */ | |
| | | #define TAP_CONNECT_FLAG_BACKFILL 0x01 | |
| | | /** | |
| | | * Dump will cause the server to send the data stored on th | |
| | | e | |
| | | * server, but disconnect when the keys stored in the serve | |
| | | r | |
| | | * are transmitted. | |
| | | */ | |
| | | #define TAP_CONNECT_FLAG_DUMP 0x02 | |
| | | /** | |
| | | * The body contains a list of 16 bits words in network byt | |
| | | e | |
| | | * order specifying the vbucket ids to monitor. The first 1 | |
| | | 6 | |
| | | * bit word contains the number of buckets. The number of 0 | |
| | | * means "all buckets" | |
| | | */ | |
| | | #define TAP_CONNECT_FLAG_LIST_VBUCKETS 0x04 | |
| | | /** | |
| | | * The responsibility of the vbuckets is to be transferred | |
| | | * over to the caller when all items are transferred. | |
| | | */ | |
| | | #define TAP_CONNECT_FLAG_TAKEOVER_VBUCKETS 0x08 | |
| | | /** | |
| | | * The tap consumer supports ack'ing of tap messages | |
| | | */ | |
| | | #define TAP_CONNECT_SUPPORT_ACK 0x10 | |
| | | /** | |
| | | * The tap consumer would prefer to just get the keys | |
| | | * back. If the engine supports this it will set | |
| | | * the TAP_FLAG_NO_VALUE flag in each of the | |
| | | * tap packets returned. | |
| | | */ | |
| | | #define TAP_CONNECT_REQUEST_KEYS_ONLY 0x20 | |
| | | /** | |
| | | * The body contains a list of (vbucket_id, last_checkpoint | |
| | | _id) | |
| | | * pairs. This provides the checkpoint support in TAP strea | |
| | | ms. | |
| | | * The last checkpoint id represents the last checkpoint th | |
| | | at | |
| | | * was successfully persisted. | |
| | | */ | |
| | | #define TAP_CONNECT_CHECKPOINT 0x40 | |
| | | /** | |
| | | * The tap consumer is a registered tap client, which means | |
| | | that | |
| | | * the tap server will maintain its checkpoint cursor perma | |
| | | nently. | |
| | | */ | |
| | | #define TAP_CONNECT_REGISTERED_CLIENT 0x80 | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + 4]; | |
| | | } protocol_binary_request_tap_connect; | |
| | | | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | struct { | |
| | | uint16_t enginespecific_length; | |
| | | /* | |
| | | * The flag section support the following flags | |
| | | */ | |
| | | /** | |
| | | * Request that the consumer send a response packet | |
| | | * for this packet. The opaque field must be preserved | |
| | | * in the response. | |
| | | */ | |
| | | #define TAP_FLAG_ACK 0x01 | |
| | | /** | |
| | | * The value for the key is not included in the packet | |
| | | */ | |
| | | #define TAP_FLAG_NO_VALUE 0x02 | |
| | | uint16_t flags; | |
| | | uint8_t ttl; | |
| | | uint8_t res1; | |
| | | uint8_t res2; | |
| | | uint8_t res3; | |
| | | } tap; | |
| | | struct { | |
| | | uint32_t flags; | |
| | | uint32_t expiration; | |
| | | } item; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + 16]; | |
| | | } protocol_binary_request_tap_mutation; | |
| | | | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | struct { | |
| | | uint16_t enginespecific_length; | |
| | | /** | |
| | | * See the definition of the flags for | |
| | | * protocol_binary_request_tap_mutation for a descripti | |
| | | on | |
| | | * of the available flags. | |
| | | */ | |
| | | uint16_t flags; | |
| | | uint8_t ttl; | |
| | | uint8_t res1; | |
| | | uint8_t res2; | |
| | | uint8_t res3; | |
| | | } tap; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + 8]; | |
| | | } protocol_binary_request_tap_no_extras; | |
| | | | |
| | | typedef protocol_binary_request_tap_no_extras protocol_binary_request_t | |
| | | ap_delete; | |
| | | typedef protocol_binary_request_tap_no_extras protocol_binary_request_t | |
| | | ap_flush; | |
| | | typedef protocol_binary_request_tap_no_extras protocol_binary_request_t | |
| | | ap_opaque; | |
| | | typedef protocol_binary_request_tap_no_extras protocol_binary_request_t | |
| | | ap_vbucket_set; | |
| | | | |
| | | /** | |
| | | * Definition of the packet used by the scrub. | |
| | | */ | |
| | | typedef protocol_binary_request_no_extras protocol_binary_request_scrub | |
| | | ; | |
| | | | |
| | | /** | |
| | | * Definition of the packet returned from scrub. | |
| | | */ | |
| | | typedef protocol_binary_response_no_extras protocol_binary_response_scr | |
| | | ub; | |
| | | | |
| | | /** | |
| | | * Definition of the packet used by set vbucket | |
| | | */ | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_request_header header; | |
| | | struct { | |
| | | vbucket_state_t state; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_request_header) + sizeof(vbuck | |
| | | et_state_t)]; | |
| | | } protocol_binary_request_set_vbucket; | |
| | | /** | |
| | | * Definition of the packet returned from set vbucket | |
| | | */ | |
| | | typedef protocol_binary_response_no_extras protocol_binary_response_set | |
| | | _vbucket; | |
| | | /** | |
| | | * Definition of the packet used by del vbucket | |
| | | */ | |
| | | typedef protocol_binary_request_no_extras protocol_binary_request_del_v | |
| | | bucket; | |
| | | /** | |
| | | * Definition of the packet returned from del vbucket | |
| | | */ | |
| | | typedef protocol_binary_response_no_extras protocol_binary_response_del | |
| | | _vbucket; | |
| | | | |
| | | /** | |
| | | * Definition of the packet used by get vbucket | |
| | | */ | |
| | | typedef protocol_binary_request_no_extras protocol_binary_request_get_v | |
| | | bucket; | |
| | | | |
| | | /** | |
| | | * Definition of the packet returned from get vbucket | |
| | | */ | |
| | | typedef union { | |
| | | struct { | |
| | | protocol_binary_response_header header; | |
| | | struct { | |
| | | vbucket_state_t state; | |
| | | } body; | |
| | | } message; | |
| | | uint8_t bytes[sizeof(protocol_binary_response_header) + sizeof(vbuc | |
| | | ket_state_t)]; | |
| | | } protocol_binary_response_get_vbucket; | |
| | | | |
| | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| #endif /* PROTOCOL_BINARY_H */ | | #endif /* PROTOCOL_BINARY_H */ | |
| | | | |
End of changes. 10 change blocks. |
| 6 lines changed or deleted | | 318 lines changed or added | |
|
| storage.h | | storage.h | |
| | | | |
| skipping to change at line 59 | | skipping to change at line 59 | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_cas(memcached_st *ptr, | | memcached_return_t memcached_cas(memcached_st *ptr, | |
| const char *key, size_t key_length, | | const char *key, size_t key_length, | |
| const char *value, size_t value_length, | | const char *value, size_t value_length, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags, | | uint32_t flags, | |
| uint64_t cas); | | uint64_t cas); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_set_by_key(memcached_st *ptr, | | memcached_return_t memcached_set_by_key(memcached_st *ptr, | |
|
| const char *master_key, size_t mast
er_key_length, | | const char *group_key, size_t group
_key_length, | |
| const char *key, size_t key_length, | | const char *key, size_t key_length, | |
| const char *value, size_t value_len
gth, | | const char *value, size_t value_len
gth, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags); | | uint32_t flags); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_add_by_key(memcached_st *ptr, | | memcached_return_t memcached_add_by_key(memcached_st *ptr, | |
|
| const char *master_key, size_t mast
er_key_length, | | const char *group_key, size_t group
_key_length, | |
| const char *key, size_t key_length, | | const char *key, size_t key_length, | |
| const char *value, size_t value_len
gth, | | const char *value, size_t value_len
gth, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags); | | uint32_t flags); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_replace_by_key(memcached_st *ptr, | | memcached_return_t memcached_replace_by_key(memcached_st *ptr, | |
|
| const char *master_key, size_t
master_key_length, | | const char *group_key, size_t g
roup_key_length, | |
| const char *key, size_t key_len
gth, | | const char *key, size_t key_len
gth, | |
| const char *value, size_t value
_length, | | const char *value, size_t value
_length, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags); | | uint32_t flags); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_prepend_by_key(memcached_st *ptr, | | memcached_return_t memcached_prepend_by_key(memcached_st *ptr, | |
|
| const char *master_key, size_t
master_key_length, | | const char *group_key, size_t g
roup_key_length, | |
| const char *key, size_t key_len
gth, | | const char *key, size_t key_len
gth, | |
| const char *value, size_t value
_length, | | const char *value, size_t value
_length, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags); | | uint32_t flags); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_append_by_key(memcached_st *ptr, | | memcached_return_t memcached_append_by_key(memcached_st *ptr, | |
|
| const char *master_key, size_t m
aster_key_length, | | const char *group_key, size_t gr
oup_key_length, | |
| const char *key, size_t key_leng
th, | | const char *key, size_t key_leng
th, | |
| const char *value, size_t value_
length, | | const char *value, size_t value_
length, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags); | | uint32_t flags); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_cas_by_key(memcached_st *ptr, | | memcached_return_t memcached_cas_by_key(memcached_st *ptr, | |
|
| const char *master_key, size_t mast
er_key_length, | | const char *group_key, size_t group
_key_length, | |
| const char *key, size_t key_length, | | const char *key, size_t key_length, | |
| const char *value, size_t value_len
gth, | | const char *value, size_t value_len
gth, | |
| time_t expiration, | | time_t expiration, | |
| uint32_t flags, | | uint32_t flags, | |
| uint64_t cas); | | uint64_t cas); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|