couchbase 4.4.2 → 4.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/CMakeLists.txt +2 -0
  2. package/deps/couchbase-cxx-client/CMakeLists.txt +17 -14
  3. package/deps/couchbase-cxx-client/README.md +2 -2
  4. package/deps/couchbase-cxx-client/cmake/Packaging.cmake +4 -0
  5. package/deps/couchbase-cxx-client/cmake/Testing.cmake +1 -1
  6. package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +24 -2
  7. package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +43 -4
  8. package/deps/couchbase-cxx-client/core/agent_group.cxx +8 -0
  9. package/deps/couchbase-cxx-client/core/agent_group.hxx +4 -0
  10. package/deps/couchbase-cxx-client/core/bucket.cxx +16 -20
  11. package/deps/couchbase-cxx-client/core/bucket.hxx +12 -12
  12. package/deps/couchbase-cxx-client/core/cluster.cxx +44 -52
  13. package/deps/couchbase-cxx-client/core/cluster_agent.cxx +8 -0
  14. package/deps/couchbase-cxx-client/core/cluster_agent.hxx +4 -0
  15. package/deps/couchbase-cxx-client/core/collections_component.cxx +2 -2
  16. package/deps/couchbase-cxx-client/core/columnar/agent.cxx +2 -2
  17. package/deps/couchbase-cxx-client/core/columnar/agent.hxx +1 -1
  18. package/deps/couchbase-cxx-client/core/columnar/management_component.cxx +3 -3
  19. package/deps/couchbase-cxx-client/core/columnar/query_component.cxx +103 -45
  20. package/deps/couchbase-cxx-client/core/columnar/query_component.hxx +1 -0
  21. package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +8 -0
  22. package/deps/couchbase-cxx-client/core/http_component.cxx +55 -24
  23. package/deps/couchbase-cxx-client/core/http_component.hxx +4 -0
  24. package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +15 -15
  25. package/deps/couchbase-cxx-client/core/impl/bootstrap_error.hxx +10 -2
  26. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +1 -1
  27. package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +6 -6
  28. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +36 -40
  29. package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
  30. package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +5 -5
  31. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +13 -5
  32. package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -3
  33. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
  34. package/deps/couchbase-cxx-client/core/impl/scan_result.cxx +1 -1
  35. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +12 -12
  36. package/deps/couchbase-cxx-client/core/io/http_command.hxx +31 -20
  37. package/deps/couchbase-cxx-client/core/io/http_session.cxx +5 -0
  38. package/deps/couchbase-cxx-client/core/io/http_session.hxx +17 -4
  39. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +97 -49
  40. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +15 -14
  41. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
  42. package/deps/couchbase-cxx-client/core/io/streams.cxx +256 -0
  43. package/deps/couchbase-cxx-client/core/io/streams.hxx +31 -155
  44. package/deps/couchbase-cxx-client/core/logger/configuration.hxx +5 -0
  45. package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.cxx +2 -3
  46. package/deps/couchbase-cxx-client/core/logger/logger.cxx +39 -7
  47. package/deps/couchbase-cxx-client/core/logger/logger.hxx +7 -0
  48. package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.cxx +188 -0
  49. package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.hxx +73 -0
  50. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -1
  51. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +3 -1
  52. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +3 -1
  53. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +3 -1
  54. package/deps/couchbase-cxx-client/core/operations/management/bucket_update.cxx +3 -1
  55. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +3 -2
  56. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +5 -2
  57. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +4 -2
  58. package/deps/couchbase-cxx-client/core/operations/management/group_upsert.cxx +3 -3
  59. package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -1
  60. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +4 -1
  61. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +3 -1
  62. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +3 -2
  63. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +3 -2
  64. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +3 -2
  65. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +3 -2
  66. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +5 -2
  67. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +5 -2
  68. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +4 -2
  69. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +3 -2
  70. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +5 -2
  71. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -1
  72. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -1
  73. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +3 -1
  74. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -1
  75. package/deps/couchbase-cxx-client/core/origin.cxx +37 -17
  76. package/deps/couchbase-cxx-client/core/platform/base64.cc +1 -1
  77. package/deps/couchbase-cxx-client/core/platform/random.cc +2 -0
  78. package/deps/couchbase-cxx-client/core/platform/uuid.h +6 -6
  79. package/deps/couchbase-cxx-client/core/row_streamer.cxx +1 -1
  80. package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.cc +1 -1
  81. package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.h +4 -4
  82. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +2 -0
  83. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +8 -0
  84. package/deps/couchbase-cxx-client/core/tracing/constants.hxx +3 -0
  85. package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.cxx +87 -0
  86. package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.hxx +57 -0
  87. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +16 -15
  88. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +2 -2
  89. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +2 -2
  90. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +2 -2
  91. package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +128 -52
  92. package/deps/couchbase-cxx-client/couchbase/analytics_options.hxx +4 -3
  93. package/deps/couchbase-cxx-client/couchbase/codec/tao_json_serializer.hxx +1 -1
  94. package/deps/couchbase-cxx-client/couchbase/mutate_in_specs.hxx +2 -2
  95. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +4 -3
  96. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +1 -1
  97. package/package.json +8 -8
  98. package/src/binding.cpp +13 -13
package/CMakeLists.txt CHANGED
@@ -194,6 +194,7 @@ set(COUCHBASE_CXX_SOURCE_DIR "${PROJECT_SOURCE_DIR}/deps/couchbase-cxx-client")
194
194
  if(CMAKE_JS_VERSION VERSION_GREATER_EQUAL "7.0.0")
195
195
  target_include_directories(${PROJECT_NAME}
196
196
  PRIVATE ${NODEJS_INC_DIR}
197
+ "${COUCHBASE_CXX_BINARY_DIR}/generated"
197
198
  "${COUCHBASE_CXX_SOURCE_DIR}"
198
199
  "${COUCHBASE_CXX_SOURCE_DIR}/third_party/cxx_function"
199
200
  "${COUCHBASE_CXX_SOURCE_DIR}/third_party/expected/include")
@@ -208,6 +209,7 @@ else()
208
209
  target_include_directories(${PROJECT_NAME}
209
210
  PRIVATE ${NODEJS_INC_DIR}
210
211
  ${NODE_ADDON_API_DIR}
212
+ "${COUCHBASE_CXX_BINARY_DIR}/generated"
211
213
  "${COUCHBASE_CXX_SOURCE_DIR}"
212
214
  "${COUCHBASE_CXX_SOURCE_DIR}/third_party/cxx_function"
213
215
  "${COUCHBASE_CXX_SOURCE_DIR}/third_party/expected/include")
@@ -21,7 +21,7 @@ endif()
21
21
 
22
22
  project(
23
23
  couchbase_cxx_client
24
- VERSION "1.0.2"
24
+ VERSION "1.0.3"
25
25
  LANGUAGES CXX C)
26
26
  message(STATUS "Couchbase C++ client ${couchbase_cxx_client_VERSION} build ${couchbase_cxx_client_BUILD_NUMBER}, master: ${COUCHBASE_CXX_CLIENT_MASTER_PROJECT}")
27
27
  message(STATUS "System: ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_VERSION}, ${CMAKE_SYSTEM_PROCESSOR}")
@@ -76,19 +76,6 @@ include(cmake/OpenSSL.cmake)
76
76
 
77
77
  include(cmake/VersionInfo.cmake)
78
78
 
79
- include(cmake/DetectStandardFilesystem.cmake)
80
- couchbase_cxx_check_filesystem(
81
- couchbase_cxx_client
82
- "filesystem"
83
- "std::filesystem"
84
- "stdc++fs;c++fs"
85
- STD_FILESYSTEM)
86
- if(STD_FILESYSTEM)
87
- message(STATUS "Using std::filesystem")
88
- else()
89
- message(FATAL_ERROR "Couchbase C++ Client requires C++17, including an implementation of std::filesystem.")
90
- endif()
91
-
92
79
  add_subdirectory(core/platform)
93
80
  set(couchbase_cxx_client_FILES
94
81
  ${CMAKE_CURRENT_BINARY_DIR}/generated/mozilla_ca_bundle.cxx
@@ -242,6 +229,7 @@ set(couchbase_cxx_client_FILES
242
229
  core/io/mcbp_message.cxx
243
230
  core/io/mcbp_parser.cxx
244
231
  core/io/mcbp_session.cxx
232
+ core/io/streams.cxx
245
233
  core/key_value_config.cxx
246
234
  core/logger/custom_rotating_file_sink.cxx
247
235
  core/logger/logger.cxx
@@ -260,6 +248,7 @@ set(couchbase_cxx_client_FILES
260
248
  core/mcbp/server_duration.cxx
261
249
  core/meta/version.cxx
262
250
  core/metrics/logging_meter.cxx
251
+ core/metrics/meter_wrapper.cxx
263
252
  core/n1ql_query_options.cxx
264
253
  core/operations/document_analytics.cxx
265
254
  core/operations/document_append.cxx
@@ -412,6 +401,7 @@ set(couchbase_cxx_client_FILES
412
401
  core/seed_config.cxx
413
402
  core/topology/configuration.cxx
414
403
  core/tracing/threshold_logging_tracer.cxx
404
+ core/tracing/tracer_wrapper.cxx
415
405
  core/transactions/active_transaction_record.cxx
416
406
  core/transactions/async_attempt_context.cxx
417
407
  core/transactions/atr_cleanup_entry.cxx
@@ -492,6 +482,19 @@ if(WIN32 OR NOT COUCHBASE_CXX_CLIENT_BUILD_SHARED)
492
482
  endif()
493
483
 
494
484
  foreach(TARGET ${couchbase_cxx_client_LIBRARIES})
485
+ include(cmake/DetectStandardFilesystem.cmake)
486
+ couchbase_cxx_check_filesystem(
487
+ ${TARGET}
488
+ "filesystem"
489
+ "std::filesystem"
490
+ "stdc++fs;c++fs"
491
+ STD_FILESYSTEM)
492
+ if(STD_FILESYSTEM)
493
+ message(STATUS "Using std::filesystem")
494
+ else()
495
+ message(FATAL_ERROR "Couchbase C++ Client requires C++17, including an implementation of std::filesystem.")
496
+ endif()
497
+
495
498
  set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
496
499
 
497
500
  target_include_directories(
@@ -21,9 +21,9 @@ CPMAddPackage(
21
21
  NAME
22
22
  couchbase_cxx_client
23
23
  GIT_TAG
24
- 1.0.2
24
+ 1.0.3
25
25
  VERSION
26
- 1.0.2
26
+ 1.0.3
27
27
  GITHUB_REPOSITORY
28
28
  "couchbase/couchbase-cxx-client"
29
29
  OPTIONS
@@ -62,6 +62,7 @@ set(CPM_USE_LOCAL_PACKAGES OFF CACHE BOOL \"\" FORCE)
62
62
  set(CPM_SOURCE_CACHE \"\${PROJECT_SOURCE_DIR}/third_party_cache\" CACHE STRING \"\" FORCE)
63
63
  set(COUCHBASE_CXX_CLIENT_GIT_REVISION \"${COUCHBASE_CXX_CLIENT_GIT_REVISION}\")
64
64
  set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE \"${COUCHBASE_CXX_CLIENT_GIT_DESCRIBE}\")
65
+ set(COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP \"${COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP}\")
65
66
  set(COUCHBASE_CXX_CLIENT_EMBED_MOZILLA_CA_BUNDLE_ROOT \"\${PROJECT_SOURCE_DIR}/third_party_cache\" CACHE STRING \"\" FORCE)
66
67
  message(STATUS \"Building from Tarball: ${COUCHBASE_CXX_CLIENT_TARBALL_NAME}.tar.gz\")
67
68
  ")
@@ -132,8 +133,11 @@ if(COUCHBASE_CXX_CLIENT_RPM_TARGETS)
132
133
  add_custom_target(packaging_srpm DEPENDS ${COUCHBASE_CXX_CLIENT_SRPM})
133
134
 
134
135
  list(APPEND COUCHBASE_CXX_CLIENT_SUPPORTED_ROOTS
136
+ "opensuse-leap-15.5-${CMAKE_SYSTEM_PROCESSOR}"
135
137
  "rocky-9-${CMAKE_SYSTEM_PROCESSOR}"
138
+ "rocky-8-${CMAKE_SYSTEM_PROCESSOR}"
136
139
  "amazonlinux-2023-${CMAKE_SYSTEM_PROCESSOR}"
140
+ "fedora-40-${CMAKE_SYSTEM_PROCESSOR}"
137
141
  )
138
142
 
139
143
  message(STATUS "Supported build roots for RPM packages: ${COUCHBASE_CXX_CLIENT_SUPPORTED_ROOTS}")
@@ -15,7 +15,7 @@ if(COUCHBASE_CXX_CLIENT_ENABLE_VALGRIND)
15
15
  if(VALGRIND)
16
16
  set(VALGRIND_COMMAND "${VALGRIND}")
17
17
  set(VALGRIND_COMMAND_OPTIONS
18
- "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe"
18
+ "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe --suppressions=${PROJECT_SOURCE_DIR}/.valgrind_suppressions.txt"
19
19
  )
20
20
  set(MEMORYCHECK_COMMAND "${VALGRIND}")
21
21
  set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_COMMAND_OPTIONS}")
@@ -24,8 +24,30 @@ if(NOT COUCHBASE_CXX_CLIENT_GIT_DESCRIBE)
24
24
  endif()
25
25
  endif()
26
26
 
27
- string(TIMESTAMP COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP "%Y-%m-%dT%H:%M:%S" UTC)
28
- string(TIMESTAMP COUCHBASE_CXX_CLIENT_BUILD_DATE "%Y-%m-%d" UTC)
27
+ if(NOT COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP)
28
+ if(GIT)
29
+ execute_process(
30
+ COMMAND git describe --tags --abbrev=0 HEAD
31
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
32
+ RESULT_VARIABLE tag_result
33
+ OUTPUT_STRIP_TRAILING_WHITESPACE
34
+ OUTPUT_VARIABLE last_tag)
35
+
36
+ if (tag_result EQUAL 0)
37
+ execute_process(
38
+ COMMAND git log --max-count=1 --no-patch --format=%cd --date=format:%Y-%m-%dT%H:%M:%S ${last_tag}
39
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
40
+ OUTPUT_STRIP_TRAILING_WHITESPACE
41
+ OUTPUT_VARIABLE COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP)
42
+ endif()
43
+ endif()
44
+
45
+ if (NOT COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP)
46
+ string(TIMESTAMP COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP "%Y-%m-%dT%H:%M:%S" UTC)
47
+ endif()
48
+ endif()
49
+
50
+ string(REGEX REPLACE "T.*" "" COUCHBASE_CXX_CLIENT_BUILD_DATE "${COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP}")
29
51
 
30
52
  # set(couchbase_cxx_client_BUILD_NUMBER 142)
31
53
  # set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "1.0.0-beta.4-27-g6807da0") #-> "couchbase_cxx_client-1.0.0-beta.4+142.27.6807da0"
@@ -1,3 +1,9 @@
1
+ %if 0%{?suse_version}
2
+ %global license_dir %{_datadir}/doc
3
+ %else
4
+ %global license_dir %{_docdir}
5
+ %endif
6
+
1
7
  Name: couchbase-cxx-client
2
8
  Summary: Couchbase C++ SDK
3
9
  Version: @COUCHBASE_CXX_CLIENT_PACKAGE_VERSION@
@@ -6,10 +12,20 @@ Vendor: Couchbase, Inc.
6
12
  Packager: Couchbase SDK Team <support@couchbase.com>
7
13
  License: ASL 2.0
8
14
  URL: https://docs.couchbase.com/cxx-sdk/current/hello-world/overview.html
15
+ %if 0%{?suse_version} == 1500
16
+ BuildRequires: gcc13, gcc13-c++
17
+ %else
9
18
  BuildRequires: gcc, gcc-c++
19
+ %endif
10
20
  BuildRequires: cmake >= 3.19
11
21
  Source0: @COUCHBASE_CXX_CLIENT_TARBALL_NAME@.tar.gz
12
22
 
23
+ %if 0%{?amzn}
24
+ # The additional linker flags break AmazonLinux
25
+ # https://bugzilla.redhat.com/show_bug.cgi?id=2043092
26
+ %undefine _package_note_flags
27
+ %endif
28
+
13
29
  %description
14
30
  This is the client and protocol library for Couchbase project.
15
31
 
@@ -28,6 +44,13 @@ Development files for the Couchbase C++ SDK.
28
44
  %prep
29
45
  %autosetup -p1 -n@COUCHBASE_CXX_CLIENT_TARBALL_NAME@
30
46
  %cmake \
47
+ %if 0%{?rhel} == 8 || 0%{?rocky} == 8 || 0%{?ol} == 8
48
+ -S "." -B "redhat-linux-build" \
49
+ %endif
50
+ %if 0%{?suse_version} == 1500
51
+ -DCMAKE_C_COMPILER=gcc-13 \
52
+ -DCMAKE_CXX_COMPILER=g++-13 \
53
+ %endif
31
54
  -DBUILD_SHARED_LIBS=OFF \
32
55
  -DCOUCHBASE_CXX_CLIENT_INSTALL=ON \
33
56
  -DCOUCHBASE_CXX_CLIENT_STATIC_BORINGSSL=ON \
@@ -38,15 +61,32 @@ Development files for the Couchbase C++ SDK.
38
61
  -DCOUCHBASE_CXX_CLIENT_BUILD_SHARED=ON
39
62
 
40
63
  %build
64
+ %if 0%{?rhel} == 8 || 0%{?rocky} == 8 || 0%{?ol} == 8
65
+ /usr/bin/cmake --build "redhat-linux-build" -j${RPM_BUILD_NCPUS} --verbose
66
+ %else
67
+ %if 0%{?suse_version} == 1500
68
+ cd build
69
+ %endif
41
70
  %cmake_build
71
+ %endif
42
72
 
43
73
  %install
74
+ %if 0%{?rhel} == 8 || 0%{?rocky} == 8 || 0%{?ol} == 8
75
+ DESTDIR="%{buildroot}" /usr/bin/cmake --install "redhat-linux-build"
76
+ %else
44
77
  %cmake_install
78
+ %endif
79
+ %if 0%{?suse_version} == 1500
80
+ %{__mkdir_p} %{buildroot}%{license_dir}/tao/json %{buildroot}%{_libdir}/cmake
81
+ %{__mv} %{buildroot}%{license_dir}/taocpp-json/tao/json/LICENSE %{buildroot}%{license_dir}/tao/json/LICENSE
82
+ %{__mv} %{buildroot}%{_datadir}/taocpp-json/cmake %{buildroot}%{_libdir}/cmake/taocpp-json
83
+ %{__mv} %{buildroot}%{_datadir}/pegtl/cmake %{buildroot}%{_libdir}/cmake/pegtl
84
+ %endif
45
85
 
46
86
  %files
47
- %license %{_docdir}/couchbase_cxx_client/LICENSE.txt
48
- %license %{_docdir}/tao/pegtl/LICENSE
49
- %license %{_docdir}/tao/json/LICENSE
87
+ %license %{license_dir}/couchbase_cxx_client/LICENSE.txt
88
+ %license %{license_dir}/tao/pegtl/LICENSE
89
+ %license %{license_dir}/tao/json/LICENSE
50
90
  %{_libdir}/libcouchbase_cxx_client.so.*
51
91
 
52
92
  %files tools
@@ -62,4 +102,3 @@ Development files for the Couchbase C++ SDK.
62
102
  %changelog
63
103
  * @COUCHBASE_CXX_CLIENT_RPM_DATE@ Couchbase SDK Team <support@couchbase.com> - @COUCHBASE_CXX_CLIENT_PACKAGE_VERSION@-@COUCHBASE_CXX_CLIENT_PACKAGE_RELEASE@
64
104
  - Automated build.
65
- %{_libdir}/libcouchbase_cxx_client_static.a
@@ -132,7 +132,11 @@ public:
132
132
 
133
133
  auto free_form_http_request(const http_request& request,
134
134
  free_form_http_request_callback&& callback)
135
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
136
+ -> tl::expected<std::shared_ptr<pending_operation>, error_union>
137
+ #else
135
138
  -> tl::expected<std::shared_ptr<pending_operation>, std::error_code>
139
+ #endif
136
140
  {
137
141
  return cluster_agent_.free_form_http_request(request, std::move(callback));
138
142
  }
@@ -221,7 +225,11 @@ agent_group::search_query(const search_query_options& options, search_query_call
221
225
  auto
222
226
  agent_group::free_form_http_request(const http_request& request,
223
227
  free_form_http_request_callback&& callback)
228
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
229
+ -> tl::expected<std::shared_ptr<pending_operation>, error_union>
230
+ #else
224
231
  -> tl::expected<std::shared_ptr<pending_operation>, std::error_code>
232
+ #endif
225
233
  {
226
234
  return impl_->free_form_http_request(request, std::move(callback));
227
235
  }
@@ -70,7 +70,11 @@ public:
70
70
 
71
71
  auto free_form_http_request(const http_request& request,
72
72
  free_form_http_request_callback&& callback)
73
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
74
+ -> tl::expected<std::shared_ptr<pending_operation>, error_union>;
75
+ #else
73
76
  -> tl::expected<std::shared_ptr<pending_operation>, std::error_code>;
77
+ #endif
74
78
 
75
79
  auto wait_until_ready(std::chrono::milliseconds timeout,
76
80
  const wait_until_ready_options& options,
@@ -25,11 +25,13 @@
25
25
  #include "core/io/mcbp_message.hxx"
26
26
  #include "core/logger/logger.hxx"
27
27
  #include "core/mcbp/codec.hxx"
28
+ #include "core/metrics/meter_wrapper.hxx"
28
29
  #include "core/protocol/client_opcode.hxx"
29
30
  #include "core/protocol/client_request.hxx"
30
31
  #include "core/protocol/hello_feature.hxx"
31
32
  #include "core/response_handler.hxx"
32
33
  #include "core/service_type.hxx"
34
+ #include "core/tracing/tracer_wrapper.hxx"
33
35
  #include "core/utils/movable_function.hxx"
34
36
  #include "dispatcher.hxx"
35
37
  #include "impl/bootstrap_state_listener.hxx"
@@ -42,10 +44,8 @@
42
44
  #include "retry_orchestrator.hxx"
43
45
 
44
46
  #include <couchbase/error_codes.hxx>
45
- #include <couchbase/metrics/meter.hxx>
46
47
  #include <couchbase/retry_reason.hxx>
47
48
  #include <couchbase/retry_strategy.hxx>
48
- #include <couchbase/tracing/request_tracer.hxx>
49
49
 
50
50
  #include <asio/bind_executor.hpp>
51
51
  #include <asio/error.hpp>
@@ -82,8 +82,8 @@ public:
82
82
  bucket_impl(std::string client_id,
83
83
  std::string name,
84
84
  couchbase::core::origin origin,
85
- std::shared_ptr<couchbase::tracing::request_tracer> tracer,
86
- std::shared_ptr<couchbase::metrics::meter> meter,
85
+ std::shared_ptr<tracing::tracer_wrapper> tracer,
86
+ std::shared_ptr<metrics::meter_wrapper> meter,
87
87
  std::vector<protocol::hello_feature> known_features,
88
88
  std::shared_ptr<impl::bootstrap_state_listener> state_listener,
89
89
  asio::io_context& ctx,
@@ -114,15 +114,11 @@ public:
114
114
  std::optional<key_value_error_map_info> error_info)
115
115
  {
116
116
  // TODO(SA): copy from mcbp_command, subject to refactor later
117
- static const std::string meter_name = "db.couchbase.operations";
118
- static const std::map<std::string, std::string> tags = {
119
- { "db.couchbase.service", "kv" },
120
- { "db.operation", fmt::format("{}", req->command_) },
117
+ metrics::metric_attributes attrs{
118
+ service_type::key_value, fmt::format("{}", req->command_), ec, name_, req->scope_name_,
119
+ req->collection_name_,
121
120
  };
122
- meter_->get_value_recorder(meter_name, tags)
123
- ->record_value(std::chrono::duration_cast<std::chrono::microseconds>(
124
- std::chrono::steady_clock::now() - req->dispatched_time_)
125
- .count());
121
+ meter_->record_value(std::move(attrs), req->dispatched_time_);
126
122
 
127
123
  if (ec == asio::error::operation_aborted) {
128
124
  // TODO(SA): fix tracing
@@ -894,12 +890,12 @@ public:
894
890
  return configured_;
895
891
  }
896
892
 
897
- [[nodiscard]] auto tracer() const -> std::shared_ptr<couchbase::tracing::request_tracer>
893
+ [[nodiscard]] auto tracer() const -> std::shared_ptr<tracing::tracer_wrapper>
898
894
  {
899
895
  return tracer_;
900
896
  }
901
897
 
902
- [[nodiscard]] auto meter() const -> std::shared_ptr<couchbase::metrics::meter>
898
+ [[nodiscard]] auto meter() const -> std::shared_ptr<metrics::meter_wrapper>
903
899
  {
904
900
  return meter_;
905
901
  }
@@ -952,8 +948,8 @@ private:
952
948
  const std::string name_;
953
949
  const std::string log_prefix_;
954
950
  const origin origin_;
955
- const std::shared_ptr<couchbase::tracing::request_tracer> tracer_;
956
- const std::shared_ptr<couchbase::metrics::meter> meter_;
951
+ const std::shared_ptr<tracing::tracer_wrapper> tracer_;
952
+ const std::shared_ptr<metrics::meter_wrapper> meter_;
957
953
  const std::vector<protocol::hello_feature> known_features_;
958
954
  const std::shared_ptr<impl::bootstrap_state_listener> state_listener_;
959
955
  mcbp::codec codec_;
@@ -985,8 +981,8 @@ private:
985
981
  bucket::bucket(std::string client_id,
986
982
  asio::io_context& ctx,
987
983
  asio::ssl::context& tls,
988
- std::shared_ptr<couchbase::tracing::request_tracer> tracer,
989
- std::shared_ptr<couchbase::metrics::meter> meter,
984
+ std::shared_ptr<tracing::tracer_wrapper> tracer,
985
+ std::shared_ptr<metrics::meter_wrapper> meter,
990
986
  std::string name,
991
987
  couchbase::core::origin origin,
992
988
  std::vector<protocol::hello_feature> known_features,
@@ -1054,13 +1050,13 @@ bucket::log_prefix() const -> const std::string&
1054
1050
  }
1055
1051
 
1056
1052
  auto
1057
- bucket::tracer() const -> std::shared_ptr<couchbase::tracing::request_tracer>
1053
+ bucket::tracer() const -> std::shared_ptr<tracing::tracer_wrapper>
1058
1054
  {
1059
1055
  return impl_->tracer();
1060
1056
  }
1061
1057
 
1062
1058
  auto
1063
- bucket::meter() const -> std::shared_ptr<couchbase::metrics::meter>
1059
+ bucket::meter() const -> std::shared_ptr<metrics::meter_wrapper>
1064
1060
  {
1065
1061
  return impl_->meter();
1066
1062
  }
@@ -33,14 +33,6 @@
33
33
 
34
34
  namespace couchbase
35
35
  {
36
- namespace metrics
37
- {
38
- class meter;
39
- } // namespace metrics
40
- namespace tracing
41
- {
42
- class request_tracer;
43
- } // namespace tracing
44
36
  namespace core
45
37
  {
46
38
  namespace mcbp
@@ -52,6 +44,14 @@ namespace diag
52
44
  class ping_collector;
53
45
  struct diagnostics_result;
54
46
  } // namespace diag
47
+ namespace tracing
48
+ {
49
+ class tracer_wrapper;
50
+ } // namespace tracing
51
+ namespace metrics
52
+ {
53
+ class meter_wrapper;
54
+ } // namespace metrics
55
55
  namespace impl
56
56
  {
57
57
  class bootstrap_state_listener;
@@ -68,8 +68,8 @@ public:
68
68
  bucket(std::string client_id,
69
69
  asio::io_context& ctx,
70
70
  asio::ssl::context& tls,
71
- std::shared_ptr<couchbase::tracing::request_tracer> tracer,
72
- std::shared_ptr<couchbase::metrics::meter> meter,
71
+ std::shared_ptr<tracing::tracer_wrapper> tracer,
72
+ std::shared_ptr<metrics::meter_wrapper> meter,
73
73
  std::string name,
74
74
  couchbase::core::origin origin,
75
75
  std::vector<protocol::hello_feature> known_features,
@@ -200,8 +200,8 @@ public:
200
200
 
201
201
  [[nodiscard]] auto name() const -> const std::string&;
202
202
  [[nodiscard]] auto log_prefix() const -> const std::string&;
203
- [[nodiscard]] auto tracer() const -> std::shared_ptr<couchbase::tracing::request_tracer>;
204
- [[nodiscard]] auto meter() const -> std::shared_ptr<couchbase::metrics::meter>;
203
+ [[nodiscard]] auto tracer() const -> std::shared_ptr<tracing::tracer_wrapper>;
204
+ [[nodiscard]] auto meter() const -> std::shared_ptr<metrics::meter_wrapper>;
205
205
  [[nodiscard]] auto default_retry_strategy() const -> std::shared_ptr<couchbase::retry_strategy>;
206
206
  [[nodiscard]] auto is_closed() const -> bool;
207
207
  [[nodiscard]] auto is_configured() const -> bool;
@@ -39,6 +39,7 @@
39
39
  #include "core/mcbp/queue_request.hxx"
40
40
  #include "core/meta/version.hxx"
41
41
  #include "core/metrics/logging_meter.hxx"
42
+ #include "core/metrics/meter_wrapper.hxx"
42
43
  #include "core/metrics/noop_meter.hxx"
43
44
  #include "core/operations/document_analytics.hxx"
44
45
  #include "core/operations/document_append.hxx"
@@ -145,6 +146,7 @@
145
146
  #include "core/topology/capabilities.hxx"
146
147
  #include "core/tracing/noop_tracer.hxx"
147
148
  #include "core/tracing/threshold_logging_tracer.hxx"
149
+ #include "core/tracing/tracer_wrapper.hxx"
148
150
  #include "core/utils/join_strings.hxx"
149
151
  #include "core/utils/movable_function.hxx"
150
152
  #include "crud_component.hxx"
@@ -352,30 +354,7 @@ public:
352
354
  id_,
353
355
  couchbase::core::meta::sdk_semver(),
354
356
  origin_.to_json());
355
- // ignore the enable_tracing flag if a tracer was passed in
356
- if (nullptr != origin_.options().tracer) {
357
- tracer_ = origin_.options().tracer;
358
- } else {
359
- if (origin_.options().enable_tracing) {
360
- tracer_ = std::make_shared<tracing::threshold_logging_tracer>(
361
- ctx_, origin_.options().tracing_options);
362
- } else {
363
- tracer_ = std::make_shared<tracing::noop_tracer>();
364
- }
365
- }
366
- tracer_->start();
367
- // ignore the metrics options if a meter was passed in.
368
- if (nullptr != origin_.options().meter) {
369
- meter_ = origin_.options().meter;
370
- } else {
371
- if (origin_.options().enable_metrics) {
372
- meter_ = std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options);
373
- } else {
374
- meter_ = std::make_shared<metrics::noop_meter>();
375
- }
376
- }
377
- meter_->start();
378
- session_manager_->set_tracer(tracer_);
357
+ setup_observability();
379
358
  if (origin_.options().enable_dns_srv) {
380
359
  std::string hostname;
381
360
  std::string port;
@@ -433,30 +412,7 @@ public:
433
412
  id_,
434
413
  couchbase::core::meta::sdk_semver(),
435
414
  origin_.to_json());
436
- // ignore the enable_tracing flag if a tracer was passed in
437
- if (nullptr != origin_.options().tracer) {
438
- tracer_ = origin_.options().tracer;
439
- } else {
440
- if (origin_.options().enable_tracing) {
441
- tracer_ = std::make_shared<tracing::threshold_logging_tracer>(
442
- ctx_, origin_.options().tracing_options);
443
- } else {
444
- tracer_ = std::make_shared<tracing::noop_tracer>();
445
- }
446
- }
447
- tracer_->start();
448
- // ignore the metrics options if a meter was passed in.
449
- if (nullptr != origin_.options().meter) {
450
- meter_ = origin_.options().meter;
451
- } else {
452
- if (origin_.options().enable_metrics) {
453
- meter_ = std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options);
454
- } else {
455
- meter_ = std::make_shared<metrics::noop_meter>();
456
- }
457
- }
458
- meter_->start();
459
- session_manager_->set_tracer(tracer_);
415
+ setup_observability();
460
416
  session_manager_->set_dispatch_timeout(origin_.options().dispatch_timeout);
461
417
  // at this point we will infinitely try to connect
462
418
  if (origin_.options().enable_dns_srv) {
@@ -493,6 +449,10 @@ public:
493
449
  b = std::make_shared<bucket>(
494
450
  id_, ctx_, tls_, tracer_, meter_, bucket_name, origin, known_features, dns_srv_tracker_);
495
451
  buckets_.try_emplace(bucket_name, b);
452
+
453
+ // Register the tracer & the meter for config updates to track Cluster name & UUID
454
+ b->on_configuration_update(tracer_);
455
+ b->on_configuration_update(meter_);
496
456
  }
497
457
  }
498
458
  if (b == nullptr) {
@@ -1092,7 +1052,7 @@ public:
1092
1052
  if (cluster->session_) {
1093
1053
  cluster->session_->ping(collector->build_reporter(), timeout);
1094
1054
  }
1095
- cluster->for_each_bucket([&collector, &timeout](auto bucket) {
1055
+ cluster->for_each_bucket([&collector, &timeout](const auto& bucket) {
1096
1056
  bucket->ping(collector, timeout);
1097
1057
  });
1098
1058
  }
@@ -1145,7 +1105,7 @@ public:
1145
1105
  }
1146
1106
  self->retry_backoff_.cancel();
1147
1107
  #endif
1148
- self->for_each_bucket([](auto bucket) {
1108
+ self->for_each_bucket([](const auto& bucket) {
1149
1109
  bucket->close();
1150
1110
  });
1151
1111
  self->session_manager_->close();
@@ -1221,6 +1181,38 @@ public:
1221
1181
  }
1222
1182
 
1223
1183
  private:
1184
+ void setup_observability()
1185
+ {
1186
+ // ignore the enable_tracing flag if a tracer was passed in
1187
+ if (nullptr != origin_.options().tracer) {
1188
+ tracer_ = tracing::tracer_wrapper::create(origin_.options().tracer);
1189
+ } else {
1190
+ if (origin_.options().enable_tracing) {
1191
+ tracer_ =
1192
+ tracing::tracer_wrapper::create(std::make_shared<tracing::threshold_logging_tracer>(
1193
+ ctx_, origin_.options().tracing_options));
1194
+ } else {
1195
+ tracer_ = tracing::tracer_wrapper::create(std::make_shared<tracing::noop_tracer>());
1196
+ }
1197
+ }
1198
+ tracer_->start();
1199
+ // ignore the metrics options if a meter was passed in.
1200
+ if (nullptr != origin_.options().meter) {
1201
+ meter_ = metrics::meter_wrapper::create(origin_.options().meter);
1202
+ } else {
1203
+ if (origin_.options().enable_metrics) {
1204
+ meter_ = metrics::meter_wrapper::create(
1205
+ std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options));
1206
+ } else {
1207
+ meter_ = metrics::meter_wrapper::create(std::make_shared<metrics::noop_meter>());
1208
+ }
1209
+ }
1210
+ meter_->start();
1211
+
1212
+ session_manager_->set_tracer(tracer_);
1213
+ session_manager_->set_meter(meter_);
1214
+ }
1215
+
1224
1216
  std::string id_{ uuid::to_string(uuid::random()) };
1225
1217
  asio::io_context& ctx_;
1226
1218
  asio::executor_work_guard<asio::io_context::executor_type> work_;
@@ -1231,8 +1223,8 @@ private:
1231
1223
  std::mutex buckets_mutex_{};
1232
1224
  std::map<std::string, std::shared_ptr<bucket>> buckets_{};
1233
1225
  couchbase::core::origin origin_{};
1234
- std::shared_ptr<couchbase::tracing::request_tracer> tracer_{ nullptr };
1235
- std::shared_ptr<couchbase::metrics::meter> meter_{ nullptr };
1226
+ std::shared_ptr<tracing::tracer_wrapper> tracer_{ nullptr };
1227
+ std::shared_ptr<metrics::meter_wrapper> meter_{ nullptr };
1236
1228
  std::atomic_bool stopped_{ false };
1237
1229
  #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
1238
1230
  std::shared_ptr<couchbase::core::io::cluster_config_tracker> config_tracker_{};
@@ -42,7 +42,11 @@ public:
42
42
 
43
43
  auto free_form_http_request(const http_request& request,
44
44
  free_form_http_request_callback&& callback)
45
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
46
+ -> tl::expected<std::shared_ptr<pending_operation>, error_union>
47
+ #else
45
48
  -> tl::expected<std::shared_ptr<pending_operation>, std::error_code>
49
+ #endif
46
50
  {
47
51
  return http_.do_http_request(request, std::move(callback));
48
52
  }
@@ -61,7 +65,11 @@ cluster_agent::cluster_agent(asio::io_context& io, cluster_agent_config config)
61
65
  auto
62
66
  cluster_agent::free_form_http_request(const couchbase::core::http_request& request,
63
67
  couchbase::core::free_form_http_request_callback&& callback)
68
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
69
+ -> tl::expected<std::shared_ptr<pending_operation>, error_union>
70
+ #else
64
71
  -> tl::expected<std::shared_ptr<pending_operation>, std::error_code>
72
+ #endif
65
73
  {
66
74
  return impl_->free_form_http_request(request, std::move(callback));
67
75
  }
@@ -40,7 +40,11 @@ public:
40
40
 
41
41
  auto free_form_http_request(const http_request& request,
42
42
  free_form_http_request_callback&& callback)
43
+ #ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
44
+ -> tl::expected<std::shared_ptr<pending_operation>, error_union>;
45
+ #else
43
46
  -> tl::expected<std::shared_ptr<pending_operation>, std::error_code>;
47
+ #endif
44
48
 
45
49
  private:
46
50
  std::shared_ptr<cluster_agent_impl> impl_;
@@ -430,7 +430,7 @@ collection_id_cache_entry_impl::refresh_collection_id(
430
430
  self->manager_.lock()->remove(req->scope_name_, req->collection_name_);
431
431
  auto queue = self->swap_queue();
432
432
  queue->close();
433
- return queue->drain([ec](auto r) {
433
+ return queue->drain([ec](const auto& r) {
434
434
  r->try_callback({}, ec);
435
435
  });
436
436
  }
@@ -443,7 +443,7 @@ collection_id_cache_entry_impl::refresh_collection_id(
443
443
  res.collection_id);
444
444
  auto queue = self->swap_queue();
445
445
  queue->close();
446
- return queue->drain([self](auto r) {
446
+ return queue->drain([self](const auto& r) {
447
447
  if (auto ec = self->assign_collection_id(r); ec) {
448
448
  CB_LOG_DEBUG("failed to set collection ID \"{}.{}\" on request (OP={}): {}",
449
449
  r->scope_name_,