Couchbase C Client  2.10.0
Asynchronous C Client for Couchbase
deprecated.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2014 Couchbase, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef LCB_DEPRECATED_H
19 #define LCB_DEPRECATED_H
20 #ifndef LIBCOUCHBASE_COUCHBASE_H
21 #error "include <libcouchbase/couchbase.h> first"
22 #endif
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define LCB_DEPR_API(X) LIBCOUCHBASE_API LCB_DEPRECATED(X)
33 #define LCB_DEPR_API2(X, reason) LIBCOUCHBASE_API LCB_DEPRECATED2(X, reason)
34 
36 LCB_DEPR_API2(void lcb_behavior_set_ipv6(lcb_t instance, lcb_ipv6_t mode), "Use LCB_CNTL_IP6POLICY");
38 LCB_DEPR_API2(lcb_ipv6_t lcb_behavior_get_ipv6(lcb_t instance), "Use LCB_CNTL_IP6POLICY");
40 LCB_DEPR_API2(void lcb_behavior_set_config_errors_threshold(lcb_t instance, lcb_size_t num_events),
41  "Use LCB_CNTL_CONFERRTHRESH");
43 LCB_DEPR_API2(lcb_size_t lcb_behavior_get_config_errors_threshold(lcb_t instance),
44  "Use LCB_CNTL_CONFERRTHRESH");
46 LCB_DEPR_API2(void lcb_set_timeout(lcb_t instance, lcb_uint32_t usec),
47  "Use LCB_CNTL_OP_TIMEOUT");
49 LCB_DEPR_API2(lcb_uint32_t lcb_get_timeout(lcb_t instance),
50  "Use LCB_CNTL_OP_TIMEOUT");
52 LCB_DEPR_API2(void lcb_set_view_timeout(lcb_t instance, lcb_uint32_t usec),
53  "Use LCB_CNTL_VIEW_TIMEOUT");
55 LCB_DEPR_API2(lcb_uint32_t lcb_get_view_timeout(lcb_t instance),
56  "Use LCB_CNTL_VIEW_TIMEOUT");
57 
65 LCB_DEPR_API2(lcb_error_t lcb_get_last_error(lcb_t instance),
66  "This function does not returning meaningful information. Use the operation callbacks "
67  "and/or bootstrap callbacks");
68 
70 LCB_DEPR_API2(void lcb_flush_buffers(lcb_t instance, const void *cookie),
71  "This function does nothing");
72 
74 typedef enum {
75  LCB_VBUCKET_STATE_ACTIVE = 1, /* Actively servicing a vbucket. */
76  LCB_VBUCKET_STATE_REPLICA = 2, /* Servicing a vbucket as a replica only. */
77  LCB_VBUCKET_STATE_PENDING = 3, /* Pending active. */
78  LCB_VBUCKET_STATE_DEAD = 4 /* Not in use, pending deletion. */
80 
81 typedef void (*lcb_error_callback)(lcb_t instance, lcb_error_t error, const char *errinfo);
82 
88 LCB_DEPR_API2(lcb_error_callback lcb_set_error_callback(lcb_t, lcb_error_callback),
89  "This function only reports bootstrap errors. Use lcb_set_bootstrap_callback instead");
90 
91 
92 
97 struct lcb_timer_st;
98 typedef struct lcb_timer_st *lcb_timer_t;
99 typedef void (*lcb_timer_callback)(lcb_timer_t timer, lcb_t instance, const void *cookie);
100 LCB_DEPR_API(lcb_timer_t lcb_timer_create(lcb_t instance, const void *command_cookie, lcb_uint32_t usec, int periodic, lcb_timer_callback callback, lcb_error_t *error));
101 LCB_DEPR_API(lcb_error_t lcb_timer_destroy(lcb_t instance, lcb_timer_t timer));
102 
103 typedef enum lcb_compat_t { LCB_MEMCACHED_CLUSTER = 0x00, LCB_CACHED_CONFIG = 0x01 } lcb_compat_t;
104 typedef lcb_compat_t lcb_cluster_t;
105 struct lcb_memcached_st { const char *serverlist; const char *username; const char *password; };
106 struct lcb_cached_config_st {
107  const char *cachefile;
108  struct lcb_create_st createopt;
109 };
110 
115 #define lcb_create_compat lcb__create_compat_230
116 LCB_DEPR_API2(lcb_error_t lcb_create_compat(lcb_compat_t type, const void *specific, lcb_t *instance, struct lcb_io_opt_st *io),
117  "Use memcached:// for legacy memcached. For config cache, use LCB_CNTL_CONFIGCACHE");
118 
119 typedef enum {
120  LCB_ASYNCHRONOUS = 0x00,
121  LCB_SYNCHRONOUS = 0xff
122 } lcb_syncmode_t;
123 LCB_DEPR_API2(void lcb_behavior_set_syncmode(lcb_t, lcb_syncmode_t),
124  "Syncmode will be removed in future versions. Use lcb_wait() instead");
125 LCB_DEPR_API2(lcb_syncmode_t lcb_behavior_get_syncmode(lcb_t),
126  "Syncmode will be removed in future versions. Use lcb_wait() instead");
127 
128 LCB_DEPR_API2(const char *lcb_get_host(lcb_t),
129  "Use lcb_get_node(instance, LCB_NODE_HTCONFIG, 0)");
130 LCB_DEPR_API2(const char *lcb_get_port(lcb_t),
131  "Use lcb_get_node(instance, LCB_NODE_HTCONFIG, 0)");
132 
133 /* STRUCTURE ABBREV ID MAXVER */
134 #define LCB_XSSIZES(X) \
135  X(struct lcb_create_st, C_ST, 0, 3) \
136  X(struct lcb_create_io_ops_st, C_I_O_ST, 1, 1) \
137  \
138  X(struct lcb_get_cmd_st, G_C_ST, 2, 0) \
139  X(struct lcb_get_replica_cmd_st, G_R_C_ST, 3, 1) \
140  X(struct lcb_unlock_cmd_st, U_C_ST, 4, 0) \
141  X(lcb_touch_cmd_t, T_C_ST, 5, 0) \
142  X(struct lcb_store_cmd_st, S_C_ST, 6, 0) \
143  X(struct lcb_arithmetic_cmd_st, A_C_ST, 7, 0) \
144  X(struct lcb_observe_cmd_st, O_C_ST, 8, 0) \
145  X(struct lcb_remove_cmd_st, R_C_ST, 9, 0) \
146  X(struct lcb_http_cmd_st, H_C_ST, 10, 1) \
147  X(struct lcb_server_stats_cmd_st, S_S_C_ST, 11, 0) \
148  X(struct lcb_server_version_cmd_st, S_V_C_ST, 12, 0) \
149  X(struct lcb_verbosity_cmd_st, V_C_ST, 13, 0) \
150  X(struct lcb_flush_cmd_st, F_C_ST, 14, 0) \
151  \
152  X(lcb_get_resp_t, G_R_ST, 15, 0) \
153  X(lcb_store_resp_t, S_R_ST, 16, 0) \
154  X(lcb_remove_resp_t, R_R_ST, 17, 0) \
155  X(lcb_touch_resp_t, T_R_ST, 18, 0) \
156  X(lcb_unlock_resp_t, U_R_ST, 19, 0) \
157  X(lcb_arithmetic_resp_t, A_R_ST, 20, 0) \
158  X(lcb_observe_resp_t, O_R_ST, 21, 0) \
159  X(lcb_http_resp_t, H_R_ST, 22, 0) \
160  X(lcb_server_stat_resp_t, S_S_R_ST, 23, 0) \
161  X(lcb_server_version_resp_t, S_V_R_ST, 24, 0) \
162  X(lcb_verbosity_resp_t, V_R_ST, 25, 0) \
163  X(lcb_flush_resp_t, F_R_ST, 26, 0)
164 
165 typedef enum {
166 #define X(sname, sabbrev, idval, vernum) \
167  LCB_##sabbrev##_ID = idval, LCB_##sabbrev##_V = vernum,
168  LCB_XSSIZES(X)
169  LCB_ST_M = 26
170 #undef X
171 } lcb__STRUCTSIZES;
172 
173 #define lcb_verify_compiler_setup() ( \
174  lcb_verify_struct_size(LCB_C_ST_ID, LCB_C_ST_V, sizeof(struct lcb_create_st)) == LCB_SUCCESS && \
175  lcb_verify_struct_size(LCB_C_I_O_ST_ID, LCB_C_I_O_ST_V, sizeof(struct lcb_create_io_ops_st)) == LCB_SUCCESS && \
176  lcb_verify_struct_size(LCB_G_C_ST_ID, LCB_G_C_ST_V, sizeof(struct lcb_get_cmd_st)) == LCB_SUCCESS && \
177  lcb_verify_struct_size(LCB_G_R_C_ST_ID, LCB_G_R_C_ST_V, sizeof(struct lcb_get_replica_cmd_st)) == LCB_SUCCESS && \
178  lcb_verify_struct_size(LCB_U_C_ST_ID, LCB_U_C_ST_V, sizeof(struct lcb_unlock_cmd_st)) == LCB_SUCCESS && \
179  lcb_verify_struct_size(LCB_T_C_ST_ID, LCB_T_C_ST_V, sizeof(lcb_touch_cmd_t)) == LCB_SUCCESS && \
180  lcb_verify_struct_size(LCB_S_C_ST_ID, LCB_S_C_ST_V, sizeof(struct lcb_store_cmd_st)) == LCB_SUCCESS && \
181  lcb_verify_struct_size(LCB_A_C_ST_ID, LCB_A_C_ST_V, sizeof(struct lcb_arithmetic_cmd_st)) == LCB_SUCCESS && \
182  lcb_verify_struct_size(LCB_O_C_ST_ID, LCB_O_C_ST_V, sizeof(struct lcb_observe_cmd_st)) == LCB_SUCCESS && \
183  lcb_verify_struct_size(LCB_R_C_ST_ID, LCB_R_C_ST_V, sizeof(struct lcb_remove_cmd_st)) == LCB_SUCCESS && \
184  lcb_verify_struct_size(LCB_H_C_ST_ID, LCB_H_C_ST_V, sizeof(struct lcb_http_cmd_st)) == LCB_SUCCESS && \
185  lcb_verify_struct_size(LCB_S_S_C_ST_ID, LCB_S_S_C_ST_V, sizeof(struct lcb_server_stats_cmd_st)) == LCB_SUCCESS && \
186  lcb_verify_struct_size(LCB_S_V_C_ST_ID, LCB_S_V_C_ST_V, sizeof(struct lcb_server_version_cmd_st)) == LCB_SUCCESS && \
187  lcb_verify_struct_size(LCB_V_C_ST_ID, LCB_V_C_ST_V, sizeof(struct lcb_verbosity_cmd_st)) == LCB_SUCCESS && \
188  lcb_verify_struct_size(LCB_F_C_ST_ID, LCB_F_C_ST_V, sizeof(struct lcb_flush_cmd_st)) == LCB_SUCCESS && \
189  lcb_verify_struct_size(LCB_G_R_ST_ID, LCB_G_R_ST_V, sizeof(lcb_get_resp_t)) == LCB_SUCCESS &&\
190  lcb_verify_struct_size(LCB_S_R_ST_ID, LCB_S_R_ST_V, sizeof(lcb_store_resp_t)) == LCB_SUCCESS && \
191  lcb_verify_struct_size(LCB_R_R_ST_ID, LCB_R_R_ST_V, sizeof(lcb_remove_resp_t)) == LCB_SUCCESS && \
192  lcb_verify_struct_size(LCB_T_R_ST_ID, LCB_T_R_ST_V, sizeof(lcb_touch_resp_t)) == LCB_SUCCESS && \
193  lcb_verify_struct_size(LCB_U_R_ST_ID, LCB_U_R_ST_V, sizeof(lcb_unlock_resp_t)) == LCB_SUCCESS && \
194  lcb_verify_struct_size(LCB_A_R_ST_ID, LCB_A_R_ST_V, sizeof(lcb_arithmetic_resp_t)) == LCB_SUCCESS && \
195  lcb_verify_struct_size(LCB_O_R_ST_ID, LCB_O_R_ST_V, sizeof(lcb_observe_resp_t)) == LCB_SUCCESS && \
196  lcb_verify_struct_size(LCB_H_R_ST_ID, LCB_H_R_ST_V, sizeof(lcb_http_resp_t)) == LCB_SUCCESS && \
197  lcb_verify_struct_size(LCB_S_S_R_ST_ID, LCB_S_S_R_ST_V, sizeof(lcb_server_stat_resp_t)) == LCB_SUCCESS && \
198  lcb_verify_struct_size(LCB_S_V_R_ST_ID, LCB_S_V_R_ST_V, sizeof(lcb_server_version_resp_t)) == LCB_SUCCESS && \
199  lcb_verify_struct_size(LCB_V_R_ST_ID, LCB_V_R_ST_V, sizeof(lcb_verbosity_resp_t)) == LCB_SUCCESS && \
200  lcb_verify_struct_size(LCB_F_R_ST_ID, LCB_F_R_ST_V, sizeof(lcb_flush_resp_t)) == LCB_SUCCESS \
201 )
202 
213 LIBCOUCHBASE_API
214 lcb_error_t lcb_verify_struct_size(lcb_uint32_t id, lcb_uint32_t version,
215  lcb_size_t size);
216 
220 #define LCB_CNTL_RBUFSIZE 0x02
221 
222 #define LCB_CNTL_WBUFSIZE 0x03
223 
224 #define LCB_CNTL_SYNCMODE 0x0a
225 
226 #define LCB_CNTL_SKIP_CONFIGURATION_ERRORS_ON_CONNECT 0x13
227 
229 #define lcb_is_error_enomem(a) ((a == LCB_CLIENT_ENOMEM) || (a == LCB_ENOMEM))
230 
231 #define lcb_is_error_etmpfail(a) ((a == LCB_CLIENT_ETMPFAIL) || (a == LCB_ETMPFAIL))
232 
233 typedef enum {
234  LCB_CONFIGURATION_NEW = 0x00,
235  LCB_CONFIGURATION_CHANGED = 0x01,
236  LCB_CONFIGURATION_UNCHANGED = 0x02
237 } lcb_configuration_t;
238 
239 typedef void (*lcb_configuration_callback)(lcb_t instance, lcb_configuration_t config);
240 
243  lcb_configuration_callback lcb_set_configuration_callback(lcb_t, lcb_configuration_callback),
244  "use lcb_set_bootstrap_callback() to determine when client is ready");
245 
246 /* Deprecated HTTP "Status Aliases" */
247 typedef enum {
248  LCB_HTTP_STATUS_CONTINUE = 100,
249  LCB_HTTP_STATUS_SWITCHING_PROTOCOLS = 101,
250  LCB_HTTP_STATUS_PROCESSING = 102,
251  LCB_HTTP_STATUS_OK = 200,
252  LCB_HTTP_STATUS_CREATED = 201,
253  LCB_HTTP_STATUS_ACCEPTED = 202,
254  LCB_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203,
255  LCB_HTTP_STATUS_NO_CONTENT = 204,
256  LCB_HTTP_STATUS_RESET_CONTENT = 205,
257  LCB_HTTP_STATUS_PARTIAL_CONTENT = 206,
258  LCB_HTTP_STATUS_MULTI_STATUS = 207,
259  LCB_HTTP_STATUS_MULTIPLE_CHOICES = 300,
260  LCB_HTTP_STATUS_MOVED_PERMANENTLY = 301,
261  LCB_HTTP_STATUS_FOUND = 302,
262  LCB_HTTP_STATUS_SEE_OTHER = 303,
263  LCB_HTTP_STATUS_NOT_MODIFIED = 304,
264  LCB_HTTP_STATUS_USE_PROXY = 305,
265  LCB_HTTP_STATUS_UNUSED = 306,
266  LCB_HTTP_STATUS_TEMPORARY_REDIRECT = 307,
267  LCB_HTTP_STATUS_BAD_REQUEST = 400,
268  LCB_HTTP_STATUS_UNAUTHORIZED = 401,
269  LCB_HTTP_STATUS_PAYMENT_REQUIRED = 402,
270  LCB_HTTP_STATUS_FORBIDDEN = 403,
271  LCB_HTTP_STATUS_NOT_FOUND = 404,
272  LCB_HTTP_STATUS_METHOD_NOT_ALLOWED = 405,
273  LCB_HTTP_STATUS_NOT_ACCEPTABLE = 406,
274  LCB_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,
275  LCB_HTTP_STATUS_REQUEST_TIMEOUT = 408,
276  LCB_HTTP_STATUS_CONFLICT = 409,
277  LCB_HTTP_STATUS_GONE = 410,
278  LCB_HTTP_STATUS_LENGTH_REQUIRED = 411,
279  LCB_HTTP_STATUS_PRECONDITION_FAILED = 412,
280  LCB_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413,
281  LCB_HTTP_STATUS_REQUEST_URI_TOO_LONG = 414,
282  LCB_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415,
283  LCB_HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
284  LCB_HTTP_STATUS_EXPECTATION_FAILED = 417,
285  LCB_HTTP_STATUS_UNPROCESSABLE_ENTITY = 422,
286  LCB_HTTP_STATUS_LOCKED = 423,
287  LCB_HTTP_STATUS_FAILED_DEPENDENCY = 424,
288  LCB_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
289  LCB_HTTP_STATUS_NOT_IMPLEMENTED = 501,
290  LCB_HTTP_STATUS_BAD_GATEWAY = 502,
291  LCB_HTTP_STATUS_SERVICE_UNAVAILABLE = 503,
292  LCB_HTTP_STATUS_GATEWAY_TIMEOUT = 504,
293  LCB_HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505,
294  LCB_HTTP_STATUS_INSUFFICIENT_STORAGE = 507
295 } lcb_http_status_t;
296 
300 typedef enum {
301  /* encryption (e.g. private key for assymetric ciphers) */
302  LCBCRYPTO_KEY_ENCRYPT = 0,
303  /* decryption (e.g. private key for assymetric ciphers) */
304  LCBCRYPTO_KEY_DECRYPT = 1,
305  LCBCRYPTO_KEY__MAX
307 
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 #endif
int version
Indicates which field in the lcb_CRST_u union should be used.
Definition: couchbase.h:330
lcb_vbucket_state_t
I&#39;m not sure what uses this anymore.
Definition: deprecated.h:74
lcbcrypto_KEYTYPE
Definition: deprecated.h:300
lcb_error_t lcb_verify_struct_size(lcb_uint32_t id, lcb_uint32_t version, lcb_size_t size)
Verify that libcouchbase and yourself have the same size for a certain version of a struct...
lcb_ipv6_t
Modes for handling IPv6 in the IO layer.
Definition: cntl.h:287
lcb_timer_t lcb_timer_create(lcb_t instance, const void *command_cookie, lcb_uint32_t usec, int periodic, lcb_timer_callback callback, lcb_error_t *error))
lcb_error_t lcb_timer_destroy(lcb_t instance, lcb_timer_t timer))
struct lcb_st * lcb_t
Library handle representing a connection to a cluster and its data buckets.
Definition: couchbase.h:41
Wrapper structure for lcb_create()
Definition: couchbase.h:328
lcb_error_t
Error codes returned by the library.
Definition: error.h:580
#define lcb_create_compat
Definition: deprecated.h:115
LCB_DEPR_API2(void lcb_behavior_set_ipv6(lcb_t instance, lcb_ipv6_t mode), "Use LCB_CNTL_IP6POLICY")