First pass through turning instance into ++
[m6w6/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 } state;
49
50 struct {
51 // Everything below here is pretty static.
52 bool auto_eject_hosts:1;
53 bool binary_protocol:1;
54 bool buffer_requests:1;
55 bool hash_with_namespace:1;
56 bool no_block:1; // Don't block
57 bool reply:1;
58 bool randomize_replica_read:1;
59 bool support_cas:1;
60 bool tcp_nodelay:1;
61 bool use_sort_hosts:1;
62 bool use_udp:1;
63 bool verify_key:1;
64 bool tcp_keepalive:1;
65 bool is_aes:1;
66 } flags;
67
68 memcached_server_distribution_t distribution;
69 hashkit_st hashkit;
70 struct {
71 unsigned int version;
72 } server_info;
73 uint32_t number_of_hosts;
74 #ifdef __cplusplus
75 org::libmemcached::Instance* servers;
76 org::libmemcached::Instance* last_disconnected_server;
77 #else
78 void *servers;
79 void *last_disconnected_server;
80 #endif
81 int32_t snd_timeout;
82 int32_t rcv_timeout;
83 uint32_t server_failure_limit;
84 uint32_t io_msg_watermark;
85 uint32_t io_bytes_watermark;
86 uint32_t io_key_prefetch;
87 uint32_t tcp_keepidle;
88 int32_t poll_timeout;
89 int32_t connect_timeout; // How long we will wait on connect() before we will timeout
90 int32_t retry_timeout;
91 int32_t dead_timeout;
92 int send_size;
93 int recv_size;
94 void *user_data;
95 uint64_t query_id;
96 uint32_t number_of_replicas;
97 memcached_result_st result;
98
99 struct {
100 bool weighted;
101 uint32_t continuum_count; // Ketama
102 uint32_t continuum_points_counter; // Ketama
103 time_t next_distribution_rebuild; // Ketama
104 memcached_continuum_item_st *continuum; // Ketama
105 } ketama;
106
107 struct memcached_virtual_bucket_t *virtual_bucket;
108
109 struct memcached_allocator_t allocators;
110
111 memcached_clone_fn on_clone;
112 memcached_cleanup_fn on_cleanup;
113 memcached_trigger_key_fn get_key_failure;
114 memcached_trigger_delete_key_fn delete_trigger;
115 memcached_callback_st *callbacks;
116 struct memcached_sasl_st sasl;
117 struct memcached_error_t *error_messages;
118 struct memcached_array_st *_namespace;
119 struct {
120 uint32_t initial_pool_size;
121 uint32_t max_pool_size;
122 int32_t version; // This is used by pool and others to determine if the memcached_st is out of date.
123 struct memcached_array_st *filename;
124 } configure;
125 struct {
126 bool is_allocated:1;
127 } options;
128
129 };