1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
6 * Copyright (C) 2006-2009 Brian Aker All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following disclaimer
17 * in the documentation and/or other materials provided with the
20 * * The names of its contributors may not be used to endorse or
21 * promote products derived from this software without specific prior
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 #include <sys/types.h>
45 #if !defined(__cplusplus)
49 #include <libmemcached/visibility.h>
50 #include <libmemcached/configure.h>
51 #include <libmemcached/platform.h>
52 #include <libmemcached/constants.h>
53 #include <libmemcached/return.h>
54 #include <libmemcached/types.h>
55 #include <libmemcached/string.h>
56 #include <libmemcached/array.h>
57 #include <libmemcached/error.h>
58 #include <libmemcached/stats.h>
59 #include <libhashkit/hashkit.h>
61 // Everything above this line must be in the order specified.
62 #include <libmemcached/allocators.h>
63 #include <libmemcached/analyze.h>
64 #include <libmemcached/auto.h>
65 #include <libmemcached/behavior.h>
66 #include <libmemcached/callback.h>
67 #include <libmemcached/delete.h>
68 #include <libmemcached/dump.h>
69 #include <libmemcached/fetch.h>
70 #include <libmemcached/flush.h>
71 #include <libmemcached/flush_buffers.h>
72 #include <libmemcached/get.h>
73 #include <libmemcached/hash.h>
74 #include <libmemcached/options.h>
75 #include <libmemcached/parse.h>
76 #include <libmemcached/quit.h>
77 #include <libmemcached/result.h>
78 #include <libmemcached/server.h>
79 #include <libmemcached/server_list.h>
80 #include <libmemcached/storage.h>
81 #include <libmemcached/strerror.h>
82 #include <libmemcached/verbosity.h>
83 #include <libmemcached/version.h>
84 #include <libmemcached/sasl.h>
88 @note these are static and should not change without a call to behavior.
92 bool is_processing_input
:1;
93 bool is_time_for_rebuild
:1;
97 // Everything below here is pretty static.
98 bool auto_eject_hosts
:1;
99 bool binary_protocol
:1;
100 bool buffer_requests
:1;
101 bool hash_with_namespace
:1;
102 bool no_block
:1; // Don't block
104 bool randomize_replica_read
:1;
107 bool use_sort_hosts
:1;
110 bool tcp_keepalive
:1;
113 memcached_server_distribution_t distribution
;
115 uint32_t number_of_hosts
;
116 memcached_server_st
*servers
;
117 memcached_server_st
*last_disconnected_server
;
120 uint32_t server_failure_limit
;
121 uint32_t io_msg_watermark
;
122 uint32_t io_bytes_watermark
;
123 uint32_t io_key_prefetch
;
124 uint32_t tcp_keepidle
;
125 int32_t poll_timeout
;
126 int32_t connect_timeout
;
127 int32_t retry_timeout
;
132 uint32_t number_of_replicas
;
133 memcached_result_st result
;
137 uint32_t continuum_count
; // Ketama
138 uint32_t continuum_points_counter
; // Ketama
139 time_t next_distribution_rebuild
; // Ketama
140 memcached_continuum_item_st
*continuum
; // Ketama
143 struct memcached_virtual_bucket_t
*virtual_bucket
;
145 struct memcached_allocator_t allocators
;
147 memcached_clone_fn on_clone
;
148 memcached_cleanup_fn on_cleanup
;
149 memcached_trigger_key_fn get_key_failure
;
150 memcached_trigger_delete_key_fn delete_trigger
;
151 memcached_callback_st
*callbacks
;
152 struct memcached_sasl_st sasl
;
153 struct memcached_error_t
*error_messages
;
154 struct memcached_array_st
*_namespace
;
156 uint32_t initial_pool_size
;
157 uint32_t max_pool_size
;
158 int32_t version
; // This is used by pool and others to determine if the memcached_st is out of date.
159 struct memcached_array_st
*filename
;
172 void memcached_servers_reset(memcached_st
*ptr
);
175 memcached_st
*memcached_create(memcached_st
*ptr
);
178 memcached_st
*memcached(const char *string
, size_t string_length
);
181 void memcached_free(memcached_st
*ptr
);
184 memcached_return_t
memcached_reset(memcached_st
*ptr
);
187 void memcached_reset_last_disconnected_server(memcached_st
*ptr
);
190 memcached_st
*memcached_clone(memcached_st
*clone
, const memcached_st
*ptr
);
193 void *memcached_get_user_data(const memcached_st
*ptr
);
196 void *memcached_set_user_data(memcached_st
*ptr
, void *data
);
199 memcached_return_t
memcached_push(memcached_st
*destination
, const memcached_st
*source
);
202 memcached_server_instance_st
memcached_server_instance_by_position(const memcached_st
*ptr
, uint32_t server_key
);
205 uint32_t memcached_server_count(const memcached_st
*);
208 uint64_t memcached_query_id(const memcached_st
*);