libcouchbase 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +11 -8
  3. data/ext/libcouchbase/CMakeLists.txt +1 -1
  4. data/ext/libcouchbase/README.markdown +38 -6
  5. data/ext/libcouchbase/RELEASE_NOTES.markdown +151 -0
  6. data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +2 -2
  7. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +3 -3
  8. data/ext/libcouchbase/cmake/source_files.cmake +1 -0
  9. data/ext/libcouchbase/contrib/cJSON/cJSON.c +686 -288
  10. data/ext/libcouchbase/contrib/cJSON/cJSON.h +0 -0
  11. data/ext/libcouchbase/contrib/cbsasl/src/hash.c +17 -17
  12. data/ext/libcouchbase/contrib/cliopts/cliopts.c +76 -0
  13. data/ext/libcouchbase/contrib/cliopts/cliopts.h +66 -15
  14. data/ext/libcouchbase/contrib/genhash/genhash.c +1 -2
  15. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +4 -3
  16. data/ext/libcouchbase/example/instancepool/main.cc +12 -2
  17. data/ext/libcouchbase/example/libeventdirect/main.c +99 -25
  18. data/ext/libcouchbase/example/minimal/minimal.c +7 -5
  19. data/ext/libcouchbase/example/observe/durability.c +102 -0
  20. data/ext/libcouchbase/example/observe/observe.c +19 -6
  21. data/ext/libcouchbase/example/subdoc/subdoc-xattrs.c +1 -2
  22. data/ext/libcouchbase/include/libcouchbase/cntl-private.h +6 -8
  23. data/ext/libcouchbase/include/libcouchbase/cntl.h +84 -64
  24. data/ext/libcouchbase/include/libcouchbase/couchbase.h +295 -78
  25. data/ext/libcouchbase/include/libcouchbase/deprecated.h +2 -2
  26. data/ext/libcouchbase/include/libcouchbase/error.h +1 -1
  27. data/ext/libcouchbase/include/libcouchbase/iops.h +9 -9
  28. data/ext/libcouchbase/include/libcouchbase/ixmgmt.h +2 -2
  29. data/ext/libcouchbase/include/libcouchbase/n1ql.h +69 -7
  30. data/ext/libcouchbase/include/libcouchbase/vbucket.h +17 -0
  31. data/ext/libcouchbase/include/libcouchbase/views.h +3 -3
  32. data/ext/libcouchbase/include/memcached/protocol_binary.h +62 -1
  33. data/ext/libcouchbase/packaging/deb/control +1 -1
  34. data/ext/libcouchbase/packaging/rpm/libcouchbase.spec.in +37 -36
  35. data/ext/libcouchbase/src/bootstrap.cc +22 -8
  36. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +1 -1
  37. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +0 -1
  38. data/ext/libcouchbase/src/bucketconfig/confmon.cc +13 -8
  39. data/ext/libcouchbase/src/callbacks.c +2 -0
  40. data/ext/libcouchbase/src/cntl.cc +28 -17
  41. data/ext/libcouchbase/src/dns-srv.cc +1 -2
  42. data/ext/libcouchbase/src/dump.cc +4 -0
  43. data/ext/libcouchbase/src/errmap.h +89 -16
  44. data/ext/libcouchbase/src/handler.cc +28 -11
  45. data/ext/libcouchbase/src/http/http-priv.h +4 -1
  46. data/ext/libcouchbase/src/http/http.cc +3 -0
  47. data/ext/libcouchbase/src/instance.cc +1 -1
  48. data/ext/libcouchbase/src/internal.h +1 -0
  49. data/ext/libcouchbase/src/lcbio/connect.cc +2 -3
  50. data/ext/libcouchbase/src/lcbio/manager.cc +2 -2
  51. data/ext/libcouchbase/src/lcbio/ssl.h +10 -0
  52. data/ext/libcouchbase/src/mc/mcreq.c +8 -0
  53. data/ext/libcouchbase/src/mcserver/mcserver.cc +14 -1
  54. data/ext/libcouchbase/src/n1ql/ixmgmt.cc +0 -3
  55. data/ext/libcouchbase/src/n1ql/n1ql.cc +22 -29
  56. data/ext/libcouchbase/src/n1ql/params.cc +46 -1
  57. data/ext/libcouchbase/src/newconfig.cc +4 -4
  58. data/ext/libcouchbase/src/operations/durability-seqno.cc +4 -0
  59. data/ext/libcouchbase/src/operations/durability.cc +3 -0
  60. data/ext/libcouchbase/src/operations/ping.cc +315 -0
  61. data/ext/libcouchbase/src/operations/stats.cc +10 -0
  62. data/ext/libcouchbase/src/operations/subdoc.cc +13 -1
  63. data/ext/libcouchbase/src/retrychk.cc +1 -0
  64. data/ext/libcouchbase/src/settings.c +2 -0
  65. data/ext/libcouchbase/src/settings.h +13 -7
  66. data/ext/libcouchbase/src/ssl/ssl_c.c +28 -2
  67. data/ext/libcouchbase/src/ssl/ssl_common.c +3 -0
  68. data/ext/libcouchbase/src/ssl/ssl_e.c +15 -1
  69. data/ext/libcouchbase/src/ssl/ssl_iot_common.h +3 -1
  70. data/ext/libcouchbase/src/timings.c +0 -1
  71. data/ext/libcouchbase/src/vbucket/vbucket.c +49 -1
  72. data/ext/libcouchbase/tests/iotests/mock-environment.cc +58 -40
  73. data/ext/libcouchbase/tests/iotests/mock-environment.h +23 -4
  74. data/ext/libcouchbase/tests/iotests/mock-unit-test.h +8 -8
  75. data/ext/libcouchbase/tests/iotests/t_behavior.cc +5 -5
  76. data/ext/libcouchbase/tests/iotests/t_durability.cc +50 -0
  77. data/ext/libcouchbase/tests/iotests/t_eerrs.cc +4 -2
  78. data/ext/libcouchbase/tests/iotests/t_errmap.cc +6 -3
  79. data/ext/libcouchbase/tests/iotests/t_lock.cc +5 -6
  80. data/ext/libcouchbase/tests/iotests/t_misc.cc +44 -0
  81. data/ext/libcouchbase/tests/iotests/t_serverops.cc +1 -0
  82. data/ext/libcouchbase/tests/iotests/t_subdoc.cc +28 -0
  83. data/ext/libcouchbase/tests/iotests/t_views.cc +22 -10
  84. data/ext/libcouchbase/tools/CMakeLists.txt +21 -1
  85. data/ext/libcouchbase/tools/cbc-handlers.h +23 -3
  86. data/ext/libcouchbase/tools/cbc-n1qlback.cc +1 -1
  87. data/ext/libcouchbase/tools/cbc-pillowfight.cc +126 -26
  88. data/ext/libcouchbase/tools/cbc-proxy.cc +403 -0
  89. data/ext/libcouchbase/tools/cbc-subdoc.cc +826 -0
  90. data/ext/libcouchbase/tools/cbc.cc +149 -37
  91. data/ext/libcouchbase/tools/common/options.h +5 -2
  92. data/ext/libcouchbase/tools/linenoise/linenoise.c +15 -15
  93. data/lib/libcouchbase.rb +4 -0
  94. data/lib/libcouchbase/bucket.rb +51 -0
  95. data/lib/libcouchbase/connection.rb +100 -13
  96. data/lib/libcouchbase/ext/libcouchbase.rb +40 -0
  97. data/lib/libcouchbase/ext/libcouchbase/cmdsubdoc.rb +13 -1
  98. data/lib/libcouchbase/ext/libcouchbase/enums.rb +2 -1
  99. data/lib/libcouchbase/ext/libcouchbase/sdspec.rb +5 -0
  100. data/lib/libcouchbase/subdoc_request.rb +129 -0
  101. data/lib/libcouchbase/version.rb +1 -1
  102. data/spec/bucket_spec.rb +15 -1
  103. data/spec/connection_spec.rb +1 -1
  104. data/spec/subdoc_spec.rb +192 -0
  105. metadata +13 -4
  106. data/ext/libcouchbase/.travis.yml +0 -19
@@ -54,9 +54,8 @@ op_callback(lcb_t instance, int cbtype, const lcb_RESPBASE *rb)
54
54
  fprintf(stderr, "FLAGS: 0x%x\n", rg->itmflags);
55
55
  }
56
56
  } else {
57
- die(instance, lcb_strcbtype(rb->rc), rb->rc);
57
+ die(instance, lcb_strcbtype(cbtype), rb->rc);
58
58
  }
59
- (void)instance;
60
59
  }
61
60
 
62
61
  int main(int argc, char *argv[])
@@ -70,14 +69,17 @@ int main(int argc, char *argv[])
70
69
  create_options.version = 3;
71
70
 
72
71
  if (argc < 2) {
73
- fprintf(stderr, "Usage: %s couchbase://host/bucket [ password ]\n", argv[0]);
72
+ fprintf(stderr, "Usage: %s couchbase://host/bucket [ password [ username ] ]\n", argv[0]);
74
73
  exit(EXIT_FAILURE);
75
74
  }
76
75
 
77
76
  create_options.v.v3.connstr = argv[1];
78
- if (argc >= 3) {
77
+ if (argc > 2) {
79
78
  create_options.v.v3.passwd = argv[2];
80
79
  }
80
+ if (argc > 3) {
81
+ create_options.v.v3.username = argv[3];
82
+ }
81
83
 
82
84
  err = lcb_create(&instance, &create_options);
83
85
  if (err != LCB_SUCCESS) {
@@ -114,7 +116,7 @@ int main(int argc, char *argv[])
114
116
  lcb_wait(instance);
115
117
 
116
118
  /* Now fetch the item back */
117
- LCB_CMD_SET_KEY(&gcmd, "foo", strlen("foo"));
119
+ LCB_CMD_SET_KEY(&gcmd, "key", strlen("key"));
118
120
  err = lcb_get3(instance, NULL, &gcmd);
119
121
  if (err != LCB_SUCCESS) {
120
122
  die(instance, "Couldn't schedule retrieval operation", err);
@@ -0,0 +1,102 @@
1
+ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2017 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
+ /*
19
+ * BUILD:
20
+ * cc -o durability durability.c -lcouchbase
21
+ *
22
+ * RUN:
23
+ * ./durability [ CONNSTRING [ PASSWORD [ USERNAME ] ] ]
24
+ *
25
+ * # use default durability check method
26
+ * ./durability couchbase://localhost
27
+ *
28
+ * # force durability check method based on sequence numbers
29
+ * ./durability couchbase://localhost?fetch_mutation_tokens=true&dur_mutation_tokens=true
30
+ */
31
+ #include <stdlib.h>
32
+ #include <stdio.h>
33
+ #include <string.h>
34
+ #include <assert.h>
35
+ #include <libcouchbase/couchbase.h>
36
+ #include <libcouchbase/api3.h>
37
+
38
+ #define fail(msg) \
39
+ fprintf(stderr, "%s\n", msg); \
40
+ exit(EXIT_FAILURE)
41
+
42
+ #define fail2(msg, err) \
43
+ fprintf(stderr, "%s\n", msg); \
44
+ fprintf(stderr, "Error was 0x%x (%s)\n", err, lcb_strerror(NULL, err)); \
45
+ exit(EXIT_FAILURE)
46
+
47
+ static void store_callback(lcb_t instance, int cbtype, const lcb_RESPBASE *rb)
48
+ {
49
+ const lcb_RESPSTOREDUR *resp = (const lcb_RESPSTOREDUR *)rb;
50
+ fprintf(stderr, "Got status of operation: 0x%02x, %s\n", resp->rc, lcb_strerror(NULL, resp->rc));
51
+ fprintf(stderr, "Stored: %s\n", resp->store_ok ? "true" : "false");
52
+ fprintf(stderr, "Number of roundtrips: %d\n", resp->dur_resp->nresponses);
53
+ fprintf(stderr, "In memory on master: %s\n", resp->dur_resp->exists_master ? "true" : "false");
54
+ fprintf(stderr, "Persisted on master: %s\n", resp->dur_resp->persisted_master ? "true" : "false");
55
+ fprintf(stderr, "Nodes have value replicated: %d\n", resp->dur_resp->nreplicated);
56
+ fprintf(stderr, "Nodes have value persisted (including master): %d\n", resp->dur_resp->npersisted);
57
+ }
58
+
59
+ int main(int argc, char *argv[])
60
+ {
61
+ lcb_t instance;
62
+ lcb_error_t err;
63
+ lcb_CMDSTOREDUR cmd = {0};
64
+ struct lcb_create_st create_options = {0};
65
+ const char *key = "foo";
66
+ const char *value = "{\"val\":42}";
67
+
68
+ create_options.version = 3;
69
+ if (argc > 1) {
70
+ create_options.v.v3.connstr = argv[1];
71
+ }
72
+ if (argc > 2) {
73
+ create_options.v.v3.passwd = argv[2];
74
+ }
75
+ if (argc > 3) {
76
+ create_options.v.v3.username = argv[3];
77
+ }
78
+
79
+ if ((err = lcb_create(&instance, &create_options)) != LCB_SUCCESS) {
80
+ fail2("cannot create connection instance", err);
81
+ }
82
+ if ((err = lcb_connect(instance)) != LCB_SUCCESS) {
83
+ fail2("Couldn't schedule connection", err);
84
+ }
85
+ lcb_wait(instance);
86
+ if ((err = lcb_get_bootstrap_status(instance)) != LCB_SUCCESS) {
87
+ fail2("Couldn't get initial cluster configuration", err);
88
+ }
89
+ lcb_install_callback3(instance, LCB_CALLBACK_STOREDUR, store_callback);
90
+
91
+ LCB_CMD_SET_KEY(&cmd, key, strlen(key));
92
+ LCB_CMD_SET_VALUE(&cmd, value, strlen(value));
93
+ /* replicate and persist on all nodes */
94
+ cmd.replicate_to = -1;
95
+ cmd.persist_to = -1;
96
+ lcb_storedur3(instance, NULL, &cmd);
97
+
98
+ lcb_wait(instance);
99
+
100
+ lcb_destroy(instance);
101
+ return EXIT_SUCCESS;
102
+ }
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright 2013 Couchbase, Inc.
3
+ * Copyright 2013-2017 Couchbase, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -28,11 +28,12 @@
28
28
 
29
29
  #define fail(msg) \
30
30
  fprintf(stderr, "%s\n", msg); \
31
- exit(EXIT_FAILURE);
31
+ exit(EXIT_FAILURE)
32
32
 
33
33
  #define fail2(msg, err) \
34
34
  fprintf(stderr, "%s\n", msg); \
35
- fprintf(stderr, "Error was 0x%x (%s)\n", err, lcb_strerror(NULL, err))
35
+ fprintf(stderr, "Error was 0x%x (%s)\n", err, lcb_strerror(NULL, err)); \
36
+ exit(EXIT_FAILURE)
36
37
 
37
38
  typedef struct {
38
39
  int master;
@@ -81,12 +82,24 @@ int main(int argc, char *argv[])
81
82
  lcb_MULTICMD_CTX *mctx = NULL;
82
83
  observe_info obs_info;
83
84
  unsigned nservers, ii;
85
+ struct lcb_create_st create_options = { 0 };
84
86
 
85
- if (argc != 2) {
86
- fail("requires key as argument");
87
+ if (argc < 2) {
88
+ fail("Requires key as argument\n"
89
+ "Usage: observe KEY [CONNSTRING [ PASSWORD [ USERNAME ] ] ]\n");
90
+ }
91
+ create_options.version = 3;
92
+ if (argc > 2) {
93
+ create_options.v.v3.connstr = argv[2];
94
+ }
95
+ if (argc > 3) {
96
+ create_options.v.v3.passwd = argv[3];
97
+ }
98
+ if (argc > 4) {
99
+ create_options.v.v3.username = argv[4];
87
100
  }
88
101
 
89
- if ((err = lcb_create(&instance, NULL)) != LCB_SUCCESS) {
102
+ if ((err = lcb_create(&instance, &create_options)) != LCB_SUCCESS) {
90
103
  fail2("cannot create connection instance", err);
91
104
  }
92
105
  if ((err = lcb_connect(instance)) != LCB_SUCCESS) {
@@ -124,8 +124,7 @@ static void n1qlrow_callback(lcb_t instance, int type, const lcb_RESPN1QL *resp)
124
124
  lcb_sched_leave(instance);
125
125
  }
126
126
 
127
- // #define DEFAULT_CONNSTR "couchbase://localhost/travel-sample"
128
- #define DEFAULT_CONNSTR "couchbase://192.168.1.194/travel-sample"
127
+ #define DEFAULT_CONNSTR "couchbase://localhost/travel-sample"
129
128
 
130
129
  static lcb_t connect_as(char *username, char *password)
131
130
  {
@@ -204,9 +204,6 @@ struct lcb_cntl_iops_info_st {
204
204
  #define LCB_CNTL_CONFIG_ALL_NODES 0x20
205
205
 
206
206
  /**
207
- * @internal
208
- *
209
- * @volatile
210
207
  * Reinitialize the instance using a connection string. Only options and
211
208
  * the hostlists are used from this string. The bucket in the string (if specified)
212
209
  * and any SSL options (i.e. `couchbases://` or `ssl=no_verify`) are ignored.
@@ -214,6 +211,7 @@ struct lcb_cntl_iops_info_st {
214
211
  *
215
212
  * This is the newer variant of @ref LCB_CNTL_CONFIG_ALL_NODES
216
213
  * @cntl_arg_setonly{const char *}
214
+ * @internal
217
215
  */
218
216
  #define LCB_CNTL_REINIT_CONNSTR 0x2B
219
217
 
@@ -290,7 +288,6 @@ struct lcb_cntl_rdballocfactory {
290
288
  lcb_RDBALLOCFACTORY factory;
291
289
  };
292
290
  /**
293
- * @volatile
294
291
  * Set the allocator factory used by libcouchbase. The allocator factory is
295
292
  * a function invoked with no arguments which yields a new rdb_ALLOCATOR
296
293
  * object. Currently the use and API of this object is considered internal
@@ -299,6 +296,7 @@ struct lcb_cntl_rdballocfactory {
299
296
  * Mode|Arg
300
297
  * ----|---
301
298
  * Set, Get | `lcb_cntl_rdballocfactory*`
299
+ * @volatile
302
300
  */
303
301
  #define LCB_CNTL_RDBALLOCFACTORY 0x27
304
302
 
@@ -319,37 +317,37 @@ typedef enum {
319
317
 
320
318
 
321
319
  /**
322
- * @volatile
323
320
  * @brief Persist heuristic vbucket information across updates.
324
321
  *
325
322
  * As of version 2.4.8 this option no longer has any effect, and vBucket
326
323
  * heuristics are always retained for a maximum of 20 seconds.
327
324
  * @cntl_arg_both{int*}
325
+ * @volatile
328
326
  */
329
327
  #define LCB_CNTL_VBGUESS_PERSIST 0x32
330
328
 
331
329
  /**
332
- * @volatile
333
330
  * This is a collection of various options which sacrifice data safety for
334
331
  * speed.
332
+ * @volatile
335
333
  */
336
334
  #define LCB_CNTL_UNSAFE_OPTIMIZE 0x33
337
335
 
338
336
  /**
339
- * @volatile
340
337
  * Disable or enable Nagle's algorithm. The default is to disable it, as it
341
338
  * will typically reduce latency. In general it is recommended not to touch
342
339
  * this setting. It is here mainly for debugging.
343
340
  *
344
341
  * Conventionally, the option to disable Nagle's algorithm is called "TCP_NODELAY",
345
342
  * thus if this value is one, Nagle is off, and vice versa.
343
+ * @volatile
346
344
  */
347
345
  #define LCB_CNTL_TCP_NODELAY 0x39
348
346
 
349
347
  /**
350
- * @volatile
351
348
  * Get the lcb_HISTOGRAM object for key-value timings
352
349
  * @cntl_arg_getonly{lcb_HISTOGRAM**}
350
+ * @volatile
353
351
  */
354
352
  #define LCB_CNTL_KVTIMINGS 0x3C
355
353
 
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright 2013 Couchbase, Inc.
3
+ * Copyright 2017 Couchbase, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -73,14 +73,25 @@ extern "C" {
73
73
  * pointer types depending on whether the `mode` is retrieval or storage.
74
74
  *
75
75
  *
76
- * @section lcb-timeout-info Timeout Settings
76
+ * @section lcb-time-info Timeout and Time Value Settings
77
+ *
78
+ * There are various settings on the library that control behavior with
79
+ * respect to wall clock time.
77
80
  *
78
81
  * Timeout settings control how long the library will wait for a certain event
79
82
  * before proceeding to the next course of action (which may either be to try
80
83
  * a different operation or fail the current one, depending on the specific
81
84
  * timeout).
82
85
  *
83
- * Timeouts are specified in _microseconds_ stored within an `lcb_U32`.
86
+ * Other settings may configure how often the library proactively polls for
87
+ * a configuration update, retries various interally retried operations and
88
+ * so forth.
89
+ *
90
+ * Time values are specified in _microseconds_ stored within an `lcb_U32`.
91
+ *
92
+ * When specified as an argument to lcb_cntl_string() or through the connection
93
+ * string, it will be parsed from a string float value where the integer-part
94
+ * is in seconds and the fractional-part is in fractions of a second.
84
95
  *
85
96
  * Note that timeouts in libcouchbase are implemented via an event loop
86
97
  * scheduler. As such their accuracy and promptness is limited by how
@@ -133,7 +144,7 @@ extern "C" {
133
144
  *
134
145
  * @cntl_arg_both{lcbU32*}
135
146
  * @committed
136
- * @see lcb-timeout-info
147
+ * @see lcb-time-info
137
148
  */
138
149
  #define LCB_CNTL_OP_TIMEOUT 0x00
139
150
 
@@ -165,13 +176,27 @@ extern "C" {
165
176
  */
166
177
  #define LCB_CNTL_BUCKETNAME 0x30
167
178
 
179
+ /**
180
+ * @brief Get the bucket type.
181
+ * This returns the bucket type - which is either of the following:
182
+ *
183
+ * * LCB_BTYPE_UNSPEC
184
+ * * LCB_BTYPE_COUCHBASE
185
+ * * LCB_BTYPE_EPHEMERAL
186
+ * * LCB_BTYPE_MEMCACHED
187
+ *
188
+ * @see https://developer.couchbase.com/documentation/server/current/architecture/core-data-access-buckets.html
189
+ *
190
+ * @cntl_arg_getonly{lcb_BTYPE*}
191
+ */
192
+ #define LCB_CNTL_BUCKETTYPE 0x48
193
+
168
194
  /**
169
195
  * @brief Get the handle type.
170
196
  * This returns the handle type - which is either LCB_TYPE_CLUSTER or
171
197
  * LCB_TYPE_BUCKET
172
198
  *
173
199
  * @cntl_arg_getonly{lcb_type_t*}
174
- * @uncommitted
175
200
  */
176
201
  #define LCB_CNTL_HANDLETYPE 0x04
177
202
 
@@ -179,7 +204,6 @@ extern "C" {
179
204
  * Obtains the current cluster configuration from the client.
180
205
  *
181
206
  * @cntl_arg_getonly{lcbvb_CONFIG**}
182
- * @uncommitted
183
207
  */
184
208
  #define LCB_CNTL_VBCONFIG 0x05
185
209
 
@@ -222,13 +246,12 @@ typedef struct lcb_cntl_vbinfo_st {
222
246
  * update is requested again.
223
247
  *
224
248
  * @cntl_arg_both{lcb_SIZE*}
225
- * @uncommitted
226
249
  */
227
250
  #define LCB_CNTL_CONFERRTHRESH 0x0c
228
251
 
229
252
  /**
230
253
  * @brief Default timeout for lcb_durability_poll()
231
- * @ingroup lcb-timeout-info
254
+ * @ingroup lcb-time-info
232
255
  *
233
256
  * This is the time the client will
234
257
  * spend sending repeated probes to a given key's vBucket masters and replicas
@@ -248,7 +271,12 @@ typedef struct lcb_cntl_vbinfo_st {
248
271
  * @committed*/
249
272
  #define LCB_CNTL_DURABILITY_INTERVAL 0x0e
250
273
 
251
- /**@brief Timeout for non-views HTTP requests
274
+ /**
275
+ * @brief Timeout for otherwise unspecified HTTP requests
276
+ *
277
+ * Examples of these kinds of HTTP requests might be cluster management,
278
+ * user management, etc.
279
+ *
252
280
  * @cntl_arg_both{lcb_U32*}
253
281
  * @committed*/
254
282
  #define LCB_CNTL_HTTP_TIMEOUT 0x0f
@@ -323,7 +351,6 @@ typedef struct lcb_cntl_vbinfo_st {
323
351
  * libcouchbase API, after which it may have been freed.
324
352
  *
325
353
  * @cntl_arg_get_and_set{char**, char*}
326
- * @uncommitted
327
354
  */
328
355
  #define LCB_CNTL_FORCE_SASL_MECH 0x16
329
356
 
@@ -360,7 +387,6 @@ struct lcb_logprocs_st;
360
387
  /**
361
388
  * @brief Logger callback
362
389
  *
363
- * @uncommitted
364
390
  *
365
391
  * This callback is invoked for each logging message emitted
366
392
  * @param procs the logging structure provided
@@ -378,7 +404,7 @@ typedef void (*lcb_logging_callback)(struct lcb_logprocs_st *procs,
378
404
 
379
405
  /**
380
406
  * @brief Logging context
381
- * @uncommitted
407
+ * @volatile
382
408
  *
383
409
  * This structure defines the logging handlers. Currently there is only
384
410
  * a single field defined which is the default callback for the loggers.
@@ -415,13 +441,14 @@ typedef struct lcb_logprocs_st {
415
441
  *
416
442
  * @cntl_arg_both{lcb_U32*}
417
443
  * @see LCB_CNTL_CONFERRTHRESH
418
- * @uncommitted
419
444
  */
420
445
  #define LCB_CNTL_CONFDELAY_THRESH 0x19
421
446
 
422
- /**@brief Get the transport used to fetch cluster configuration.
447
+ /**
448
+ * @brief Get the transport used to fetch cluster configuration.
423
449
  * @cntl_arg_getonly{lcb_config_transport_t*}
424
- * @uncommitted*/
450
+ * @uncommitted
451
+ */
425
452
  #define LCB_CNTL_CONFIG_TRANSPORT 0x1A
426
453
 
427
454
  /**
@@ -468,19 +495,22 @@ typedef struct lcb_logprocs_st {
468
495
  */
469
496
  #define LCB_CNTL_HTCONFIG_IDLE_TIMEOUT 0x1C
470
497
 
471
- /**@brief Get the current SCM changeset for the library binary
498
+ /**
499
+ * @brief Get the current SCM changeset for the library binary
472
500
  * @cntl_arg_getonly{char**}
473
- * @committed*/
501
+ */
474
502
  #define LCB_CNTL_CHANGESET 0x1F
475
503
 
476
504
  /**
477
- * @brief file used for the configuration cache.
505
+ * @brief File used for the configuration cache.
478
506
  *
479
507
  * The configuration
480
508
  * cache allows to bootstrap from a cluster without using the initial
481
509
  * bootstrap connection, considerably reducing latency. If the file passed
482
510
  * does not exist, the normal bootstrap process is performed and the file
483
- * is written to with the current information.
511
+ * is written to with the current information. File will be updated as
512
+ * the configuration in the cluster changes. Multiple instances may race
513
+ * to update the file, and that is the intended behavior.
484
514
  *
485
515
  * @note The leading directories for the file must exist, otherwise the file
486
516
  * will never be created.
@@ -529,12 +559,14 @@ typedef enum {
529
559
  * @see LCB_CNTL_SSL_MODE
530
560
  */
531
561
  #define LCB_CNTL_SSL_CERT 0x23
532
- /* For back compat */
562
+ /**
563
+ * Alias for @ref LCB_CNTL_SSL_CERT for backward compatibility.
564
+ * @deprecated
565
+ */
533
566
  #define LCB_CNTL_SSL_CACERT LCB_CNTL_SSL_CERT
534
567
 
535
568
  /**
536
- * @brief
537
- * Select retry mode to manipulate
569
+ * @brief Select retry mode to manipulate
538
570
  */
539
571
  typedef enum {
540
572
  LCB_RETRY_ON_TOPOCHANGE = 0, /**< Select retry for topology */
@@ -577,8 +609,10 @@ typedef enum {
577
609
  */
578
610
  #define LCB_RETRYOPT_CREATE(mode, policy) (((mode) << 16) | policy)
579
611
 
580
- #define LCB_RETRYOPT_GETMODE(u) (u) >> 16
581
- #define LCB_RETRYOPT_GETPOLICY(u) (u) & 0xffff
612
+ /** Get mode from retry setting value */
613
+ #define LCB_RETRYOPT_GETMODE(u) ((u) >> 16)
614
+ /** Get policy from retry setting value */
615
+ #define LCB_RETRYOPT_GETPOLICY(u) ((u)&0xffff)
582
616
 
583
617
  /**
584
618
  * @volatile
@@ -637,12 +671,9 @@ typedef enum {
637
671
  } lcb_HTCONFIG_URLTYPE;
638
672
 
639
673
  /**
640
- * @volatile - Primarily here to support tests and buggy HTTP servers/proxies
641
- * which do not like to maintain a connection upon receipt of a 404.
642
- *
643
674
  * @brief Set the URL selection mode.
644
675
  *
645
- * The URL type can be a mask of the lcb_HTCONFIG_URLTYPE constants which
676
+ * The URL type can be a mask of the #lcb_HTCONFIG_URLTYPE constants which
646
677
  * indicate which URLs the HTTP provider should use.
647
678
  *
648
679
  * The default is to use the `25PLUS` URI first, and fallback on the compat uri
@@ -654,11 +685,13 @@ typedef enum {
654
685
  * This setting is only used when CCCP is disabled. This will typically be for
655
686
  * older clusters or for memcached buckets.
656
687
  * @cntl_arg_both{`int*` (value is one of @ref lcb_HTCONFIG_URLTYPE)}
688
+
689
+ * @volatile Primarily here to support tests and buggy HTTP servers/proxies
690
+ * which do not like to maintain a connection upon receipt of a 404.
657
691
  */
658
692
  #define LCB_CNTL_HTCONFIG_URLTYPE 0x25
659
693
 
660
694
  /**
661
- * @volatile
662
695
  * Determines whether to run the event loop internally within lcb_destroy()
663
696
  * until no more I/O resources remain for the library. This is usually only
664
697
  * necessary if you are creating a lot of instances and/or are using memory
@@ -666,12 +699,11 @@ typedef enum {
666
699
  *
667
700
  * @cntl_arg_both{`int*` (as a boolean)}
668
701
  * @see lcb_destroy_async() and lcb_set_destroy_callback()
702
+ * @volatile
669
703
  */
670
704
  #define LCB_CNTL_SYNCDESTROY 0x28
671
705
 
672
706
  /**
673
- * @committed
674
- *
675
707
  * Sets the logging level for the console logger. If a logger is already
676
708
  * initialized (either from the environment, or via lcb_cntl_logger() then
677
709
  * this operation does nothing.
@@ -681,8 +713,8 @@ typedef enum {
681
713
  * it from the environment.
682
714
  *
683
715
  * The argument passed to lcb_cntl() is an integer of 0 until
684
- * `LCB_LOGLEVEL_MAX`, though the actual type is of `lcb_U32` rather than
685
- * an enum type.
716
+ * `LCB_LOG_MAX`, though the actual type is of `lcb_U32` rather than
717
+ * an enum type #lcb_log_severity_t.
686
718
  *
687
719
  * @cntl_arg_setonly{const lcb_U32 *}
688
720
  * @see LCB_CNTL_LOGGER
@@ -690,7 +722,6 @@ typedef enum {
690
722
  #define LCB_CNTL_CONLOGGER_LEVEL 0x29
691
723
 
692
724
  /**
693
- * @uncommitted
694
725
  *
695
726
  * Sets the output file (as a `FILE*`) for the console logger. Note that
696
727
  * any existing file pointer will be cleared (but not `fclose()`d.
@@ -710,8 +741,6 @@ typedef enum {
710
741
  #define LCB_CNTL_CONLOGGER_FP 0x3B
711
742
 
712
743
  /**
713
- * @committed
714
- *
715
744
  * Sets the behavior for reporting network errors. By default network errors
716
745
  * are returned as `LCB_NETWORK_ERROR` return codes for compatibility reasons.
717
746
  * More detailed error codes may be available by enabling this option which will
@@ -726,7 +755,6 @@ typedef enum {
726
755
  #define LCB_CNTL_DETAILED_ERRCODES 0x2A
727
756
 
728
757
  /**
729
- * @uncommitted
730
758
  *
731
759
  * Sets the interval at which the retry queue will attempt to resend a failed
732
760
  * operation. When an operation fails and the retry policy (see
@@ -744,7 +772,6 @@ typedef enum {
744
772
  #define LCB_CNTL_RETRY_INTERVAL 0x2C
745
773
 
746
774
  /**
747
- * @uncommitted
748
775
  *
749
776
  * When an operation has been retried more than once and it has still not
750
777
  * succeeded, the library will attempt to back off for the operation by
@@ -756,7 +783,6 @@ typedef enum {
756
783
  #define LCB_CNTL_RETRY_BACKOFF 0x2D
757
784
 
758
785
  /**
759
- * @volatile
760
786
  * Whether commands are retried immediately upon receipt of not-my-vbucket
761
787
  * replies.
762
788
  *
@@ -766,22 +792,22 @@ typedef enum {
766
792
  * and @ref LCB_CNTL_RETRY_BACKOFF settings. Disabling this setting will
767
793
  * restore the older behavior. This may be used in case there are problems
768
794
  * with the default heuristic/retry algorithm.
795
+ *
796
+ * @volatile
769
797
  */
770
798
  #define LCB_CNTL_RETRY_NMV_IMM 0x37
771
799
 
772
800
  /**
773
- * @volatile
774
- *
775
801
  * Set the maximum pool size for pooled http (view request) sockets. This should
776
802
  * be set to 1 (the default) unless you plan to execute concurrent view requests.
777
803
  * You may set this to 0 to disable pooling
778
804
  *
779
805
  * @cntl_arg_both{lcb_SIZE}
806
+ * @volatile
780
807
  */
781
808
  #define LCB_CNTL_HTTP_POOLSIZE 0x2E
782
809
 
783
810
  /**
784
- * @uncomitted
785
811
  * Determine whether or not a new configuration should be received when an error
786
812
  * is received over the HTTP API (i.e. via lcb_make_http_request().
787
813
  *
@@ -789,24 +815,24 @@ typedef enum {
789
815
  * expectedly issuing a lot of requests which may result in an error.
790
816
  *
791
817
  * @cntl_arg_both{int (as boolean)}
818
+ * @uncommitted
792
819
  */
793
820
  #define LCB_CNTL_HTTP_REFRESH_CONFIG_ON_ERROR 0x2F
794
821
 
795
822
  /**
796
- * @volatile
797
823
  * Set the behavior of the lcb_sched_leave() API call. By default the
798
824
  * lcb_sched_leave() will also set up the necessary requirements for flushing
799
825
  * to the network. If this option is off then an explicit call to
800
826
  * lcb_sched_flush() must be performed instead.
801
827
  *
802
828
  * @cntl_arg_both{int (as boolean)}
829
+ * @volatile
803
830
  */
804
831
  #define LCB_CNTL_SCHED_IMPLICIT_FLUSH 0x31
805
832
 
806
833
  /**
807
- * @volatile
808
834
  *
809
- * Allow the server to return an additional 16 bytes of data for each
835
+ * Request the server to return an additional 16 bytes of data for each
810
836
  * mutation operation. This extra information may help with more reliable
811
837
  * durability polling, but will also increase the size of the response packet.
812
838
  *
@@ -819,8 +845,6 @@ typedef enum {
819
845
  #define LCB_CNTL_FETCH_MUTATION_TOKENS 0x34
820
846
 
821
847
  /**
822
- * @volatile
823
- *
824
848
  * This setting determines whether the lcb_durability_poll() function will
825
849
  * transparently attempt to use mutation token functionality (rather than checking
826
850
  * the CAS). This option is most useful for older code which does
@@ -836,24 +860,23 @@ typedef enum {
836
860
  * function.
837
861
  *
838
862
  * @cntl_arg_both{int (as boolean)}
863
+ * @volatile
839
864
  */
840
865
  #define LCB_CNTL_DURABILITY_MUTATION_TOKENS 0x35
841
866
 
842
867
  /**
843
- * @volatile
844
- *
845
868
  * This read-only property determines if the mutation token mechanism is supported
846
869
  * on the cluster itself. This will only be accurate once a single operation
847
870
  * has been performed on the cluster - or in other words, once a connection
848
871
  * to a data node has been established for the purposes of normal operations.
849
872
  *
850
873
  * @cntl_arg_getonly{int (as boolean)}
874
+ * @uncommitted
851
875
  */
852
876
  #define LCB_CNTL_MUTATION_TOKENS_SUPPORTED 0x38
853
877
 
854
878
 
855
879
  /**
856
- * @uncommitted
857
880
  * This setting determines if calls to lcb_wait() and lcb_wait3() will reset
858
881
  * the timeout of pending operations to the time that lcb_wait() was called,
859
882
  * rather than having the operation maintain the time of the call which
@@ -862,21 +885,21 @@ typedef enum {
862
885
  * avoid prematurely having operations time out.
863
886
  *
864
887
  * @cntl_arg_both{int (as boolean)}
888
+ * @uncommitted
865
889
  *
866
890
  * Use `"readj_wait_tmo"` for the string version
867
891
  */
868
892
  #define LCB_CNTL_RESET_TIMEOUT_ON_WAIT 0x3A
869
893
 
870
894
  /**
871
- * @volatile
872
895
  * Clears the internal prepared statement cache for N1QL
873
896
  *
874
897
  * This does not take any arguments, and is valid only on @ref LCB_CNTL_SET
898
+ * @uncommitted
875
899
  */
876
900
  #define LCB_CNTL_N1QL_CLEARACHE 0x3E
877
901
 
878
902
  /**
879
- * @committed
880
903
  * Sets additional text for negotiation. This allows wrappers or applications
881
904
  * to add additional identifying information which can then be seen in the
882
905
  * server logs.
@@ -902,12 +925,11 @@ typedef const char *lcb_BUCKETCRED[2];
902
925
  /**
903
926
  * Set the amount of time the client should wait before retrying a
904
927
  * not-my-vbucket response packet. The default is 100ms. The value should
905
- * be specified in microseconds
906
- *
907
- * @committed
908
- * @cntl_arg_both{lcb_U32*}
928
+ * be specified in microseconds.
909
929
  *
910
930
  * Use `"retry_nmv_interval"` with lcb_cntl_string()
931
+ *
932
+ * @cntl_arg_both{lcb_U32*}
911
933
  */
912
934
  #define LCB_CNTL_RETRY_NMV_INTERVAL 0x41
913
935
 
@@ -919,7 +941,6 @@ typedef const char *lcb_BUCKETCRED[2];
919
941
  * @note This setting only works for event-style I/O plugins. This means it
920
942
  * has no effect on completion style plugins such as libuv or Windows IOCP
921
943
  *
922
- * @committed
923
944
  * @cntl_arg_both{lcb_U32*}
924
945
  */
925
946
  #define LCB_CNTL_READ_CHUNKSIZE 0x42
@@ -930,7 +951,6 @@ typedef const char *lcb_BUCKETCRED[2];
930
951
  *
931
952
  * Use `enable_errmap` in the connection string
932
953
  *
933
- * @volatile
934
954
  * @cntl_arg_both{int* (as boolean)}
935
955
  */
936
956
  #define LCB_CNTL_ENABLE_ERRMAP 0x43
@@ -945,7 +965,6 @@ typedef const char *lcb_BUCKETCRED[2];
945
965
  *
946
966
  * Use `select_bucket` in the connection string
947
967
  *
948
- * @volatile
949
968
  * @cntl_arg_both{int* (as boolean)}
950
969
  */
951
970
  #define LCB_CNTL_SELECT_BUCKET 0x44
@@ -956,7 +975,6 @@ typedef const char *lcb_BUCKETCRED[2];
956
975
  *
957
976
  * The keepalive interval will be set to the operating system default.
958
977
  *
959
- * @committed
960
978
  * @cntl_arg_both{int* (as boolean)}
961
979
  */
962
980
  #define LCB_CNTL_TCP_KEEPALIVE 0x45
@@ -970,7 +988,6 @@ typedef const char *lcb_BUCKETCRED[2];
970
988
  * This option facilitates 'fast failover' - in that the client can preemptively
971
989
  * check for any cluster topology updates before encountering an error.
972
990
  *
973
- * @volatile
974
991
  * @cntl_arg_both{lcb_U32*}
975
992
  *
976
993
  * The value for this option is a time value. See the top of this header
@@ -998,15 +1015,18 @@ typedef const char *lcb_BUCKETCRED[2];
998
1015
  * servers don't understand anyway). To disable the sending of hello, set this
999
1016
  * value to false.
1000
1017
  *
1001
- * @uncommitted
1002
1018
  * @cntl_arg_both{int* (as boolean)}
1019
+ * @committed
1003
1020
  *
1004
1021
  * You can also use `send_hello=false` in the connection string.
1005
1022
  */
1006
1023
  #define LCB_CNTL_SEND_HELLO 0x47
1007
1024
 
1008
- /** This is not a command, but rather an indicator of the last item */
1009
- #define LCB_CNTL__MAX 0x48
1025
+ /**
1026
+ * This is not a command, but rather an indicator of the last item.
1027
+ * @internal
1028
+ */
1029
+ #define LCB_CNTL__MAX 0x49
1010
1030
  /**@}*/
1011
1031
 
1012
1032
  #ifdef __cplusplus