couchbase 4.2.1 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/CMakeLists.txt +1 -0
  2. package/deps/couchbase-cxx-client/.gitmodules +3 -0
  3. package/deps/couchbase-cxx-client/.idea/misc.xml +1 -0
  4. package/deps/couchbase-cxx-client/.idea/vcs.xml +1 -0
  5. package/deps/couchbase-cxx-client/CMakeLists.txt +11 -1
  6. package/deps/couchbase-cxx-client/README.md +3 -3
  7. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +4 -1
  8. package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +13 -1
  9. package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
  10. package/deps/couchbase-cxx-client/core/cluster.hxx +15 -5
  11. package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +17 -6
  12. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -1
  13. package/deps/couchbase-cxx-client/core/impl/collection_query_index_manager.cxx +93 -0
  14. package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +11 -0
  15. package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +119 -0
  16. package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +108 -0
  17. package/deps/couchbase-cxx-client/core/impl/get.cxx +1 -1
  18. package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +76 -0
  19. package/deps/couchbase-cxx-client/core/impl/query.cxx +5 -7
  20. package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +168 -0
  21. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +15 -1
  22. package/deps/couchbase-cxx-client/core/logger/configuration.hxx +3 -0
  23. package/deps/couchbase-cxx-client/core/logger/level.hxx +21 -0
  24. package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -6
  25. package/deps/couchbase-cxx-client/core/meta/CMakeLists.txt +4 -2
  26. package/deps/couchbase-cxx-client/core/meta/features.hxx +31 -0
  27. package/deps/couchbase-cxx-client/core/meta/version.cxx +67 -5
  28. package/deps/couchbase-cxx-client/core/meta/version.hxx +12 -1
  29. package/deps/couchbase-cxx-client/core/metrics/CMakeLists.txt +4 -1
  30. package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +46 -5
  31. package/deps/couchbase-cxx-client/core/metrics/logging_meter.hxx +10 -26
  32. package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +3 -2
  33. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +10 -12
  34. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -3
  35. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.cxx +8 -14
  36. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -1
  37. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +15 -8
  38. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +7 -14
  39. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +2 -0
  40. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +11 -16
  41. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +2 -0
  42. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +8 -12
  43. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +4 -3
  44. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.cxx +21 -12
  45. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -2
  46. package/deps/couchbase-cxx-client/core/origin.hxx +1 -1
  47. package/deps/couchbase-cxx-client/core/platform/uuid.cc +1 -2
  48. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -1
  49. package/deps/couchbase-cxx-client/core/query_context.hxx +79 -0
  50. package/deps/couchbase-cxx-client/core/tracing/CMakeLists.txt +3 -1
  51. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +19 -4
  52. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.hxx +2 -2
  53. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +10 -4
  54. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +52 -63
  55. package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +8 -3
  56. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +163 -126
  57. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +24 -37
  58. package/deps/couchbase-cxx-client/core/transactions/forward_compat.hxx +4 -4
  59. package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +51 -13
  60. package/deps/couchbase-cxx-client/core/transactions/internal/client_record.hxx +26 -1
  61. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +21 -0
  62. package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +40 -18
  63. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +5 -0
  64. package/deps/couchbase-cxx-client/core/transactions/result.hxx +26 -0
  65. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +48 -47
  66. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +6 -6
  67. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +33 -19
  68. package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +18 -2
  69. package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +25 -2
  70. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +4 -4
  71. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +49 -56
  72. package/deps/couchbase-cxx-client/core/transactions/waitable_op_list.hxx +7 -7
  73. package/deps/couchbase-cxx-client/core/transactions.hxx +0 -12
  74. package/deps/couchbase-cxx-client/core/utils/binary.hxx +1 -1
  75. package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +55 -0
  76. package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +12 -45
  77. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +1 -1
  78. package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +6 -7
  79. package/deps/couchbase-cxx-client/couchbase/collection.hxx +8 -0
  80. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +218 -0
  81. package/deps/couchbase-cxx-client/couchbase/configuration_profiles_registry.hxx +3 -0
  82. package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +166 -0
  83. package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +172 -0
  84. package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +129 -0
  85. package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +116 -0
  86. package/deps/couchbase-cxx-client/couchbase/fmt/cas.hxx +1 -1
  87. package/deps/couchbase-cxx-client/couchbase/fmt/query_scan_consistency.hxx +46 -0
  88. package/deps/couchbase-cxx-client/couchbase/fmt/query_status.hxx +70 -0
  89. package/deps/couchbase-cxx-client/couchbase/fmt/tls_verify_mode.hxx +46 -0
  90. package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +100 -0
  91. package/deps/couchbase-cxx-client/{core → couchbase}/management/query_index.hxx +2 -2
  92. package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +16 -0
  93. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +178 -6
  94. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +1 -18
  95. package/deps/couchbase-cxx-client/couchbase/scope.hxx +5 -2
  96. package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +16 -0
  97. package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +11 -4
  98. package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +5 -3
  99. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +16 -0
  100. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +0 -6
  101. package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +115 -0
  102. package/deps/couchbase-cxx-client/examples/minimal.cxx +3 -1
  103. package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +72 -0
  104. package/deps/couchbase-cxx-client/test/test_integration_management.cxx +727 -310
  105. package/deps/couchbase-cxx-client/test/test_integration_query.cxx +4 -8
  106. package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +14 -0
  107. package/deps/couchbase-cxx-client/test/test_transaction_transaction_public_blocking_api.cxx +34 -19
  108. package/deps/couchbase-cxx-client/test/test_unit_transaction_logging.cxx +66 -22
  109. package/deps/couchbase-cxx-client/test/test_unit_utils.cxx +51 -0
  110. package/deps/couchbase-cxx-client/test/tools/tool_kv_loader.cxx +2 -2
  111. package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -0
  112. package/deps/couchbase-cxx-client/test/utils/wait_until.cxx +4 -4
  113. package/deps/couchbase-cxx-client/third_party/docopt/.travis.yml +103 -0
  114. package/deps/couchbase-cxx-client/third_party/docopt/CMakeLists.txt +129 -0
  115. package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-Boost-1.0 +23 -0
  116. package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-MIT +23 -0
  117. package/deps/couchbase-cxx-client/third_party/docopt/README.rst +479 -0
  118. package/deps/couchbase-cxx-client/third_party/docopt/docopt-config.cmake +1 -0
  119. package/deps/couchbase-cxx-client/third_party/docopt/docopt.cpp +687 -0
  120. package/deps/couchbase-cxx-client/third_party/docopt/docopt.h +98 -0
  121. package/deps/couchbase-cxx-client/third_party/docopt/docopt.pc.in +9 -0
  122. package/deps/couchbase-cxx-client/third_party/docopt/docopt_private.h +676 -0
  123. package/deps/couchbase-cxx-client/third_party/docopt/docopt_util.h +122 -0
  124. package/deps/couchbase-cxx-client/third_party/docopt/docopt_value.h +341 -0
  125. package/deps/couchbase-cxx-client/third_party/docopt/examples/naval_fate.cpp +36 -0
  126. package/deps/couchbase-cxx-client/third_party/docopt/main.cpp +16 -0
  127. package/deps/couchbase-cxx-client/third_party/docopt/run_testcase.cpp +40 -0
  128. package/deps/couchbase-cxx-client/third_party/docopt/run_tests.py +72 -0
  129. package/deps/couchbase-cxx-client/third_party/docopt/testcases.docopt +957 -0
  130. package/deps/couchbase-cxx-client/tools/CMakeLists.txt +14 -0
  131. package/deps/couchbase-cxx-client/tools/cbc.cxx +65 -0
  132. package/deps/couchbase-cxx-client/tools/command.hxx +31 -0
  133. package/deps/couchbase-cxx-client/tools/command_registry.cxx +43 -0
  134. package/deps/couchbase-cxx-client/tools/command_registry.hxx +39 -0
  135. package/deps/couchbase-cxx-client/tools/get.cxx +267 -0
  136. package/deps/couchbase-cxx-client/tools/get.hxx +26 -0
  137. package/deps/couchbase-cxx-client/tools/query.cxx +441 -0
  138. package/deps/couchbase-cxx-client/tools/query.hxx +26 -0
  139. package/deps/couchbase-cxx-client/tools/utils.cxx +418 -0
  140. package/deps/couchbase-cxx-client/tools/utils.hxx +150 -0
  141. package/deps/couchbase-cxx-client/tools/version.cxx +82 -0
  142. package/deps/couchbase-cxx-client/tools/version.hxx +26 -0
  143. package/dist/authenticators.d.ts +2 -2
  144. package/dist/authenticators.js +1 -2
  145. package/dist/binding.d.ts +32 -16
  146. package/dist/cluster.js +14 -7
  147. package/dist/collection.d.ts +6 -0
  148. package/dist/collection.js +8 -0
  149. package/dist/queryexecutor.js +1 -1
  150. package/dist/queryindexmanager.d.ts +100 -4
  151. package/dist/queryindexmanager.js +344 -118
  152. package/dist/transactions.js +0 -2
  153. package/package.json +1 -1
  154. package/src/connection.cpp +2 -0
  155. package/src/connection.hpp +1 -0
  156. package/src/connection_autogen.cpp +16 -0
  157. package/src/jstocbpp_autogen.hpp +93 -23
  158. package/src/jstocbpp_basic.hpp +24 -0
  159. package/src/jstocbpp_transactions.hpp +0 -8
  160. package/tools/gen-bindings-js.js +1 -0
  161. package/tools/gen-bindings-json.py +4 -2
  162. package/deps/couchbase-cxx-client/core/transactions/logging.cxx +0 -107
package/CMakeLists.txt CHANGED
@@ -17,6 +17,7 @@ include_directories(${CMAKE_JS_INC})
17
17
 
18
18
  set(COUCHBASE_CXX_CLIENT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
19
19
  set(COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
20
+ set(COUCHBASE_CXX_CLIENT_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
20
21
  set(COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL ON CACHE BOOL "" FORCE)
21
22
  set(COUCHBASE_CXX_CLIENT_STATIC_STDLIB ON CACHE BOOL "" FORCE)
22
23
  add_subdirectory(deps/couchbase-cxx-client)
@@ -26,3 +26,6 @@
26
26
  [submodule "third_party/fmt"]
27
27
  path = third_party/fmt
28
28
  url = https://github.com/fmtlib/fmt.git
29
+ [submodule "third_party/docopt"]
30
+ path = third_party/docopt
31
+ url = https://github.com/docopt/docopt.cpp.git
@@ -7,6 +7,7 @@
7
7
  <file path="$PROJECT_DIR$/couchbase" />
8
8
  <file path="$PROJECT_DIR$/examples" />
9
9
  <file path="$PROJECT_DIR$/private" />
10
+ <file path="$PROJECT_DIR$/tools" />
10
11
  <file path="$PROJECT_DIR$/transactions" />
11
12
  </sourceRoots>
12
13
  <libraryRoots>
@@ -4,6 +4,7 @@
4
4
  <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
5
  <mapping directory="$PROJECT_DIR$/third_party/asio" vcs="Git" />
6
6
  <mapping directory="$PROJECT_DIR$/third_party/catch2" vcs="Git" />
7
+ <mapping directory="$PROJECT_DIR$/third_party/docopt" vcs="Git" />
7
8
  <mapping directory="$PROJECT_DIR$/third_party/fmt" vcs="Git" />
8
9
  <mapping directory="$PROJECT_DIR$/third_party/gsl" vcs="Git" />
9
10
  <mapping directory="$PROJECT_DIR$/third_party/hdr_histogram_c" vcs="Git" />
@@ -259,11 +259,14 @@ set(couchbase_cxx_client_FILES
259
259
  core/impl/append.cxx
260
260
  core/impl/best_effort_retry_strategy.cxx
261
261
  core/impl/build_deferred_query_indexes.cxx
262
+ core/impl/collection_query_index_manager.cxx
262
263
  core/impl/cluster.cxx
263
264
  core/impl/common_error_category.cxx
264
265
  core/impl/configuration_profiles_registry.cxx
266
+ core/impl/create_query_index.cxx
265
267
  core/impl/decrement.cxx
266
268
  core/impl/dns_srv_tracker.cxx
269
+ core/impl/drop_query_index.cxx
267
270
  core/impl/exists.cxx
268
271
  core/impl/expiry.cxx
269
272
  core/impl/fail_fast_retry_strategy.cxx
@@ -272,6 +275,7 @@ set(couchbase_cxx_client_FILES
272
275
  core/impl/get_all_replicas.cxx
273
276
  core/impl/get_and_lock.cxx
274
277
  core/impl/get_and_touch.cxx
278
+ core/impl/get_all_query_indexes.cxx
275
279
  core/impl/get_any_replica.cxx
276
280
  core/impl/get_replica.cxx
277
281
  core/impl/increment.cxx
@@ -293,6 +297,7 @@ set(couchbase_cxx_client_FILES
293
297
  core/impl/search_error_category.cxx
294
298
  core/impl/streaming_json_lexter_error_category.cxx
295
299
  core/impl/unlock.cxx
300
+ core/impl/watch_query_indexes.cxx
296
301
  core/impl/subdoc/array_add_unique.cxx
297
302
  core/impl/subdoc/array_append.cxx
298
303
  core/impl/subdoc/array_insert.cxx
@@ -325,7 +330,6 @@ set(couchbase_cxx_client_FILES
325
330
  core/transactions/attempt_context_impl.cxx
326
331
  core/transactions/binary.cxx
327
332
  core/transactions/exceptions.cxx
328
- core/transactions/logging.cxx
329
333
  core/transactions/result.cxx
330
334
  core/transactions/staged_mutation.cxx
331
335
  core/transactions/utils.cxx
@@ -411,3 +415,9 @@ option(COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES "Build example programs" TRUE)
411
415
  if (COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES)
412
416
  add_subdirectory(examples)
413
417
  endif ()
418
+
419
+ option(COUCHBASE_CXX_CLIENT_BUILD_TOOLS "Build tools" TRUE)
420
+ if (COUCHBASE_CXX_CLIENT_BUILD_TOOLS)
421
+ add_subdirectory(third_party/docopt)
422
+ add_subdirectory(tools)
423
+ endif ()
@@ -1,9 +1,9 @@
1
1
  # Couchbase C++ Client
2
2
 
3
3
  [![license](https://img.shields.io/github/license/couchbaselabs/couchbase-cxx-client?color=brightgreen)](https://opensource.org/licenses/Apache-2.0)
4
- [![linters](https://img.shields.io/github/actions/workflow/status/couchbaselabs/couchbase-cxx-client/linters.yml?branch=main&label=linters)](https://github.com/couchbaselabs/couchbase-cxx-client/actions?query=workflow%3Alinters)
5
- [![sanitizers](https://img.shields.io/github/actions/workflow/status/couchbaselabs/couchbase-cxx-client/sanitizers.yml?branch=main&label=sanitizers)](https://github.com/couchbaselabs/couchbase-cxx-client/actions?query=workflow%3Asanitizers)
6
- [![tests](https://img.shields.io/github/actions/workflow/status/couchbaselabs/couchbase-cxx-client/tests.yml?branch=main&label=tests)](https://github.com/couchbaselabs/couchbase-cxx-client/actions?query=workflow%3Atests)
4
+ [![linters](https://img.shields.io/github/actions/workflow/status/couchbaselabs/couchbase-cxx-client/linters.yml?branch=main&label=linters)](https://github.com/couchbaselabs/couchbase-cxx-client/actions?query=workflow%3Alinters+branch%3Amain)
5
+ [![sanitizers](https://img.shields.io/github/actions/workflow/status/couchbaselabs/couchbase-cxx-client/sanitizers.yml?branch=main&label=sanitizers)](https://github.com/couchbaselabs/couchbase-cxx-client/actions?query=workflow%3Asanitizers+branch%3Amain)
6
+ [![tests](https://img.shields.io/github/actions/workflow/status/couchbaselabs/couchbase-cxx-client/tests.yml?branch=main&label=tests)](https://github.com/couchbaselabs/couchbase-cxx-client/actions?query=workflow%3Atests+branch%3Amain)
7
7
 
8
8
  This repo is under active development and is not yet ready for release as a public SDK.
9
9
 
@@ -67,7 +67,6 @@ function(set_project_warnings project_name)
67
67
  -Wuseless-cast # warn if you perform a cast to the same type
68
68
  -Wdeprecated-declarations # warn if [[deprecated]] elements being used
69
69
  )
70
-
71
70
  set(CLANG_WARNINGS ${COMMON_WARNINGS}
72
71
  -Wshadow # warn the user if a variable declaration shadows one from a parent context
73
72
  )
@@ -77,6 +76,10 @@ function(set_project_warnings project_name)
77
76
  elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
78
77
  set(PROJECT_WARNINGS ${CLANG_WARNINGS})
79
78
  elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
79
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0" AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
80
+ # One of the occurrences: https://github.com/chriskohlhoff/asio/pull/1176
81
+ set(GCC_WARNINGS ${GCC_WARNINGS} -Wno-error=null-dereference -Wno-error=array-bounds)
82
+ endif()
80
83
  set(PROJECT_WARNINGS ${GCC_WARNINGS})
81
84
  else()
82
85
  message(AUTHOR_WARNING "No compiler warnings set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
@@ -9,7 +9,19 @@ if(NOT COUCHBASE_CXX_CLIENT_GIT_REVISION)
9
9
  else()
10
10
  set(COUCHBASE_CXX_CLIENT_GIT_REVISION "unknown")
11
11
  endif()
12
- string(SUBSTRING "${COUCHBASE_CXX_CLIENT_GIT_REVISION}" 0 7 COUCHBASE_CXX_CLIENT_GIT_REVISION_SHORT)
12
+ endif()
13
+ string(SUBSTRING "${COUCHBASE_CXX_CLIENT_GIT_REVISION}" 0 7 COUCHBASE_CXX_CLIENT_GIT_REVISION_SHORT)
14
+
15
+ if(NOT COUCHBASE_CXX_CLIENT_GIT_DESCRIBE)
16
+ if(GIT)
17
+ execute_process(
18
+ COMMAND git describe --always --long HEAD
19
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
20
+ OUTPUT_STRIP_TRAILING_WHITESPACE
21
+ OUTPUT_VARIABLE COUCHBASE_CXX_CLIENT_GIT_DESCRIBE)
22
+ else()
23
+ set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "unknown")
24
+ endif()
13
25
  endif()
14
26
 
15
27
  string(TIMESTAMP COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP "%Y-%m-%d %H:%M:%S" UTC)
@@ -30,5 +30,6 @@ constexpr auto COUCHBASE_CXX_CLIENT_VERSION_PATCH = @couchbase_cxx_client_VERSIO
30
30
  constexpr auto COUCHBASE_CXX_CLIENT_VERSION_BUILD = @couchbase_cxx_client_BUILD_NUMBER@;
31
31
  constexpr auto COUCHBASE_CXX_CLIENT_GIT_REVISION = "@COUCHBASE_CXX_CLIENT_GIT_REVISION@";
32
32
  constexpr auto COUCHBASE_CXX_CLIENT_GIT_REVISION_SHORT = "@COUCHBASE_CXX_CLIENT_GIT_REVISION_SHORT@";
33
+ constexpr auto COUCHBASE_CXX_CLIENT_GIT_DESCRIBE = "@COUCHBASE_CXX_CLIENT_GIT_DESCRIBE@";
33
34
  #cmakedefine COUCHBASE_CXX_CLIENT_STATIC_STDLIB 1
34
35
  #cmakedefine COUCHBASE_CXX_CLIENT_STATIC_OPENSSL 1
@@ -88,17 +88,18 @@ class cluster : public std::enable_shared_from_this<cluster>
88
88
  tracer_ = std::make_shared<tracing::noop_tracer>();
89
89
  }
90
90
  }
91
+ tracer_->start();
91
92
  // ignore the metrics options if a meter was passed in.
92
93
  if (nullptr != origin_.options().meter) {
93
94
  meter_ = origin_.options().meter;
94
95
  } else {
95
-
96
96
  if (origin_.options().enable_metrics) {
97
97
  meter_ = std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options);
98
98
  } else {
99
99
  meter_ = std::make_shared<metrics::noop_meter>();
100
100
  }
101
101
  }
102
+ meter_->start();
102
103
  session_manager_->set_tracer(tracer_);
103
104
  if (origin_.options().enable_dns_srv) {
104
105
  auto [hostname, _] = origin_.next_address();
@@ -110,7 +111,7 @@ class cluster : public std::enable_shared_from_this<cluster>
110
111
  [self, hostname = std::move(hostname), handler = std::forward<Handler>(handler)](origin::node_list nodes,
111
112
  std::error_code ec) mutable {
112
113
  if (ec) {
113
- return handler(ec);
114
+ return self->close([ec, handler = std::forward<Handler>(handler)]() mutable { handler(ec); });
114
115
  }
115
116
  if (!nodes.empty()) {
116
117
  self->origin_.set_nodes(std::move(nodes));
@@ -141,7 +142,13 @@ class cluster : public std::enable_shared_from_this<cluster>
141
142
  self->session_manager_->close();
142
143
  handler();
143
144
  self->work_.reset();
145
+ if (self->tracer_) {
146
+ self->tracer_->stop();
147
+ }
144
148
  self->tracer_.reset();
149
+ if (self->meter_) {
150
+ self->meter_->stop();
151
+ }
145
152
  self->meter_.reset();
146
153
  }));
147
154
  }
@@ -395,7 +402,7 @@ class cluster : public std::enable_shared_from_this<cluster>
395
402
  tls_.load_verify_file(origin_.options().trust_certificate, ec);
396
403
  if (ec) {
397
404
  CB_LOG_ERROR("[{}]: unable to load verify file \"{}\": {}", id_, origin_.options().trust_certificate, ec.message());
398
- return handler(ec);
405
+ return close([ec, handler = std::forward<Handler>(handler)]() mutable { return handler(ec); });
399
406
  }
400
407
  }
401
408
  #ifdef COUCHBASE_CXX_CLIENT_TLS_KEY_LOG_FILE
@@ -414,13 +421,13 @@ class cluster : public std::enable_shared_from_this<cluster>
414
421
  tls_.use_certificate_chain_file(origin_.certificate_path(), ec);
415
422
  if (ec) {
416
423
  CB_LOG_ERROR("[{}]: unable to load certificate chain \"{}\": {}", id_, origin_.certificate_path(), ec.message());
417
- return handler(ec);
424
+ return close([ec, handler = std::forward<Handler>(handler)]() mutable { return handler(ec); });
418
425
  }
419
426
  CB_LOG_DEBUG(R"([{}]: use TLS private key: "{}")", id_, origin_.key_path());
420
427
  tls_.use_private_key_file(origin_.key_path(), asio::ssl::context::file_format::pem, ec);
421
428
  if (ec) {
422
429
  CB_LOG_ERROR("[{}]: unable to load private key \"{}\": {}", id_, origin_.key_path(), ec.message());
423
- return handler(ec);
430
+ return close([ec, handler = std::forward<Handler>(handler)]() mutable { return handler(ec); });
424
431
  }
425
432
  }
426
433
  session_ = io::mcbp_session(id_, ctx_, tls_, origin_, dns_srv_tracker_);
@@ -465,6 +472,9 @@ class cluster : public std::enable_shared_from_this<cluster>
465
472
  }
466
473
  });
467
474
  }
475
+ if (ec) {
476
+ return self->close([ec, handler = std::forward<Handler>(handler)]() mutable { handler(ec); });
477
+ }
468
478
  handler(ec);
469
479
  });
470
480
  }
@@ -39,22 +39,24 @@ build_context(Response& resp)
39
39
  std::move(resp.ctx.http_body),
40
40
  std::move(resp.ctx.path) };
41
41
  }
42
-
43
42
  void
44
43
  initiate_build_deferred_indexes(std::shared_ptr<couchbase::core::cluster> core,
45
44
  std::string bucket_name,
46
45
  build_query_index_options::built options,
46
+ query_context query_ctx,
47
+ std::string collection_name,
47
48
  build_deferred_query_indexes_handler&& handler)
48
49
  {
49
50
  core->execute(
50
51
  operations::management::query_index_get_all_deferred_request{
51
52
  bucket_name,
52
- options.scope_name.value_or(""),
53
- options.collection_name.value_or(""),
53
+ "",
54
+ collection_name,
55
+ query_ctx,
54
56
  {},
55
57
  options.timeout,
56
58
  },
57
- [core, bucket_name, options = std::move(options), handler = std::move(handler)](
59
+ [core, bucket_name, collection_name, options = std::move(options), query_ctx, handler = std::move(handler)](
58
60
  operations::management::query_index_get_all_deferred_response resp1) mutable {
59
61
  auto list_resp = std::move(resp1);
60
62
  if (list_resp.ctx.ec) {
@@ -66,8 +68,9 @@ initiate_build_deferred_indexes(std::shared_ptr<couchbase::core::cluster> core,
66
68
  core->execute(
67
69
  operations::management::query_index_build_request{
68
70
  std::move(bucket_name),
69
- options.scope_name.value_or(""),
70
- options.collection_name.value_or(""),
71
+ "",
72
+ collection_name,
73
+ query_ctx,
71
74
  std::move(list_resp.index_names),
72
75
  {},
73
76
  options.timeout,
@@ -78,4 +81,12 @@ initiate_build_deferred_indexes(std::shared_ptr<couchbase::core::cluster> core,
78
81
  });
79
82
  });
80
83
  }
84
+ void
85
+ initiate_build_deferred_indexes(std::shared_ptr<couchbase::core::cluster> core,
86
+ std::string bucket_name,
87
+ build_query_index_options::built options,
88
+ build_deferred_query_indexes_handler&& handler)
89
+ {
90
+ return initiate_build_deferred_indexes(core, std::move(bucket_name), options, {}, "", std::move(handler));
91
+ }
81
92
  } // namespace couchbase::core::impl
@@ -169,7 +169,7 @@ initiate_cluster_connect(asio::io_service& io,
169
169
  auto c = couchbase::cluster(core);
170
170
  // create txns as we want to start cleanup immediately if configured with metadata_collection
171
171
  [[maybe_unused]] std::shared_ptr<couchbase::transactions::transactions> t = c.transactions();
172
- handler(c, {});
172
+ handler(std::move(c), {});
173
173
  });
174
174
  }
175
175
 
@@ -0,0 +1,93 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present 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
+ #include <core/query_context.hxx>
19
+ #include <couchbase/collection_query_index_manager.hxx>
20
+
21
+ namespace couchbase
22
+ {
23
+
24
+ void
25
+ collection_query_index_manager::get_all_indexes(const get_all_query_indexes_options& options, get_all_indexes_handler&& handler) const
26
+ {
27
+ return core::impl::initiate_get_all_query_indexes(core_,
28
+ "",
29
+ options.build(),
30
+ core::query_context(bucket_name_, scope_name_),
31
+ collection_name_,
32
+ std::forward<get_all_indexes_handler>(handler));
33
+ }
34
+
35
+ void
36
+ collection_query_index_manager::create_index(std::string index_name,
37
+ std::vector<std::string> fields,
38
+ const create_query_index_options& options,
39
+ create_query_index_handler&& handler) const
40
+ {
41
+ return core::impl::initiate_create_query_index(core_,
42
+ "",
43
+ std::move(index_name),
44
+ std::move(fields),
45
+ options.build(),
46
+ { bucket_name_, scope_name_ },
47
+ collection_name_,
48
+ std::forward<create_query_index_handler>(handler));
49
+ }
50
+
51
+ void
52
+ collection_query_index_manager::create_primary_index(const create_primary_query_index_options& options,
53
+ create_query_index_handler&& handler) const
54
+ {
55
+ return core::impl::initiate_create_primary_query_index(
56
+ core_, "", options.build(), { bucket_name_, scope_name_ }, collection_name_, std::move(handler));
57
+ }
58
+
59
+ void
60
+ collection_query_index_manager::drop_primary_index(const drop_primary_query_index_options& options,
61
+ drop_query_index_handler&& handler) const
62
+ {
63
+ return core::impl::initiate_drop_primary_query_index(
64
+ core_, "", options.build(), { bucket_name_, scope_name_ }, collection_name_, std::move(handler));
65
+ }
66
+ void
67
+ collection_query_index_manager::drop_index(std::string index_name,
68
+ const drop_query_index_options& options,
69
+ drop_query_index_handler&& handler) const
70
+ {
71
+ return core::impl::initiate_drop_query_index(
72
+ core_, "", std::move(index_name), options.build(), { bucket_name_, scope_name_ }, collection_name_, std::move(handler));
73
+ }
74
+ void
75
+ collection_query_index_manager::build_deferred_indexes(const build_query_index_options& options,
76
+ build_deferred_query_indexes_handler&& handler) const
77
+ {
78
+ return core::impl::initiate_build_deferred_indexes(core_,
79
+ "",
80
+ options.build(),
81
+ { bucket_name_, scope_name_ },
82
+ collection_name_,
83
+ std::forward<build_deferred_query_indexes_handler>(handler));
84
+ }
85
+ void
86
+ collection_query_index_manager::watch_indexes(std::vector<std::string> index_names,
87
+ const watch_query_indexes_options& options,
88
+ watch_query_indexes_handler&& handler) const
89
+ {
90
+ return core::impl::initiate_watch_query_indexes(
91
+ core_, "", std::move(index_names), options.build(), { bucket_name_, scope_name_ }, collection_name_, std::move(handler));
92
+ }
93
+ } // namespace couchbase
@@ -59,4 +59,15 @@ configuration_profiles_registry::apply_profile(const std::string& name, couchbas
59
59
 
60
60
  profile->apply(options);
61
61
  }
62
+
63
+ auto
64
+ configuration_profiles_registry::available_profiles() -> std::vector<std::string>
65
+ {
66
+ std::vector<std::string> profile_names;
67
+ std::scoped_lock lock(registry::store_mutex);
68
+ for (const auto& [name, _] : registry::store) {
69
+ profile_names.push_back(name);
70
+ }
71
+ return profile_names;
72
+ }
62
73
  } // namespace couchbase
@@ -0,0 +1,119 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present 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
+ #include <couchbase/error_codes.hxx>
19
+ #include <couchbase/query_index_manager.hxx>
20
+
21
+ #include "core/cluster.hxx"
22
+ #include "core/operations/management/query_index_create.hxx"
23
+
24
+ namespace couchbase::core::impl
25
+ {
26
+ template<typename Response>
27
+ static manager_error_context
28
+ build_context(Response& resp)
29
+ {
30
+ return { resp.ctx.ec,
31
+ resp.ctx.last_dispatched_to,
32
+ resp.ctx.last_dispatched_from,
33
+ resp.ctx.retry_attempts,
34
+ std::move(resp.ctx.retry_reasons),
35
+ std::move(resp.ctx.client_context_id),
36
+ resp.ctx.http_status,
37
+ std::move(resp.ctx.http_body),
38
+ std::move(resp.ctx.path) };
39
+ }
40
+
41
+ void
42
+ initiate_create_query_index(std::shared_ptr<couchbase::core::cluster> core,
43
+ std::string bucket_name,
44
+ std::string index_name,
45
+ std::vector<std::string> fields,
46
+ couchbase::create_query_index_options::built options,
47
+ query_context query_ctx,
48
+ std::string collection_name,
49
+ create_query_index_handler&& handler)
50
+ {
51
+ core->execute(
52
+ operations::management::query_index_create_request{
53
+ bucket_name,
54
+ "",
55
+ collection_name,
56
+ index_name,
57
+ fields,
58
+ query_ctx,
59
+ false,
60
+ options.ignore_if_exists,
61
+ options.condition,
62
+ options.deferred,
63
+ options.num_replicas,
64
+ {},
65
+ options.timeout,
66
+ },
67
+ [core, bucket_name, options = std::move(options), handler = std::move(handler)](
68
+ operations::management::query_index_create_response resp) { handler(build_context(resp)); });
69
+ }
70
+
71
+ void
72
+ initiate_create_query_index(std::shared_ptr<couchbase::core::cluster> core,
73
+ std::string bucket_name,
74
+ std::string index_name,
75
+ std::vector<std::string> fields,
76
+ couchbase::create_query_index_options::built options,
77
+ create_query_index_handler&& handler)
78
+ {
79
+ initiate_create_query_index(
80
+ core, std::move(bucket_name), std::move(index_name), std::move(fields), options, {}, "", std::move(handler));
81
+ }
82
+
83
+ void
84
+ initiate_create_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
85
+ std::string bucket_name,
86
+ couchbase::create_primary_query_index_options::built options,
87
+ query_context query_ctx,
88
+ std::string collection_name,
89
+ create_primary_query_index_handler&& handler)
90
+ {
91
+ core->execute(
92
+ operations::management::query_index_create_request{
93
+ bucket_name,
94
+ "",
95
+ collection_name,
96
+ options.index_name.value_or(""),
97
+ {},
98
+ query_ctx,
99
+ true,
100
+ options.ignore_if_exists,
101
+ {},
102
+ options.deferred,
103
+ options.num_replicas,
104
+ {},
105
+ options.timeout,
106
+ },
107
+ [core, bucket_name, options = std::move(options), handler = std::move(handler)](
108
+ operations::management::query_index_create_response resp) { handler(build_context(resp)); });
109
+ }
110
+
111
+ void
112
+ initiate_create_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
113
+ std::string bucket_name,
114
+ couchbase::create_primary_query_index_options::built options,
115
+ create_primary_query_index_handler&& handler)
116
+ {
117
+ initiate_create_primary_query_index(core, std::move(bucket_name), std::move(options), {}, "", std::move(handler));
118
+ }
119
+ } // namespace couchbase::core::impl
@@ -0,0 +1,108 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2020-Present 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
+ #include "couchbase/error_codes.hxx"
19
+ #include "couchbase/query_index_manager.hxx"
20
+
21
+ #include "core/cluster.hxx"
22
+ #include "core/operations/management/query_index_drop.hxx"
23
+
24
+ namespace couchbase::core::impl
25
+ {
26
+ template<typename Response>
27
+ static manager_error_context
28
+ build_context(Response& resp)
29
+ {
30
+ return { resp.ctx.ec,
31
+ resp.ctx.last_dispatched_to,
32
+ resp.ctx.last_dispatched_from,
33
+ resp.ctx.retry_attempts,
34
+ std::move(resp.ctx.retry_reasons),
35
+ std::move(resp.ctx.client_context_id),
36
+ resp.ctx.http_status,
37
+ std::move(resp.ctx.http_body),
38
+ std::move(resp.ctx.path) };
39
+ }
40
+
41
+ void
42
+ initiate_drop_query_index(std::shared_ptr<couchbase::core::cluster> core,
43
+ std::string bucket_name,
44
+ std::string index_name,
45
+ drop_query_index_options::built options,
46
+ query_context query_context,
47
+ std::string collection_name,
48
+ drop_query_index_handler&& handler)
49
+ {
50
+ core->execute(
51
+ operations::management::query_index_drop_request{
52
+ bucket_name,
53
+ "",
54
+ collection_name,
55
+ index_name,
56
+ query_context,
57
+ false,
58
+ options.ignore_if_not_exists,
59
+ {},
60
+ options.timeout,
61
+ },
62
+ [core, bucket_name, options = std::move(options), handler = std::move(handler)](
63
+ operations::management::query_index_drop_response resp) { handler(build_context(resp)); });
64
+ }
65
+
66
+ void
67
+ initiate_drop_query_index(std::shared_ptr<couchbase::core::cluster> core,
68
+ std::string bucket_name,
69
+ std::string index_name,
70
+ couchbase::drop_query_index_options::built options,
71
+ drop_query_index_handler&& handler)
72
+ {
73
+ initiate_drop_query_index(core, std::move(bucket_name), std::move(index_name), options, {}, "", std::move(handler));
74
+ }
75
+
76
+ void
77
+ initiate_drop_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
78
+ std::string bucket_name,
79
+ couchbase::drop_primary_query_index_options::built options,
80
+ query_context query_ctx,
81
+ std::string collection_name,
82
+ drop_primary_query_index_handler&& handler)
83
+ {
84
+ core->execute(
85
+ operations::management::query_index_drop_request{
86
+ bucket_name,
87
+ "",
88
+ collection_name,
89
+ options.index_name.value_or(""),
90
+ query_ctx,
91
+ true,
92
+ options.ignore_if_not_exists,
93
+ {},
94
+ options.timeout,
95
+ },
96
+ [core, bucket_name, options = std::move(options), handler = std::move(handler)](
97
+ operations::management::query_index_drop_response resp) { handler(build_context(resp)); });
98
+ }
99
+ void
100
+ initiate_drop_primary_query_index(std::shared_ptr<couchbase::core::cluster> core,
101
+ std::string bucket_name,
102
+ couchbase::drop_primary_query_index_options::built options,
103
+ drop_primary_query_index_handler&& handler)
104
+ {
105
+ return initiate_drop_primary_query_index(core, std::move(bucket_name), options, {}, "", std::move(handler));
106
+ }
107
+
108
+ } // namespace couchbase::core::impl
@@ -59,7 +59,7 @@ initiate_get_operation(std::shared_ptr<couchbase::core::cluster> core,
59
59
  },
60
60
  [handler = std::move(handler)](operations::get_projected_response&& resp) mutable {
61
61
  std::optional<std::chrono::system_clock::time_point> expiry_time{};
62
- if (resp.expiry) {
62
+ if (resp.expiry && resp.expiry.value() > 0) {
63
63
  expiry_time.emplace(std::chrono::seconds{ resp.expiry.value() });
64
64
  }
65
65
  return handler(std::move(resp.ctx), get_result{ resp.cas, { std::move(resp.value), resp.flags }, expiry_time });