couchbase 4.2.3 → 4.2.5-dev.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CMakeLists.txt +136 -11
- package/deps/couchbase-cxx-client/CMakeLists.txt +54 -4
- package/deps/couchbase-cxx-client/README.md +1 -0
- package/deps/couchbase-cxx-client/bin/create-search-index +164 -0
- package/deps/couchbase-cxx-client/bin/init-cluster +55 -10
- package/deps/couchbase-cxx-client/bin/run-unit-tests +62 -6
- package/deps/couchbase-cxx-client/bin/travel-sample-index-v6.json +184 -0
- package/deps/couchbase-cxx-client/bin/travel-sample-index.json +188 -0
- package/deps/couchbase-cxx-client/cmake/Documentation.cmake +0 -1
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +98 -3
- package/deps/couchbase-cxx-client/cmake/Testing.cmake +8 -0
- package/deps/couchbase-cxx-client/cmake/build_config.hxx.in +3 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +183 -152
- package/deps/couchbase-cxx-client/core/bucket.hxx +17 -4
- package/deps/couchbase-cxx-client/core/cluster.hxx +18 -1
- package/deps/couchbase-cxx-client/core/cluster_options.hxx +1 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +2 -1
- package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +10 -12
- package/deps/couchbase-cxx-client/core/error_context/search.hxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/boolean_field_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/boolean_query.cxx +62 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/conjunction_query.cxx +51 -0
- package/deps/couchbase-cxx-client/core/impl/date_range.cxx +89 -0
- package/deps/couchbase-cxx-client/core/impl/date_range_facet.cxx +54 -0
- package/deps/couchbase-cxx-client/core/impl/date_range_facet_result.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/date_range_query.cxx +125 -0
- package/deps/couchbase-cxx-client/core/impl/disjunction_query.cxx +51 -0
- package/deps/couchbase-cxx-client/core/impl/encoded_search_facet.hxx +29 -0
- package/deps/couchbase-cxx-client/core/impl/encoded_search_query.hxx +29 -0
- package/deps/couchbase-cxx-client/core/impl/encoded_search_sort.hxx +29 -0
- package/deps/couchbase-cxx-client/core/impl/geo_bounding_box_query.cxx +46 -0
- package/deps/couchbase-cxx-client/core/impl/geo_distance_query.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/geo_polygon_query.cxx +46 -0
- package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.cxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.cxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.cxx +141 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.hxx +61 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.cxx +60 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.hxx +41 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_result.cxx +84 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_result.hxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row.cxx +82 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row.hxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_location.hxx +32 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.cxx +137 -0
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.hxx +45 -0
- package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.cxx +80 -0
- package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/key_value_error_context.cxx +98 -0
- package/deps/couchbase-cxx-client/core/impl/match_all_query.cxx +35 -0
- package/deps/couchbase-cxx-client/core/impl/match_none_query.cxx +35 -0
- package/deps/couchbase-cxx-client/core/impl/match_phrase_query.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/match_query.cxx +59 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range.cxx +49 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range_facet.cxx +54 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range_facet_result.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/numeric_range_query.cxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/phrase_query.cxx +42 -0
- package/deps/couchbase-cxx-client/core/impl/prefix_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +75 -0
- package/deps/couchbase-cxx-client/core/impl/query_string_query.cxx +37 -0
- package/deps/couchbase-cxx-client/core/impl/regexp_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/impl/search.cxx +191 -0
- package/deps/couchbase-cxx-client/core/impl/search_error_context.cxx +147 -0
- package/deps/couchbase-cxx-client/core/impl/search_meta_data.cxx +46 -0
- package/deps/couchbase-cxx-client/core/impl/search_result.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/search_row.cxx +74 -0
- package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/search_row_locations.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_field.cxx +104 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_id.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/search_sort_score.cxx +43 -0
- package/deps/couchbase-cxx-client/core/impl/term_facet.cxx +36 -0
- package/deps/couchbase-cxx-client/core/impl/term_facet_result.cxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/term_query.cxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/term_range_query.cxx +57 -0
- package/deps/couchbase-cxx-client/core/impl/wildcard_query.cxx +40 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +9 -2
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +54 -37
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +4 -3
- package/deps/couchbase-cxx-client/core/json_string.hxx +5 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +18 -4
- package/deps/couchbase-cxx-client/core/mozilla_ca_bundle.hxx +39 -0
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -1
- package/deps/couchbase-cxx-client/core/protocol/client_request.hxx +11 -2
- package/deps/couchbase-cxx-client/core/protocol/client_response.hxx +1 -0
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +59 -46
- package/deps/couchbase-cxx-client/core/utils/connection_string.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/analytics_error_context.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/boolean_field_query.hxx +77 -0
- package/deps/couchbase-cxx-client/couchbase/boolean_query.hxx +223 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +39 -0
- package/deps/couchbase-cxx-client/couchbase/conjunction_query.hxx +88 -0
- package/deps/couchbase-cxx-client/couchbase/date_range.hxx +69 -0
- package/deps/couchbase-cxx-client/couchbase/date_range_facet.hxx +56 -0
- package/deps/couchbase-cxx-client/couchbase/date_range_facet_result.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/date_range_query.hxx +265 -0
- package/deps/couchbase-cxx-client/couchbase/disjunction_query.hxx +109 -0
- package/deps/couchbase-cxx-client/couchbase/doc_id_query.hxx +111 -0
- package/deps/couchbase-cxx-client/couchbase/error_context.hxx +17 -8
- package/deps/couchbase-cxx-client/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
- package/deps/couchbase-cxx-client/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
- package/deps/couchbase-cxx-client/couchbase/fmt/search_scan_consistency.hxx +49 -0
- package/deps/couchbase-cxx-client/couchbase/geo_bounding_box_query.hxx +107 -0
- package/deps/couchbase-cxx-client/couchbase/geo_distance_query.hxx +109 -0
- package/deps/couchbase-cxx-client/couchbase/geo_point.hxx +32 -0
- package/deps/couchbase-cxx-client/couchbase/geo_polygon_query.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/highlight_style.hxx +45 -0
- package/deps/couchbase-cxx-client/couchbase/key_value_error_context.hxx +7 -2
- package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/match_all_query.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/match_none_query.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/match_operator.hxx +45 -0
- package/deps/couchbase-cxx-client/couchbase/match_phrase_query.hxx +108 -0
- package/deps/couchbase-cxx-client/couchbase/match_query.hxx +163 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range_facet.hxx +56 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range_facet_result.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/numeric_range_query.hxx +143 -0
- package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +93 -0
- package/deps/couchbase-cxx-client/couchbase/prefix_query.hxx +82 -0
- package/deps/couchbase-cxx-client/couchbase/query_error_context.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/query_string_query.hxx +72 -0
- package/deps/couchbase-cxx-client/couchbase/regexp_query.hxx +82 -0
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +39 -0
- package/deps/couchbase-cxx-client/couchbase/search_date_range.hxx +68 -0
- package/deps/couchbase-cxx-client/couchbase/search_error_context.hxx +138 -0
- package/deps/couchbase-cxx-client/couchbase/search_facet.hxx +60 -0
- package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +50 -0
- package/deps/couchbase-cxx-client/couchbase/search_meta_data.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/search_metrics.hxx +127 -0
- package/deps/couchbase-cxx-client/couchbase/search_numeric_range.hxx +69 -0
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +509 -0
- package/deps/couchbase-cxx-client/couchbase/search_query.hxx +69 -0
- package/deps/couchbase-cxx-client/couchbase/search_result.hxx +77 -0
- package/deps/couchbase-cxx-client/couchbase/search_row.hxx +104 -0
- package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/search_row_locations.hxx +86 -0
- package/deps/couchbase-cxx-client/couchbase/search_scan_consistency.hxx +34 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field.hxx +117 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_missing.hxx +26 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_mode.hxx +27 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_type.hxx +28 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_id.hxx +60 -0
- package/deps/couchbase-cxx-client/couchbase/search_sort_score.hxx +60 -0
- package/deps/couchbase-cxx-client/couchbase/search_term_range.hxx +51 -0
- package/deps/couchbase-cxx-client/couchbase/security_options.hxx +3 -0
- package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +4 -2
- package/deps/couchbase-cxx-client/couchbase/term_facet.hxx +48 -0
- package/deps/couchbase-cxx-client/couchbase/term_facet_result.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/term_query.hxx +151 -0
- package/deps/couchbase-cxx-client/couchbase/term_range_query.hxx +142 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_result.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/transactions.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/wildcard_query.hxx +83 -0
- package/deps/couchbase-cxx-client/docs/Doxyfile.in +1 -1
- package/deps/couchbase-cxx-client/docs/cbc-analytics.md +2 -2
- package/deps/couchbase-cxx-client/docs/cbc-get.md +3 -2
- package/deps/couchbase-cxx-client/docs/cbc-pillowfight.md +7 -2
- package/deps/couchbase-cxx-client/docs/cbc-query.md +2 -2
- package/deps/couchbase-cxx-client/docs/cbc.md +3 -3
- package/deps/couchbase-cxx-client/docs/cli.hxx +5 -5
- package/deps/couchbase-cxx-client/docs/mainpage.hxx +42 -5
- package/deps/couchbase-cxx-client/test/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/test/test_integration_analytics.cxx +28 -6
- package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +7 -3
- package/deps/couchbase-cxx-client/test/test_integration_connect.cxx +7 -3
- package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +13 -3
- package/deps/couchbase-cxx-client/test/test_integration_diagnostics.cxx +8 -2
- package/deps/couchbase-cxx-client/test/test_integration_durability.cxx +12 -7
- package/deps/couchbase-cxx-client/test/test_integration_examples.cxx +283 -11
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +140 -88
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +67 -9
- package/deps/couchbase-cxx-client/test/test_integration_range_scan.cxx +12 -12
- package/deps/couchbase-cxx-client/test/test_integration_read_replica.cxx +48 -11
- package/deps/couchbase-cxx-client/test/test_integration_search.cxx +19 -1
- package/deps/couchbase-cxx-client/test/test_integration_subdoc.cxx +60 -9
- package/deps/couchbase-cxx-client/test/test_integration_tracer.cxx +3 -0
- package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +4 -0
- package/deps/couchbase-cxx-client/test/test_transaction_examples.cxx +100 -85
- package/deps/couchbase-cxx-client/test/test_unit_connection_string.cxx +29 -0
- package/deps/couchbase-cxx-client/test/test_unit_search.cxx +427 -0
- package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -1
- package/deps/couchbase-cxx-client/test/utils/logger.cxx +3 -1
- package/deps/couchbase-cxx-client/test/utils/server_version.hxx +31 -15
- package/deps/couchbase-cxx-client/test/utils/test_context.cxx +8 -0
- package/deps/couchbase-cxx-client/tools/get.cxx +9 -8
- package/deps/couchbase-cxx-client/tools/pillowfight.cxx +175 -75
- package/deps/couchbase-cxx-client/tools/version.cxx +4 -2
- package/dist/binding.d.ts +1 -1
- package/dist/binding.js +3 -2
- package/package.json +96 -1
- package/scripts/createPlatformPackages.js +108 -0
- package/scripts/install.js +45 -0
- package/scripts/prebuilds.js +249 -0
- package/scripts/prune.js +124 -0
- package/src/jstocbpp_autogen.hpp +3 -2
package/CMakeLists.txt
CHANGED
@@ -1,9 +1,108 @@
|
|
1
1
|
cmake_minimum_required(VERSION 3.17)
|
2
2
|
cmake_policy(SET CMP0042 NEW)
|
3
3
|
cmake_policy(SET CMP0048 NEW)
|
4
|
+
include(FetchContent)
|
4
5
|
set(CMAKE_CXX_STANDARD 17)
|
5
6
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
6
7
|
|
8
|
+
function(download_nodejs_headers)
|
9
|
+
message("Finding Node.js headers SHA for version: ${NODE_RUNTIMEVERSION}")
|
10
|
+
file(DOWNLOAD
|
11
|
+
https://nodejs.org/dist/v${NODE_RUNTIMEVERSION}/SHASUMS256.txt
|
12
|
+
"${CMAKE_CURRENT_BINARY_DIR}/SHASUM256.txt"
|
13
|
+
TLS_VERIFY ON)
|
14
|
+
|
15
|
+
file(READ "${CMAKE_CURRENT_BINARY_DIR}/SHASUM256.txt" HASH_FILE_CONTENT)
|
16
|
+
set(REGEX_CHECK "node-v${NODE_RUNTIMEVERSION}-headers.tar.gz")
|
17
|
+
string(REPLACE "\n" ";" HASH_FILE_CONTENT ${HASH_FILE_CONTENT})
|
18
|
+
FOREACH(HASH ${HASH_FILE_CONTENT})
|
19
|
+
string(FIND ${HASH} ${REGEX_CHECK} FOUND_FILE)
|
20
|
+
if("${FOUND_FILE}" GREATER_EQUAL "0")
|
21
|
+
string(REGEX MATCH
|
22
|
+
"^[0-9a-f]+"
|
23
|
+
CB_NODE_VERSION_SHA256
|
24
|
+
${HASH})
|
25
|
+
break()
|
26
|
+
endif()
|
27
|
+
ENDFOREACH()
|
28
|
+
|
29
|
+
if(NOT CB_NODE_VERSION_SHA256)
|
30
|
+
message(FATAL_ERROR "Failed to extract expected hash from node shasum file.")
|
31
|
+
else()
|
32
|
+
message("Using SHA=${CB_NODE_VERSION_SHA256}")
|
33
|
+
endif()
|
34
|
+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
|
35
|
+
# see https://cmake.org/cmake/help/latest/policy/CMP0135.html
|
36
|
+
# and Externalproject_add - DOWNLOAD_EXTRACT_TIMESTAMP
|
37
|
+
FetchContent_Declare(
|
38
|
+
nodejs_headers
|
39
|
+
URL https://nodejs.org/dist/v${NODE_RUNTIMEVERSION}/node-v${NODE_RUNTIMEVERSION}-headers.tar.gz
|
40
|
+
URL_HASH SHA256=${CB_NODE_VERSION_SHA256}
|
41
|
+
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
|
42
|
+
)
|
43
|
+
else()
|
44
|
+
FetchContent_Declare(
|
45
|
+
nodejs_headers
|
46
|
+
URL https://nodejs.org/dist/v${NODE_RUNTIMEVERSION}/node-v${NODE_RUNTIMEVERSION}-headers.tar.gz
|
47
|
+
URL_HASH SHA256=${CB_NODE_VERSION_SHA256}
|
48
|
+
)
|
49
|
+
endif()
|
50
|
+
|
51
|
+
message("Downloading Node.js ${NODE_RUNTIMEVERSION} headers...")
|
52
|
+
FetchContent_MakeAvailable(nodejs_headers)
|
53
|
+
message("Downloaded Node.js ${NODE_RUNTIMEVERSION} headers to ${nodejs_headers_SOURCE_DIR}")
|
54
|
+
set(NODEJS_INC_DIR "${nodejs_headers_SOURCE_DIR}/include/node" PARENT_SCOPE)
|
55
|
+
endfunction()
|
56
|
+
|
57
|
+
function(download_nodejs_win_lib)
|
58
|
+
if(NODE_RUNTIME STREQUAL "electron")
|
59
|
+
set(NODE_LIB_URL "https://artifacts.electronjs.org/headers/dist/v${NODE_RUNTIMEVERSION}")
|
60
|
+
if(NODE_ARCH STREQUAL "x64")
|
61
|
+
set(NODE_LIB_URL "${NODE_LIB_URL}/x64")
|
62
|
+
endif()
|
63
|
+
else()
|
64
|
+
set(NODE_LIB_URL "https://nodejs.org/dist/v${NODE_RUNTIMEVERSION}")
|
65
|
+
if(NODE_ARCH STREQUAL "x64")
|
66
|
+
set(NODE_LIB_URL "${NODE_LIB_URL}/win-x64")
|
67
|
+
else()
|
68
|
+
set(NODE_LIB_URL "${NODE_LIB_URL}/win-x86")
|
69
|
+
endif()
|
70
|
+
endif()
|
71
|
+
set(NODE_LIB_URL "${NODE_LIB_URL}/node.lib")
|
72
|
+
|
73
|
+
FetchContent_Declare(
|
74
|
+
nodejs_win_lib
|
75
|
+
URL ${NODE_LIB_URL}
|
76
|
+
DOWNLOAD_NO_EXTRACT TRUE
|
77
|
+
)
|
78
|
+
|
79
|
+
message("Downloading ${NODE_RUNTIME} v${NODE_RUNTIMEVERSION} win lib...")
|
80
|
+
FetchContent_MakeAvailable(nodejs_win_lib)
|
81
|
+
message("Downloaded ${NODE_RUNTIME} v${NODE_RUNTIMEVERSION} win lib to ${nodejs_win_lib_SOURCE_DIR}")
|
82
|
+
set(NODEJS_LIB "${nodejs_win_lib_SOURCE_DIR}/node.lib" PARENT_SCOPE)
|
83
|
+
endfunction()
|
84
|
+
|
85
|
+
# cmake-js >= v7.0 no longer downloads the full Node.js Windows lib and utilizes the https://github.com/nodejs/node-api-headers
|
86
|
+
# project to build the lib. Since we rely on OpenSSL we need to pull in more than just the node-api headers, so lets download
|
87
|
+
# the node.lib ourselves.
|
88
|
+
if(WIN32 AND CMAKE_JS_VERSION VERSION_GREATER_EQUAL "7.0.0")
|
89
|
+
SET(NODEJS_LIB "")
|
90
|
+
download_nodejs_win_lib()
|
91
|
+
else()
|
92
|
+
SET(NODEJS_LIB "${CMAKE_JS_LIB}")
|
93
|
+
endif()
|
94
|
+
|
95
|
+
if(CMAKE_JS_VERSION VERSION_GREATER_EQUAL "7.0.0")
|
96
|
+
set(NODEJS_INC_DIR "")
|
97
|
+
download_nodejs_headers()
|
98
|
+
set(NODEJS_INC_DIR "${NODEJS_INC_DIR};${CMAKE_JS_INC}")
|
99
|
+
else()
|
100
|
+
set(NODEJS_INC_DIR "${CMAKE_JS_INC}")
|
101
|
+
endif()
|
102
|
+
|
103
|
+
message(STATUS "NODEJS_INC_DIR=${NODEJS_INC_DIR}")
|
104
|
+
message(STATUS "NODEJS_LIB=${NODEJS_LIB}")
|
105
|
+
|
7
106
|
# Set up some build requirements for Windows.
|
8
107
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
9
108
|
if(WIN32)
|
@@ -13,12 +112,12 @@ endif()
|
|
13
112
|
|
14
113
|
# We need to import this globally in order for OpenSSL to be available
|
15
114
|
# to our dependant libraries such as couchbase-cxx-client.
|
16
|
-
include_directories(${
|
115
|
+
include_directories(${NODEJS_INC_DIR})
|
17
116
|
|
18
117
|
set(COUCHBASE_CXX_CLIENT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
19
118
|
set(COUCHBASE_CXX_CLIENT_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
20
119
|
set(COUCHBASE_CXX_CLIENT_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
|
21
|
-
set(COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL ON CACHE BOOL ""
|
120
|
+
set(COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL ON CACHE BOOL "")
|
22
121
|
set(COUCHBASE_CXX_CLIENT_STATIC_STDLIB ON CACHE BOOL "" FORCE)
|
23
122
|
add_subdirectory(deps/couchbase-cxx-client)
|
24
123
|
|
@@ -28,20 +127,46 @@ file(GLOB SOURCE_FILES "src/*.cpp")
|
|
28
127
|
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
|
29
128
|
|
30
129
|
add_definitions(-DNAPI_VERSION=6)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
130
|
+
if(CMAKE_JS_VERSION VERSION_GREATER_EQUAL "7.0.0")
|
131
|
+
target_include_directories(${PROJECT_NAME}
|
132
|
+
PRIVATE ${NODEJS_INC_DIR}
|
133
|
+
"deps/couchbase-cxx-client/include"
|
134
|
+
"deps/couchbase-cxx-client/third_party/asio/asio/include")
|
135
|
+
else()
|
136
|
+
execute_process(COMMAND node -p "require('node-addon-api').include"
|
137
|
+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
138
|
+
OUTPUT_VARIABLE NODE_ADDON_API_DIR
|
139
|
+
)
|
140
|
+
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
141
|
+
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
142
|
+
|
143
|
+
target_include_directories(${PROJECT_NAME}
|
144
|
+
PRIVATE ${NODEJS_INC_DIR}
|
145
|
+
${NODE_ADDON_API_DIR}
|
146
|
+
"deps/couchbase-cxx-client/include"
|
147
|
+
"deps/couchbase-cxx-client/third_party/asio/asio/include")
|
148
|
+
endif()
|
36
149
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
|
37
150
|
|
38
151
|
target_link_libraries(${PROJECT_NAME}
|
39
|
-
${
|
152
|
+
${NODEJS_LIB}
|
40
153
|
couchbase_cxx_client
|
41
154
|
)
|
42
155
|
|
43
|
-
|
44
|
-
#
|
45
|
-
|
156
|
+
if(MSVC)
|
157
|
+
# Workaround a bug in cmake-js with removal of used references:
|
158
|
+
# https://github.com/cmake-js/cmake-js/issues/205
|
46
159
|
target_link_options(${PROJECT_NAME} PUBLIC /OPT:NOREF)
|
160
|
+
|
161
|
+
# since we only care about the *.PDB for a command line build, this _should_ be okay.
|
162
|
+
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
163
|
+
target_compile_options(${PROJECT_NAME} PUBLIC /Zi)
|
164
|
+
|
165
|
+
# Do we want /OPT:ICF?
|
166
|
+
set_target_properties(${PROJECT_NAME} PROPERTIES
|
167
|
+
LINK_FLAGS "/INCREMENTAL:NO /DEBUG"
|
168
|
+
COMPILE_PDB_NAME ${PROJECT_NAME}
|
169
|
+
COMPILE_PDB_OUTPUT_DIR ${CMAKE_BINARY_DIR}
|
170
|
+
)
|
171
|
+
endif()
|
47
172
|
endif()
|
@@ -80,6 +80,7 @@ add_subdirectory(core/tracing)
|
|
80
80
|
add_subdirectory(core/metrics)
|
81
81
|
|
82
82
|
set(couchbase_cxx_client_FILES
|
83
|
+
${CMAKE_CURRENT_BINARY_DIR}/generated/mozilla_ca_bundle.cxx
|
83
84
|
core/agent.cxx
|
84
85
|
core/agent_config.cxx
|
85
86
|
core/agent_group.cxx
|
@@ -256,41 +257,75 @@ set(couchbase_cxx_client_FILES
|
|
256
257
|
core/utils/split_string.cxx
|
257
258
|
core/utils/url_codec.cxx
|
258
259
|
core/impl/analytics.cxx
|
260
|
+
core/impl/search.cxx
|
259
261
|
core/impl/analytics_error_category.cxx
|
260
262
|
core/impl/append.cxx
|
261
263
|
core/impl/best_effort_retry_strategy.cxx
|
264
|
+
core/impl/boolean_field_query.cxx
|
265
|
+
core/impl/boolean_query.cxx
|
262
266
|
core/impl/build_deferred_query_indexes.cxx
|
263
|
-
core/impl/collection_query_index_manager.cxx
|
264
267
|
core/impl/cluster.cxx
|
268
|
+
core/impl/collection_query_index_manager.cxx
|
265
269
|
core/impl/common_error_category.cxx
|
266
270
|
core/impl/configuration_profiles_registry.cxx
|
271
|
+
core/impl/conjunction_query.cxx
|
267
272
|
core/impl/create_query_index.cxx
|
273
|
+
core/impl/date_range.cxx
|
274
|
+
core/impl/date_range_facet.cxx
|
275
|
+
core/impl/date_range_facet_result.cxx
|
276
|
+
core/impl/date_range_query.cxx
|
268
277
|
core/impl/decrement.cxx
|
278
|
+
core/impl/disjunction_query.cxx
|
269
279
|
core/impl/dns_srv_tracker.cxx
|
270
280
|
core/impl/drop_query_index.cxx
|
271
281
|
core/impl/exists.cxx
|
272
282
|
core/impl/expiry.cxx
|
273
283
|
core/impl/fail_fast_retry_strategy.cxx
|
274
284
|
core/impl/field_level_encryption_error_category.cxx
|
285
|
+
core/impl/geo_bounding_box_query.cxx
|
286
|
+
core/impl/geo_distance_query.cxx
|
287
|
+
core/impl/geo_polygon_query.cxx
|
275
288
|
core/impl/get.cxx
|
289
|
+
core/impl/get_all_query_indexes.cxx
|
276
290
|
core/impl/get_all_replicas.cxx
|
277
291
|
core/impl/get_and_lock.cxx
|
278
292
|
core/impl/get_and_touch.cxx
|
279
|
-
core/impl/get_all_query_indexes.cxx
|
280
293
|
core/impl/get_any_replica.cxx
|
281
294
|
core/impl/get_replica.cxx
|
282
295
|
core/impl/increment.cxx
|
283
296
|
core/impl/insert.cxx
|
297
|
+
core/impl/internal_date_range_facet_result.cxx
|
298
|
+
core/impl/internal_numeric_range_facet_result.cxx
|
299
|
+
core/impl/internal_search_error_context.cxx
|
300
|
+
core/impl/internal_search_meta_data.cxx
|
301
|
+
core/impl/internal_search_result.cxx
|
302
|
+
core/impl/internal_search_row.cxx
|
303
|
+
core/impl/internal_search_row_locations.cxx
|
304
|
+
core/impl/internal_term_facet_result.cxx
|
284
305
|
core/impl/key_value_error_category.cxx
|
306
|
+
core/impl/key_value_error_context.cxx
|
285
307
|
core/impl/lookup_in.cxx
|
286
308
|
core/impl/management_error_category.cxx
|
309
|
+
core/impl/match_all_query.cxx
|
310
|
+
core/impl/match_none_query.cxx
|
311
|
+
core/impl/match_phrase_query.cxx
|
312
|
+
core/impl/match_query.cxx
|
287
313
|
core/impl/mutate_in.cxx
|
288
314
|
core/impl/network_error_category.cxx
|
315
|
+
core/impl/numeric_range.cxx
|
316
|
+
core/impl/numeric_range_facet.cxx
|
317
|
+
core/impl/numeric_range_facet_result.cxx
|
318
|
+
core/impl/numeric_range_query.cxx
|
289
319
|
core/impl/observe_poll.cxx
|
290
320
|
core/impl/observe_seqno.cxx
|
321
|
+
core/impl/phrase_query.cxx
|
322
|
+
core/impl/prefix_query.cxx
|
291
323
|
core/impl/prepend.cxx
|
292
324
|
core/impl/query.cxx
|
293
325
|
core/impl/query_error_category.cxx
|
326
|
+
core/impl/query_error_context.cxx
|
327
|
+
core/impl/query_string_query.cxx
|
328
|
+
core/impl/regexp_query.cxx
|
294
329
|
core/impl/remove.cxx
|
295
330
|
core/impl/replace.cxx
|
296
331
|
core/impl/retry_action.cxx
|
@@ -314,6 +349,20 @@ set(couchbase_cxx_client_FILES
|
|
314
349
|
core/impl/subdoc/remove.cxx
|
315
350
|
core/impl/subdoc/replace.cxx
|
316
351
|
core/impl/subdoc/upsert.cxx
|
352
|
+
core/impl/search.cxx
|
353
|
+
core/impl/search_error_context.cxx
|
354
|
+
core/impl/search_meta_data.cxx
|
355
|
+
core/impl/search_result.cxx
|
356
|
+
core/impl/search_row.cxx
|
357
|
+
core/impl/search_row_location.cxx
|
358
|
+
core/impl/search_row_locations.cxx
|
359
|
+
core/impl/search_sort_field.cxx
|
360
|
+
core/impl/search_sort_id.cxx
|
361
|
+
core/impl/search_sort_score.cxx
|
362
|
+
core/impl/term_facet.cxx
|
363
|
+
core/impl/term_facet_result.cxx
|
364
|
+
core/impl/term_query.cxx
|
365
|
+
core/impl/term_range_query.cxx
|
317
366
|
core/impl/touch.cxx
|
318
367
|
core/impl/transaction_error_category.cxx
|
319
368
|
core/impl/transaction_get_result.cxx
|
@@ -322,6 +371,7 @@ set(couchbase_cxx_client_FILES
|
|
322
371
|
core/impl/upsert.cxx
|
323
372
|
core/impl/view_error_category.cxx
|
324
373
|
core/impl/watch_query_indexes.cxx
|
374
|
+
core/impl/wildcard_query.cxx
|
325
375
|
core/io/dns_client.cxx
|
326
376
|
core/io/dns_config.cxx
|
327
377
|
core/io/http_parser.cxx
|
@@ -405,9 +455,9 @@ endif ()
|
|
405
455
|
if (NOT COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL)
|
406
456
|
if (TARGET PkgConfig::PKG_CONFIG_OPENSSL)
|
407
457
|
target_link_libraries(couchbase_cxx_client PUBLIC PkgConfig::PKG_CONFIG_OPENSSL)
|
408
|
-
else()
|
458
|
+
else ()
|
409
459
|
target_link_libraries(couchbase_cxx_client PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
410
|
-
endif()
|
460
|
+
endif ()
|
411
461
|
endif ()
|
412
462
|
|
413
463
|
option(COUCHBASE_CXX_CLIENT_BUILD_TESTS "Build test programs" TRUE)
|
@@ -0,0 +1,164 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright 2020-2021 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
|
+
require "timeout"
|
18
|
+
require "net/http"
|
19
|
+
require "json"
|
20
|
+
require "openssl"
|
21
|
+
|
22
|
+
class API
|
23
|
+
def initialize(options)
|
24
|
+
@options = options
|
25
|
+
connect
|
26
|
+
end
|
27
|
+
|
28
|
+
def connect
|
29
|
+
puts "# CONNECT #{@options}"
|
30
|
+
@client = Net::HTTP.start(@options[:host], @options[:port],
|
31
|
+
use_ssl: @options[:strict_encryption],
|
32
|
+
verify_mode: OpenSSL::SSL::VERIFY_NONE)
|
33
|
+
end
|
34
|
+
|
35
|
+
def url(path)
|
36
|
+
"#{@client.use_ssl? ? 'https' : 'http'}://#{@options[:username]}@#{@options[:host]}:#{@options[:port]}#{path}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def decode_response(response)
|
40
|
+
payload =
|
41
|
+
if response['content-type'] =~ /application\/json/
|
42
|
+
JSON.parse(response.body)
|
43
|
+
else
|
44
|
+
response.body
|
45
|
+
end
|
46
|
+
p payload if @options[:verbose]
|
47
|
+
payload
|
48
|
+
end
|
49
|
+
|
50
|
+
def setup_request(request)
|
51
|
+
request.basic_auth(@options[:username], @options[:password])
|
52
|
+
request['accept'] = "application/json"
|
53
|
+
end
|
54
|
+
|
55
|
+
def get(path)
|
56
|
+
puts "# GET #{url(path)}"
|
57
|
+
req = Net::HTTP::Get.new(path)
|
58
|
+
setup_request(req)
|
59
|
+
res = @client.request(req)
|
60
|
+
decode_response(res)
|
61
|
+
rescue EOFError
|
62
|
+
connect
|
63
|
+
retry
|
64
|
+
rescue => ex
|
65
|
+
puts "#{__method__}: #{ex}, sleep for 1 second and retry"
|
66
|
+
sleep(1)
|
67
|
+
retry
|
68
|
+
end
|
69
|
+
|
70
|
+
def post_form(path, fields = {})
|
71
|
+
puts "# POST #{url(path)} #{fields}"
|
72
|
+
req = Net::HTTP::Post.new(path)
|
73
|
+
setup_request(req)
|
74
|
+
req.form_data = fields
|
75
|
+
res = @client.request(req)
|
76
|
+
decode_response(res)
|
77
|
+
rescue EOFError
|
78
|
+
connect
|
79
|
+
retry
|
80
|
+
rescue => ex
|
81
|
+
puts "#{__method__}: #{ex}, sleep for 1 second and retry"
|
82
|
+
sleep(1)
|
83
|
+
retry
|
84
|
+
end
|
85
|
+
|
86
|
+
def post_json(path, object)
|
87
|
+
data = JSON.generate(object)
|
88
|
+
puts "# POST #{url(path)} #{data}"
|
89
|
+
req = Net::HTTP::Post.new(path)
|
90
|
+
req['content-type'] = "application/json"
|
91
|
+
setup_request(req)
|
92
|
+
res = @client.request(req, data)
|
93
|
+
decode_response(res)
|
94
|
+
rescue EOFError
|
95
|
+
connect
|
96
|
+
retry
|
97
|
+
rescue => ex
|
98
|
+
puts "#{__method__}: #{ex}, sleep for 1 second and retry"
|
99
|
+
sleep(1)
|
100
|
+
retry
|
101
|
+
end
|
102
|
+
|
103
|
+
def put_json(path, object)
|
104
|
+
data = JSON.generate(object)
|
105
|
+
puts "# PUT #{url(path)} #{data}"
|
106
|
+
req = Net::HTTP::Put.new(path)
|
107
|
+
req['content-type'] = "application/json"
|
108
|
+
setup_request(req)
|
109
|
+
res = @client.request(req, data)
|
110
|
+
decode_response(res)
|
111
|
+
rescue EOFError
|
112
|
+
connect
|
113
|
+
retry
|
114
|
+
rescue => ex
|
115
|
+
puts "#{__method__}: #{ex}, sleep for 1 second and retry"
|
116
|
+
sleep(1)
|
117
|
+
retry
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def service_port_for_bucket(api, service, bucket, options)
|
122
|
+
port_key = options[:strict_encryption] ? "#{service}SSL" : service
|
123
|
+
port = 0
|
124
|
+
while port.zero?
|
125
|
+
config = api.get("/pools/default/b/#{bucket}")
|
126
|
+
port = config["nodesExt"].find{|n| n["services"].key?(port_key)}["services"][port_key].to_i rescue 0
|
127
|
+
sleep 1
|
128
|
+
end
|
129
|
+
port
|
130
|
+
end
|
131
|
+
|
132
|
+
options = {
|
133
|
+
host: ARGV[0] || "127.0.0.1",
|
134
|
+
strict_encryption: ARGV[1] == "true" || ARGV[1] == "1",
|
135
|
+
username: ARGV[2] || "Administrator",
|
136
|
+
password: ARGV[3] || "password",
|
137
|
+
bucket: "travel-sample",
|
138
|
+
verbose: true,
|
139
|
+
}
|
140
|
+
p options: options
|
141
|
+
|
142
|
+
management_api = API.new(options.merge(port: options[:strict_encryption] ? 18091 : 8091))
|
143
|
+
search_service_port = service_port_for_bucket(management_api, "fts", options[:bucket], options)
|
144
|
+
|
145
|
+
has_v6_nodes =
|
146
|
+
management_api.get("/pools/default")["nodes"]
|
147
|
+
.any? { |node| node["version"] =~ /^6\./ && node["services"].include?("fts") }
|
148
|
+
|
149
|
+
search_api = API.new(options.merge(port: search_service_port))
|
150
|
+
index_definition_path = File.join(__dir__, "travel-sample-index#{"-v6" if has_v6_nodes}.json")
|
151
|
+
puts "using index definition: #{File.basename(index_definition_path)}"
|
152
|
+
index_definition = JSON.load(File.read(index_definition_path))
|
153
|
+
search_api.put_json("/api/index/travel-sample-index", index_definition)
|
154
|
+
|
155
|
+
expected_number_of_the_documents = 1000
|
156
|
+
indexed_documents = 0
|
157
|
+
|
158
|
+
Timeout.timeout(10 * 60) do # give it 10 minutes to index
|
159
|
+
while indexed_documents < expected_number_of_the_documents
|
160
|
+
resp = search_api.get("/api/index/travel-sample-index/count")
|
161
|
+
indexed_documents = resp['count'].to_i
|
162
|
+
sleep 1
|
163
|
+
end
|
164
|
+
end
|
@@ -15,7 +15,9 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
require "set"
|
18
|
+
require "timeout"
|
18
19
|
require "optparse"
|
20
|
+
require "openssl"
|
19
21
|
|
20
22
|
class Object
|
21
23
|
def to_b
|
@@ -117,6 +119,24 @@ class API
|
|
117
119
|
data = JSON.generate(object)
|
118
120
|
puts "# POST #{url(path)} #{data}"
|
119
121
|
req = Net::HTTP::Post.new(path)
|
122
|
+
req['content-type'] = "application/json"
|
123
|
+
setup_request(req)
|
124
|
+
res = @client.request(req, data)
|
125
|
+
decode_response(res)
|
126
|
+
rescue EOFError
|
127
|
+
connect
|
128
|
+
retry
|
129
|
+
rescue => ex
|
130
|
+
puts "#{__method__}: #{ex}, sleep for 1 second and retry"
|
131
|
+
sleep(1)
|
132
|
+
retry
|
133
|
+
end
|
134
|
+
|
135
|
+
def put_json(path, object)
|
136
|
+
data = JSON.generate(object)
|
137
|
+
puts "# PUT #{url(path)} #{data}"
|
138
|
+
req = Net::HTTP::Put.new(path)
|
139
|
+
req['content-type'] = "application/json"
|
120
140
|
setup_request(req)
|
121
141
|
res = @client.request(req, data)
|
122
142
|
decode_response(res)
|
@@ -219,21 +239,46 @@ api.post_json("/sampleBuckets/install", options[:sample_buckets].to_a) if option
|
|
219
239
|
|
220
240
|
api.post_form("/settings/developerPreview", enabled: true) if options[:enable_developer_preview]
|
221
241
|
|
222
|
-
def
|
223
|
-
|
224
|
-
|
225
|
-
while
|
226
|
-
config = api.get("/pools/default/b/#{
|
227
|
-
|
242
|
+
def service_port_for_bucket(api, service, bucket, options)
|
243
|
+
port_key = options[:strict_encryption] ? "#{service}SSL" : service
|
244
|
+
port = 0
|
245
|
+
while port.zero?
|
246
|
+
config = api.get("/pools/default/b/#{bucket}")
|
247
|
+
port = config["nodesExt"].find{|n| n["services"].key?(port_key)}["services"][port_key].to_i rescue 0
|
228
248
|
sleep 1
|
229
249
|
end
|
230
|
-
|
250
|
+
port
|
231
251
|
end
|
232
252
|
|
233
|
-
|
234
|
-
query_api = API.new(options.merge(port: query_port_for_bucket(api, options[:bucket], options)))
|
253
|
+
query_api = API.new(options.merge(port: service_port_for_bucket(api, "n1ql", options[:bucket], options)))
|
235
254
|
query_api.post_form("/query/service", statement: "CREATE PRIMARY INDEX ON `#{options[:bucket]}` USING GSI")
|
236
255
|
options[:sample_buckets].each do |bucket|
|
237
|
-
|
256
|
+
service_port_for_bucket(api, "n1ql", bucket, options)
|
238
257
|
query_api.post_form("/query/service", statement: "CREATE PRIMARY INDEX ON `#{bucket}` USING GSI")
|
239
258
|
end
|
259
|
+
|
260
|
+
puts service_port_for_bucket(api, "fts", options[:bucket], options)
|
261
|
+
|
262
|
+
if options[:sample_buckets].include?("travel-sample") && services.include?("fts")
|
263
|
+
search_api = API.new(options.merge(port: service_port_for_bucket(api, "fts", options[:bucket], options)))
|
264
|
+
|
265
|
+
has_v6_nodes =
|
266
|
+
api.get("/pools/default")["nodes"]
|
267
|
+
.any? { |node| node["version"] =~ /^6\./ && node["services"].include?("fts") }
|
268
|
+
|
269
|
+
index_definition_path = File.join(__dir__, "travel-sample-index#{"-v6" if has_v6_nodes}.json")
|
270
|
+
puts "using index definition: #{File.basename(index_definition_path)}"
|
271
|
+
index_definition = JSON.load(File.read(index_definition_path))
|
272
|
+
search_api.put_json("/api/index/travel-sample-index", index_definition)
|
273
|
+
|
274
|
+
expected_number_of_the_documents = 1000
|
275
|
+
indexed_documents = 0
|
276
|
+
Timeout.timeout(10 * 60) do # give it 10 minutes to index
|
277
|
+
while indexed_documents < expected_number_of_the_documents
|
278
|
+
resp = search_api.get("/api/index/travel-sample-index/count")
|
279
|
+
indexed_documents = resp['count'].to_i
|
280
|
+
sleep 1
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
@@ -37,7 +37,55 @@ fi
|
|
37
37
|
|
38
38
|
cd "${BUILD_DIR}"
|
39
39
|
|
40
|
-
|
40
|
+
CB_USE_GOCAVES=${CB_USE_GOCAVES:-""}
|
41
|
+
GOCAVES_PID=
|
42
|
+
GOCAVES_CONNECTION_STRING=
|
43
|
+
if [ "$CB_USE_GOCAVES" = "yes" -o "$CB_USE_GOCAVES" = "1" ]
|
44
|
+
then
|
45
|
+
GOCAVES=
|
46
|
+
case "$(uname -sm)" in
|
47
|
+
"Darwin x86_64")
|
48
|
+
GOCAVES="gocaves-macos"
|
49
|
+
;;
|
50
|
+
|
51
|
+
"Darwin arm64")
|
52
|
+
GOCAVES="gocaves-macos-arm64"
|
53
|
+
;;
|
54
|
+
|
55
|
+
"Linux x86_64")
|
56
|
+
GOCAVES="gocaves-linux-amd64"
|
57
|
+
;;
|
58
|
+
|
59
|
+
"Linux aarch64")
|
60
|
+
GOCAVES="gocaves-linux-arm64"
|
61
|
+
;;
|
62
|
+
esac
|
63
|
+
echo "GOCAVES=${GOCAVES}"
|
64
|
+
if [ "${GOCAVES}x" != "x" ]
|
65
|
+
then
|
66
|
+
GOCAVES_VERSION="v0.0.1-78"
|
67
|
+
echo "GOCAVES_VERSION=${GOCAVES_VERSION}"
|
68
|
+
GOCAVES_PATH="${BUILD_DIR}/${GOCAVES}-${GOCAVES_VERSION}"
|
69
|
+
if [ ! -e "${GOCAVES_PATH}" ]
|
70
|
+
then
|
71
|
+
curl -L -o "${GOCAVES_PATH}" https://github.com/couchbaselabs/gocaves/releases/download/${GOCAVES_VERSION}/${GOCAVES}
|
72
|
+
chmod u+x "${GOCAVES_PATH}"
|
73
|
+
fi
|
74
|
+
${GOCAVES_PATH} -mock-only > gocaves.txt 2>&1 &
|
75
|
+
sleep 1
|
76
|
+
GOCAVES_PID=$!
|
77
|
+
GOCAVES_CONNECTION_STRING=$(grep -o 'couchbase://[^"]\+' gocaves.txt)
|
78
|
+
echo "GOCAVES_CONNECTION_STRING=${GOCAVES_CONNECTION_STRING}"
|
79
|
+
if [ ! -z "${GOCAVES_CONNECTION_STRING}" ]
|
80
|
+
then
|
81
|
+
export TEST_CONNECTION_STRING="${GOCAVES_CONNECTION_STRING}"
|
82
|
+
export TEST_USE_GOCAVES=1
|
83
|
+
trap "kill -9 ${GOCAVES_PID}" SIGINT SIGTERM
|
84
|
+
fi
|
85
|
+
fi
|
86
|
+
fi
|
87
|
+
|
88
|
+
[ -f /proc/sys/kernel/core_pattern ] && cat /proc/sys/kernel/core_pattern
|
41
89
|
if [ -e /usr/bin/apport-unpack ]
|
42
90
|
then
|
43
91
|
mkdir -p $HOME/.config/apport
|
@@ -52,6 +100,11 @@ ulimit -c unlimited
|
|
52
100
|
${CB_CTEST} --output-on-failure --label-regex 'integration|unit' --output-junit results.xml
|
53
101
|
STATUS=$?
|
54
102
|
|
103
|
+
if [ ! -z "${GOCAVES_PID}" ]
|
104
|
+
then
|
105
|
+
kill -9 ${GOCAVES_PID}
|
106
|
+
fi
|
107
|
+
|
55
108
|
if [ "x${STATUS}" != "x0" ]
|
56
109
|
then
|
57
110
|
if [ -e /usr/bin/coredumpctl ]
|
@@ -74,11 +127,14 @@ then
|
|
74
127
|
fi
|
75
128
|
for core in /tmp/core.* "${PWD}/core*"
|
76
129
|
do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
130
|
+
if [ -f $core ]
|
131
|
+
then
|
132
|
+
echo $core
|
133
|
+
executable=$(file $core | ruby -e "print ARGF.read[/execfn: '([^']+)'/, 1]")
|
134
|
+
echo $executable
|
135
|
+
gdb $executable $core --batch -ex "thread apply all bt"
|
136
|
+
rm -f $core
|
137
|
+
fi
|
82
138
|
done
|
83
139
|
fi
|
84
140
|
|