couchbase 3.2.0 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/README.md +24 -18
  2. package/binding.gyp +88 -85
  3. package/deps/lcb/CMakeLists.txt +1 -1
  4. package/deps/lcb/CONTRIBUTING.md +1 -1
  5. package/deps/lcb/README.markdown +2 -2
  6. package/deps/lcb/RELEASE_NOTES.markdown +99 -14
  7. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  8. package/deps/lcb/contrib/cbsasl/src/scram-sha/scram_utils.cc +22 -26
  9. package/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +20 -7
  10. package/deps/lcb/doc/Doxyfile +1 -1
  11. package/deps/lcb/example/CMakeLists.txt +4 -4
  12. package/deps/lcb/example/libuvdirect/main.c +39 -12
  13. package/deps/lcb/example/minimal/durability.cc +149 -0
  14. package/deps/lcb/example/minimal/query.c +11 -9
  15. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  16. package/deps/lcb/gyp_config/linux/arm64/config.h +243 -0
  17. package/deps/lcb/include/libcouchbase/couchbase.h +80 -5
  18. package/deps/lcb/include/libcouchbase/error.h +2 -0
  19. package/deps/lcb/include/libcouchbase/ixmgmt.h +15 -10
  20. package/deps/lcb/include/libcouchbase/tracing.h +2 -2
  21. package/deps/lcb/include/memcached/protocol_binary.h +21 -0
  22. package/deps/lcb/libcouchbase.gyp +347 -349
  23. package/deps/lcb/packaging/deb/control +1 -1
  24. package/deps/lcb/src/analytics/analytics_handle.cc +13 -5
  25. package/deps/lcb/src/analytics/analytics_handle.hh +29 -0
  26. package/deps/lcb/src/bootstrap.cc +6 -3
  27. package/deps/lcb/src/capi/cmd_analytics.cc +12 -1
  28. package/deps/lcb/src/capi/cmd_analytics.hh +30 -0
  29. package/deps/lcb/src/capi/cmd_counter.hh +23 -0
  30. package/deps/lcb/src/capi/cmd_exists.hh +24 -1
  31. package/deps/lcb/src/capi/cmd_get.hh +22 -0
  32. package/deps/lcb/src/capi/cmd_get_replica.hh +23 -0
  33. package/deps/lcb/src/capi/cmd_http.hh +7 -0
  34. package/deps/lcb/src/capi/cmd_query.cc +11 -1
  35. package/deps/lcb/src/capi/cmd_query.hh +31 -0
  36. package/deps/lcb/src/capi/cmd_remove.hh +23 -0
  37. package/deps/lcb/src/capi/cmd_search.cc +6 -0
  38. package/deps/lcb/src/capi/cmd_search.hh +23 -0
  39. package/deps/lcb/src/capi/cmd_store.hh +33 -21
  40. package/deps/lcb/src/capi/cmd_subdoc.hh +35 -0
  41. package/deps/lcb/src/capi/cmd_touch.hh +23 -0
  42. package/deps/lcb/src/capi/cmd_unlock.hh +23 -0
  43. package/deps/lcb/src/capi/cmd_view.hh +6 -0
  44. package/deps/lcb/src/capi/collection_qualifier.hh +2 -2
  45. package/deps/lcb/src/cntl.cc +45 -11
  46. package/deps/lcb/src/crypto.cc +2 -2
  47. package/deps/lcb/src/dns-srv.cc +5 -3
  48. package/deps/lcb/src/errmap.cc +5 -9
  49. package/deps/lcb/src/errmap.h +7 -3
  50. package/deps/lcb/src/handler.cc +24 -18
  51. package/deps/lcb/src/hostlist.h +2 -2
  52. package/deps/lcb/src/http/http-priv.h +2 -2
  53. package/deps/lcb/src/http/http.cc +5 -2
  54. package/deps/lcb/src/instance.cc +20 -11
  55. package/deps/lcb/src/internal.h +9 -0
  56. package/deps/lcb/src/lcbio/connect.cc +14 -2
  57. package/deps/lcb/src/lcbio/connect.h +2 -2
  58. package/deps/lcb/src/lcbio/ctx.cc +4 -2
  59. package/deps/lcb/src/lcbio/ioutils.cc +9 -10
  60. package/deps/lcb/src/lcbio/manager.cc +1 -1
  61. package/deps/lcb/src/mcserver/mcserver.cc +9 -6
  62. package/deps/lcb/src/mcserver/negotiate.cc +39 -17
  63. package/deps/lcb/src/n1ql/ixmgmt.cc +1 -2
  64. package/deps/lcb/src/n1ql/query_handle.cc +41 -19
  65. package/deps/lcb/src/n1ql/query_handle.hh +28 -1
  66. package/deps/lcb/src/operations/counter.cc +18 -5
  67. package/deps/lcb/src/operations/exists.cc +25 -4
  68. package/deps/lcb/src/operations/get.cc +39 -19
  69. package/deps/lcb/src/operations/get_replica.cc +28 -8
  70. package/deps/lcb/src/operations/observe.cc +1 -1
  71. package/deps/lcb/src/operations/ping.cc +8 -8
  72. package/deps/lcb/src/operations/pktfwd.cc +2 -1
  73. package/deps/lcb/src/operations/remove.cc +39 -22
  74. package/deps/lcb/src/operations/store.cc +18 -5
  75. package/deps/lcb/src/operations/subdoc.cc +18 -6
  76. package/deps/lcb/src/operations/touch.cc +34 -16
  77. package/deps/lcb/src/operations/unlock.cc +24 -5
  78. package/deps/lcb/src/packetutils.h +3 -2
  79. package/deps/lcb/src/retryq.cc +24 -5
  80. package/deps/lcb/src/search/search.cc +1 -0
  81. package/deps/lcb/src/search/search_handle.cc +30 -8
  82. package/deps/lcb/src/search/search_handle.hh +29 -0
  83. package/deps/lcb/src/settings.cc +1 -1
  84. package/deps/lcb/src/ssl/ssl_common.c +6 -7
  85. package/deps/lcb/src/tracing/span.cc +47 -14
  86. package/deps/lcb/src/tracing/tracer.cc +11 -2
  87. package/deps/lcb/src/tracing/tracing-internal.h +105 -93
  88. package/deps/lcb/src/utilities.cc +43 -0
  89. package/deps/lcb/src/utilities.h +53 -0
  90. package/deps/lcb/src/vbucket/vbucket.c +34 -33
  91. package/deps/lcb/src/views/view_handle.cc +13 -5
  92. package/deps/lcb/src/views/view_handle.hh +29 -0
  93. package/deps/lcb/tests/CMakeLists.txt +21 -0
  94. package/deps/lcb/tests/basic/t_ctlcodes.cc +24 -3
  95. package/deps/lcb/tests/basic/t_jsparse.cc +8 -0
  96. package/deps/lcb/tests/basic/t_n1qlstrings.cc +73 -0
  97. package/deps/lcb/tests/iotests/mock-environment.cc +30 -1
  98. package/deps/lcb/tests/iotests/mock-environment.h +49 -0
  99. package/deps/lcb/tests/iotests/mock-unit-test.cc +104 -6
  100. package/deps/lcb/tests/iotests/mock-unit-test.h +34 -0
  101. package/deps/lcb/tests/iotests/t_collections.cc +1 -1
  102. package/deps/lcb/tests/iotests/t_confmon.cc +4 -2
  103. package/deps/lcb/tests/iotests/t_get.cc +109 -7
  104. package/deps/lcb/tests/iotests/t_http.cc +9 -4
  105. package/deps/lcb/tests/iotests/t_lock.cc +18 -0
  106. package/deps/lcb/tests/iotests/t_mutate.cc +157 -63
  107. package/deps/lcb/tests/iotests/t_n1ql.cc +330 -33
  108. package/deps/lcb/tests/iotests/t_views.cc +1 -0
  109. package/deps/lcb/tests/iotests/testutil.cc +168 -0
  110. package/deps/lcb/tests/iotests/testutil.h +116 -0
  111. package/deps/lcb/tests/mocksupport/procutil.c +32 -28
  112. package/deps/lcb/tests/mocksupport/server.c +0 -1
  113. package/deps/lcb/tests/mocksupport/timeout.c +2 -2
  114. package/deps/lcb/tools/cbc.cc +7 -0
  115. package/dist/analyticsindexmanager.js +512 -524
  116. package/dist/binding.d.ts +3 -0
  117. package/dist/bindingutilities.js +4 -0
  118. package/dist/bucket.js +1 -1
  119. package/dist/bucketmanager.d.ts +31 -1
  120. package/dist/bucketmanager.js +194 -186
  121. package/dist/cluster.d.ts +7 -0
  122. package/dist/cluster.js +48 -38
  123. package/dist/collection.js +11 -17
  124. package/dist/collectionmanager.js +181 -197
  125. package/dist/connection.d.ts +3 -1
  126. package/dist/connection.js +27 -16
  127. package/dist/couchbase.d.ts +1 -0
  128. package/dist/couchbase.js +3 -13
  129. package/dist/datastructures.js +239 -310
  130. package/dist/diagnosticsexecutor.js +70 -85
  131. package/dist/errors.d.ts +70 -0
  132. package/dist/errors.js +96 -2
  133. package/dist/eventingfunctionmanager.d.ts +804 -0
  134. package/dist/eventingfunctionmanager.js +993 -0
  135. package/dist/httpexecutor.d.ts +2 -1
  136. package/dist/httpexecutor.js +30 -37
  137. package/dist/queryindexmanager.js +240 -266
  138. package/dist/scope.js +10 -4
  139. package/dist/sdspecs.d.ts +1 -1
  140. package/dist/searchexecutor.js +3 -0
  141. package/dist/searchindexmanager.js +240 -271
  142. package/dist/searchquery.d.ts +17 -0
  143. package/dist/searchquery.js +22 -1
  144. package/dist/searchtypes.d.ts +7 -2
  145. package/dist/searchtypes.js +2 -2
  146. package/dist/usermanager.js +251 -264
  147. package/dist/utilities.d.ts +2 -0
  148. package/dist/utilities.js +7 -2
  149. package/dist/viewexecutor.js +1 -1
  150. package/dist/viewindexmanager.js +131 -150
  151. package/package.json +1 -1
  152. package/src/addondata.cpp +58 -0
  153. package/src/addondata.h +40 -0
  154. package/src/binding.cpp +3 -1
  155. package/src/cas.h +2 -2
  156. package/src/connection.cpp +25 -178
  157. package/src/connection.h +8 -65
  158. package/src/connection_ops.cpp +57 -34
  159. package/src/constants.cpp +3 -0
  160. package/src/instance.cpp +235 -0
  161. package/src/instance.h +102 -0
  162. package/src/{connection_callbacks.cpp → instance_callbacks.cpp} +34 -34
  163. package/src/logger.cpp +11 -1
  164. package/src/logger.h +3 -0
  165. package/src/metrics.cpp +10 -0
  166. package/src/metrics.h +3 -0
  167. package/src/mutationtoken.h +2 -2
  168. package/src/opbuilder.h +13 -15
  169. package/src/respreader.cpp +1 -0
  170. package/src/respreader.h +6 -4
  171. package/src/tracespan.h +11 -11
  172. package/src/tracing.cpp +11 -0
  173. package/src/tracing.h +3 -0
  174. package/src/valueparser.h +5 -0
  175. package/deps/lcb/example/observe/durability.c +0 -110
package/README.md CHANGED
@@ -42,24 +42,30 @@ Here is a simple example of instantiating a connection, adding a new document
42
42
  into the bucket and then retrieving its contents:
43
43
 
44
44
  ```javascript
45
- var couchbase = require('couchbase');
46
- var cluster = new couchbase.Cluster('couchbase://127.0.0.1', {
47
- username: 'username',
48
- password: 'password',
49
- });
50
- var bucket = cluster.bucket('default');
51
- var coll = bucket.defaultCollection();
52
-
53
- coll.upsert('testdoc', { name: 'Frank' }, (err, res) => {
54
- if (err) throw err;
55
-
56
- coll.get('testdoc', (err, res) => {
57
- if (err) throw err;
58
-
59
- console.log(res.value);
60
- // {name: Frank}
61
- });
62
- });
45
+ var couchbase = require('couchbase')
46
+
47
+ couchbase.connect(
48
+ 'couchbase://127.0.0.1',
49
+ {
50
+ username: 'username',
51
+ password: 'password',
52
+ },
53
+ (err, cluster) => {
54
+ var bucket = cluster.bucket('default')
55
+ var coll = bucket.defaultCollection()
56
+
57
+ coll.upsert('testdoc', { name: 'Frank' }, (err, res) => {
58
+ if (err) throw err
59
+
60
+ coll.get('testdoc', (err, res) => {
61
+ if (err) throw err
62
+
63
+ console.log(res.value)
64
+ // {name: Frank}
65
+ })
66
+ })
67
+ }
68
+ )
63
69
  ```
64
70
 
65
71
  ## Documentation
package/binding.gyp CHANGED
@@ -1,92 +1,95 @@
1
1
  {
2
- 'targets': [{
3
- 'target_name': 'couchbase_impl',
4
- 'variables': {
5
- 'couchbase_root%': ''
6
- },
7
- 'defines': [
8
- 'LCBUV_EMBEDDED_SOURCE',
9
- 'LCB_TRACING'
10
- ],
11
- 'conditions': [
12
- [ 'couchbase_root==""', {
2
+ 'targets': [{
3
+ 'target_name': 'couchbase_impl',
4
+ 'variables': {
5
+ 'couchbase_root%': ''
6
+ },
13
7
  'defines': [
14
- 'LIBCOUCHBASE_STATIC'
8
+ 'LCBUV_EMBEDDED_SOURCE',
9
+ 'LCB_TRACING'
15
10
  ],
16
- 'dependencies': [
17
- 'deps/lcb/libcouchbase.gyp:couchbase'
18
- ]
19
- }, {
20
11
  'conditions': [
21
- [ 'OS=="win"', {
22
- 'include_dirs': [
23
- '<(couchbase_root)/include/'
24
- ],
25
- 'link_settings': {
26
- 'libraries': [
27
- '-l<(couchbase_root)/lib/libcouchbase.lib'
28
- ]
29
- },
30
- 'copies': [
31
- {
32
- 'files': [ '<(couchbase_root)/bin/libcouchbase.dll' ],
33
- 'destination': '<(module_root_dir)/build/Release/'
34
- },{
35
- 'files': [ '<(couchbase_root)/bin/libcouchbase.dll' ],
36
- 'destination': '<(module_root_dir)/build/Debug/'
37
- }
38
- ],
39
- }, {
40
- 'link_settings': {
41
- 'libraries': [
42
- '-lcouchbase',
43
- ],
44
- },
45
- 'include_dirs': [ '<(couchbase_root)/include' ],
46
- 'libraries+': [ '-L<(couchbase_root)/lib' ],
47
- 'conditions': [ [ 'OS!="mac"', {'libraries+':['-Wl,-rpath=<(couchbase_root)/lib']} ] ]
48
- }]
49
- ]
50
- }],
51
- ['OS!="win"', {
52
- 'link_settings': {
53
- 'libraries': [
54
- '$(EXTRA_LDFLAGS)'
55
- ],
56
- },
57
- 'cflags': [
58
- '-g',
59
- '-fPIC',
60
- '-Wall',
61
- '-Wextra',
62
- '$(EXTRA_CFLAGS)',
63
- '$(EXTRA_CPPFLAGS)',
64
- '$(EXTRA_CXXFLAGS)',
12
+ ['couchbase_root==""', {
13
+ 'defines': [
14
+ 'LIBCOUCHBASE_STATIC'
15
+ ],
16
+ 'dependencies': [
17
+ 'deps/lcb/libcouchbase.gyp:couchbase'
18
+ ]
19
+ }, {
20
+ 'conditions': [
21
+ ['OS=="win"', {
22
+ 'include_dirs': [
23
+ '<(couchbase_root)/include/'
24
+ ],
25
+ 'link_settings': {
26
+ 'libraries': [
27
+ '-l<(couchbase_root)/lib/libcouchbase.lib'
28
+ ]
29
+ },
30
+ 'copies': [
31
+ {
32
+ 'files': ['<(couchbase_root)/bin/libcouchbase.dll'],
33
+ 'destination': '<(module_root_dir)/build/Release/'
34
+ }, {
35
+ 'files': ['<(couchbase_root)/bin/libcouchbase.dll'],
36
+ 'destination': '<(module_root_dir)/build/Debug/'
37
+ }
38
+ ],
39
+ }, {
40
+ 'link_settings': {
41
+ 'libraries': [
42
+ '-lcouchbase',
43
+ ],
44
+ },
45
+ 'include_dirs': ['<(couchbase_root)/include'],
46
+ 'libraries+': ['-L<(couchbase_root)/lib'],
47
+ 'conditions': [['OS!="mac"', {'libraries+': ['-Wl,-rpath=<(couchbase_root)/lib']}]]
48
+ }]
49
+ ]
50
+ }],
51
+ ['OS!="win"', {
52
+ 'link_settings': {
53
+ 'libraries': [
54
+ '$(EXTRA_LDFLAGS)'
55
+ ],
56
+ },
57
+ 'cflags': [
58
+ '-g',
59
+ '-fPIC',
60
+ '-Wall',
61
+ '-Wextra',
62
+ '$(EXTRA_CFLAGS)',
63
+ '$(EXTRA_CPPFLAGS)',
64
+ '$(EXTRA_CXXFLAGS)',
65
+ ],
66
+ 'cflags_c':[
67
+ '-pedantic',
68
+ '-std=gnu99',
69
+ ]
70
+ }]
71
+ ],
72
+ 'sources': [
73
+ 'src/addondata.cpp',
74
+ 'src/binding.cpp',
75
+ 'src/cas.cpp',
76
+ 'src/connection_ops.cpp',
77
+ 'src/connection.cpp',
78
+ 'src/constants.cpp',
79
+ 'src/error.cpp',
80
+ 'src/instance.cpp',
81
+ 'src/instance_callbacks.cpp',
82
+ 'src/lcbx.cpp',
83
+ 'src/logger.cpp',
84
+ 'src/metrics.cpp',
85
+ 'src/mutationtoken.cpp',
86
+ 'src/opbuilder.cpp',
87
+ 'src/respreader.cpp',
88
+ 'src/tracing.cpp',
89
+ 'src/uv-plugin-all.cpp'
65
90
  ],
66
- 'cflags_c':[
67
- '-pedantic',
68
- '-std=gnu99',
91
+ 'include_dirs': [
92
+ '<!(node -e "require(\'nan\')")'
69
93
  ]
70
- }]
71
- ],
72
- 'sources': [
73
- 'src/binding.cpp',
74
- 'src/cas.cpp',
75
- 'src/connection_callbacks.cpp',
76
- 'src/connection_ops.cpp',
77
- 'src/connection.cpp',
78
- 'src/constants.cpp',
79
- 'src/error.cpp',
80
- 'src/lcbx.cpp',
81
- 'src/logger.cpp',
82
- 'src/metrics.cpp',
83
- 'src/mutationtoken.cpp',
84
- 'src/opbuilder.cpp',
85
- 'src/tracing.cpp',
86
- 'src/uv-plugin-all.cpp'
87
- ],
88
- 'include_dirs': [
89
- '<!(node -e "require(\'nan\')")'
90
- ]
91
- }]
94
+ }]
92
95
  }
@@ -30,7 +30,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
30
30
  # Couchbase mock path to download
31
31
  SET(COUCHBASE_MOCK_VERSION 1.5.25)
32
32
  SET(COUCHBASE_MOCK_URL "https://github.com/couchbase/CouchbaseMock/releases/download/${COUCHBASE_MOCK_VERSION}/CouchbaseMock-${COUCHBASE_MOCK_VERSION}.jar")
33
- project(libcouchbase VERSION 3.2.0 LANGUAGES C CXX)
33
+ project(libcouchbase VERSION 3.2.4 LANGUAGES C CXX)
34
34
 
35
35
  if (NOT CMAKE_VERSION VERSION_LESS "3.13")
36
36
  # CMP0077: option() honors normal variables
@@ -66,7 +66,7 @@ Add your public SSH key to gerrit before submitting.
66
66
  Assuming you have a repository created like so:
67
67
 
68
68
  ```
69
- $ git clone git://github.com/couchbase/libcouchbase.git
69
+ $ git clone https://github.com/couchbase/libcouchbase.git
70
70
  ```
71
71
 
72
72
  you can simply perform two simple steps to get started with gerrit:
@@ -48,7 +48,7 @@ Provided is a convenience script called `cmake/configure`. It is a Perl
48
48
  script and functions like a normal `autotools` script.
49
49
 
50
50
  ```shell
51
- $ git clone git://github.com/couchbase/libcouchbase.git
51
+ $ git clone https://github.com/couchbase/libcouchbase.git
52
52
  $ cd libcouchbase && mkdir build && cd build
53
53
  $ ../cmake/configure
54
54
  $ make
@@ -60,7 +60,7 @@ $ ctest
60
60
  Assuming `git` and Visual Studio 2010 are installed, from a `CMD` shell, do:
61
61
 
62
62
  ```
63
- C:\> git clone git://github.com/couchbase/libcouchbase.git
63
+ C:\> git clone https://github.com/couchbase/libcouchbase.git
64
64
  C:\> mkdir lcb-build
65
65
  C:\> cd lcb-build
66
66
  C:\> cmake -G "Visual Studio 10" ..\libcouchbase
@@ -1,60 +1,145 @@
1
1
  # Release Notes
2
2
 
3
+ ## 3.2.4 (2021-11-23)
4
+
5
+ CCBC-1522: Filter `DnsQuery` results on Windows by type: only use records with `DNS_TYPE_SRV` type.
6
+
7
+ CCBC-1521: Fixed bootstrap process when client certificate is used. We always pipeline error map request with `HELLO`
8
+ request, and usually await for `hello`+`error_map` responses, because after that goes SASL authentication (and then
9
+ optional selection of the bucket) which cannot be completely pipelined. But in case of client certificate, we might
10
+ terminate bootstrap process too early if the bootstrap process does not require immediate selection of the bucket.
11
+
12
+ CCBC-1432: Support for rate limiting error codes: `LCB_ERR_RATE_LIMITED` and `LCB_ERR_QUOTA_LIMITED`.
13
+
14
+ CCBC-1514: Do not translate unknown error with "item-only" attribute into `LCB_ERR_CAS_MISMATCH`.
15
+
16
+ CCBC-1515: Performance optimization: replace `sstream` with string `append()`. Only if list of IO vectors supplied for
17
+ value in mutation operations.
18
+
19
+ ## 3.2.3 (2021-10-20)
20
+
21
+ * CCBC-1484: Fixed tracing tags in accordance to RFC.
22
+
23
+ * CCBC-1510: Fixed key length calculation for exists/get/touch/unlock.
24
+
25
+ * CCBC-1495: Fixed payload encoding in query index management helpers. Query index management helpers now explicitly
26
+ declared deperecated.
27
+
28
+ * CCBC-1506: Duration values now accepted golang style encoding. Connection string and `lcb_cntl_string` now can parse
29
+ strings with duration encoded in golang style, e.g. `analytics_timeout=5s42us`. The result still converted into 32-bit
30
+ value with microsecond resolution.
31
+
32
+ * Improved test coverage, stability and documentation.
33
+
34
+ ## 3.2.2 (2021-09-22)
35
+
36
+ * CCBC-1485: Allow disabling tracer for connected instance.
37
+
38
+ * CCBC-1472: Ensure strict JSON parsing mode for query meta.
39
+
40
+ * CCBC-1494: Disconnect logger after `lcb_destroy` invoked to avoid double free errors.
41
+
42
+ * CCBC-1457: improve error message when server enforces encryption
43
+
44
+ * CCBC-1489: Fixed get_and_touch to use the correct expiry.
45
+
46
+ * CCBC-1487: Fixed `retryq` erasing already sent packets.
47
+
48
+ * CCBC-1488: Fixed incorrect refcounting in `Connstart`.
49
+
50
+ * CCBC-1479: Initialize fields of custom tracer struct.
51
+
52
+ * CCBC-1478: Do not retry successful query with empty result.
53
+
54
+ * CCBC-1216: Implement user impersonation API
55
+
56
+ * Improved test coverage and stability.
57
+
58
+ ## 3.2.1 (2021-08-20)
59
+
60
+ * CCBC-1429: Fixed positional parameters for query/analtyics:
61
+
62
+ * reverts behaviour `lcb_cmdquery_positional_param` and `lcb_cmdanalytics_positional_param` to append single
63
+ JSON-encoded value to arguments array.
64
+
65
+ * introduces new functions `lcb_cmdquery_positional_params` and `lcb_cmdanalytics_positional_params` that accept all
66
+ positional arguments at once as JSON-encoded array.
67
+
68
+ * document, that old functions will emit compiler warning since 3.3.0 release and will be removed later.
69
+
70
+ * CCBC-1428: Clear callback upon error in `lcb_search`.
71
+
72
+ * CCBC-1454: Fixed compiler warning in `lcb_getreplica`.
73
+
74
+ * CCBC-1453: Refactored local name caching in `lcbio_cache_local_name` to simplify the code and eliminate compiler warnings.
75
+
76
+ * CCBC-1451: Fixed strdup usage, in some cases the compiler might choose `strdup` to return `int` instead of `char *`
77
+ which might lead to memory issues.
78
+
79
+ * CCBC-1448: Fixed cmake macro for examples. The macro `ADD_EXAMPLE` now correctly updates header directories for
80
+ generated target.
81
+
82
+ * CCBC-1445: Always invoke callbacks for pending HTTP operations. When destroying `lcb_INSTANCE` make sure that all HTTP
83
+ requests (views, query, search, analytics) will have their callbacks invoked.
84
+
85
+ * CCBC-1438: Fixed frame size for mutations with durability. Counter, Store and Subdoc mutations were sending incorrect
86
+ frame size of durability encoding, which led to rejection of the command by the server.
87
+
3
88
  ## 3.2.0 (2021-07-19)
4
89
 
5
90
  * Various improvements and fixes in test and build infrastruture
6
91
 
7
92
  * CBCC-1280 Support for OpenTelemetry tracing.
8
-
93
+
9
94
  Tracing updated to allow for an external tracer that creates and finishes spans, adds tags, destroys spans. Also,
10
95
  spans now have the notion of being the 'outer' span. That is the span that has all the outer span tags, and is the
11
96
  one whose duration is used to determine whether or not the operation has exceeded the threshold if the
12
97
  ThresholdLoggingTracer is used.
13
-
98
+
14
99
  If you pass in a parent that is an outer span, you must call `lcbtrace_span_finish` yourself. When an operation
15
100
  begins, if there is no parent span passed in, or if there is but it isn't an 'outer' span, then the operation creates
16
101
  the outer span itself.
17
102
  See `/examples/tracing/otel_tracing.cc` for an example.
18
-
103
+
19
104
  * CCBC-1362: Support for metrics.
20
-
105
+
21
106
  When enabled, by default will output a histogram of latencies for various kv operations plus query, search, analytics
22
107
  and view queries.
23
-
108
+
24
109
  If desired, an external metrics collector can be passed in when the instance is created, which will then be called
25
110
  with latencies for each operation. This can be used to call into an opentelemetry meter for aggregation and export.
26
111
  See `/examples/metrics/otel_metrics.cc` for an example.
27
112
 
28
113
  * CCBC-1421: Allow empty path for subdocument array methods.
29
-
114
+
30
115
  * CCBC-1417: Depecate CAS usage with counter operation.
31
116
 
32
117
  * CCBC-1418: Map query error 13014 to `LCB_ERR_AUTHENTICATION_FAILURE`.
33
-
118
+
34
119
  * CCBC-1357: Allow to preserve expiration with Replace, Upsert and MutateIn operations.
35
120
 
36
121
  * CCBC-1384: Allow the operations to be deferred until the instance will be connected to cluster.
37
122
 
38
123
  * CCBC-1410: Refactor dynamic authenticator. NOTE: this API still volatile and might be changed in future.
39
-
124
+
40
125
  In order to improve UX and allow caller to implement credential caching the API for authenticator was revised:
41
-
126
+
42
127
  * instead of separate callbacks for username/password, now it uses single callback
43
-
128
+
44
129
  * in the callback, the caller can figure out the reason of credentials request using `lcbauth_credentials_reason()`
45
-
130
+
46
131
  * the caller can signal that it failed to retrieve credentials from external provider, and set result with
47
132
  `lcbauth_credentials_result()`. In this case the SDK will not retry the operation.
48
-
133
+
49
134
 
50
135
  * CCBC-1413: Skip `SELECT_BUCKET` packets waiting retry queue.
51
136
 
52
137
  * CCBC-1169: Request copy from active vbucket for `get_all_replicas` operation.
53
138
 
54
139
  * CCBC-1406: Fill in prepared statement handle on retry.
55
-
140
+
56
141
  * CCBC-1405: Remove const from command cookie.
57
-
142
+
58
143
  * CCBC-1402: Fix parsing JSON primitives as query rows.
59
144
 
60
145
  ## 3.1.3 (2021-05-10)
@@ -65,7 +65,7 @@ IF(APPLE)
65
65
  ELSE()
66
66
  SET(LCB_SONAME_MAJOR "8")
67
67
  ENDIF()
68
- SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.1")
68
+ SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.5")
69
69
 
70
70
  MESSAGE(STATUS "libcouchbase ${LCB_VERSION_MAJOR},${LCB_VERSION_MINOR},${LCB_VERSION_PATCH}")
71
71
  MESSAGE(STATUS "Building libcouchbase ${LCB_VERSION}/${LCB_VERSION_CHANGESET}")
@@ -16,8 +16,8 @@
16
16
 
17
17
  #include "scram_utils.h"
18
18
  #include "config.h"
19
- #include <time.h>
20
- #include <ctype.h>
19
+ #include <ctime>
20
+ #include <cctype>
21
21
  #include "strcodecs/strcodecs.h"
22
22
 
23
23
  #ifndef LCB_NO_SSL
@@ -46,9 +46,9 @@ void seed_rand(void)
46
46
  // The entropy of these values is not good, but that's enough for generating nonces.
47
47
 
48
48
  #ifdef LCB_NO_SSL
49
- srand(time(NULL));
49
+ srand(time(nullptr));
50
50
  #else
51
- time_t current_time = time(NULL);
51
+ time_t current_time = time(nullptr);
52
52
  clock_t clk;
53
53
  #ifdef _WIN32
54
54
  int pid;
@@ -73,7 +73,7 @@ void seed_rand(void)
73
73
  */
74
74
  void generate_nonce(char *buffer, int buffer_length)
75
75
  {
76
- if ((NULL == buffer) || (0 == buffer_length)) {
76
+ if ((nullptr == buffer) || (0 == buffer_length)) {
77
77
  // invalid input arguments
78
78
  return;
79
79
  }
@@ -88,14 +88,13 @@ void generate_nonce(char *buffer, int buffer_length)
88
88
  int aRandom = 0;
89
89
  unsigned int aMaxRandBits = 0, aRandRange,
90
90
  aMaxRand = RAND_MAX; // we have to compute how many bits the rand() function can return
91
- int i;
92
91
  while (aMaxRand >>= 1) {
93
92
  aMaxRandBits++;
94
93
  }
95
94
  aRandRange = aMaxRandBits / 8; // number of bytes we can extract from a rand() value.
96
95
  // To avoid generating a new random number for each character, we call rand() only once every 5 characters.
97
96
  // A 32-bits integer can give 5 values of 6 bits.
98
- for (i = 0; i < buffer_length; ++i) {
97
+ for (int i = 0; i < buffer_length; ++i) {
99
98
  if (i % aRandRange == 0) {
100
99
  // we refill aRandom
101
100
  aRandom = rand();
@@ -115,8 +114,7 @@ void generate_nonce(char *buffer, int buffer_length)
115
114
  int compute_special_chars(const char *buffer, int buffer_length)
116
115
  {
117
116
  int result = 0;
118
- int i;
119
- for (i = 0; i < buffer_length; ++i) {
117
+ for (int i = 0; i < buffer_length; ++i) {
120
118
  char c = buffer[i];
121
119
  if (iscntrl(c)) {
122
120
  return -1; // control characters are not allowed
@@ -140,13 +138,12 @@ int compute_special_chars(const char *buffer, int buffer_length)
140
138
  void usernmcpy(char *dest, const char *src, size_t n)
141
139
  {
142
140
  char *newdest = dest;
143
- unsigned int i;
144
141
 
145
- if (NULL == dest || NULL == src || 0 == n) {
142
+ if (nullptr == dest || nullptr == src || 0 == n) {
146
143
  return; // invalid arguments
147
144
  }
148
145
 
149
- for (i = 0; i < n; ++i) {
146
+ for (size_t i = 0; i < n; ++i) {
150
147
  char c = src[i];
151
148
  switch (c) {
152
149
  case '=':
@@ -178,7 +175,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
178
175
  const char *oldptr = serverin;
179
176
  unsigned int remainlen = serverinlen;
180
177
 
181
- if (NULL == serverin || 0 == serverinlen) {
178
+ if (nullptr == serverin || 0 == serverinlen) {
182
179
  return SASL_BADPARAM;
183
180
  }
184
181
 
@@ -186,7 +183,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
186
183
  do {
187
184
  unsigned int attrlen; // attribute length
188
185
  ptr = static_cast<const char *>(memchr(ptr, ',', remainlen));
189
- if (ptr != NULL) {
186
+ if (ptr != nullptr) {
190
187
  // oldptr points to the beginning of the attribute
191
188
  // Ex: "r=xxxxx,s=zzzzzz,i=10"
192
189
  // ^ ^
@@ -209,7 +206,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
209
206
  }
210
207
  switch (oldptr[0]) {
211
208
  case 'r': // nonce
212
- if (*nonce != NULL) {
209
+ if (*nonce != nullptr) {
213
210
  // it looks like we already stored a previous occurrence of the nonce attribute
214
211
  return SASL_BADPARAM;
215
212
  }
@@ -217,7 +214,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
217
214
  *noncelength = attrlen - 2;
218
215
  break;
219
216
  case 's': // salt
220
- if (*salt != NULL) {
217
+ if (*salt != nullptr) {
221
218
  // it looks like we already stored a previous occurrence of the salt attribute
222
219
  return SASL_BADPARAM;
223
220
  }
@@ -244,7 +241,7 @@ cbsasl_error_t parse_server_challenge(const char *serverin, unsigned int serveri
244
241
 
245
242
  remainlen = remainlen - attrlen - 1;
246
243
  oldptr = ptr;
247
- } while (ptr != NULL);
244
+ } while (ptr != nullptr);
248
245
 
249
246
  return SASL_OK;
250
247
  }
@@ -313,17 +310,17 @@ static cbsasl_error_t HMAC_digest(cbsasl_auth_mechanism_t auth_mech, const unsig
313
310
  {
314
311
  switch (auth_mech) {
315
312
  case SASL_AUTH_MECH_SCRAM_SHA1:
316
- if (HMAC(EVP_sha1(), key, keylen, data, datalen, digest, digestlen) == NULL) {
313
+ if (HMAC(EVP_sha1(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
317
314
  return SASL_FAIL;
318
315
  }
319
316
  break;
320
317
  case SASL_AUTH_MECH_SCRAM_SHA256:
321
- if (HMAC(EVP_sha256(), key, keylen, data, datalen, digest, digestlen) == NULL) {
318
+ if (HMAC(EVP_sha256(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
322
319
  return SASL_FAIL;
323
320
  }
324
321
  break;
325
322
  case SASL_AUTH_MECH_SCRAM_SHA512:
326
- if (HMAC(EVP_sha512(), key, keylen, data, datalen, digest, digestlen) == NULL) {
323
+ if (HMAC(EVP_sha512(), key, keylen, data, datalen, digest, digestlen) == nullptr) {
327
324
  return SASL_FAIL;
328
325
  }
329
326
  break;
@@ -369,19 +366,19 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
369
366
  unsigned int storedkeylen = 0;
370
367
  switch (auth_mech) {
371
368
  case SASL_AUTH_MECH_SCRAM_SHA1:
372
- if (SHA1(clientkeyhmac, hmaclen, storedkey) == NULL) {
369
+ if (SHA1(clientkeyhmac, hmaclen, storedkey) == nullptr) {
373
370
  return SASL_FAIL;
374
371
  }
375
372
  storedkeylen = SHA_DIGEST_LENGTH;
376
373
  break;
377
374
  case SASL_AUTH_MECH_SCRAM_SHA256:
378
- if (SHA256(clientkeyhmac, hmaclen, storedkey) == NULL) {
375
+ if (SHA256(clientkeyhmac, hmaclen, storedkey) == nullptr) {
379
376
  return SASL_FAIL;
380
377
  }
381
378
  storedkeylen = SHA256_DIGEST_LENGTH;
382
379
  break;
383
380
  case SASL_AUTH_MECH_SCRAM_SHA512:
384
- if (SHA512(clientkeyhmac, hmaclen, storedkey) == NULL) {
381
+ if (SHA512(clientkeyhmac, hmaclen, storedkey) == nullptr) {
385
382
  return SASL_FAIL;
386
383
  }
387
384
  storedkeylen = SHA512_DIGEST_LENGTH;
@@ -396,7 +393,7 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
396
393
  // client-final-message-without-proof
397
394
  unsigned int authmesslen = cfblen + 1 + sfmlen + 1 + cfwplen;
398
395
  char *authmess = static_cast<char *>(calloc(authmesslen + 1, 1)); // +1 for the binary zero
399
- if (NULL == authmess) {
396
+ if (nullptr == authmess) {
400
397
  return SASL_NOMEM;
401
398
  }
402
399
  memcpy(authmess, clientfirstbare, cfblen);
@@ -419,8 +416,7 @@ cbsasl_error_t compute_client_proof(cbsasl_auth_mechanism_t auth_mech, const uns
419
416
  // final step:
420
417
  // ClientProof := ClientKey XOR ClientSignature
421
418
  char clientproof[EVP_MAX_MD_SIZE]; // binary client proof
422
- unsigned int i;
423
- for (i = 0; i < clientsignlen; ++i) {
419
+ for (unsigned i = 0; i < clientsignlen; ++i) {
424
420
  clientproof[i] = clientkeyhmac[i] ^ clientsign[i];
425
421
  }
426
422