libcouchbase 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -2
  3. data/ext/libcouchbase/CMakeLists.txt +51 -25
  4. data/ext/libcouchbase/CONTRIBUTING.md +46 -65
  5. data/ext/libcouchbase/RELEASE_NOTES.markdown +163 -0
  6. data/ext/libcouchbase/cmake/Modules/DownloadLcbDep.cmake +9 -11
  7. data/ext/libcouchbase/cmake/Modules/FindProfiler.cmake +16 -0
  8. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +6 -6
  9. data/ext/libcouchbase/cmake/config-cmake.h.in +2 -0
  10. data/ext/libcouchbase/cmake/configure +16 -0
  11. data/ext/libcouchbase/example/CMakeLists.txt +17 -2
  12. data/ext/libcouchbase/example/analytics/.gitignore +1 -0
  13. data/ext/libcouchbase/example/analytics/analytics.c +158 -0
  14. data/ext/libcouchbase/example/analytics/build-queries.rb +34 -0
  15. data/ext/libcouchbase/example/analytics/cJSON.c +1 -0
  16. data/ext/libcouchbase/example/analytics/cJSON.h +1 -0
  17. data/ext/libcouchbase/example/analytics/queries.h +113 -0
  18. data/ext/libcouchbase/example/analytics/queries/00-show-dataverse.json +5 -0
  19. data/ext/libcouchbase/example/analytics/queries/01-setup-dataset-breweries.json +6 -0
  20. data/ext/libcouchbase/example/analytics/queries/02-setup-dataset-beers.json +6 -0
  21. data/ext/libcouchbase/example/analytics/queries/03-initiate-shadow.json +6 -0
  22. data/ext/libcouchbase/example/analytics/queries/04-list-datasets.json +7 -0
  23. data/ext/libcouchbase/example/analytics/queries/05-count-breweries.json +5 -0
  24. data/ext/libcouchbase/example/analytics/queries/06-first-brewery.json +6 -0
  25. data/ext/libcouchbase/example/analytics/queries/07-key-based-lookup.json +6 -0
  26. data/ext/libcouchbase/example/analytics/queries/08-exact-match-lookup.json +7 -0
  27. data/ext/libcouchbase/example/analytics/queries/09-exact-match-lookup-different-shape.json +6 -0
  28. data/ext/libcouchbase/example/analytics/queries/10-other-query-filters.json +6 -0
  29. data/ext/libcouchbase/example/analytics/queries/11-equijoin.json +9 -0
  30. data/ext/libcouchbase/example/analytics/queries/12-equijoin-select-star.json +10 -0
  31. data/ext/libcouchbase/example/analytics/queries/13-ansi-join.json +8 -0
  32. data/ext/libcouchbase/example/analytics/queries/14-join-select-values.json +8 -0
  33. data/ext/libcouchbase/example/analytics/queries/15-nested-outer-join.json +7 -0
  34. data/ext/libcouchbase/example/analytics/queries/16-theta-join.json +8 -0
  35. data/ext/libcouchbase/example/analytics/queries/17-existential-quantification.json +9 -0
  36. data/ext/libcouchbase/example/analytics/queries/18-universal-quantification.json +7 -0
  37. data/ext/libcouchbase/example/analytics/queries/19-simple-aggregation.json +6 -0
  38. data/ext/libcouchbase/example/analytics/queries/20-simple-aggregation-unwrapped-value.json +6 -0
  39. data/ext/libcouchbase/example/analytics/queries/21-simple-aggregation-explicit.json +6 -0
  40. data/ext/libcouchbase/example/analytics/queries/22-grouping-and-aggregation.json +6 -0
  41. data/ext/libcouchbase/example/analytics/queries/23-grouping-and-aggregation-with-hint.json +7 -0
  42. data/ext/libcouchbase/example/analytics/queries/24-grouping-and-limits.json +7 -0
  43. data/ext/libcouchbase/example/analytics/queries/25-named-parameters.json +7 -0
  44. data/ext/libcouchbase/example/analytics/queries/26-positional-parameters.json +7 -0
  45. data/ext/libcouchbase/example/crypto/common_provider.c +2 -0
  46. data/ext/libcouchbase/example/crypto/common_provider.h +2 -0
  47. data/ext/libcouchbase/example/crypto/openssl_symmetric_decrypt.c +5 -0
  48. data/ext/libcouchbase/example/crypto/openssl_symmetric_encrypt.c +0 -1
  49. data/ext/libcouchbase/example/crypto/openssl_symmetric_provider.c +16 -26
  50. data/ext/libcouchbase/example/db/db.c +10 -6
  51. data/ext/libcouchbase/example/fts/.gitignore +1 -0
  52. data/ext/libcouchbase/example/fts/build-queries.rb +33 -0
  53. data/ext/libcouchbase/example/fts/fts.c +142 -0
  54. data/ext/libcouchbase/example/fts/queries.h +61 -0
  55. data/ext/libcouchbase/example/fts/queries/00-simple-text-query.json +12 -0
  56. data/ext/libcouchbase/example/fts/queries/01-simple-text-query-on-non-default-index.json +9 -0
  57. data/ext/libcouchbase/example/fts/queries/02-simple-text-query-on-stored-field.json +13 -0
  58. data/ext/libcouchbase/example/fts/queries/03-match-query-with-facet.json +19 -0
  59. data/ext/libcouchbase/example/fts/queries/04-docid-query.json +11 -0
  60. data/ext/libcouchbase/example/fts/queries/05-unanalyzed-term-query-with-fuzziness-level-of-0.json +13 -0
  61. data/ext/libcouchbase/example/fts/queries/06-unanalyzed-term-query-with-fuzziness-level-of-2.json +14 -0
  62. data/ext/libcouchbase/example/fts/queries/07-match-phrase-query.json +13 -0
  63. data/ext/libcouchbase/example/fts/queries/08-phrase-query.json +16 -0
  64. data/ext/libcouchbase/example/fts/queries/09-query-string-query.json +9 -0
  65. data/ext/libcouchbase/example/fts/queries/10-conjunction-query.json +21 -0
  66. data/ext/libcouchbase/example/fts/queries/11-wild-card-query.json +13 -0
  67. data/ext/libcouchbase/example/fts/queries/12-numeric-range-query.json +11 -0
  68. data/ext/libcouchbase/example/fts/queries/13-regexp-query.json +13 -0
  69. data/ext/libcouchbase/example/minimal/.gitignore +1 -0
  70. data/ext/libcouchbase/example/minimal/query.c +185 -0
  71. data/ext/libcouchbase/example/subdoc/subdoc-xattrs.c +2 -2
  72. data/ext/libcouchbase/example/tracing/cJSON.c +1 -1
  73. data/ext/libcouchbase/example/tracing/cJSON.h +1 -1
  74. data/ext/libcouchbase/include/libcouchbase/cbft.h +38 -4
  75. data/ext/libcouchbase/include/libcouchbase/cntl-private.h +8 -97
  76. data/ext/libcouchbase/include/libcouchbase/cntl.h +288 -8
  77. data/ext/libcouchbase/include/libcouchbase/couchbase.h +47 -10
  78. data/ext/libcouchbase/include/libcouchbase/crypto.h +214 -48
  79. data/ext/libcouchbase/include/libcouchbase/deprecated.h +12 -0
  80. data/ext/libcouchbase/include/libcouchbase/error.h +33 -2
  81. data/ext/libcouchbase/include/libcouchbase/ixmgmt.h +1 -1
  82. data/ext/libcouchbase/include/libcouchbase/n1ql.h +87 -13
  83. data/ext/libcouchbase/include/libcouchbase/subdoc.h +3 -7
  84. data/ext/libcouchbase/include/libcouchbase/tracing.h +174 -56
  85. data/ext/libcouchbase/include/libcouchbase/vbucket.h +21 -1
  86. data/ext/libcouchbase/include/libcouchbase/views.h +49 -4
  87. data/ext/libcouchbase/packaging/deb/control +2 -3
  88. data/ext/libcouchbase/packaging/parse-git-describe.pl +1 -1
  89. data/ext/libcouchbase/plugins/io/libev/CMakeLists.txt +7 -5
  90. data/ext/libcouchbase/plugins/io/libevent/CMakeLists.txt +7 -5
  91. data/ext/libcouchbase/plugins/io/libuv/CMakeLists.txt +14 -12
  92. data/ext/libcouchbase/plugins/io/libuv/libuv_compat.h +3 -0
  93. data/ext/libcouchbase/plugins/io/libuv/plugin-libuv.c +14 -6
  94. data/ext/libcouchbase/plugins/io/select/CMakeLists.txt +7 -5
  95. data/ext/libcouchbase/src/bootstrap.cc +6 -1
  96. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +2 -7
  97. data/ext/libcouchbase/src/bucketconfig/bc_file.cc +1 -1
  98. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +4 -11
  99. data/ext/libcouchbase/src/bucketconfig/clconfig.h +29 -36
  100. data/ext/libcouchbase/src/bucketconfig/confmon.cc +4 -2
  101. data/ext/libcouchbase/src/cntl.cc +181 -151
  102. data/ext/libcouchbase/src/config_static.h +1 -1
  103. data/ext/libcouchbase/src/connspec.cc +5 -1
  104. data/ext/libcouchbase/src/connspec.h +3 -1
  105. data/ext/libcouchbase/src/crypto.cc +93 -80
  106. data/ext/libcouchbase/src/dns-srv.cc +1 -1
  107. data/ext/libcouchbase/src/handler.cc +0 -1
  108. data/ext/libcouchbase/src/http/http-priv.h +1 -0
  109. data/ext/libcouchbase/src/http/http.cc +1 -2
  110. data/ext/libcouchbase/src/instance.cc +21 -2
  111. data/ext/libcouchbase/src/internal.h +1 -0
  112. data/ext/libcouchbase/src/lcbio/ctx.c +24 -3
  113. data/ext/libcouchbase/src/lcbio/ioutils.cc +1 -1
  114. data/ext/libcouchbase/src/lcbio/rw-inl.h +22 -1
  115. data/ext/libcouchbase/src/lcbio/ssl.h +2 -0
  116. data/ext/libcouchbase/src/mc/compress.cc +18 -11
  117. data/ext/libcouchbase/src/mc/mcreq.c +2 -0
  118. data/ext/libcouchbase/src/mc/mcreq.h +1 -1
  119. data/ext/libcouchbase/src/mcserver/mcserver.cc +163 -6
  120. data/ext/libcouchbase/src/mcserver/negotiate.cc +17 -7
  121. data/ext/libcouchbase/src/n1ql/n1ql.cc +12 -3
  122. data/ext/libcouchbase/src/newconfig.cc +4 -3
  123. data/ext/libcouchbase/src/nodeinfo.cc +1 -7
  124. data/ext/libcouchbase/src/operations/observe.cc +1 -0
  125. data/ext/libcouchbase/src/operations/ping.cc +5 -3
  126. data/ext/libcouchbase/src/retryq.cc +22 -0
  127. data/ext/libcouchbase/src/retryq.h +2 -1
  128. data/ext/libcouchbase/src/rnd.cc +5 -12
  129. data/ext/libcouchbase/src/settings.c +4 -7
  130. data/ext/libcouchbase/src/settings.h +6 -2
  131. data/ext/libcouchbase/src/strcodecs/base64.c +59 -0
  132. data/ext/libcouchbase/src/strcodecs/strcodecs.h +2 -0
  133. data/ext/libcouchbase/src/trace.h +2 -2
  134. data/ext/libcouchbase/src/tracing/span.cc +177 -45
  135. data/ext/libcouchbase/src/tracing/threshold_logging_tracer.cc +70 -28
  136. data/ext/libcouchbase/src/tracing/tracing-internal.h +33 -48
  137. data/ext/libcouchbase/src/vbucket/vbucket.c +146 -30
  138. data/ext/libcouchbase/src/wait.cc +1 -1
  139. data/ext/libcouchbase/tests/CMakeLists.txt +13 -4
  140. data/ext/libcouchbase/tests/iotests/mock-environment.cc +1 -1
  141. data/ext/libcouchbase/tests/iotests/t_misc.cc +2 -2
  142. data/ext/libcouchbase/tests/iotests/t_views.cc +1 -1
  143. data/ext/libcouchbase/tests/iotests/testutil.cc +3 -2
  144. data/ext/libcouchbase/tests/vbucket/confdata/map_node_present_nodesext_missing_nodes.json +94 -0
  145. data/ext/libcouchbase/tests/vbucket/t_config.cc +15 -0
  146. data/ext/libcouchbase/tools/CMakeLists.txt +11 -6
  147. data/ext/libcouchbase/tools/cbc-handlers.h +9 -0
  148. data/ext/libcouchbase/tools/cbc-proxy.cc +1 -1
  149. data/ext/libcouchbase/tools/cbc.cc +33 -5
  150. data/ext/libcouchbase/tools/common/options.cc +1 -1
  151. data/ext/libcouchbase/tools/extract-packets.rb +110 -0
  152. data/lib/libcouchbase/connection.rb +13 -5
  153. data/lib/libcouchbase/ext/tasks.rb +1 -1
  154. data/lib/libcouchbase/version.rb +1 -1
  155. metadata +62 -7
@@ -52,7 +52,9 @@ typedef enum {
52
52
  LCBVB_SVCTYPE_IXADMIN, /**< Index administration */
53
53
  LCBVB_SVCTYPE_N1QL, /**< N1QL Query */
54
54
  LCBVB_SVCTYPE_FTS, /**< Fulltext */
55
- LCBVB_SVCTYPE_CBAS, /**< Analytics Query */
55
+ LCBVB_SVCTYPE_ANALYTICS, /**< Analytics Query */
56
+ /* for backward compatiblity */
57
+ #define LCBVB_SVCTYPE_CBAS LCBVB_SVCTYPE_ANALYTICS
56
58
  LCBVB_SVCTYPE__MAX
57
59
  } lcbvb_SVCTYPE;
58
60
 
@@ -101,6 +103,9 @@ typedef struct {
101
103
  char *ftspath; /**< Path prefix for fulltext queries */
102
104
  char *cbaspath; /**< Path prefix for analytics queries */
103
105
  unsigned nvbs; /**< Total number of vbuckets the server has assigned */
106
+ char *alt_hostname; /**< selected alternative hostname for the node */
107
+ lcbvb_SERVICES alt_svc; /**< selected alternative plain services */
108
+ lcbvb_SERVICES alt_svc_ssl; /**< selected alternative SSL Services */
104
109
  } lcbvb_SERVER;
105
110
 
106
111
  /**@volatile. ABI/API compatibility not guaranteed between versions */
@@ -194,6 +199,13 @@ lcbvb_parse_json(const char *data);
194
199
  * Load a JSON-based configuration string into a configuration object
195
200
  * @param vbc Object to populate
196
201
  * @param data NUL-terminated string to parse
202
+ * @param source hostname of the node, which emitted configuration. Pointer
203
+ * to NULL will disable heuristic when network argument is pointer to NULL
204
+ * string.
205
+ * @param network pointer to string, which specified key in alternative
206
+ * addresses dict. Use pointer NULL string to trigger heuristic, in this
207
+ * case, the function will try to match configuration source address to
208
+ * the list of addresses to determine best network.
197
209
  * @return 0 on success, nonzero on failure
198
210
  * @note it is recommended to use this function rather than lcbvb_parse_json()
199
211
  * as this will contain the error string in the configuration in case of parse
@@ -203,6 +215,14 @@ LIBCOUCHBASE_API
203
215
  int
204
216
  lcbvb_load_json(lcbvb_CONFIG *vbc, const char *data);
205
217
 
218
+
219
+ /**
220
+ * @uncommmitted
221
+ */
222
+ LIBCOUCHBASE_API
223
+ int
224
+ lcbvb_load_json_ex(lcbvb_CONFIG *vbc, const char *data, const char *source, char **network);
225
+
206
226
  /**@brief Serialize the current config as a JSON string.
207
227
  * @volatile
208
228
  * Serialize the current configuration as a JSON string. The string returned is
@@ -37,6 +37,9 @@ extern "C" {
37
37
  namespace lcb { namespace views { struct ViewRequest; } }
38
38
  typedef lcb::views::ViewRequest* lcb_VIEWHANDLE;
39
39
  #else
40
+ /**
41
+ * Pointer for request instance
42
+ */
40
43
  typedef struct lcbview_REQUEST_st *lcb_VIEWHANDLE;
41
44
  #endif
42
45
 
@@ -294,17 +297,59 @@ lcb_view_query_initcmd(lcb_CMDVIEWQUERY *vq,
294
297
  LIBCOUCHBASE_API
295
298
  void
296
299
  lcb_view_cancel(lcb_t instance, lcb_VIEWHANDLE handle);
300
+ /**@}*/
297
301
 
302
+
303
+ /**
304
+ * @ingroup lcb-public-api
305
+ * @addtogroup lcb-tracing-api
306
+ * @{
307
+ */
298
308
  #ifdef LCB_TRACING
309
+
299
310
  /**
300
- * @uncommitted
311
+ * Associate parent tracing span with the View request.
312
+ *
313
+ * @param instance the instance
314
+ * @param handle View request handle
315
+ * @param span parent span
316
+ *
317
+ * @par Attach parent tracing span to view request object.
318
+ * @code{.c}
319
+ * lcb_CMDVIEWQUERY vcmd = {0};
320
+ * char *doc_name = "beer";
321
+ * char *view_name = "by_location";
322
+ * char *options = "reduce=false&limit=3";
323
+ *
324
+ * vcmd.callback = view_callback;
325
+ * vcmd.ddoc = doc_name;
326
+ * vcmd.nddoc = strlen(doc_name);
327
+ * vcmd.view = view_name;
328
+ * vcmd.nview = strlen(view_name);
329
+ * vcmd.optstr = options;
330
+ * vcmd.noptstr = strlen(options);
331
+ * vcmd.cmdflags = LCB_CMDVIEWQUERY_F_INCLUDE_DOCS;
332
+ *
333
+ * lcb_VIEWHANDLE handle;
334
+ * vcmd.handle = &handle;
335
+ *
336
+ * err = lcb_view_query(instance, NULL, &vcmd);
337
+ * if (err != LCB_SUCCESS) {
338
+ * die(instance, "Couldn't schedule view operation", err);
339
+ * }
340
+ * lcb_view_set_parent_span(instance, handle, span);
341
+ * @endcode
342
+ *
343
+ * @see @ref example/tracing/views.c
344
+ * @committed
301
345
  */
302
346
  LIBCOUCHBASE_API
303
347
  void lcb_view_set_parent_span(lcb_t instance, lcb_VIEWHANDLE handle, lcbtrace_SPAN *span);
304
- #endif
305
-
306
- /**@}*/
307
348
 
349
+ #endif
350
+ /**
351
+ * @} (Group: Tracing)
352
+ */
308
353
  #ifdef __cplusplus
309
354
  }
310
355
  #endif
@@ -10,7 +10,7 @@ Vcs-Git: git://github.com/couchbase/libcouchbase.git
10
10
 
11
11
  Package: libcouchbase2-libevent
12
12
  Architecture: any
13
- Depends: libevent-1.4-2 (>= 1.4) | libevent-2.0-5 (>= 2.0), libcouchbase2-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
13
+ Depends: libcouchbase2-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
14
14
  Multi-Arch: same
15
15
  Description: library for the Couchbase protocol (libevent backend)
16
16
  libcouchbase is a library implementing Couchbase protocol.
@@ -19,7 +19,7 @@ Description: library for the Couchbase protocol (libevent backend)
19
19
 
20
20
  Package: libcouchbase2-libev
21
21
  Architecture: any
22
- Depends: libev3 (>= 3) | libev4 (>= 4), libcouchbase2-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
22
+ Depends: libcouchbase2-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
23
23
  Multi-Arch: same
24
24
  Description: library for the Couchbase protocol (libev backend)
25
25
  libcouchbase is a library implementing Couchbase protocol.
@@ -70,4 +70,3 @@ Description: library for the Couchbase protocol
70
70
  libcouchbase is a library implementing Couchbase protocol.
71
71
  .
72
72
  This package provides the cbc tools built on libcouchbase library.
73
-
@@ -47,7 +47,7 @@ if ($WantHelp) {
47
47
 
48
48
  my $output;
49
49
  if (!$Input) {
50
- $output = qx(git describe --long);
50
+ $output = qx(git describe --long --abbrev=10);
51
51
  } else {
52
52
  $output = $Input;
53
53
  }
@@ -1,8 +1,10 @@
1
- INSTALL(
2
- FILES
3
- libev_io_opts.h
4
- DESTINATION
5
- include/libcouchbase)
1
+ IF(LCB_INSTALL_HEADERS)
2
+ INSTALL(
3
+ FILES
4
+ libev_io_opts.h
5
+ DESTINATION
6
+ include/libcouchbase)
7
+ ENDIF(LCB_INSTALL_HEADERS)
6
8
 
7
9
  IF(NOT (HAVE_LIBEV3 OR HAVE_LIBEV4))
8
10
  RETURN()
@@ -1,8 +1,10 @@
1
- INSTALL(
2
- FILES
3
- libevent_io_opts.h
4
- DESTINATION
5
- include/libcouchbase)
1
+ IF(LCB_INSTALL_HEADERS)
2
+ INSTALL(
3
+ FILES
4
+ libevent_io_opts.h
5
+ DESTINATION
6
+ include/libcouchbase)
7
+ ENDIF(LCB_INSTALL_HEADERS)
6
8
 
7
9
 
8
10
  IF(NOT (HAVE_LIBEVENT OR HAVE_LIBEVENT2))
@@ -1,16 +1,18 @@
1
- INSTALL(
2
- FILES
3
- plugin-libuv.c
4
- plugin-internal.h
5
- libuv_compat.h
6
- DESTINATION
7
- include/libcouchbase/plugins/io/libuv)
1
+ IF(LCB_INSTALL_HEADERS)
2
+ INSTALL(
3
+ FILES
4
+ plugin-libuv.c
5
+ plugin-internal.h
6
+ libuv_compat.h
7
+ DESTINATION
8
+ include/libcouchbase/plugins/io/libuv)
8
9
 
9
- INSTALL(
10
- FILES
11
- libuv_io_opts.h
12
- DESTINATION
13
- include/libcouchbase)
10
+ INSTALL(
11
+ FILES
12
+ libuv_io_opts.h
13
+ DESTINATION
14
+ include/libcouchbase)
15
+ ENDIF(LCB_INSTALL_HEADERS)
14
16
 
15
17
  IF(NOT HAVE_LIBUV OR LCB_NO_PLUGINS OR NOT LCB_BUILD_LIBUV)
16
18
  RETURN()
@@ -111,6 +111,9 @@
111
111
  #ifndef EAI_OVERFLOW
112
112
  #define EAI_OVERFLOW EAI_FAIL
113
113
  #endif
114
+ #ifndef EFTYPE
115
+ #define EFTYPE EAI_FAIL
116
+ #endif
114
117
 
115
118
  #define OK 0
116
119
 
@@ -330,7 +330,6 @@ static int start_connect(lcb_io_opt_t iobase,
330
330
  my_uvreq_t *uvr;
331
331
  int ret;
332
332
  int err_is_set = 0;
333
- uv_os_fd_t fd = INVALID_SOCKET;
334
333
 
335
334
  uvr = alloc_uvreq(sock, (generic_callback_t)callback);
336
335
  if (!uvr) {
@@ -366,12 +365,17 @@ static int start_connect(lcb_io_opt_t iobase,
366
365
  incref_sock(sock);
367
366
  }
368
367
 
369
- /* Fetch socket descriptor for internal usage.
370
- * For example to detect dead sockets. */
371
- ret = uv_fileno((uv_handle_t *)&sock->tcp, &fd);
372
- if (ret == 0) {
373
- sock->base.socket = fd;
368
+ #if UV_VERSION_HEX >= 0x010000
369
+ {
370
+ uv_os_fd_t fd = INVALID_SOCKET;
371
+ /* Fetch socket descriptor for internal usage.
372
+ * For example to detect dead sockets. */
373
+ ret = uv_fileno((uv_handle_t *)&sock->tcp, &fd);
374
+ if (ret == 0) {
375
+ sock->base.socket = fd;
376
+ }
374
377
  }
378
+ #endif
375
379
 
376
380
  return ret;
377
381
  }
@@ -620,6 +624,7 @@ static void set_last_error(my_iops_t *io, int error)
620
624
  io->base.v.v1.error = uvc_last_errno(io->loop, error);
621
625
  }
622
626
 
627
+ #if UV_VERSION_HEX >= 0x010000
623
628
  static int check_closed(lcb_io_opt_t io, lcb_sockdata_t *sockbase, int flags)
624
629
  {
625
630
  my_sockdata_t *sd = (my_sockdata_t *)sockbase;
@@ -661,6 +666,7 @@ GT_RETRY:
661
666
  }
662
667
  }
663
668
  }
669
+ #endif
664
670
 
665
671
  static void wire_iops2(int version,
666
672
  lcb_loop_procs *loop,
@@ -687,7 +693,9 @@ static void wire_iops2(int version,
687
693
  iocp->read2 = start_read;
688
694
  iocp->write2 = start_write2;
689
695
  iocp->cntl = cntl_socket;
696
+ #if UV_VERSION_HEX >= 0x010000
690
697
  iocp->is_closed = check_closed;
698
+ #endif
691
699
 
692
700
  /** Stuff we don't use */
693
701
  iocp->write = NULL;
@@ -4,8 +4,10 @@ SET_TARGET_PROPERTIES(couchbase_select
4
4
  PROPERTIES
5
5
  COMPILE_FLAGS "${CMAKE_C_FLAGS} ${LCB_CORE_CFLAGS}"
6
6
  POSITION_INDEPENDENT_CODE TRUE)
7
- INSTALL(
8
- FILES
9
- select_io_opts.h
10
- DESTINATION
11
- include/libcouchbase/)
7
+ IF(LCB_INSTALL_HEADERS)
8
+ INSTALL(
9
+ FILES
10
+ select_io_opts.h
11
+ DESTINATION
12
+ include/libcouchbase/)
13
+ ENDIF(LCB_INSTALL_HEADERS)
@@ -53,7 +53,6 @@ void Bootstrap::config_callback(EventType event, ConfigInfo *info) {
53
53
 
54
54
  tm.cancel();
55
55
 
56
- lcb_log(LOGARGS(instance, DEBUG), "Instance configured");
57
56
 
58
57
  if (info->get_origin() != CLCONFIG_FILE) {
59
58
  /* Set the timestamp for the current config to control throttling,
@@ -88,6 +87,7 @@ void Bootstrap::config_callback(EventType event, ConfigInfo *info) {
88
87
  state = S_BOOTSTRAPPED;
89
88
  lcb_aspend_del(&instance->pendops, LCB_PENDTYPE_COUNTER, NULL);
90
89
 
90
+ lcb_log(LOGARGS(instance, INFO), "Selected network configuration: \"%s\"", LCBT_SETTING(instance, network));
91
91
  if (instance->type == LCB_TYPE_BUCKET) {
92
92
  if (LCBVB_DISTTYPE(LCBT_VBCONFIG(instance)) == LCBVB_DIST_KETAMA &&
93
93
  instance->cur_configinfo->get_origin() != CLCONFIG_MCRAW) {
@@ -212,6 +212,11 @@ lcb_error_t Bootstrap::bootstrap(unsigned options) {
212
212
  }
213
213
 
214
214
  if (options == BS_REFRESH_INITIAL) {
215
+ if (LCBT_SETTING(parent, network)) {
216
+ lcb_log(LOGARGS(parent, INFO), "Requested network configuration: \"%s\"", LCBT_SETTING(parent, network));
217
+ } else {
218
+ lcb_log(LOGARGS(parent, INFO), "Requested network configuration: heuristic");
219
+ }
215
220
  state = S_INITIAL_PRE;
216
221
  parent->confmon->prepare();
217
222
  tm.rearm(LCBT_SETTING(parent, config_timeout));
@@ -186,7 +186,7 @@ CccpProvider::update(const char *host, const char *data)
186
186
  if (!vbc) {
187
187
  return LCB_CLIENT_ENOMEM;
188
188
  }
189
- rv = lcbvb_load_json(vbc, data);
189
+ rv = lcbvb_load_json_ex(vbc, data, host, &LCBT_SETTING(this->parent, network));
190
190
 
191
191
  if (rv) {
192
192
  lcb_log(LOGARGS(this, ERROR), LOGFMT "Failed to parse config", LOGID(this));
@@ -313,17 +313,12 @@ CccpProvider::configure_nodes(const lcb::Hostlist& nodes_)
313
313
  void
314
314
  CccpProvider::config_updated(lcbvb_CONFIG *vbc)
315
315
  {
316
- lcbvb_SVCMODE mode;
316
+ lcbvb_SVCMODE mode = LCBT_SETTING_SVCMODE(parent);
317
317
  if (LCBVB_NSERVERS(vbc) < 1) {
318
318
  return;
319
319
  }
320
320
 
321
321
  nodes->clear();
322
- if (settings().sslopts & LCB_SSL_ENABLED) {
323
- mode = LCBVB_SVCMODE_SSL;
324
- } else {
325
- mode = LCBVB_SVCMODE_PLAIN;
326
- }
327
322
  for (size_t ii = 0; ii < LCBVB_NSERVERS(vbc); ii++) {
328
323
  const char *mcaddr = lcbvb_get_hostport(vbc,
329
324
  ii, LCBVB_SVCTYPE_DATA, mode);
@@ -82,7 +82,7 @@ FileProvider::Status FileProvider::load_cache()
82
82
  }
83
83
 
84
84
  if (last_mtime == st.st_mtime) {
85
- lcb_log(LOGARGS(this, WARN), LOGFMT "Modification time too old", LOGID(this));
85
+ lcb_log(LOGARGS(this, DEBUG), LOGFMT "Modification time too old", LOGID(this));
86
86
  return NO_CHANGES;
87
87
  }
88
88
 
@@ -100,6 +100,7 @@ process_chunk(HttpProvider *http, const void *buf, unsigned nbuf)
100
100
  int rv;
101
101
  lcbvb_CONFIG *cfgh;
102
102
  unsigned state, oldstate, diff;
103
+ lcb_host_t *host;
103
104
  htp::Response& resp = http->htp->get_cur_response();
104
105
 
105
106
  oldstate = resp.state;
@@ -146,7 +147,6 @@ process_chunk(HttpProvider *http, const void *buf, unsigned nbuf)
146
147
 
147
148
  GT_CHECKDONE:
148
149
  if (http->try_nexturi) {
149
- lcb_host_t *host;
150
150
  if (!(state & htp::Parser::S_DONE)) {
151
151
  return LCB_SUCCESS;
152
152
  }
@@ -177,7 +177,8 @@ process_chunk(HttpProvider *http, const void *buf, unsigned nbuf)
177
177
  if (!cfgh) {
178
178
  return LCB_CLIENT_ENOMEM;
179
179
  }
180
- rv = lcbvb_load_json(cfgh, resp.body.c_str());
180
+ host = lcbio_get_host(lcbio_ctx_sock(http->ioctx));
181
+ rv = lcbvb_load_json_ex(cfgh, resp.body.c_str(), host->host, &LCBT_SETTING(http->parent, network));
181
182
  if (rv != 0) {
182
183
  lcb_log(LOGARGS(http, ERR), LOGFMT "Failed to parse a valid config from HTTP stream", LOGID(http));
183
184
  lcb_log_badconfig(LOGARGS(http, ERR), cfgh, resp.body.c_str());
@@ -413,17 +414,9 @@ ConfigInfo* HttpProvider::get_cached() {
413
414
 
414
415
  void HttpProvider::config_updated(lcbvb_CONFIG *newconfig)
415
416
  {
416
- unsigned sopts;
417
- lcbvb_SVCMODE mode;
417
+ lcbvb_SVCMODE mode = LCBT_SETTING_SVCMODE(parent);
418
418
  nodes->clear();
419
419
 
420
- sopts = settings().sslopts;
421
- if (sopts & LCB_SSL_ENABLED) {
422
- mode = LCBVB_SVCMODE_SSL;
423
- } else {
424
- mode = LCBVB_SVCMODE_PLAIN;
425
- }
426
-
427
420
  for (size_t ii = 0; ii < newconfig->nsrv; ++ii) {
428
421
  const char *ss;
429
422
  lcb_error_t status;
@@ -156,15 +156,16 @@ struct Confmon {
156
156
  * This function creates a new `confmon` object which can be used to manage
157
157
  * configurations and their providers.
158
158
  *
159
- * @param settings
160
- * @param iot
159
+ * @param settings pointer to LCB settings
160
+ * @param iot pointer socket IO routines
161
+ * @param instance LCB handle
161
162
  *
162
163
  * Once the confmon object has been created you may enable or disable various
163
164
  * providers (see lcb_confmon_set_provider_active()). Once no more providers
164
165
  * remain to be activated you should call lcb_confmon_prepare() once. Then
165
166
  * call the rest of the functions.
166
167
  */
167
- Confmon(lcb_settings*, lcbio_pTABLE iot, lcb_t instance);
168
+ Confmon(lcb_settings* settings, lcbio_pTABLE iot, lcb_t instance);
168
169
  void destroy() { delete this; }
169
170
  ~Confmon();
170
171
 
@@ -186,7 +187,6 @@ struct Confmon {
186
187
  * Prepares the configuration monitor object for operations. This will insert
187
188
  * all the enabled providers into a list. Call this function each time a
188
189
  * provider has been enabled.
189
- * @param mon
190
190
  */
191
191
  void prepare();
192
192
 
@@ -212,7 +212,6 @@ struct Confmon {
212
212
  *
213
213
  * This function is reentrant safe and may be called at any time.
214
214
  *
215
- * @param mon
216
215
  * @see lcb_confmon_add_listener()
217
216
  * @see #stop()
218
217
  * @see #is_refreshing()
@@ -229,7 +228,6 @@ struct Confmon {
229
228
  * This function is safe to call anywhere. If the monitor is already stopped
230
229
  * then this function does nothing.
231
230
  *
232
- * @param mon
233
231
  * @see #start()
234
232
  * @see #is_refreshing()
235
233
  */
@@ -237,7 +235,6 @@ struct Confmon {
237
235
 
238
236
  /**
239
237
  * @brief Check if the monitor is waiting for a new config from a provider
240
- * @param mon
241
238
  * @return true if refreshing, false if idle
242
239
  */
243
240
  bool is_refreshing() const {
@@ -262,7 +259,6 @@ struct Confmon {
262
259
 
263
260
  /**
264
261
  * @brief Get the current monitor state
265
- * @param mon the monitor
266
262
  * @return a set of flags consisting of @ref State values.
267
263
  */
268
264
  int get_state() const {
@@ -291,8 +287,8 @@ struct Confmon {
291
287
  * provider or enter the inactive state depending on the configuration and
292
288
  * whether the current provider is the last provider in the list.
293
289
  *
294
- * @param provider
295
- * @param err
290
+ * @param which reference to provider, which has been failed
291
+ * @param why error code
296
292
  */
297
293
  void provider_failed(Provider *which, lcb_error_t why);
298
294
 
@@ -312,13 +308,13 @@ struct Confmon {
312
308
  * This function should _not_ be called outside of an asynchronous provider's
313
309
  * handler.
314
310
  *
315
- * @param provider the provider which yielded the new configuration
316
- * @param info the new configuration
311
+ * @param which the provider which yielded the new configuration
312
+ * @param config the new configuration
317
313
  */
318
314
  void provider_got_config(Provider *which, ConfigInfo* config);
319
315
 
320
- /** Dump information about the monitor
321
- * @param mon the monitor object
316
+ /**
317
+ * Dump information about the monitor
322
318
  * @param fp the file to which information should be written
323
319
  */
324
320
  void dump(FILE *fp);
@@ -339,16 +335,14 @@ struct Confmon {
339
335
  * until remove_listener is called. Note that the listener is not allocated
340
336
  * by the confmon and its responsibility is the user's
341
337
  *
342
- * @param mon the monitor
343
- * @param listener the listener. The listener's contents are not copied into
338
+ * @param lsn the listener. The listener's contents are not copied into
344
339
  * confmon and should thus remain valid until it is removed
345
340
  */
346
341
  void add_listener(Listener* lsn);
347
342
 
348
343
  /**
349
344
  * @brief Unregister (and remove) a listener added via lcb_confmon_add_listener()
350
- * @param mon the monitor
351
- * @param listener the listener
345
+ * @param lsn the listener
352
346
  */
353
347
  void remove_listener(Listener *lsn);
354
348
 
@@ -423,8 +417,6 @@ struct Provider {
423
417
  * against a provider taking an excessively long time; therefore a provider
424
418
  * should implement a timeout mechanism of its choice to promptly deliver
425
419
  * a success or failure.
426
- *
427
- * @param pb
428
420
  */
429
421
  virtual lcb_error_t refresh() = 0;
430
422
 
@@ -436,7 +428,7 @@ struct Provider {
436
428
  * be needed again in quite some time. How long this "time" is can range
437
429
  * between 0 seconds and several minutes depending on how a user has
438
430
  * configured the client.
439
- * @param pb
431
+ *
440
432
  * @return true if actually paused
441
433
  */
442
434
  virtual bool pause() {
@@ -446,17 +438,17 @@ struct Provider {
446
438
  /**
447
439
  * Called when a new configuration has been received.
448
440
  *
449
- * @param provider the provider instance
450
441
  * @param config the current configuration.
451
442
  * Note that this should only update the server list and do nothing
452
443
  * else.
453
444
  */
454
- virtual void config_updated(lcbvb_CONFIG*) {
445
+ virtual void config_updated(lcbvb_CONFIG* config) {
446
+ (void)config;
455
447
  }
456
448
 
457
449
  /**
458
450
  * Retrieve the list of nodes from this provider, if applicable
459
- * @param p the provider
451
+ *
460
452
  * @return A list of nodes, or NULL if the provider does not have a list
461
453
  */
462
454
  virtual const lcb::Hostlist* get_nodes() const {
@@ -465,18 +457,20 @@ struct Provider {
465
457
 
466
458
  /**
467
459
  * Call to change the configured nodes of this provider.
468
- * @param p The provider
460
+ *
469
461
  * @param l The list of nodes to apply
470
462
  */
471
- virtual void configure_nodes(const lcb::Hostlist&) {
463
+ virtual void configure_nodes(const lcb::Hostlist& l) {
464
+ (void)l;
472
465
  }
473
466
 
474
467
  /**
475
468
  * Dump state information. This callback is optional
476
- * @param p the provider
469
+ *
477
470
  * @param f the file to write to
478
471
  */
479
- virtual void dump(FILE *) const {
472
+ virtual void dump(FILE *f) const {
473
+ (void)f;
480
474
  }
481
475
 
482
476
  void enable() {
@@ -515,7 +509,7 @@ public:
515
509
  * Creates a new configuration wrapper object containing the vbucket config
516
510
  * pointed to by 'config'. Its initial refcount will be set to 1.
517
511
  *
518
- * @param config a newly parsed configuration
512
+ * @param vbc a newly parsed configuration
519
513
  * @param origin the type of provider from which the config originated.
520
514
  * @return a new ConfigInfo object. This should be incref()'d/decref()'d
521
515
  * as needed.
@@ -529,12 +523,12 @@ public:
529
523
  * This function returns an integer less than
530
524
  * zero, zero or greater than zero if the first argument is considered older
531
525
  * than, equal to, or later than the second argument.
532
- * @param a
533
- * @param b
526
+ *
527
+ * @param config anoother config
534
528
  * @see lcbvb_get_revision
535
529
  * @see ConfigInfo::cmpclock
536
530
  */
537
- int compare(const ConfigInfo&);
531
+ int compare(const ConfigInfo& config);
538
532
 
539
533
  /**
540
534
  * @brief Increment the refcount on a config object
@@ -545,7 +539,6 @@ public:
545
539
  * @brief Decrement the refcount on a config object.
546
540
  * Decrement the refcount. If the internal refcount reaches 0 then the internal
547
541
  * members (including the vbucket config handle itself) will be freed.
548
- * @param info the configuration
549
542
  */
550
543
  void decref() {
551
544
  if (!--refcount) {
@@ -621,7 +614,7 @@ bool file_set_filename(Provider *p, const char *f, bool ro);
621
614
 
622
615
  /**
623
616
  * Retrieve the filename for the provider
624
- * @param p The provider of type LCB_CLCONFIG_FILE
617
+ * @param p The provider of type CLCONFIG_FILE
625
618
  * @return the current filename being used.
626
619
  */
627
620
  const char* file_get_filename(Provider *p);
@@ -636,7 +629,7 @@ void file_set_readonly(Provider *p, bool val);
636
629
  /**
637
630
  * Get the socket representing the current REST connection to the cluster
638
631
  * (if applicable)
639
- * @param mon
632
+ * @param p The provider of type CLCONFIG_HTTP
640
633
  * @return
641
634
  */
642
635
  const lcbio_SOCKET* http_get_conn(const Provider *p);
@@ -647,7 +640,7 @@ static inline const lcbio_SOCKET* http_get_conn(Confmon *c) {
647
640
 
648
641
  /**
649
642
  * Get the hostname for the current REST connection to the cluster
650
- * @param mon
643
+ * @param p The provider of type CLCONFIG_HTTP
651
644
  * @return
652
645
  */
653
646
  const lcb_host_t * http_get_host(const Provider *p);