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
@@ -72,7 +72,7 @@ class collection_cache
|
|
72
72
|
if (auto ptr = cid_map_.find(path); ptr != cid_map_.end()) {
|
73
73
|
return ptr->second;
|
74
74
|
}
|
75
|
-
return
|
75
|
+
return std::nullopt;
|
76
76
|
}
|
77
77
|
|
78
78
|
void update(const std::string& path, std::uint32_t id)
|
@@ -379,7 +379,7 @@ class mcbp_session_impl
|
|
379
379
|
Expects(protocol::is_valid_server_request_opcode(msg.header.opcode));
|
380
380
|
switch (static_cast<protocol::server_opcode>(msg.header.opcode)) {
|
381
381
|
case protocol::server_opcode::cluster_map_change_notification: {
|
382
|
-
protocol::cmd_info info{ session_->
|
382
|
+
protocol::cmd_info info{ session_->bootstrap_hostname_, session_->bootstrap_port_number_ };
|
383
383
|
if (session_->origin_.options().dump_configuration) {
|
384
384
|
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()), msg.body.size() };
|
385
385
|
CB_LOG_TRACE(
|
@@ -404,7 +404,7 @@ class mcbp_session_impl
|
|
404
404
|
CB_LOG_WARNING("{} unexpected server request: opcode={:x}, opaque={}{:a}{:a}",
|
405
405
|
session_->log_prefix_,
|
406
406
|
msg.header.opcode,
|
407
|
-
msg.header.opaque,
|
407
|
+
utils::byte_swap(msg.header.opaque),
|
408
408
|
spdlog::to_hex(msg.header_data()),
|
409
409
|
spdlog::to_hex(msg.body));
|
410
410
|
}
|
@@ -416,7 +416,7 @@ class mcbp_session_impl
|
|
416
416
|
session_->log_prefix_,
|
417
417
|
magic,
|
418
418
|
msg.header.opcode,
|
419
|
-
msg.header.opaque,
|
419
|
+
utils::byte_swap(msg.header.opaque),
|
420
420
|
spdlog::to_hex(msg.header_data()),
|
421
421
|
spdlog::to_hex(msg.body));
|
422
422
|
break;
|
@@ -473,7 +473,7 @@ class mcbp_session_impl
|
|
473
473
|
Expects(protocol::is_valid_client_opcode(msg.header.opcode));
|
474
474
|
switch (auto opcode = static_cast<protocol::client_opcode>(msg.header.opcode)) {
|
475
475
|
case protocol::client_opcode::get_cluster_config: {
|
476
|
-
protocol::cmd_info info{ session_->
|
476
|
+
protocol::cmd_info info{ session_->bootstrap_hostname_, session_->bootstrap_port_number_ };
|
477
477
|
if (session_->origin_.options().dump_configuration) {
|
478
478
|
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()), msg.body.size() };
|
479
479
|
CB_LOG_TRACE("{} configuration from get_cluster_config response (size={}, endpoint=\"{}:{}\"), {}",
|
@@ -781,13 +781,10 @@ class mcbp_session_impl
|
|
781
781
|
return;
|
782
782
|
}
|
783
783
|
std::tie(bootstrap_hostname_, bootstrap_port_) = origin_.next_address();
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
bucket_name_.value_or("-"),
|
789
|
-
bootstrap_hostname_,
|
790
|
-
bootstrap_port_);
|
784
|
+
bootstrap_port_number_ = gsl::narrow_cast<std::uint16_t>(std::stoul(bootstrap_port_, nullptr, 10));
|
785
|
+
bootstrap_address_ = fmt::format("{}:{}", bootstrap_hostname_, bootstrap_port_);
|
786
|
+
log_prefix_ =
|
787
|
+
fmt::format("[{}/{}/{}/{}] <{}>", client_id_, id_, stream_->log_prefix(), bucket_name_.value_or("-"), bootstrap_address_);
|
791
788
|
CB_LOG_DEBUG("{} attempt to establish MCBP connection", log_prefix_);
|
792
789
|
|
793
790
|
async_resolve(origin_.options().use_ip_protocol,
|
@@ -807,7 +804,7 @@ class mcbp_session_impl
|
|
807
804
|
return stopped_;
|
808
805
|
}
|
809
806
|
|
810
|
-
void on_stop(utils::movable_function<void(
|
807
|
+
void on_stop(utils::movable_function<void()> handler)
|
811
808
|
{
|
812
809
|
on_stop_handler_ = std::move(handler);
|
813
810
|
}
|
@@ -863,7 +860,7 @@ class mcbp_session_impl
|
|
863
860
|
config_listeners_.clear();
|
864
861
|
state_ = diag::endpoint_state::disconnected;
|
865
862
|
if (auto on_stop = std::move(on_stop_handler_); on_stop) {
|
866
|
-
on_stop(
|
863
|
+
on_stop();
|
867
864
|
}
|
868
865
|
}
|
869
866
|
|
@@ -874,7 +871,7 @@ class mcbp_session_impl
|
|
874
871
|
}
|
875
872
|
std::uint32_t opaque{ 0 };
|
876
873
|
std::memcpy(&opaque, buf.data() + 12, sizeof(opaque));
|
877
|
-
CB_LOG_TRACE("{} MCBP send, opaque={}, {:n}", log_prefix_, opaque, spdlog::to_hex(buf.begin(), buf.begin() + 24));
|
874
|
+
CB_LOG_TRACE("{} MCBP send, opaque={}, {:n}", log_prefix_, utils::byte_swap(opaque), spdlog::to_hex(buf.begin(), buf.begin() + 24));
|
878
875
|
std::scoped_lock lock(output_buffer_mutex_);
|
879
876
|
output_buffer_.emplace_back(std::move(buf));
|
880
877
|
}
|
@@ -1058,6 +1055,11 @@ class mcbp_session_impl
|
|
1058
1055
|
return config_->index_for_this_node();
|
1059
1056
|
}
|
1060
1057
|
|
1058
|
+
[[nodiscard]] const std::string& bootstrap_address() const
|
1059
|
+
{
|
1060
|
+
return bootstrap_address_;
|
1061
|
+
}
|
1062
|
+
|
1061
1063
|
[[nodiscard]] const std::string& bootstrap_hostname() const
|
1062
1064
|
{
|
1063
1065
|
return bootstrap_hostname_;
|
@@ -1068,6 +1070,11 @@ class mcbp_session_impl
|
|
1068
1070
|
return bootstrap_port_;
|
1069
1071
|
}
|
1070
1072
|
|
1073
|
+
[[nodiscard]] std::uint16_t bootstrap_port_number() const
|
1074
|
+
{
|
1075
|
+
return bootstrap_port_number_;
|
1076
|
+
}
|
1077
|
+
|
1071
1078
|
[[nodiscard]] std::uint32_t next_opaque()
|
1072
1079
|
{
|
1073
1080
|
return ++opaque_;
|
@@ -1161,15 +1168,15 @@ class mcbp_session_impl
|
|
1161
1168
|
CB_LOG_TRACE("{} configuration from not_my_vbucket response (size={}, endpoint=\"{}:{}\"), {}",
|
1162
1169
|
log_prefix_,
|
1163
1170
|
config_text.size(),
|
1164
|
-
|
1165
|
-
|
1171
|
+
bootstrap_hostname_,
|
1172
|
+
bootstrap_port_number_,
|
1166
1173
|
config_text);
|
1167
1174
|
}
|
1168
|
-
auto config = protocol::parse_config(config_text,
|
1175
|
+
auto config = protocol::parse_config(config_text, bootstrap_hostname_, bootstrap_port_number_);
|
1169
1176
|
CB_LOG_DEBUG("{} received not_my_vbucket status for {}, opaque={} with config rev={} in the payload",
|
1170
1177
|
log_prefix_,
|
1171
1178
|
protocol::client_opcode(msg.header.opcode),
|
1172
|
-
msg.header.opaque,
|
1179
|
+
utils::byte_swap(msg.header.opaque),
|
1173
1180
|
config.rev_str());
|
1174
1181
|
update_configuration(std::move(config));
|
1175
1182
|
}
|
@@ -1204,6 +1211,12 @@ class mcbp_session_impl
|
|
1204
1211
|
CB_LOG_DEBUG(R"({} server returned {} ({}), it must be transient condition, retrying)", log_prefix_, ec.value(), ec.message());
|
1205
1212
|
return initiate_bootstrap();
|
1206
1213
|
}
|
1214
|
+
if (!origin_.exhausted() && ec == errc::common::authentication_failure) {
|
1215
|
+
CB_LOG_DEBUG(
|
1216
|
+
R"({} server returned authentication_failure, but the bootstrap list is not exhausted yet. It must be transient condition, retrying)",
|
1217
|
+
log_prefix_);
|
1218
|
+
return initiate_bootstrap();
|
1219
|
+
}
|
1207
1220
|
|
1208
1221
|
if (!bootstrapped_ && bootstrap_callback_) {
|
1209
1222
|
bootstrap_deadline_.cancel();
|
@@ -1382,8 +1395,10 @@ class mcbp_session_impl
|
|
1382
1395
|
if (self->stopped_) {
|
1383
1396
|
return;
|
1384
1397
|
}
|
1385
|
-
CB_LOG_TRACE(
|
1386
|
-
|
1398
|
+
CB_LOG_TRACE("{} MCBP recv, opaque={}, {:n}",
|
1399
|
+
self->log_prefix_,
|
1400
|
+
utils::byte_swap(msg.header.opaque),
|
1401
|
+
spdlog::to_hex(msg.header_data()));
|
1387
1402
|
if (self->bootstrapped_) {
|
1388
1403
|
self->handler_->handle(std::move(msg));
|
1389
1404
|
} else {
|
@@ -1462,7 +1477,7 @@ class mcbp_session_impl
|
|
1462
1477
|
std::mutex command_handlers_mutex_{};
|
1463
1478
|
std::map<std::uint32_t, command_handler> command_handlers_{};
|
1464
1479
|
std::vector<std::shared_ptr<config_listener>> config_listeners_{};
|
1465
|
-
utils::movable_function<void(
|
1480
|
+
utils::movable_function<void()> on_stop_handler_{};
|
1466
1481
|
|
1467
1482
|
std::atomic_bool bootstrapped_{ false };
|
1468
1483
|
std::atomic_bool stopped_{ false };
|
@@ -1482,6 +1497,8 @@ class mcbp_session_impl
|
|
1482
1497
|
std::mutex writing_buffer_mutex_{};
|
1483
1498
|
std::string bootstrap_hostname_{};
|
1484
1499
|
std::string bootstrap_port_{};
|
1500
|
+
std::string bootstrap_address_{};
|
1501
|
+
std::uint16_t bootstrap_port_number_{};
|
1485
1502
|
asio::ip::tcp::endpoint endpoint_{}; // connected endpoint
|
1486
1503
|
std::string endpoint_address_{}; // cached string with endpoint address
|
1487
1504
|
asio::ip::tcp::endpoint local_endpoint_{};
|
@@ -1582,22 +1599,16 @@ mcbp_session::supports_feature(protocol::hello_feature feature)
|
|
1582
1599
|
return impl_->supports_feature(feature);
|
1583
1600
|
}
|
1584
1601
|
|
1585
|
-
|
1586
|
-
// mcbp_session::id() const
|
1587
|
-
// {
|
1588
|
-
// return impl_->id();
|
1589
|
-
// }
|
1590
|
-
std::string
|
1602
|
+
const std::string&
|
1591
1603
|
mcbp_session::id() const
|
1592
1604
|
{
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
return fmt::format("{}, nullptr", reinterpret_cast<const void*>(this));
|
1605
|
+
return impl_->id();
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
const std::string&
|
1609
|
+
mcbp_session::bootstrap_address() const
|
1610
|
+
{
|
1611
|
+
return impl_->bootstrap_address();
|
1601
1612
|
}
|
1602
1613
|
|
1603
1614
|
std::string
|
@@ -1624,6 +1635,12 @@ mcbp_session::bootstrap_port() const
|
|
1624
1635
|
return impl_->bootstrap_port();
|
1625
1636
|
}
|
1626
1637
|
|
1638
|
+
std::uint16_t
|
1639
|
+
mcbp_session::bootstrap_port_number() const
|
1640
|
+
{
|
1641
|
+
return impl_->bootstrap_port_number();
|
1642
|
+
}
|
1643
|
+
|
1627
1644
|
void
|
1628
1645
|
mcbp_session::write_and_subscribe(std::uint32_t opaque, std::vector<std::byte>&& data, command_handler&& handler)
|
1629
1646
|
{
|
@@ -1637,7 +1654,7 @@ mcbp_session::bootstrap(utils::movable_function<void(std::error_code, topology::
|
|
1637
1654
|
}
|
1638
1655
|
|
1639
1656
|
void
|
1640
|
-
mcbp_session::on_stop(utils::movable_function<void(
|
1657
|
+
mcbp_session::on_stop(utils::movable_function<void()> handler)
|
1641
1658
|
{
|
1642
1659
|
return impl_->on_stop(std::move(handler));
|
1643
1660
|
}
|
@@ -101,17 +101,18 @@ class mcbp_session
|
|
101
101
|
[[nodiscard]] mcbp_context context() const;
|
102
102
|
[[nodiscard]] bool supports_feature(protocol::hello_feature feature);
|
103
103
|
[[nodiscard]] std::vector<protocol::hello_feature> supported_features() const;
|
104
|
-
|
105
|
-
[[nodiscard]] std::string id() const;
|
104
|
+
[[nodiscard]] const std::string& id() const;
|
106
105
|
[[nodiscard]] std::string remote_address() const;
|
107
106
|
[[nodiscard]] std::string local_address() const;
|
107
|
+
[[nodiscard]] const std::string& bootstrap_address() const;
|
108
108
|
[[nodiscard]] const std::string& bootstrap_hostname() const;
|
109
109
|
[[nodiscard]] const std::string& bootstrap_port() const;
|
110
|
+
[[nodiscard]] std::uint16_t bootstrap_port_number() const;
|
110
111
|
void write_and_subscribe(std::shared_ptr<mcbp::queue_request>, std::shared_ptr<response_handler> handler);
|
111
112
|
void write_and_subscribe(std::uint32_t opaque, std::vector<std::byte>&& data, command_handler&& handler);
|
112
113
|
void bootstrap(utils::movable_function<void(std::error_code, topology::configuration)>&& handler,
|
113
114
|
bool retry_on_bucket_not_found = false);
|
114
|
-
void on_stop(utils::movable_function<void(
|
115
|
+
void on_stop(utils::movable_function<void()> handler);
|
115
116
|
void stop(retry_reason reason);
|
116
117
|
[[nodiscard]] std::size_t index() const;
|
117
118
|
[[nodiscard]] bool has_config() const;
|
@@ -17,10 +17,12 @@
|
|
17
17
|
|
18
18
|
#include "version.hxx"
|
19
19
|
|
20
|
+
#include "core/mozilla_ca_bundle.hxx"
|
20
21
|
#include "core/transactions/forward_compat.hxx"
|
21
22
|
#include "core/utils/join_strings.hxx"
|
22
23
|
#include "core/utils/json.hxx"
|
23
24
|
|
25
|
+
#include <couchbase/build_config.hxx>
|
24
26
|
#include <couchbase/build_info.hxx>
|
25
27
|
#include <couchbase/build_version.hxx>
|
26
28
|
|
@@ -76,7 +78,7 @@ sdk_build_info()
|
|
76
78
|
info["link_libraries"] = COUCHBASE_CXX_CLIENT_LINK_LIBRARIES;
|
77
79
|
info["link_options"] = COUCHBASE_CXX_CLIENT_LINK_OPTIONS;
|
78
80
|
info["static_stdlib"] =
|
79
|
-
#if defined(
|
81
|
+
#if defined(COUCHBASE_CXX_CLIENT_STATIC_STDLIB)
|
80
82
|
"true"
|
81
83
|
#else
|
82
84
|
"false"
|
@@ -84,7 +86,7 @@ sdk_build_info()
|
|
84
86
|
;
|
85
87
|
info["post_linked_openssl"] = COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL;
|
86
88
|
info["static_openssl"] =
|
87
|
-
#if defined(
|
89
|
+
#if defined(COUCHBASE_CXX_CLIENT_STATIC_OPENSSL)
|
88
90
|
"true"
|
89
91
|
#else
|
90
92
|
"false"
|
@@ -112,8 +114,19 @@ sdk_build_info()
|
|
112
114
|
}
|
113
115
|
}
|
114
116
|
#endif
|
117
|
+
|
118
|
+
#if defined(COUCHBASE_CXX_CLIENT_EMBED_MOZILLA_CA_BUNDLE)
|
119
|
+
info["mozilla_ca_bundle_embedded"] = "true";
|
120
|
+
info["mozilla_ca_bundle_sha256"] = COUCHBASE_CXX_CLIENT_MOZILLA_CA_BUNDLE_SHA256;
|
121
|
+
info["mozilla_ca_bundle_date"] = COUCHBASE_CXX_CLIENT_MOZILLA_CA_BUNDLE_DATE;
|
122
|
+
#else
|
123
|
+
info["mozilla_ca_bundle_embedded"] = "false";
|
124
|
+
#endif
|
125
|
+
info["mozilla_ca_bundle_size"] = std::to_string(default_ca::mozilla_ca_certs().size());
|
115
126
|
info["openssl_default_cert_dir"] = X509_get_default_cert_dir();
|
116
127
|
info["openssl_default_cert_file"] = X509_get_default_cert_file();
|
128
|
+
info["openssl_default_cert_dir_env"] = X509_get_default_cert_dir_env();
|
129
|
+
info["openssl_default_cert_file_env"] = X509_get_default_cert_file_env();
|
117
130
|
info["openssl_ssl_interface_include_directories"] = OPENSSL_SSL_INTERFACE_INCLUDE_DIRECTORIES;
|
118
131
|
info["openssl_ssl_interface_link_libraries"] = OPENSSL_SSL_INTERFACE_LINK_LIBRARIES;
|
119
132
|
info["openssl_ssl_imported_location"] = OPENSSL_SSL_IMPORTED_LOCATION;
|
@@ -138,9 +151,10 @@ sdk_build_info_json()
|
|
138
151
|
{
|
139
152
|
tao::json::value info;
|
140
153
|
for (const auto& [name, value] : sdk_build_info()) {
|
141
|
-
if (name == "version_major" || name == "version_minor" || name == "version_patch" || name == "version_build"
|
154
|
+
if (name == "version_major" || name == "version_minor" || name == "version_patch" || name == "version_build" ||
|
155
|
+
name == "mozilla_ca_bundle_size") {
|
142
156
|
info[name] = std::stoi(value);
|
143
|
-
} else if (name == "snapshot" || name == "static_stdlib" || name == "static_openssl") {
|
157
|
+
} else if (name == "snapshot" || name == "static_stdlib" || name == "static_openssl" || name == "mozilla_ca_bundle_embedded") {
|
144
158
|
info[name] = value == "true";
|
145
159
|
} else {
|
146
160
|
info[name] = value;
|
@@ -0,0 +1,39 @@
|
|
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
|
+
#pragma once
|
19
|
+
|
20
|
+
#include <array>
|
21
|
+
#include <gsl/span>
|
22
|
+
#include <string_view>
|
23
|
+
|
24
|
+
namespace couchbase::core::default_ca
|
25
|
+
{
|
26
|
+
struct certificate {
|
27
|
+
std::string_view authority;
|
28
|
+
std::string_view body;
|
29
|
+
};
|
30
|
+
|
31
|
+
auto
|
32
|
+
mozilla_ca_certs() -> gsl::span<const certificate>;
|
33
|
+
|
34
|
+
auto
|
35
|
+
mozilla_ca_certs_date() -> std::string_view;
|
36
|
+
|
37
|
+
auto
|
38
|
+
mozilla_ca_certs_sha256() -> std::string_view;
|
39
|
+
} // namespace couchbase::core::default_ca
|
@@ -32,9 +32,11 @@ search_request::encode_to(search_request::encoded_request_type& encoded, http_co
|
|
32
32
|
{
|
33
33
|
auto body = tao::json::value{
|
34
34
|
{ "query", utils::json::parse(query) },
|
35
|
-
{ "explain", explain },
|
36
35
|
{ "ctl", { { "timeout", encoded.timeout.count() } } },
|
37
36
|
};
|
37
|
+
if (explain) {
|
38
|
+
body["explain"] = *explain;
|
39
|
+
}
|
38
40
|
if (limit) {
|
39
41
|
body["size"] = *limit;
|
40
42
|
}
|
@@ -121,7 +121,7 @@ struct search_request {
|
|
121
121
|
|
122
122
|
std::optional<std::uint32_t> limit{};
|
123
123
|
std::optional<std::uint32_t> skip{};
|
124
|
-
bool explain{ false };
|
124
|
+
std::optional<bool> explain{ false };
|
125
125
|
bool disable_scoring{ false };
|
126
126
|
/**
|
127
127
|
* UNCOMMITTED: If set to true, will include the vector of search_location in rows.
|
@@ -29,6 +29,8 @@
|
|
29
29
|
#include <cstring>
|
30
30
|
#include <gsl/util>
|
31
31
|
|
32
|
+
#include <iostream>
|
33
|
+
|
32
34
|
namespace couchbase::core::protocol
|
33
35
|
{
|
34
36
|
std::pair<bool, std::uint32_t>
|
@@ -110,10 +112,17 @@ class client_request
|
|
110
112
|
private:
|
111
113
|
[[nodiscard]] std::vector<std::byte> generate_payload(bool try_to_compress)
|
112
114
|
{
|
113
|
-
|
115
|
+
// SA: for some reason GCC 8.5.0 on CentOS 8 sees here null-pointer dereference
|
116
|
+
#if defined(__GNUC__) && __GNUC__ == 8
|
117
|
+
#pragma GCC diagnostic push
|
118
|
+
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
119
|
+
#endif
|
120
|
+
std::vector<std::byte> payload(header_size + body_.size(), std::byte{});
|
114
121
|
payload[0] = static_cast<std::byte>(magic_);
|
115
122
|
payload[1] = static_cast<std::byte>(opcode_);
|
116
|
-
|
123
|
+
#if defined(__GNUC__) && __GNUC__ == 8
|
124
|
+
#pragma GCC diagnostic pop
|
125
|
+
#endif
|
117
126
|
const auto& framing_extras = body_.framing_extras();
|
118
127
|
|
119
128
|
std::uint16_t key_size = gsl::narrow_cast<std::uint16_t>(body_.key().size());
|