Merge doc update.
[awesomized/libmemcached] / libmemcached-1.0 / struct / memcached.h
1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
2 *
3 * Libmemcached library
4 *
5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
6 * Copyright (C) 2006-2009 Brian Aker All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following disclaimer
17 * in the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * * The names of its contributors may not be used to endorse or
21 * promote products derived from this software without specific prior
22 * written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 */
37
38 #pragma once
39
40 struct memcached_st {
41 /**
42 @note these are static and should not change without a call to behavior.
43 */
44 struct {
45 bool is_purging:1;
46 bool is_processing_input:1;
47 bool is_time_for_rebuild:1;
48 bool not_used:1;
49 } state;
50
51 struct {
52 // Everything below here is pretty static.
53 bool auto_eject_hosts:1;
54 bool binary_protocol:1;
55 bool buffer_requests:1;
56 bool hash_with_namespace:1;
57 bool no_block:1; // Don't block
58 bool reply:1;
59 bool randomize_replica_read:1;
60 bool support_cas:1;
61 bool tcp_nodelay:1;
62 bool use_sort_hosts:1;
63 bool use_udp:1;
64 bool verify_key:1;
65 bool tcp_keepalive:1;
66 bool is_aes:1;
67 bool is_fetching_version:1;
68 bool not_used:1;
69 } flags;
70
71 memcached_server_distribution_t distribution;
72 hashkit_st hashkit;
73 struct {
74 unsigned int version;
75 } server_info;
76 uint32_t number_of_hosts;
77 #ifdef __cplusplus
78 org::libmemcached::Instance* servers;
79 org::libmemcached::Instance* last_disconnected_server;
80 #else
81 void *servers;
82 void *last_disconnected_server;
83 #endif
84 int32_t snd_timeout;
85 int32_t rcv_timeout;
86 uint32_t server_failure_limit;
87 uint32_t io_msg_watermark;
88 uint32_t io_bytes_watermark;
89 uint32_t io_key_prefetch;
90 uint32_t tcp_keepidle;
91 int32_t poll_timeout;
92 int32_t connect_timeout; // How long we will wait on connect() before we will timeout
93 int32_t retry_timeout;
94 int32_t dead_timeout;
95 int send_size;
96 int recv_size;
97 void *user_data;
98 uint64_t query_id;
99 uint32_t number_of_replicas;
100 memcached_result_st result;
101
102 struct {
103 bool weighted_;
104 uint32_t continuum_count; // Ketama
105 uint32_t continuum_points_counter; // Ketama
106 time_t next_distribution_rebuild; // Ketama
107 struct memcached_continuum_item_st *continuum; // Ketama
108 } ketama;
109
110 struct memcached_virtual_bucket_t *virtual_bucket;
111
112 struct memcached_allocator_t allocators;
113
114 memcached_clone_fn on_clone;
115 memcached_cleanup_fn on_cleanup;
116 memcached_trigger_key_fn get_key_failure;
117 memcached_trigger_delete_key_fn delete_trigger;
118 memcached_callback_st *callbacks;
119 struct memcached_sasl_st sasl;
120 struct memcached_error_t *error_messages;
121 struct memcached_array_st *_namespace;
122 struct {
123 uint32_t initial_pool_size;
124 uint32_t max_pool_size;
125 int32_t version; // This is used by pool and others to determine if the memcached_st is out of date.
126 struct memcached_array_st *filename;
127 } configure;
128 struct {
129 bool is_allocated:1;
130 } options;
131
132 };