| constants.h | | constants.h | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 71 | |
| MEMCACHED_FETCH_NOTFINISHED, | | MEMCACHED_FETCH_NOTFINISHED, | |
| MEMCACHED_TIMEOUT, | | MEMCACHED_TIMEOUT, | |
| MEMCACHED_BUFFERED, | | MEMCACHED_BUFFERED, | |
| 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_FAILURE, | |
| | | MEMCACHED_AUTH_CONTINUE, | |
| MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ | | MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */ | |
| } memcached_return_t; | | } memcached_return_t; | |
| | | | |
| typedef enum { | | typedef enum { | |
| 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_MAX | | MEMCACHED_DISTRIBUTION_CONSISTENT_MAX | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 119 | |
| MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK, | | MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK, | |
| MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, | | MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, | |
| 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_KEEPIDLE, | |
| 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. 2 change blocks. |
| 0 lines changed or deleted | | 5 lines changed or added | |
|
| memcached.h | | memcached.h | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| #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/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/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> | |
| | | | |
| 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 MEMCACHED_BITFIELD; | | bool is_purging:1; | |
| bool is_processing_input MEMCACHED_BITFIELD; | | bool is_processing_input: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 MEMCACHED_BITFIELD; | | bool auto_eject_hosts:1; | |
| bool binary_protocol MEMCACHED_BITFIELD; | | bool binary_protocol:1; | |
| bool buffer_requests MEMCACHED_BITFIELD; | | bool buffer_requests:1; | |
| bool cork MEMCACHED_BITFIELD; | | bool cork:1; | |
| bool hash_with_prefix_key MEMCACHED_BITFIELD; | | bool hash_with_prefix_key:1; | |
| bool ketama_weighted MEMCACHED_BITFIELD; | | bool ketama_weighted:1; | |
| bool no_block MEMCACHED_BITFIELD; | | bool no_block:1; | |
| bool no_reply MEMCACHED_BITFIELD; | | bool no_reply:1; | |
| bool randomize_replica_read MEMCACHED_BITFIELD; | | bool randomize_replica_read:1; | |
| bool reuse_memory MEMCACHED_BITFIELD; | | bool reuse_memory:1; | |
| bool support_cas MEMCACHED_BITFIELD; | | bool support_cas:1; | |
| bool tcp_nodelay MEMCACHED_BITFIELD; | | bool tcp_nodelay:1; | |
| bool use_cache_lookups MEMCACHED_BITFIELD; | | bool use_cache_lookups:1; | |
| bool use_sort_hosts MEMCACHED_BITFIELD; | | bool use_sort_hosts:1; | |
| bool use_udp MEMCACHED_BITFIELD; | | bool use_udp:1; | |
| bool verify_key MEMCACHED_BITFIELD; | | bool verify_key: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 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; | |
| int cached_errno; | | 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 | | 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 | | time_t next_distribution_rebuild; // Ketama | |
| size_t prefix_key_length; | | size_t prefix_key_length; | |
| | | | |
| skipping to change at line 122 | | skipping to change at line 127 | |
| 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; | |
| char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE]; | | char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE]; | |
| struct { | | struct { | |
|
| bool is_allocated MEMCACHED_BITFIELD; | | 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); | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 157 | |
| | | | |
| 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); | |
| | | | |
|
| | | LIBMEMCACHED_API | |
| | | memcached_return_t memcached_push(memcached_st *destination, const memcache | |
| | | d_st *source); | |
| | | | |
| | | LIBMEMCACHED_API | |
| | | memcached_server_instance_st memcached_server_instance_by_position(const me | |
| | | mcached_st *ptr, uint32_t server_key); | |
| | | | |
| | | LIBMEMCACHED_API | |
| | | uint32_t memcached_server_count(const memcached_st *); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } // extern "C" | | } // extern "C" | |
| #endif | | #endif | |
| | | | |
|
| // Local Only Inline | | | |
| static inline memcached_server_st *memcached_server_instance_fetch(memcache | | | |
| d_st *ptr, uint32_t server_key) | | | |
| { | | | |
| return &ptr->servers[server_key]; | | | |
| } | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| class Memcached : private memcached_st { | | class Memcached : private memcached_st { | |
| public: | | public: | |
| | | | |
| Memcached() | | Memcached() | |
| { | | { | |
| memcached_create(this); | | memcached_create(this); | |
| } | | } | |
| | | | |
| ~Memcached() | | ~Memcached() | |
| | | | |
End of changes. 9 change blocks. |
| 26 lines changed or deleted | | 36 lines changed or added | |
|
| memcached.hpp | | memcached.hpp | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| * are needed, they will be created from this class). | | * are needed, they will be created from this class). | |
| */ | | */ | |
| class Memcache | | class Memcache | |
| { | | { | |
| public: | | public: | |
| | | | |
| Memcache() | | Memcache() | |
| : | | : | |
| servers_list(), | | servers_list(), | |
| memc(), | | memc(), | |
|
| servers(NULL), | | | |
| result() | | result() | |
| { | | { | |
| memcached_create(&memc); | | memcached_create(&memc); | |
| } | | } | |
| | | | |
| Memcache(const std::string &in_servers_list) | | Memcache(const std::string &in_servers_list) | |
| : | | : | |
| servers_list(in_servers_list), | | servers_list(in_servers_list), | |
| memc(), | | memc(), | |
|
| servers(NULL), | | | |
| result() | | result() | |
| { | | { | |
| memcached_create(&memc); | | memcached_create(&memc); | |
|
| servers= memcached_servers_parse(servers_list.c_str()); | | init(); | |
| memcached_server_push(&memc, servers); | | | |
| } | | } | |
| | | | |
| Memcache(const std::string &hostname, | | Memcache(const std::string &hostname, | |
| in_port_t port) | | in_port_t port) | |
| : | | : | |
| servers_list(), | | servers_list(), | |
| memc(), | | memc(), | |
|
| servers(NULL), | | | |
| result() | | result() | |
| { | | { | |
| memcached_create(&memc); | | memcached_create(&memc); | |
|
| | | | |
| servers_list.append(hostname); | | servers_list.append(hostname); | |
| servers_list.append(":"); | | servers_list.append(":"); | |
| std::ostringstream strsmt; | | std::ostringstream strsmt; | |
| strsmt << port; | | strsmt << port; | |
| servers_list.append(strsmt.str()); | | servers_list.append(strsmt.str()); | |
|
| servers= memcached_servers_parse(servers_list.c_str()); | | | |
| memcached_server_push(&memc, servers); | | init(); | |
| } | | } | |
| | | | |
| Memcache(memcached_st *clone) | | Memcache(memcached_st *clone) | |
| : | | : | |
| servers_list(), | | servers_list(), | |
| memc(), | | memc(), | |
|
| servers(NULL), | | | |
| result() | | result() | |
| { | | { | |
| memcached_clone(&memc, clone); | | memcached_clone(&memc, clone); | |
| } | | } | |
| | | | |
| Memcache(const Memcache &rhs) | | Memcache(const Memcache &rhs) | |
| : | | : | |
| servers_list(rhs.servers_list), | | servers_list(rhs.servers_list), | |
| memc(), | | memc(), | |
|
| servers(NULL), | | | |
| result() | | result() | |
| { | | { | |
| memcached_clone(&memc, const_cast<memcached_st *>(&rhs.getImpl())); | | memcached_clone(&memc, const_cast<memcached_st *>(&rhs.getImpl())); | |
|
| servers= memcached_servers_parse(servers_list.c_str()); | | init(); | |
| memcached_server_push(&memc, servers); | | | |
| } | | } | |
| | | | |
| Memcache &operator=(const Memcache &rhs) | | Memcache &operator=(const Memcache &rhs) | |
| { | | { | |
| if (this != &rhs) | | if (this != &rhs) | |
| { | | { | |
| memcached_clone(&memc, const_cast<memcached_st *>(&rhs.getImpl())); | | memcached_clone(&memc, const_cast<memcached_st *>(&rhs.getImpl())); | |
|
| servers= memcached_servers_parse(servers_list.c_str()); | | init(); | |
| memcached_server_push(&memc, servers); | | | |
| } | | } | |
|
| | | | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| ~Memcache() | | ~Memcache() | |
| { | | { | |
| memcached_free(&memc); | | memcached_free(&memc); | |
|
| memcached_server_list_free(servers); | | } | |
| | | | |
| | | void init() | |
| | | { | |
| | | memcached_server_st *servers; | |
| | | servers= memcached_servers_parse(servers_list.c_str()); | |
| | | memcached_server_push(&memc, servers); | |
| | | memcached_server_free(servers); | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Get the internal memcached_st * | | * Get the internal memcached_st * | |
| */ | | */ | |
| memcached_st &getImpl() | | memcached_st &getImpl() | |
| { | | { | |
| return memc; | | return memc; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 177 | | skipping to change at line 178 | |
| | | | |
| /** | | /** | |
| * Set the list of memcached servers to use. | | * Set the list of memcached servers to use. | |
| * | | * | |
| * @param[in] in_servers_list list of servers | | * @param[in] in_servers_list list of servers | |
| * @return true on success; false otherwise | | * @return true on success; false otherwise | |
| */ | | */ | |
| bool setServers(const std::string &in_servers_list) | | bool setServers(const std::string &in_servers_list) | |
| { | | { | |
| servers_list.assign(in_servers_list); | | servers_list.assign(in_servers_list); | |
|
| servers= memcached_servers_parse(in_servers_list.c_str()); | | init(); | |
| memcached_server_push(&memc, servers); | | | |
| return (servers == NULL); | | return (memcached_server_count(&memc)); | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Add a server to the list of memcached servers to use. | | * Add a server to the list of memcached servers to use. | |
| * | | * | |
| * @param[in] server_name name of the server to add | | * @param[in] server_name name of the server to add | |
| * @param[in] port port number of server to add | | * @param[in] port port number of server to add | |
| * @return true on success; false otherwise | | * @return true on success; false otherwise | |
| */ | | */ | |
| bool addServer(const std::string &server_name, in_port_t port) | | bool addServer(const std::string &server_name, in_port_t port) | |
| { | | { | |
| memcached_return_t rc; | | memcached_return_t rc; | |
|
| std::ostringstream strstm; | | | |
| servers_list.append(","); | | rc= memcached_server_add(&memc, server_name.c_str(), port); | |
| servers_list.append(server_name); | | | |
| servers_list.append(":"); | | | |
| strstm << port; | | | |
| servers_list.append(strstm.str()); | | | |
| servers= memcached_server_list_append(servers, | | | |
| server_name.c_str(), | | | |
| port, | | | |
| &rc); | | | |
| memcached_server_push(&memc, servers); | | | |
| return (rc == MEMCACHED_SUCCESS); | | return (rc == MEMCACHED_SUCCESS); | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Remove a server from the list of memcached servers to use. | | * Remove a server from the list of memcached servers to use. | |
| * | | * | |
| * @param[in] server_name name of the server to remove | | * @param[in] server_name name of the server to remove | |
| * @param[in] port port number of server to remove | | * @param[in] port port number of server to remove | |
| * @return true on success; false otherwise | | * @return true on success; false otherwise | |
| */ | | */ | |
| bool removeServer(const std::string &server_name, in_port_t port) | | bool removeServer(const std::string &server_name, in_port_t port) | |
| { | | { | |
| std::string tmp_str; | | std::string tmp_str; | |
| std::ostringstream strstm; | | std::ostringstream strstm; | |
| tmp_str.append(","); | | tmp_str.append(","); | |
| tmp_str.append(server_name); | | tmp_str.append(server_name); | |
| tmp_str.append(":"); | | tmp_str.append(":"); | |
| strstm << port; | | strstm << port; | |
| tmp_str.append(strstm.str()); | | tmp_str.append(strstm.str()); | |
|
| memcached_server_st *server= memcached_servers_parse(tmp_str.c_str()); | | | |
| | | | |
|
| memcached_return_t rc= memcached_server_remove(server); | | //memcached_return_t rc= memcached_server_remove(server); | |
| | | | |
|
| return (rc == MEMCACHED_SUCCESS); | | return false; | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Fetches an individual value from the server. mget() must always | | * Fetches an individual value from the server. mget() must always | |
| * be called before using this method. | | * be called before using this method. | |
| * | | * | |
| * @param[in] key key of object to fetch | | * @param[in] key key of object to fetch | |
| * @param[out] ret_val store returned object in this vector | | * @param[out] ret_val store returned object in this vector | |
| * @return a memcached return structure | | * @return a memcached return structure | |
| */ | | */ | |
| | | | |
| skipping to change at line 968 | | skipping to change at line 960 | |
| } | | } | |
| | | | |
| uint32_t server_count= memcached_server_count(&memc); | | uint32_t server_count= memcached_server_count(&memc); | |
| | | | |
| /* | | /* | |
| * For each memcached server, construct a std::map for its stats and ad
d | | * For each memcached server, construct a std::map for its stats and ad
d | |
| * it to the std::map of overall stats. | | * it to the std::map of overall stats. | |
| */ | | */ | |
| for (uint32_t x= 0; x < server_count; x++) | | for (uint32_t x= 0; x < server_count; x++) | |
| { | | { | |
|
| | | memcached_server_instance_st instance= | |
| | | memcached_server_instance_by_position(&memc, x); | |
| std::ostringstream strstm; | | std::ostringstream strstm; | |
|
| std::string server_name(memcached_server_name(&memc, servers[x])); | | std::string server_name(memcached_server_name(instance)); | |
| server_name.append(":"); | | server_name.append(":"); | |
|
| strstm << memcached_server_port(&memc, servers[x]); | | strstm << memcached_server_port(instance); | |
| server_name.append(strstm.str()); | | server_name.append(strstm.str()); | |
| | | | |
| std::map<std::string, std::string> server_stats; | | std::map<std::string, std::string> server_stats; | |
| char **list= NULL; | | char **list= NULL; | |
| char **ptr= NULL; | | char **ptr= NULL; | |
| | | | |
| list= memcached_stat_get_keys(&memc, &stats[x], &rc); | | list= memcached_stat_get_keys(&memc, &stats[x], &rc); | |
| for (ptr= list; *ptr; ptr++) | | for (ptr= list; *ptr; ptr++) | |
| { | | { | |
| char *value= memcached_stat_get_value(&memc, &stats[x], *ptr, &rc); | | char *value= memcached_stat_get_value(&memc, &stats[x], *ptr, &rc); | |
| | | | |
| skipping to change at line 998 | | skipping to change at line 992 | |
| } | | } | |
| | | | |
| memcached_stat_free(&memc, stats); | | memcached_stat_free(&memc, stats); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| private: | | private: | |
| | | | |
| std::string servers_list; | | std::string servers_list; | |
| memcached_st memc; | | memcached_st memc; | |
|
| memcached_server_st *servers; | | | |
| memcached_result_st result; | | memcached_result_st result; | |
| }; | | }; | |
| | | | |
| } | | } | |
| | | | |
| #endif /* LIBMEMCACHEDPP_H */ | | #endif /* LIBMEMCACHEDPP_H */ | |
| | | | |
End of changes. 21 change blocks. |
| 34 lines changed or deleted | | 27 lines changed or added | |
|
| protocol_binary.h | | protocol_binary.h | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND | | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND | |
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TO
RT | | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TO
RT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| /* | | /* | |
| * 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@gmail.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 <stdint.h> | | /** | |
| | | * \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. | |
| */ | | */ | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 75 | |
| * 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_AUTH_ERROR = 0x20, | |
| | | 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_PAUSE = 0xfe00, | | PROTOCOL_BINARY_RESPONSE_PAUSE = 0xfe00, | |
| PROTOCOL_BINARY_RESPONSE_EIO = 0xff00 | | PROTOCOL_BINARY_RESPONSE_EIO = 0xff00 | |
|
| | | | |
| } 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 112 | | skipping to change at line 118 | |
| 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_SASL_LIST_MECHS = 0x20, | |
| | | PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21, | |
| | | PROTOCOL_BINARY_CMD_SASL_STEP = 0x22, | |
| | | | |
| /* These commands are used for range operations and exist within | | /* 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, | |
| PROTOCOL_BINARY_CMD_RSET = 0x31, | | PROTOCOL_BINARY_CMD_RSET = 0x31, | |
| 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, | |
| | | | |
| skipping to change at line 417 | | skipping to change at line 427 | |
| typedef protocol_binary_request_rangeop protocol_binary_request_rappend
q; | | typedef protocol_binary_request_rangeop protocol_binary_request_rappend
q; | |
| 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; | |
| | | | |
|
| | | /** | |
| | | * @} | |
| | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| #endif /* PROTOCOL_BINARY_H */ | | #endif /* PROTOCOL_BINARY_H */ | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 16 lines changed or added | |
|
| result.h | | result.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| | | | |
| struct memcached_result_st { | | struct memcached_result_st { | |
| uint32_t item_flags; | | uint32_t item_flags; | |
| time_t item_expiration; | | time_t item_expiration; | |
| size_t key_length; | | size_t key_length; | |
| uint64_t item_cas; | | uint64_t item_cas; | |
| const memcached_st *root; | | const memcached_st *root; | |
| memcached_string_st value; | | memcached_string_st value; | |
| char item_key[MEMCACHED_MAX_KEY]; | | char item_key[MEMCACHED_MAX_KEY]; | |
| struct { | | struct { | |
|
| bool is_allocated MEMCACHED_BITFIELD; | | bool is_allocated:1; | |
| bool is_initialized MEMCACHED_BITFIELD; | | bool is_initialized:1; | |
| } options; | | } options; | |
| /* Add result callback function */ | | /* Add result callback function */ | |
| }; | | }; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /* Result Struct */ | | /* Result Struct */ | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void memcached_result_free(memcached_result_st *result); | | void memcached_result_free(memcached_result_st *result); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void memcached_result_reset(memcached_result_st *ptr); | | void memcached_result_reset(memcached_result_st *ptr); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_result_st *memcached_result_create(const memcached_st *ptr, | | memcached_result_st *memcached_result_create(const memcached_st *ptr, | |
| memcached_result_st *result); | | memcached_result_st *result); | |
| | | | |
|
| static inline const char *memcached_result_key_value(const memcached_result | | LIBMEMCACHED_API | |
| _st *self) | | const char *memcached_result_key_value(const memcached_result_st *self); | |
| { | | | |
| return self->key_length ? self->item_key : NULL; | | LIBMEMCACHED_API | |
| } | | size_t memcached_result_key_length(const memcached_result_st *self); | |
| | | | |
| static inline size_t memcached_result_key_length(const memcached_result_st | | LIBMEMCACHED_API | |
| *self) | | const char *memcached_result_value(const memcached_result_st *self); | |
| { | | | |
| return self->key_length; | | LIBMEMCACHED_API | |
| } | | size_t memcached_result_length(const memcached_result_st *self); | |
| | | | |
| static inline const char *memcached_result_value(const memcached_result_st | | LIBMEMCACHED_API | |
| *self) | | uint32_t memcached_result_flags(const memcached_result_st *self); | |
| { | | | |
| const memcached_string_st *sptr= &self->value; | | LIBMEMCACHED_API | |
| return memcached_string_value(sptr); | | uint64_t memcached_result_cas(const memcached_result_st *self); | |
| } | | | |
| | | | |
| static inline size_t memcached_result_length(const memcached_result_st *sel | | | |
| f) | | | |
| { | | | |
| const memcached_string_st *sptr= &self->value; | | | |
| return memcached_string_length(sptr); | | | |
| } | | | |
| | | | |
| static inline uint32_t memcached_result_flags(const memcached_result_st *se | | | |
| lf) | | | |
| { | | | |
| return self->item_flags; | | | |
| } | | | |
| | | | |
| static inline uint64_t memcached_result_cas(const memcached_result_st *self | | | |
| ) | | | |
| { | | | |
| return self->item_cas; | | | |
| } | | | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_result_set_value(memcached_result_st *ptr, con
st char *value, size_t length); | | memcached_return_t memcached_result_set_value(memcached_result_st *ptr, con
st char *value, size_t length); | |
| | | | |
|
| static inline void memcached_result_set_flags(memcached_result_st *self, ui | | LIBMEMCACHED_API | |
| nt32_t flags) | | void memcached_result_set_flags(memcached_result_st *self, uint32_t flags); | |
| { | | | |
| self->item_flags= flags; | | LIBMEMCACHED_API | |
| } | | void memcached_result_set_expiration(memcached_result_st *self, time_t expi | |
| | | ration); | |
| static inline void memcached_result_set_expiration(memcached_result_st *sel | | | |
| f, time_t expiration) | | | |
| { | | | |
| self->item_expiration= expiration; | | | |
| } | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } // extern "C" | | } // extern "C" | |
| #endif | | #endif | |
| | | | |
| #endif /* __LIBMEMCACHED_RESULT_H__ */ | | #endif /* __LIBMEMCACHED_RESULT_H__ */ | |
| | | | |
End of changes. 3 change blocks. |
| 50 lines changed or deleted | | 25 lines changed or added | |
|
| server.h | | server.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * | | * | |
| * Summary: String structure used for libmemcached. | | * Summary: String structure used for libmemcached. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef __LIBMEMCACHED_SERVER_H__ | | #ifndef __LIBMEMCACHED_SERVER_H__ | |
| #define __LIBMEMCACHED_SERVER_H__ | | #define __LIBMEMCACHED_SERVER_H__ | |
| | | | |
| struct memcached_server_st { | | struct memcached_server_st { | |
| struct { | | struct { | |
|
| bool is_allocated MEMCACHED_BITFIELD; | | bool is_allocated:1; | |
| bool is_initialized MEMCACHED_BITFIELD; | | bool is_initialized:1; | |
| bool sockaddr_inited MEMCACHED_BITFIELD; | | bool sockaddr_inited:1; | |
| bool is_shutting_down MEMCACHED_BITFIELD; | | bool is_shutting_down:1; | |
| } options; | | } options; | |
| uint32_t number_of_hosts; | | uint32_t number_of_hosts; | |
| uint32_t cursor_active; | | uint32_t cursor_active; | |
| in_port_t port; | | in_port_t port; | |
| int cached_errno; | | int cached_errno; | |
| int fd; | | int fd; | |
| uint32_t io_bytes_sent; /* # bytes sent since last read */ | | uint32_t io_bytes_sent; /* # bytes sent since last read */ | |
| uint32_t server_failure_counter; | | uint32_t server_failure_counter; | |
| uint32_t weight; | | uint32_t weight; | |
| struct { // Place any "state" sort variables in here. | | struct { // Place any "state" sort variables in here. | |
|
| bool is_corked; | | bool is_corked:1; | |
| | | bool is_dead:1; | |
| } state; | | } state; | |
| uint8_t major_version; | | uint8_t major_version; | |
| uint8_t micro_version; | | uint8_t micro_version; | |
| uint8_t minor_version; | | uint8_t minor_version; | |
| memcached_connection_t type; | | memcached_connection_t type; | |
| char *read_ptr; | | char *read_ptr; | |
| char *cached_server_error; | | char *cached_server_error; | |
| size_t read_buffer_length; | | size_t read_buffer_length; | |
| size_t read_data_length; | | size_t read_data_length; | |
| size_t write_buffer_offset; | | size_t write_buffer_offset; | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 57 | |
| char read_buffer[MEMCACHED_MAX_BUFFER]; | | char read_buffer[MEMCACHED_MAX_BUFFER]; | |
| char write_buffer[MEMCACHED_MAX_BUFFER]; | | char write_buffer[MEMCACHED_MAX_BUFFER]; | |
| char hostname[NI_MAXHOST]; | | char hostname[NI_MAXHOST]; | |
| }; | | }; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| memcached_return_t memcached_server_cursor(memcached_st *ptr, | | memcached_return_t memcached_server_cursor(const memcached_st *ptr, | |
| memcached_server_fn *callback, | | const memcached_server_fn *callb | |
| | | ack, | |
| void *context, | | void *context, | |
| uint32_t number_of_callbacks); | | uint32_t number_of_callbacks); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| memcached_server_st *memcached_server_by_key(memcached_st *ptr, | | memcached_server_instance_st memcached_server_by_key(const memcached_st * | |
| const char *key, | | ptr, | |
| size_t key_length, | | const char *key, | |
| memcached_return_t *error); | | size_t key_length, | |
| | | memcached_return_t | |
| LIBMEMCACHED_API | | *error); | |
| const char *memcached_server_error(memcached_server_st *ptr); | | | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void memcached_server_error_reset(memcached_server_st *ptr); | | void memcached_server_error_reset(memcached_server_st *ptr); | |
| | | | |
|
| /* These should not currently be used by end users */ | | | |
| /* TODO: Is the above comment valid? If so, how can we unit test these if t | | | |
| hey | | | |
| * aren't exported. If not, we should remove the comment */ | | | |
| | | | |
| LIBMEMCACHED_LOCAL | | | |
| memcached_server_st *memcached_server_create_with(const memcached_st *memc, | | | |
| memcached_server_st *host | | | |
| , | | | |
| const char *hostname, | | | |
| in_port_t port, | | | |
| uint32_t weight, | | | |
| memcached_connection_t ty | | | |
| pe); | | | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| void memcached_server_free(memcached_server_st *ptr); | | void memcached_server_free(memcached_server_st *ptr); | |
| | | | |
| LIBMEMCACHED_LOCAL | | LIBMEMCACHED_LOCAL | |
| memcached_server_st *memcached_server_clone(memcached_server_st *destinatio
n, | | memcached_server_st *memcached_server_clone(memcached_server_st *destinatio
n, | |
| const memcached_server_st *sour
ce); | | const memcached_server_st *sour
ce); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| memcached_return_t memcached_server_remove(memcached_server_st *st_ptr); | | memcached_server_instance_st memcached_server_get_last_disconnect(const mem | |
| | | cached_st *ptr); | |
| LIBMEMCACHED_API | | | |
| memcached_server_st *memcached_server_get_last_disconnect(memcached_st *ptr | | | |
| ); | | | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_server_add_udp(memcached_st *ptr, | | memcached_return_t memcached_server_add_udp(memcached_st *ptr, | |
| const char *hostname, | | const char *hostname, | |
| in_port_t port); | | in_port_t port); | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_server_add_unix_socket(memcached_st *ptr, | | memcached_return_t memcached_server_add_unix_socket(memcached_st *ptr, | |
| const char *filename); | | const char *filename); | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_server_add(memcached_st *ptr, | | memcached_return_t memcached_server_add(memcached_st *ptr, | |
| | | | |
| skipping to change at line 122 | | skipping to change at line 105 | |
| in_port_t port, | | in_port_t port, | |
| uint32_t weight); | | uint32_t weight); | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_server_add_unix_socket_with_weight(memcached_s
t *ptr, | | memcached_return_t memcached_server_add_unix_socket_with_weight(memcached_s
t *ptr, | |
| const char
*filename, | | const char
*filename, | |
| uint32_t we
ight); | | uint32_t we
ight); | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
| memcached_return_t memcached_server_add_with_weight(memcached_st *ptr, cons
t char *hostname, | | memcached_return_t memcached_server_add_with_weight(memcached_st *ptr, cons
t char *hostname, | |
| in_port_t port, | | in_port_t port, | |
| uint32_t weight); | | uint32_t weight); | |
|
| /* Server List Public functions */ | | | |
| | | | |
|
| | | /** | |
| | | Operations on Single Servers. | |
| | | */ | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| void memcached_server_list_free(memcached_server_st *ptr); | | uint32_t memcached_server_response_count(memcached_server_instance_st self)
; | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| memcached_return_t memcached_server_push(memcached_st *ptr, memcached_serve
r_st *list); | | const char *memcached_server_name(memcached_server_instance_st self); | |
| | | | |
| LIBMEMCACHED_API | | LIBMEMCACHED_API | |
|
| memcached_server_st *memcached_server_list_append(memcached_server_st *ptr, | | in_port_t memcached_server_port(memcached_server_instance_st self); | |
| const char *hostname, | | | |
| in_port_t port, | | | |
| memcached_return_t *error | | | |
| ); | | | |
| LIBMEMCACHED_API | | | |
| memcached_server_st *memcached_server_list_append_with_weight(memcached_ser | | | |
| ver_st *ptr, | | | |
| const char *h | | | |
| ostname, | | | |
| in_port_t por | | | |
| t, | | | |
| uint32_t weig | | | |
| ht, | | | |
| memcached_ret | | | |
| urn_t *error); | | | |
| LIBMEMCACHED_API | | | |
| unsigned int memcached_server_list_count(memcached_server_st *ptr); | | | |
| | | | |
|
| // Local Only Inline | | LIBMEMCACHED_API | |
| static inline uint32_t memcached_servers_count(memcached_server_st *servers | | const char *memcached_server_error(memcached_server_instance_st ptr); | |
| ) | | | |
| { | | | |
| return servers->number_of_hosts; | | | |
| } | | | |
| | | | |
| // Local Only Inline | | | |
| static inline uint32_t memcached_servers_set_count(memcached_server_st *ser | | | |
| vers, uint32_t count) | | | |
| { | | | |
| return servers->number_of_hosts= count; | | | |
| } | | | |
| | | | |
| #define memcached_server_count(A) (A)->number_of_hosts | | | |
| #define memcached_server_name(A,B) (B).hostname | | | |
| #define memcached_server_port(A,B) (B).port | | | |
| #define memcached_server_list(A) (A)->servers | | | |
| #define memcached_server_list_set(A,B) (A)->servers=(B) | | | |
| #define memcached_server_response_count(A) (A)->cursor_active | | | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } // extern "C" | | } // extern "C" | |
| #endif | | #endif | |
| | | | |
| #endif /* __LIBMEMCACHED_SERVER_H__ */ | | #endif /* __LIBMEMCACHED_SERVER_H__ */ | |
| | | | |
End of changes. 12 change blocks. |
| 75 lines changed or deleted | | 25 lines changed or added | |
|
| string.h | | string.h | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| unset this flag. | | unset this flag. | |
| 3) A string always has a root. | | 3) A string always has a root. | |
| */ | | */ | |
| | | | |
| struct memcached_string_st { | | struct memcached_string_st { | |
| char *end; | | char *end; | |
| char *string; | | char *string; | |
| size_t current_size; | | size_t current_size; | |
| const memcached_st *root; | | const memcached_st *root; | |
| struct { | | struct { | |
|
| bool is_allocated MEMCACHED_BITFIELD; | | bool is_allocated:1; | |
| bool is_initialized MEMCACHED_BITFIELD; | | bool is_initialized:1; | |
| } options; | | } options; | |
| }; | | }; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| LIBMEMCACHED_LOCAL | | LIBMEMCACHED_LOCAL | |
| memcached_string_st *memcached_string_create(const memcached_st *ptr, | | memcached_string_st *memcached_string_create(const memcached_st *ptr, | |
| memcached_string_st *string, | | memcached_string_st *string, | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| char character); | | char character); | |
| LIBMEMCACHED_LOCAL | | LIBMEMCACHED_LOCAL | |
| memcached_return_t memcached_string_append(memcached_string_st *string, | | memcached_return_t memcached_string_append(memcached_string_st *string, | |
| const char *value, size_t length
); | | const char *value, size_t length
); | |
| LIBMEMCACHED_LOCAL | | LIBMEMCACHED_LOCAL | |
| memcached_return_t memcached_string_reset(memcached_string_st *string); | | memcached_return_t memcached_string_reset(memcached_string_st *string); | |
| | | | |
| LIBMEMCACHED_LOCAL | | LIBMEMCACHED_LOCAL | |
| void memcached_string_free(memcached_string_st *string); | | void memcached_string_free(memcached_string_st *string); | |
| | | | |
|
| static inline size_t memcached_string_length(const memcached_string_st *sel | | LIBMEMCACHED_LOCAL | |
| f) | | size_t memcached_string_length(const memcached_string_st *self); | |
| { | | | |
| return (size_t)(self->end - self->string); | | | |
| } | | | |
| | | | |
|
| static inline size_t memcached_string_size(const memcached_string_st *self) | | LIBMEMCACHED_LOCAL | |
| { | | size_t memcached_string_size(const memcached_string_st *self); | |
| return self->current_size; | | | |
| } | | | |
| | | | |
|
| static inline const char *memcached_string_value(const memcached_string_st | | LIBMEMCACHED_LOCAL | |
| *self) | | const char *memcached_string_value(const memcached_string_st *self); | |
| { | | | |
| return self->string; | | | |
| } | | | |
| | | | |
|
| static inline char *memcached_string_value_mutable(const memcached_string_s | | LIBMEMCACHED_LOCAL | |
| t *self) | | char *memcached_string_value_mutable(const memcached_string_st *self); | |
| { | | | |
| return self->string; | | | |
| } | | | |
| | | | |
|
| #define memcached_string_set_length(A, B) (A)->end= (A)->string + B | | LIBMEMCACHED_LOCAL | |
| | | void memcached_string_set_length(memcached_string_st *self, size_t length); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* __LIBMEMCACHED_STRING_H__ */ | | #endif /* __LIBMEMCACHED_STRING_H__ */ | |
| | | | |
End of changes. 6 change blocks. |
| 22 lines changed or deleted | | 12 lines changed or added | |
|