couchbase 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/couchbase/CMakeLists.txt +10 -3
- data/ext/couchbase/cmake/CompilerWarnings.cmake +12 -4
- data/ext/couchbase/cmake/Documentation.cmake +4 -3
- data/ext/couchbase/cmake/OpenSSL.cmake +52 -7
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +4 -0
- data/ext/couchbase/cmake/VersionInfo.cmake +39 -3
- data/ext/couchbase/cmake/test_openssl.cxx +7 -0
- data/ext/couchbase/core/cluster_options.hxx +0 -1
- data/ext/couchbase/core/config_profile.cxx +23 -1
- data/ext/couchbase/core/config_profile.hxx +2 -12
- data/ext/couchbase/core/crypto/CMakeLists.txt +5 -1
- data/ext/couchbase/core/impl/analytics.cxx +236 -0
- data/ext/couchbase/core/impl/cluster.cxx +0 -1
- data/ext/couchbase/core/impl/collection_query_index_manager.cxx +3 -3
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +5 -3
- data/ext/couchbase/core/impl/get_all_query_indexes.cxx +3 -3
- data/ext/couchbase/core/impl/query.cxx +5 -5
- data/ext/couchbase/core/impl/transaction_get_result.cxx +54 -0
- data/ext/couchbase/core/io/dns_client.cxx +225 -0
- data/ext/couchbase/core/io/dns_client.hxx +19 -188
- data/ext/couchbase/core/meta/CMakeLists.txt +7 -5
- data/ext/couchbase/core/meta/version.cxx +19 -0
- data/ext/couchbase/core/operations/document_search.cxx +5 -2
- data/ext/couchbase/core/operations/document_search.hxx +0 -1
- data/ext/couchbase/core/transactions/active_transaction_record.hxx +2 -2
- data/ext/couchbase/core/transactions/atr_cleanup_entry.cxx +1 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +65 -31
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +44 -23
- data/ext/couchbase/core/transactions/forward_compat.hxx +2 -2
- data/ext/couchbase/core/transactions/internal/transaction_context.hxx +13 -13
- data/ext/couchbase/core/transactions/internal/transaction_fields.hxx +1 -0
- data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
- data/ext/couchbase/core/transactions/staged_mutation.cxx +1 -1
- data/ext/couchbase/core/transactions/staged_mutation.hxx +12 -2
- data/ext/couchbase/core/transactions/transaction_context.cxx +9 -11
- data/ext/couchbase/core/transactions/transaction_get_result.cxx +41 -31
- data/ext/couchbase/core/transactions/transaction_get_result.hxx +7 -3
- data/ext/couchbase/core/transactions/transaction_links.hxx +13 -1
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
- data/ext/couchbase/core/transactions/waitable_op_list.hxx +1 -0
- data/ext/couchbase/core/utils/connection_string.cxx +10 -3
- data/ext/couchbase/core/utils/connection_string.hxx +3 -3
- data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
- data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
- data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
- data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
- data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
- data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
- data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
- data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
- data/ext/couchbase/couchbase/cluster.hxx +35 -2
- data/ext/couchbase/couchbase/cluster_options.hxx +10 -10
- data/ext/couchbase/couchbase/collection.hxx +22 -17
- data/ext/couchbase/couchbase/collection_query_index_manager.hxx +1 -1
- data/ext/couchbase/couchbase/common_options.hxx +1 -1
- data/ext/couchbase/couchbase/configuration_profile.hxx +1 -1
- data/ext/couchbase/couchbase/configuration_profiles_registry.hxx +0 -1
- data/ext/couchbase/couchbase/create_primary_query_index_options.hxx +1 -1
- data/ext/couchbase/couchbase/drop_primary_query_index_options.hxx +1 -1
- data/ext/couchbase/couchbase/drop_query_index_options.hxx +1 -1
- data/ext/couchbase/couchbase/fmt/analytics_status.hxx +76 -0
- data/ext/couchbase/couchbase/fmt/cas.hxx +12 -0
- data/ext/couchbase/couchbase/fmt/durability_level.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/key_value_extended_error_info.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/key_value_status_code.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/mutation_token.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/query_scan_consistency.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/query_status.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/retry_reason.hxx +6 -0
- data/ext/couchbase/couchbase/fmt/tls_verify_mode.hxx +6 -0
- data/ext/couchbase/couchbase/get_all_query_indexes_options.hxx +5 -4
- data/ext/couchbase/couchbase/query_index_manager.hxx +4 -2
- data/ext/couchbase/couchbase/query_options.hxx +0 -1
- data/ext/couchbase/couchbase/scope.hxx +34 -1
- data/ext/couchbase/couchbase/subdoc/array_add_unique.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/array_append.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/array_insert.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/array_prepend.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/count.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/counter.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/exists.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/get.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/insert.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/remove.hxx +2 -0
- data/ext/couchbase/couchbase/subdoc/replace.hxx +3 -1
- data/ext/couchbase/couchbase/subdoc/upsert.hxx +2 -0
- data/ext/couchbase/couchbase/transaction_op_error_context.hxx +4 -4
- data/ext/couchbase/couchbase/transactions/attempt_context.hxx +1 -1
- data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +36 -51
- data/ext/couchbase/couchbase/transactions/transactions_config.hxx +1 -1
- data/ext/couchbase/test/CMakeLists.txt +3 -2
- data/ext/couchbase/test/test_helper.hxx +1 -1
- data/ext/couchbase/test/test_integration_analytics.cxx +289 -13
- data/ext/couchbase/test/test_integration_crud.cxx +8 -1
- data/ext/couchbase/test/test_integration_examples.cxx +182 -0
- data/ext/couchbase/test/test_integration_management.cxx +15 -3
- data/ext/couchbase/test/test_integration_search.cxx +601 -0
- data/ext/couchbase/test/test_transaction_transaction_simple.cxx +73 -0
- data/ext/couchbase/test/test_unit_config_profiles.cxx +12 -12
- data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
- data/ext/couchbase/test/test_unit_transaction_utils.cxx +76 -19
- data/ext/couchbase/third_party/snappy/CMakeLists.txt +150 -27
- data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
- data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
- data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
- data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
- data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
- data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
- data/ext/couchbase/third_party/snappy/snappy.h +19 -4
- data/ext/couchbase.cxx +506 -26
- data/ext/extconf.rb +2 -1
- data/ext/revisions.rb +3 -2
- data/lib/couchbase/binary_collection.rb +4 -4
- data/lib/couchbase/cluster.rb +13 -9
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/collection.rb +5 -0
- data/lib/couchbase/configuration.rb +3 -4
- data/lib/couchbase/errors.rb +10 -0
- data/lib/couchbase/management/collection_query_index_manager.rb +183 -0
- data/lib/couchbase/management/query_index_manager.rb +35 -3
- data/lib/couchbase/management.rb +1 -0
- data/lib/couchbase/options.rb +87 -5
- data/lib/couchbase/search_options.rb +158 -240
- data/lib/couchbase/version.rb +1 -1
- metadata +21 -6
- data/ext/couchbase/core/CMakeLists.txt +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78899f9fd7614787a46a54ca185e869cc93a7714ff0a1ef4c38feef98d7d54be
|
|
4
|
+
data.tar.gz: f42e90dc0e70b2f690f9c4f7dffe3cd9675db7d8f9025bb5db315b6e59407199
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 804b0a4c05754a5349b19f4b06ee1017f62790e2f5f50696639d9cfc1b785d4f43d688cb05c325f5e10cb1e36fca1e4775c93f91cbf10ad600a5f4755a091a28
|
|
7
|
+
data.tar.gz: cbb64fe3e1c2f5925584032cd69bb626e87c9ff61c7735a570a7e291287874076e366e2282e15d432c18832b9853c749d806cab28aa65716dc91ab835910bd6b
|
data/README.md
CHANGED
|
@@ -23,7 +23,7 @@ The library has been tested with MRI 3.0, 3.1 and 3.2. Supported platforms are L
|
|
|
23
23
|
Add this line to your application's Gemfile:
|
|
24
24
|
|
|
25
25
|
```ruby
|
|
26
|
-
gem "couchbase", "3.4.
|
|
26
|
+
gem "couchbase", "3.4.2"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
And then execute:
|
|
@@ -139,7 +139,7 @@ Now the API reference is accessible using a web browser (where `VERSION` is the
|
|
|
139
139
|
|
|
140
140
|
The gem is available as open source under the terms of the [Apache2 License](https://opensource.org/licenses/Apache-2.0).
|
|
141
141
|
|
|
142
|
-
Copyright 2011-
|
|
142
|
+
Copyright 2011-Present Couchbase, Inc.
|
|
143
143
|
|
|
144
144
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
145
145
|
you may not use this file except in compliance with the License.
|
|
@@ -255,6 +255,7 @@ set(couchbase_cxx_client_FILES
|
|
|
255
255
|
core/utils/mutation_token.cxx
|
|
256
256
|
core/utils/split_string.cxx
|
|
257
257
|
core/utils/url_codec.cxx
|
|
258
|
+
core/impl/analytics.cxx
|
|
258
259
|
core/impl/analytics_error_category.cxx
|
|
259
260
|
core/impl/append.cxx
|
|
260
261
|
core/impl/best_effort_retry_strategy.cxx
|
|
@@ -296,8 +297,6 @@ set(couchbase_cxx_client_FILES
|
|
|
296
297
|
core/impl/retry_reason.cxx
|
|
297
298
|
core/impl/search_error_category.cxx
|
|
298
299
|
core/impl/streaming_json_lexter_error_category.cxx
|
|
299
|
-
core/impl/unlock.cxx
|
|
300
|
-
core/impl/watch_query_indexes.cxx
|
|
301
300
|
core/impl/subdoc/array_add_unique.cxx
|
|
302
301
|
core/impl/subdoc/array_append.cxx
|
|
303
302
|
core/impl/subdoc/array_insert.cxx
|
|
@@ -317,9 +316,13 @@ set(couchbase_cxx_client_FILES
|
|
|
317
316
|
core/impl/subdoc/upsert.cxx
|
|
318
317
|
core/impl/touch.cxx
|
|
319
318
|
core/impl/transaction_error_category.cxx
|
|
319
|
+
core/impl/transaction_get_result.cxx
|
|
320
320
|
core/impl/transaction_op_error_category.cxx
|
|
321
|
+
core/impl/unlock.cxx
|
|
321
322
|
core/impl/upsert.cxx
|
|
322
323
|
core/impl/view_error_category.cxx
|
|
324
|
+
core/impl/watch_query_indexes.cxx
|
|
325
|
+
core/io/dns_client.cxx
|
|
323
326
|
core/io/dns_config.cxx
|
|
324
327
|
core/io/http_parser.cxx
|
|
325
328
|
core/io/mcbp_message.cxx
|
|
@@ -398,7 +401,11 @@ if (WIN32)
|
|
|
398
401
|
endif ()
|
|
399
402
|
|
|
400
403
|
if (NOT COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL)
|
|
401
|
-
|
|
404
|
+
if (TARGET PkgConfig::PKG_CONFIG_OPENSSL)
|
|
405
|
+
target_link_libraries(couchbase_cxx_client PUBLIC PkgConfig::PKG_CONFIG_OPENSSL)
|
|
406
|
+
else()
|
|
407
|
+
target_link_libraries(couchbase_cxx_client PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
|
408
|
+
endif()
|
|
402
409
|
endif ()
|
|
403
410
|
|
|
404
411
|
option(COUCHBASE_CXX_CLIENT_BUILD_TESTS "Build test programs" TRUE)
|
|
@@ -67,8 +67,8 @@ 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
|
-
set(CLANG_WARNINGS ${COMMON_WARNINGS}
|
|
71
|
-
|
|
70
|
+
set(CLANG_WARNINGS ${COMMON_WARNINGS} -Wshadow # warn the user if a variable declaration shadows one from a parent
|
|
71
|
+
# context
|
|
72
72
|
)
|
|
73
73
|
|
|
74
74
|
if(MSVC)
|
|
@@ -76,9 +76,17 @@ function(set_project_warnings project_name)
|
|
|
76
76
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
|
77
77
|
set(PROJECT_WARNINGS ${CLANG_WARNINGS})
|
|
78
78
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
79
|
-
if
|
|
79
|
+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0"
|
|
80
|
+
AND NOT
|
|
81
|
+
CMAKE_BUILD_TYPE
|
|
82
|
+
STREQUAL
|
|
83
|
+
"Debug")
|
|
80
84
|
# One of the occurrences: https://github.com/chriskohlhoff/asio/pull/1176
|
|
81
|
-
set(GCC_WARNINGS
|
|
85
|
+
set(GCC_WARNINGS
|
|
86
|
+
${GCC_WARNINGS}
|
|
87
|
+
-Wno-error=null-dereference
|
|
88
|
+
-Wno-error=array-bounds
|
|
89
|
+
-Wno-error=stringop-overflow)
|
|
82
90
|
endif()
|
|
83
91
|
set(PROJECT_WARNINGS ${GCC_WARNINGS})
|
|
84
92
|
else()
|
|
@@ -11,11 +11,12 @@ if(DOXYGEN_FOUND AND DOT)
|
|
|
11
11
|
file(
|
|
12
12
|
GLOB_RECURSE
|
|
13
13
|
COUCHBASE_CXX_CLIENT_PUBLIC_HEADERS
|
|
14
|
-
${PROJECT_SOURCE_DIR}/couchbase
|
|
15
|
-
${PROJECT_SOURCE_DIR}/docs/*.hxx
|
|
14
|
+
${PROJECT_SOURCE_DIR}/couchbase/**/*.hxx
|
|
15
|
+
${PROJECT_SOURCE_DIR}/docs/*.hxx
|
|
16
|
+
${PROJECT_SOURCE_DIR}/docs/*.md)
|
|
16
17
|
|
|
17
18
|
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/couchbase)
|
|
18
|
-
set(DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/couchbase-cxx-client-${
|
|
19
|
+
set(DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/couchbase-cxx-client-${COUCHBASE_CXX_CLIENT_SEMVER})
|
|
19
20
|
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html)
|
|
20
21
|
set(DOXYGEN_CONFIG_TEMPLATE ${PROJECT_SOURCE_DIR}/docs/Doxyfile.in)
|
|
21
22
|
set(DOXYGEN_CONFIG ${PROJECT_BINARY_DIR}/Doxyfile)
|
|
@@ -14,11 +14,21 @@ else()
|
|
|
14
14
|
if(NOT OPENSSL_ROOT_DIR)
|
|
15
15
|
if(APPLE AND COUCHBASE_CXX_CLIENT_USE_HOMEBREW_TO_DETECT_OPENSSL)
|
|
16
16
|
execute_process(
|
|
17
|
-
COMMAND brew --prefix openssl
|
|
17
|
+
COMMAND brew --prefix openssl
|
|
18
18
|
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
|
19
|
+
ERROR_VARIABLE HOMEBREW_STDERR
|
|
19
20
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
20
21
|
if(OPENSSL_ROOT_DIR)
|
|
21
|
-
message(STATUS "Found OpenSSL prefix using
|
|
22
|
+
message(STATUS "Found OpenSSL prefix using Homebrew: ${OPENSSL_ROOT_DIR}")
|
|
23
|
+
else()
|
|
24
|
+
execute_process(
|
|
25
|
+
COMMAND brew --prefix openssl@1.1
|
|
26
|
+
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
|
27
|
+
ERROR_VARIABLE HOMEBREW_STDERR
|
|
28
|
+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
29
|
+
if(OPENSSL_ROOT_DIR)
|
|
30
|
+
message(STATUS "Found OpenSSL 1.1 prefix using Homebrew: ${OPENSSL_ROOT_DIR}")
|
|
31
|
+
endif()
|
|
22
32
|
endif()
|
|
23
33
|
endif()
|
|
24
34
|
if(MSVC AND COUCHBASE_CXX_CLIENT_USE_SCOOP_TO_DETECT_OPENSSL)
|
|
@@ -32,11 +42,46 @@ else()
|
|
|
32
42
|
endif()
|
|
33
43
|
endif()
|
|
34
44
|
endif()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
|
|
46
|
+
find_package(OpenSSL 1.1)
|
|
47
|
+
if(OpenSSL_FOUND)
|
|
48
|
+
try_compile(
|
|
49
|
+
OPENSSL_USABLE ${CMAKE_CURRENT_BINARY_DIR}
|
|
50
|
+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_openssl.cxx
|
|
51
|
+
LINK_LIBRARIES OpenSSL::SSL CXX_STANDARD 17)
|
|
52
|
+
if( OPENSSL_USABLE)
|
|
53
|
+
message(STATUS "OPENSSL_VERSION: ${OPENSSL_VERSION}")
|
|
54
|
+
message(STATUS "OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
|
|
55
|
+
message(STATUS "OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}")
|
|
56
|
+
else()
|
|
57
|
+
if(UNIX)
|
|
58
|
+
message(
|
|
59
|
+
STATUS
|
|
60
|
+
"Cannot use OpenSSL ${OPENSSL_VERSION} at \"${OPENSSL_INCLUDE_DIR}\" and \"${OPENSSL_LIBRARIES}\". Will try to use from pkg-config."
|
|
61
|
+
)
|
|
62
|
+
find_package(PkgConfig REQUIRED)
|
|
63
|
+
pkg_check_modules(PKG_CONFIG_OPENSSL REQUIRED IMPORTED_TARGET GLOBAL openssl11)
|
|
64
|
+
if(PKG_CONFIG_OPENSSL_FOUND)
|
|
65
|
+
message(STATUS "PKG_CONFIG_OPENSSL_VERSION: ${PKG_CONFIG_OPENSSL_VERSION}")
|
|
66
|
+
message(STATUS "PKG_CONFIG_OPENSSL_INCLUDE_DIRS: ${PKG_CONFIG_OPENSSL_INCLUDE_DIRS}")
|
|
67
|
+
message(STATUS "PKG_CONFIG_OPENSSL_LIBRARIES: ${PKG_CONFIG_OPENSSL_LIBRARIES}")
|
|
68
|
+
else()
|
|
69
|
+
message(FATAL_ERROR "Cannot Find OpenSSL using pkg-config, find_package() returns unusable setup")
|
|
70
|
+
endif()
|
|
71
|
+
else()
|
|
72
|
+
message(FATAL_ERROR "OpenSSL discovered by find_package() returns unusable setup")
|
|
73
|
+
endif()
|
|
74
|
+
endif()
|
|
75
|
+
elseif(UNIX)
|
|
76
|
+
find_package(PkgConfig REQUIRED)
|
|
77
|
+
pkg_check_modules(PKG_CONFIG_OPENSSL REQUIRED IMPORTED_TARGET GLOBAL openssl11)
|
|
78
|
+
if(PKG_CONFIG_OPENSSL_FOUND)
|
|
79
|
+
message(STATUS "PKG_CONFIG_OPENSSL_VERSION: ${PKG_CONFIG_OPENSSL_VERSION}")
|
|
80
|
+
message(STATUS "PKG_CONFIG_OPENSSL_INCLUDE_DIRS: ${PKG_CONFIG_OPENSSL_INCLUDE_DIRS}")
|
|
81
|
+
message(STATUS "PKG_CONFIG_OPENSSL_LIBRARIES: ${PKG_CONFIG_OPENSSL_LIBRARIES}")
|
|
82
|
+
else()
|
|
83
|
+
message(FATAL_ERROR "Cannot Find OpenSSL using pkg-config")
|
|
84
|
+
endif()
|
|
40
85
|
else()
|
|
41
86
|
message(FATAL_ERROR "Cannot build Couchbase C++ SDK without OpenSSL")
|
|
42
87
|
endif()
|
|
@@ -18,6 +18,10 @@ set(PEGTL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
18
18
|
set(PEGTL_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
19
19
|
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/snappy)
|
|
20
20
|
set_target_properties(snappy PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
21
|
+
if(NOT MSVC)
|
|
22
|
+
# https://github.com/google/snappy/pull/156
|
|
23
|
+
target_compile_options(snappy PRIVATE -Wno-sign-compare)
|
|
24
|
+
endif()
|
|
21
25
|
|
|
22
26
|
set(HDR_LOG_REQUIRED OFF CACHE BOOL "" FORCE)
|
|
23
27
|
set(HDR_HISTOGRAM_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
|
@@ -25,6 +25,37 @@ if(NOT COUCHBASE_CXX_CLIENT_GIT_DESCRIBE)
|
|
|
25
25
|
endif()
|
|
26
26
|
|
|
27
27
|
string(TIMESTAMP COUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP "%Y-%m-%d %H:%M:%S" UTC)
|
|
28
|
+
string(TIMESTAMP COUCHBASE_CXX_CLIENT_BUILD_DATE "%Y-%m-%d" UTC)
|
|
29
|
+
|
|
30
|
+
# set(couchbase_cxx_client_BUILD_NUMBER 142)
|
|
31
|
+
# set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "1.0.0-beta.4-27-g6807da0") #-> "couchbase_cxx_client-1.0.0-beta.4+142.27.6807da0"
|
|
32
|
+
# set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "1.0.0-beta.4-0-g6807da0") #-> "couchbase_cxx_client-1.0.0-beta.4"
|
|
33
|
+
# set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "1.0.0-27-g6807da0") #-> "couchbase_cxx_client-1.0.0+142.27.6807da0"
|
|
34
|
+
# set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "1.0.0-0-g6807da0") #-> "couchbase_cxx_client-1.0.0"
|
|
35
|
+
# set(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE "1.0.0") #-> "couchbase_cxx_client-1.0.0"
|
|
36
|
+
set(COUCHBASE_CXX_CLIENT_SEMVER "${couchbase_cxx_client_VERSION}")
|
|
37
|
+
set(COUCHBASE_CXX_CLIENT_PACKAGE_VERSION "${couchbase_cxx_client_VERSION}")
|
|
38
|
+
set(COUCHBASE_CXX_CLIENT_PACKAGE_RELEASE "${couchbase_cxx_client_BUILD_NUMBER}")
|
|
39
|
+
if(COUCHBASE_CXX_CLIENT_GIT_DESCRIBE MATCHES
|
|
40
|
+
"^([0-9]+\\.[0-9]+\\.[0-9]+)(-([a-zA-Z0-9\\.]+))?(-([0-9]+)-g([a-zA-Z0-9]+))?$")
|
|
41
|
+
set(COUCHBASE_CXX_CLIENT_SEMVER "${CMAKE_MATCH_1}")
|
|
42
|
+
set(COUCHBASE_CXX_CLIENT_PACKAGE_VERSION "${CMAKE_MATCH_1}")
|
|
43
|
+
if(CMAKE_MATCH_3) # pre-release
|
|
44
|
+
set(COUCHBASE_CXX_CLIENT_SEMVER "${COUCHBASE_CXX_CLIENT_SEMVER}-${CMAKE_MATCH_3}")
|
|
45
|
+
set(COUCHBASE_CXX_CLIENT_PACKAGE_RELEASE "${CMAKE_MATCH_3}.${couchbase_cxx_client_BUILD_NUMBER}")
|
|
46
|
+
endif()
|
|
47
|
+
if(CMAKE_MATCH_5 AND CMAKE_MATCH_5 GREATER 0) # number_of_commits.build_number.sha1
|
|
48
|
+
set(COUCHBASE_CXX_CLIENT_SEMVER
|
|
49
|
+
"${COUCHBASE_CXX_CLIENT_SEMVER}+${CMAKE_MATCH_5}.${couchbase_cxx_client_BUILD_NUMBER}.${CMAKE_MATCH_6}")
|
|
50
|
+
if(CMAKE_MATCH_3) # pre-release
|
|
51
|
+
set(COUCHBASE_CXX_CLIENT_PACKAGE_RELEASE
|
|
52
|
+
"${CMAKE_MATCH_3}.${CMAKE_MATCH_5}.${couchbase_cxx_client_BUILD_NUMBER}.${CMAKE_MATCH_6}")
|
|
53
|
+
else()
|
|
54
|
+
set(COUCHBASE_CXX_CLIENT_PACKAGE_RELEASE "${CMAKE_MATCH_5}.${couchbase_cxx_client_BUILD_NUMBER}.${CMAKE_MATCH_6}")
|
|
55
|
+
endif()
|
|
56
|
+
endif()
|
|
57
|
+
endif()
|
|
58
|
+
|
|
28
59
|
configure_file(${PROJECT_SOURCE_DIR}/cmake/build_version.hxx.in
|
|
29
60
|
${PROJECT_BINARY_DIR}/generated/couchbase/build_version.hxx @ONLY)
|
|
30
61
|
configure_file(${PROJECT_SOURCE_DIR}/cmake/build_config.hxx.in
|
|
@@ -47,9 +78,14 @@ file(
|
|
|
47
78
|
#define COUCHBASE_CXX_CLIENT_LINK_OPTIONS \"$<TARGET_PROPERTY:couchbase_cxx_client,LINK_OPTIONS>\"
|
|
48
79
|
#define COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL \"${COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL}\"
|
|
49
80
|
|
|
50
|
-
#define
|
|
51
|
-
#define
|
|
52
|
-
#define
|
|
81
|
+
#define OPENSSL_SSL_IMPORTED_LOCATION \"$<$<TARGET_EXISTS:OpenSSL::SSL>:$<TARGET_PROPERTY:OpenSSL::SSL,IMPORTED_LOCATION>>\"
|
|
82
|
+
#define OPENSSL_SSL_INTERFACE_INCLUDE_DIRECTORIES \"$<$<TARGET_EXISTS:OpenSSL::SSL>:$<TARGET_PROPERTY:OpenSSL::SSL,INTERFACE_INCLUDE_DIRECTORIES>>\"
|
|
83
|
+
#define OPENSSL_SSL_INTERFACE_LINK_LIBRARIES \"$<$<TARGET_EXISTS:OpenSSL::SSL>:$<TARGET_PROPERTY:OpenSSL::SSL,INTERFACE_LINK_LIBRARIES>>\"
|
|
84
|
+
#define OPENSSL_CRYPTO_IMPORTED_LOCATION \"$<$<TARGET_EXISTS:OpenSSL::Crypto>:$<TARGET_PROPERTY:OpenSSL::Crypto,IMPORTED_LOCATION>>\"
|
|
85
|
+
#define OPENSSL_CRYPTO_INTERFACE_INCLUDE_DIRECTORIES \"$<$<TARGET_EXISTS:OpenSSL::Crypto>:$<TARGET_PROPERTY:OpenSSL::Crypto,INTERFACE_INCLUDE_DIRECTORIES>>\"
|
|
86
|
+
#define OPENSSL_CRYPTO_INTERFACE_LINK_LIBRARIES \"$<$<TARGET_EXISTS:OpenSSL::Crypto>:$<TARGET_PROPERTY:OpenSSL::Crypto,INTERFACE_LINK_LIBRARIES>>\"
|
|
87
|
+
#define OPENSSL_PKG_CONFIG_INTERFACE_INCLUDE_DIRECTORIES \"$<$<TARGET_EXISTS:PkgConfig::PKG_CONFIG_OPENSSL>:$<TARGET_PROPERTY:PkgConfig::PKG_CONFIG_OPENSSL,INTERFACE_INCLUDE_DIRECTORIES>>\"
|
|
88
|
+
#define OPENSSL_PKG_CONFIG_INTERFACE_LINK_LIBRARIES \"$<$<TARGET_EXISTS:PkgConfig::PKG_CONFIG_OPENSSL>:$<TARGET_PROPERTY:PkgConfig::PKG_CONFIG_OPENSSL,INTERFACE_LINK_LIBRARIES>>\"
|
|
53
89
|
|
|
54
90
|
#define CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\"
|
|
55
91
|
#define CMAKE_VERSION \"${CMAKE_VERSION}\"
|
|
@@ -53,7 +53,6 @@ struct cluster_options {
|
|
|
53
53
|
std::chrono::milliseconds analytics_timeout = timeout_defaults::analytics_timeout;
|
|
54
54
|
std::chrono::milliseconds search_timeout = timeout_defaults::search_timeout;
|
|
55
55
|
std::chrono::milliseconds management_timeout = timeout_defaults::management_timeout;
|
|
56
|
-
std::chrono::milliseconds dns_srv_timeout = timeout_defaults::dns_srv_timeout;
|
|
57
56
|
|
|
58
57
|
bool enable_tls{ false };
|
|
59
58
|
std::string trust_certificate{};
|
|
@@ -22,4 +22,26 @@ couchbase::core::known_profiles()
|
|
|
22
22
|
{
|
|
23
23
|
static couchbase::core::config_profiles profiles{};
|
|
24
24
|
return profiles;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void
|
|
28
|
+
couchbase::core::development_profile::apply(couchbase::core::cluster_options& opts)
|
|
29
|
+
{
|
|
30
|
+
opts.key_value_timeout = std::chrono::seconds(20);
|
|
31
|
+
opts.key_value_durable_timeout = std::chrono::seconds(20);
|
|
32
|
+
opts.connect_timeout = std::chrono::seconds(20);
|
|
33
|
+
opts.view_timeout = std::chrono::minutes(2);
|
|
34
|
+
opts.query_timeout = std::chrono::minutes(2);
|
|
35
|
+
opts.analytics_timeout = std::chrono::minutes(2);
|
|
36
|
+
opts.search_timeout = std::chrono::minutes(2);
|
|
37
|
+
opts.management_timeout = std::chrono::minutes(2);
|
|
38
|
+
|
|
39
|
+
// C++SDK specific
|
|
40
|
+
opts.dns_config = couchbase::core::io::dns::dns_config{
|
|
41
|
+
opts.dns_config.nameserver(),
|
|
42
|
+
opts.dns_config.port(),
|
|
43
|
+
std::chrono::seconds(20), // timeout to make DNS-SRV query
|
|
44
|
+
};
|
|
45
|
+
opts.resolve_timeout = std::chrono::seconds(20); // timeout to resolve hostnames
|
|
46
|
+
opts.bootstrap_timeout = std::chrono::minutes(2); // overall timeout to bootstrap
|
|
47
|
+
}
|
|
@@ -36,17 +36,7 @@ class config_profile
|
|
|
36
36
|
class development_profile : public config_profile
|
|
37
37
|
{
|
|
38
38
|
public:
|
|
39
|
-
void apply(couchbase::core::cluster_options& opts) override
|
|
40
|
-
{
|
|
41
|
-
opts.key_value_timeout = std::chrono::milliseconds(20000); // 20 sec kv timeout.
|
|
42
|
-
opts.key_value_durable_timeout = std::chrono::milliseconds(20000); // 20 sec durable kv timeout.
|
|
43
|
-
opts.connect_timeout = std::chrono::milliseconds(20000); // 20 sec connect timeout.
|
|
44
|
-
opts.view_timeout = std::chrono::milliseconds(120000); // 2 minute view timeout
|
|
45
|
-
opts.query_timeout = std::chrono::milliseconds(120000); // 2 minute query timeout
|
|
46
|
-
opts.analytics_timeout = std::chrono::milliseconds(120000); // 2 minute analytics timeout
|
|
47
|
-
opts.search_timeout = std::chrono::milliseconds(120000); // 2 minute search timeout
|
|
48
|
-
opts.management_timeout = std::chrono::milliseconds(120000); // 2 minute management timeout
|
|
49
|
-
}
|
|
39
|
+
void apply(couchbase::core::cluster_options& opts) override;
|
|
50
40
|
};
|
|
51
41
|
|
|
52
42
|
// this class just registers the known profiles defined above, and allows access to them.
|
|
@@ -89,4 +79,4 @@ class config_profiles
|
|
|
89
79
|
config_profiles&
|
|
90
80
|
known_profiles();
|
|
91
81
|
|
|
92
|
-
} // namespace couchbase::core
|
|
82
|
+
} // namespace couchbase::core
|
|
@@ -4,7 +4,11 @@ target_link_libraries(couchbase_crypto PRIVATE project_options project_warnings)
|
|
|
4
4
|
target_include_directories(couchbase_crypto PRIVATE ../..)
|
|
5
5
|
|
|
6
6
|
if(NOT COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL)
|
|
7
|
-
|
|
7
|
+
if (TARGET PkgConfig::PKG_CONFIG_OPENSSL)
|
|
8
|
+
target_link_libraries(couchbase_crypto PUBLIC PkgConfig::PKG_CONFIG_OPENSSL)
|
|
9
|
+
else()
|
|
10
|
+
target_link_libraries(couchbase_crypto PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
|
11
|
+
endif()
|
|
8
12
|
endif()
|
|
9
13
|
|
|
10
14
|
if(WIN32)
|
|
@@ -0,0 +1,236 @@
|
|
|
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/cluster.hxx>
|
|
19
|
+
#include <couchbase/error_codes.hxx>
|
|
20
|
+
|
|
21
|
+
#include "core/cluster.hxx"
|
|
22
|
+
#include "core/operations/document_analytics.hxx"
|
|
23
|
+
|
|
24
|
+
namespace couchbase
|
|
25
|
+
{
|
|
26
|
+
static analytics_error_context
|
|
27
|
+
build_context(core::operations::analytics_response& resp)
|
|
28
|
+
{
|
|
29
|
+
return {
|
|
30
|
+
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
|
+
resp.ctx.first_error_code,
|
|
36
|
+
std::move(resp.ctx.first_error_message),
|
|
37
|
+
std::move(resp.ctx.client_context_id),
|
|
38
|
+
std::move(resp.ctx.statement),
|
|
39
|
+
std::move(resp.ctx.parameters),
|
|
40
|
+
std::move(resp.ctx.method),
|
|
41
|
+
std::move(resp.ctx.path),
|
|
42
|
+
resp.ctx.http_status,
|
|
43
|
+
std::move(resp.ctx.http_body),
|
|
44
|
+
std::move(resp.ctx.hostname),
|
|
45
|
+
resp.ctx.port,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static analytics_status
|
|
50
|
+
map_status(core::operations::analytics_response::analytics_status status)
|
|
51
|
+
{
|
|
52
|
+
switch (status) {
|
|
53
|
+
case core::operations::analytics_response::running:
|
|
54
|
+
return analytics_status::running;
|
|
55
|
+
case core::operations::analytics_response::success:
|
|
56
|
+
return analytics_status::success;
|
|
57
|
+
case core::operations::analytics_response::errors:
|
|
58
|
+
return analytics_status::errors;
|
|
59
|
+
case core::operations::analytics_response::completed:
|
|
60
|
+
return analytics_status::completed;
|
|
61
|
+
case core::operations::analytics_response::stopped:
|
|
62
|
+
return analytics_status::stopped;
|
|
63
|
+
case core::operations::analytics_response::timedout:
|
|
64
|
+
return analytics_status::timeout;
|
|
65
|
+
case core::operations::analytics_response::closed:
|
|
66
|
+
return analytics_status::closed;
|
|
67
|
+
case core::operations::analytics_response::fatal:
|
|
68
|
+
return analytics_status::fatal;
|
|
69
|
+
case core::operations::analytics_response::aborted:
|
|
70
|
+
return analytics_status::aborted;
|
|
71
|
+
case core::operations::analytics_response::unknown:
|
|
72
|
+
return analytics_status::unknown;
|
|
73
|
+
}
|
|
74
|
+
return analytics_status::unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static std::optional<couchbase::core::analytics_scan_consistency>
|
|
78
|
+
map_scan_consistency(std::optional<couchbase::analytics_scan_consistency> consistency)
|
|
79
|
+
{
|
|
80
|
+
if (consistency.has_value()) {
|
|
81
|
+
switch (consistency.value()) {
|
|
82
|
+
case analytics_scan_consistency::not_bounded:
|
|
83
|
+
return couchbase::core::analytics_scan_consistency::not_bounded;
|
|
84
|
+
case analytics_scan_consistency::request_plus:
|
|
85
|
+
return couchbase::core::analytics_scan_consistency::request_plus;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static std::vector<codec::binary>
|
|
92
|
+
map_rows(const core::operations::analytics_response& resp)
|
|
93
|
+
{
|
|
94
|
+
std::vector<codec::binary> rows;
|
|
95
|
+
rows.reserve(resp.rows.size());
|
|
96
|
+
for (const auto& row : resp.rows) {
|
|
97
|
+
rows.emplace_back(core::utils::to_binary(row));
|
|
98
|
+
}
|
|
99
|
+
return rows;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static std::vector<analytics_warning>
|
|
103
|
+
map_warnings(core::operations::analytics_response& resp)
|
|
104
|
+
{
|
|
105
|
+
if (resp.meta.warnings.empty()) {
|
|
106
|
+
return {};
|
|
107
|
+
}
|
|
108
|
+
std::vector<analytics_warning> warnings;
|
|
109
|
+
warnings.reserve(resp.meta.warnings.size());
|
|
110
|
+
for (auto& warning : resp.meta.warnings) {
|
|
111
|
+
warnings.emplace_back(warning.code, std::move(warning.message));
|
|
112
|
+
}
|
|
113
|
+
return warnings;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static analytics_metrics
|
|
117
|
+
map_metrics(const core::operations::analytics_response& resp)
|
|
118
|
+
{
|
|
119
|
+
return analytics_metrics{
|
|
120
|
+
resp.meta.metrics.elapsed_time, resp.meta.metrics.execution_time, resp.meta.metrics.result_count,
|
|
121
|
+
resp.meta.metrics.result_size, resp.meta.metrics.processed_objects, resp.meta.metrics.error_count,
|
|
122
|
+
resp.meta.metrics.warning_count,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static std::optional<std::vector<std::byte>>
|
|
127
|
+
map_signature(core::operations::analytics_response& resp)
|
|
128
|
+
{
|
|
129
|
+
if (!resp.meta.signature) {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
return core::utils::to_binary(resp.meta.signature.value());
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static analytics_result
|
|
136
|
+
build_result(core::operations::analytics_response& resp)
|
|
137
|
+
{
|
|
138
|
+
return {
|
|
139
|
+
analytics_meta_data{
|
|
140
|
+
std::move(resp.meta.request_id),
|
|
141
|
+
std::move(resp.meta.client_context_id),
|
|
142
|
+
map_status(resp.meta.status),
|
|
143
|
+
map_warnings(resp),
|
|
144
|
+
map_metrics(resp),
|
|
145
|
+
map_signature(resp),
|
|
146
|
+
},
|
|
147
|
+
map_rows(resp),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static core::operations::analytics_request
|
|
152
|
+
build_analytics_request(std::string statement,
|
|
153
|
+
analytics_options::built options,
|
|
154
|
+
std::optional<std::string> bucket_name,
|
|
155
|
+
std::optional<std::string> scope_name)
|
|
156
|
+
{
|
|
157
|
+
core::operations::analytics_request request{
|
|
158
|
+
std::move(statement),
|
|
159
|
+
options.readonly,
|
|
160
|
+
options.priority,
|
|
161
|
+
std::move(bucket_name),
|
|
162
|
+
std::move(scope_name),
|
|
163
|
+
{},
|
|
164
|
+
map_scan_consistency(options.scan_consistency),
|
|
165
|
+
{},
|
|
166
|
+
{},
|
|
167
|
+
{},
|
|
168
|
+
{},
|
|
169
|
+
std::move(options.client_context_id),
|
|
170
|
+
options.timeout,
|
|
171
|
+
};
|
|
172
|
+
if (!options.raw.empty()) {
|
|
173
|
+
for (auto& [name, value] : options.raw) {
|
|
174
|
+
request.raw[name] = std::move(value);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (!options.positional_parameters.empty()) {
|
|
178
|
+
for (auto& value : options.positional_parameters) {
|
|
179
|
+
request.positional_parameters.emplace_back(std::move(value));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!options.named_parameters.empty()) {
|
|
183
|
+
for (auto& [name, value] : options.named_parameters) {
|
|
184
|
+
request.named_parameters[name] = std::move(value);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return request;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
void
|
|
191
|
+
cluster::analytics_query(std::string statement, const analytics_options& options, analytics_handler&& handler) const
|
|
192
|
+
{
|
|
193
|
+
auto request = build_analytics_request(std::move(statement), options.build(), {}, {});
|
|
194
|
+
|
|
195
|
+
core_->execute(std::move(request), [handler = std::move(handler)](core::operations::analytics_response resp) mutable {
|
|
196
|
+
auto r = std::move(resp);
|
|
197
|
+
return handler(build_context(r), build_result(r));
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
auto
|
|
202
|
+
cluster::analytics_query(std::string statement, const analytics_options& options) const
|
|
203
|
+
-> std::future<std::pair<analytics_error_context, analytics_result>>
|
|
204
|
+
{
|
|
205
|
+
auto barrier = std::make_shared<std::promise<std::pair<analytics_error_context, analytics_result>>>();
|
|
206
|
+
auto future = barrier->get_future();
|
|
207
|
+
analytics_query(std::move(statement), options, [barrier](auto ctx, auto result) {
|
|
208
|
+
barrier->set_value({ std::move(ctx), std::move(result) });
|
|
209
|
+
});
|
|
210
|
+
return future;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
void
|
|
214
|
+
scope::analytics_query(std::string statement, const analytics_options& options, analytics_handler&& handler) const
|
|
215
|
+
{
|
|
216
|
+
auto request = build_analytics_request(std::move(statement), options.build(), bucket_name_, name_);
|
|
217
|
+
|
|
218
|
+
core_->execute(std::move(request), [handler = std::move(handler)](core::operations::analytics_response resp) mutable {
|
|
219
|
+
auto r = std::move(resp);
|
|
220
|
+
return handler(build_context(r), build_result(r));
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
auto
|
|
225
|
+
scope::analytics_query(std::string statement, const analytics_options& options) const
|
|
226
|
+
-> std::future<std::pair<analytics_error_context, analytics_result>>
|
|
227
|
+
{
|
|
228
|
+
auto barrier = std::make_shared<std::promise<std::pair<analytics_error_context, analytics_result>>>();
|
|
229
|
+
auto future = barrier->get_future();
|
|
230
|
+
analytics_query(std::move(statement), options, [barrier](auto ctx, auto result) {
|
|
231
|
+
barrier->set_value({ std::move(ctx), std::move(result) });
|
|
232
|
+
});
|
|
233
|
+
return future;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
} // namespace couchbase
|
|
@@ -95,7 +95,6 @@ options_to_origin(const std::string& connection_string, const couchbase::cluster
|
|
|
95
95
|
if (opts.dns.nameserver) {
|
|
96
96
|
user_options.dns_config =
|
|
97
97
|
io::dns::dns_config(opts.dns.nameserver.value(), opts.dns.port.value_or(io::dns::dns_config::default_port), opts.dns.timeout);
|
|
98
|
-
user_options.dns_srv_timeout = opts.dns.timeout;
|
|
99
98
|
}
|
|
100
99
|
user_options.enable_clustermap_notification = opts.behavior.enable_clustermap_notification;
|
|
101
100
|
user_options.show_queries = opts.behavior.show_queries;
|
|
@@ -22,14 +22,14 @@ namespace couchbase
|
|
|
22
22
|
{
|
|
23
23
|
|
|
24
24
|
void
|
|
25
|
-
collection_query_index_manager::get_all_indexes(const get_all_query_indexes_options& options,
|
|
25
|
+
collection_query_index_manager::get_all_indexes(const get_all_query_indexes_options& options, get_all_query_indexes_handler&& handler) const
|
|
26
26
|
{
|
|
27
27
|
return core::impl::initiate_get_all_query_indexes(core_,
|
|
28
28
|
"",
|
|
29
29
|
options.build(),
|
|
30
30
|
core::query_context(bucket_name_, scope_name_),
|
|
31
31
|
collection_name_,
|
|
32
|
-
std::forward<
|
|
32
|
+
std::forward<get_all_query_indexes_handler>(handler));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
void
|
|
@@ -90,4 +90,4 @@ collection_query_index_manager::watch_indexes(std::vector<std::string> index_nam
|
|
|
90
90
|
return core::impl::initiate_watch_query_indexes(
|
|
91
91
|
core_, "", std::move(index_names), options.build(), { bucket_name_, scope_name_ }, collection_name_, std::move(handler));
|
|
92
92
|
}
|
|
93
|
-
} // namespace couchbase
|
|
93
|
+
} // namespace couchbase
|
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
#include "dns_srv_tracker.hxx"
|
|
19
|
-
|
|
20
|
-
#include "
|
|
19
|
+
|
|
20
|
+
#include "core/logger/logger.hxx"
|
|
21
|
+
#include "core/utils/join_strings.hxx"
|
|
21
22
|
|
|
22
23
|
#include <asio/bind_executor.hpp>
|
|
23
24
|
#include <asio/io_context.hpp>
|
|
25
|
+
#include <asio/post.hpp>
|
|
24
26
|
|
|
25
27
|
#include <memory>
|
|
26
28
|
|
|
@@ -44,7 +46,7 @@ dns_srv_tracker::get_srv_nodes(utils::movable_function<void(origin::node_list, s
|
|
|
44
46
|
address_,
|
|
45
47
|
service_,
|
|
46
48
|
config_,
|
|
47
|
-
[self = shared_from_this(), callback = std::move(callback)](couchbase::core::io::dns::
|
|
49
|
+
[self = shared_from_this(), callback = std::move(callback)](couchbase::core::io::dns::dns_srv_response&& resp) mutable {
|
|
48
50
|
origin::node_list nodes;
|
|
49
51
|
if (resp.ec) {
|
|
50
52
|
CB_LOG_WARNING("failed to fetch DNS SRV records for \"{}\" ({}), assuming that cluster is listening this address",
|