couchbase 4.3.1 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/CMakeLists.txt +16 -9
- package/deps/couchbase-cxx-client/README.md +39 -44
- package/deps/couchbase-cxx-client/cmake/0001-fix-build-for-mingw-w64-ucrt-x86_64-toolchain.patch +3 -4
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +2 -1
- package/deps/couchbase-cxx-client/cmake/Packaging.cmake +41 -0
- package/deps/couchbase-cxx-client/cmake/Sanitizers.cmake +1 -0
- package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +5 -5
- package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
- package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.pc.in +10 -0
- package/deps/couchbase-cxx-client/cmake/test_boringssl.cxx +1 -1
- package/deps/couchbase-cxx-client/cmake/test_openssl.cxx +1 -1
- package/deps/couchbase-cxx-client/core/agent.cxx +353 -304
- package/deps/couchbase-cxx-client/core/agent.hxx +94 -76
- package/deps/couchbase-cxx-client/core/agent_config.cxx +9 -8
- package/deps/couchbase-cxx-client/core/agent_config.hxx +7 -7
- package/deps/couchbase-cxx-client/core/agent_group.cxx +132 -120
- package/deps/couchbase-cxx-client/core/agent_group.hxx +26 -22
- package/deps/couchbase-cxx-client/core/agent_group_config.cxx +8 -7
- package/deps/couchbase-cxx-client/core/agent_group_config.hxx +6 -6
- package/deps/couchbase-cxx-client/core/agent_unit_test_api.hxx +6 -6
- package/deps/couchbase-cxx-client/core/analytics_query_options.cxx +21 -21
- package/deps/couchbase-cxx-client/core/analytics_query_options.hxx +19 -18
- package/deps/couchbase-cxx-client/core/analytics_scan_consistency.hxx +2 -2
- package/deps/couchbase-cxx-client/core/bucket.cxx +848 -776
- package/deps/couchbase-cxx-client/core/bucket.hxx +151 -139
- package/deps/couchbase-cxx-client/core/capella_ca.hxx +20 -19
- package/deps/couchbase-cxx-client/core/cluster.cxx +1240 -927
- package/deps/couchbase-cxx-client/core/cluster.hxx +254 -167
- package/deps/couchbase-cxx-client/core/cluster_agent.cxx +7 -7
- package/deps/couchbase-cxx-client/core/cluster_agent.hxx +4 -4
- package/deps/couchbase-cxx-client/core/cluster_agent_config.cxx +8 -7
- package/deps/couchbase-cxx-client/core/cluster_agent_config.hxx +6 -6
- package/deps/couchbase-cxx-client/core/cluster_options.cxx +17 -17
- package/deps/couchbase-cxx-client/core/cluster_options.hxx +50 -47
- package/deps/couchbase-cxx-client/core/cluster_state.hxx +3 -3
- package/deps/couchbase-cxx-client/core/collection_id_cache_entry.hxx +5 -4
- package/deps/couchbase-cxx-client/core/collections_component.cxx +372 -329
- package/deps/couchbase-cxx-client/core/collections_component.hxx +17 -13
- package/deps/couchbase-cxx-client/core/collections_component_unit_test_api.hxx +6 -6
- package/deps/couchbase-cxx-client/core/collections_options.hxx +29 -27
- package/deps/couchbase-cxx-client/core/config_listener.hxx +3 -3
- package/deps/couchbase-cxx-client/core/config_profile.hxx +3 -3
- package/deps/couchbase-cxx-client/core/config_profiles.cxx +31 -31
- package/deps/couchbase-cxx-client/core/config_profiles.hxx +19 -19
- package/deps/couchbase-cxx-client/core/core_sdk_shim.cxx +2 -1
- package/deps/couchbase-cxx-client/core/core_sdk_shim.hxx +2 -2
- package/deps/couchbase-cxx-client/core/crud_component.cxx +310 -276
- package/deps/couchbase-cxx-client/core/crud_component.hxx +21 -15
- package/deps/couchbase-cxx-client/core/crud_options.hxx +361 -354
- package/deps/couchbase-cxx-client/core/crypto/cbcrypto.cc +732 -627
- package/deps/couchbase-cxx-client/core/crypto/cbcrypto.h +12 -3
- package/deps/couchbase-cxx-client/core/design_document_namespace.hxx +2 -2
- package/deps/couchbase-cxx-client/core/design_document_namespace_fmt.hxx +18 -18
- package/deps/couchbase-cxx-client/core/diagnostics.hxx +44 -44
- package/deps/couchbase-cxx-client/core/diagnostics_fmt.hxx +76 -76
- package/deps/couchbase-cxx-client/core/diagnostics_json.hxx +61 -60
- package/deps/couchbase-cxx-client/core/diagntostics_options.hxx +14 -14
- package/deps/couchbase-cxx-client/core/dispatcher.cxx +4 -3
- package/deps/couchbase-cxx-client/core/dispatcher.hxx +8 -7
- package/deps/couchbase-cxx-client/core/document_id.cxx +37 -34
- package/deps/couchbase-cxx-client/core/document_id.hxx +87 -86
- package/deps/couchbase-cxx-client/core/document_id_fmt.hxx +10 -10
- package/deps/couchbase-cxx-client/core/durability_options.hxx +50 -49
- package/deps/couchbase-cxx-client/core/error_context/analytics.hxx +18 -18
- package/deps/couchbase-cxx-client/core/error_context/analytics_json.hxx +115 -0
- package/deps/couchbase-cxx-client/core/error_context/base_error_context.hxx +184 -0
- package/deps/couchbase-cxx-client/core/error_context/http.hxx +14 -14
- package/deps/couchbase-cxx-client/core/error_context/http_json.hxx +90 -0
- package/deps/couchbase-cxx-client/core/error_context/internal_tof_metadata_json.hxx +36 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +27 -27
- package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +41 -38
- package/deps/couchbase-cxx-client/core/error_context/key_value_error_context.hxx +235 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value_error_map_attribute.hxx +142 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value_error_map_info.hxx +139 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value_extended_error_info.hxx +86 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value_json.hxx +83 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value_status_code.hxx +109 -0
- package/deps/couchbase-cxx-client/core/error_context/query.hxx +18 -18
- package/deps/couchbase-cxx-client/core/error_context/query_error_context.hxx +150 -0
- package/deps/couchbase-cxx-client/core/error_context/query_json.hxx +114 -0
- package/deps/couchbase-cxx-client/core/error_context/query_public_json.hxx +84 -0
- package/deps/couchbase-cxx-client/core/error_context/search.hxx +17 -17
- package/deps/couchbase-cxx-client/core/error_context/search_json.hxx +101 -0
- package/deps/couchbase-cxx-client/core/error_context/subdocument_error_context.hxx +147 -0
- package/deps/couchbase-cxx-client/core/error_context/subdocument_json.hxx +48 -0
- package/deps/couchbase-cxx-client/{couchbase → core/error_context}/transaction_error_context.hxx +22 -22
- package/deps/couchbase-cxx-client/core/error_context/transaction_op_error_context.hxx +79 -0
- package/deps/couchbase-cxx-client/core/error_context/view.hxx +17 -17
- package/deps/couchbase-cxx-client/core/fmt/key_value_error_map_attribute.hxx +100 -0
- package/deps/couchbase-cxx-client/{couchbase → core}/fmt/key_value_extended_error_info.hxx +20 -20
- package/deps/couchbase-cxx-client/core/fmt/key_value_status_code.hxx +269 -0
- package/deps/couchbase-cxx-client/core/free_form_http_request.cxx +26 -26
- package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +34 -33
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +111 -131
- package/deps/couchbase-cxx-client/core/impl/analytics.hxx +5 -7
- package/deps/couchbase-cxx-client/core/impl/analytics_error_category.cxx +29 -28
- package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +615 -516
- package/deps/couchbase-cxx-client/core/impl/best_effort_retry_strategy.cxx +53 -50
- package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +346 -285
- package/deps/couchbase-cxx-client/core/impl/boolean_field_query.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/boolean_query.cxx +27 -27
- package/deps/couchbase-cxx-client/core/impl/bootstrap_state_listener.hxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +39 -34
- package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +354 -313
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +430 -325
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +1033 -1187
- package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +201 -170
- package/deps/couchbase-cxx-client/core/impl/common_error_category.cxx +58 -55
- package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +46 -32
- package/deps/couchbase-cxx-client/core/impl/conjunction_query.cxx +17 -17
- package/deps/couchbase-cxx-client/core/impl/date_range.cxx +24 -20
- package/deps/couchbase-cxx-client/core/impl/date_range_facet.cxx +22 -22
- package/deps/couchbase-cxx-client/core/impl/date_range_facet_result.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/date_range_query.cxx +50 -48
- package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +211 -198
- package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +7 -6
- package/deps/couchbase-cxx-client/core/impl/disjunction_query.cxx +18 -17
- package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +92 -75
- package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.hxx +24 -20
- package/deps/couchbase-cxx-client/core/impl/doc_id_query.cxx +9 -9
- package/deps/couchbase-cxx-client/core/impl/encoded_search_facet.hxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/encoded_search_query.hxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/encoded_search_sort.hxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/error.cxx +171 -0
- package/deps/couchbase-cxx-client/core/impl/error.hxx +64 -0
- package/deps/couchbase-cxx-client/core/impl/error_context.cxx +56 -0
- package/deps/couchbase-cxx-client/core/impl/expiry.cxx +66 -53
- package/deps/couchbase-cxx-client/core/impl/fail_fast_retry_strategy.cxx +5 -4
- package/deps/couchbase-cxx-client/core/impl/field_level_encryption_error_category.cxx +30 -28
- package/deps/couchbase-cxx-client/core/impl/geo_bounding_box_query.cxx +17 -17
- package/deps/couchbase-cxx-client/core/impl/geo_distance_query.cxx +14 -14
- package/deps/couchbase-cxx-client/core/impl/geo_polygon_query.cxx +17 -17
- package/deps/couchbase-cxx-client/core/impl/get_all_replicas.hxx +26 -22
- package/deps/couchbase-cxx-client/core/impl/get_any_replica.hxx +25 -23
- package/deps/couchbase-cxx-client/core/impl/get_replica.cxx +18 -15
- package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +23 -18
- package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.cxx +16 -14
- package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.hxx +16 -15
- package/deps/couchbase-cxx-client/core/impl/internal_error_context.cxx +79 -0
- package/deps/couchbase-cxx-client/core/impl/internal_error_context.hxx +52 -0
- package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.cxx +18 -15
- package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.hxx +16 -15
- package/deps/couchbase-cxx-client/core/impl/internal_scan_result.hxx +7 -7
- package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.cxx +25 -22
- package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.hxx +32 -31
- package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.cxx +15 -13
- package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.hxx +10 -9
- package/deps/couchbase-cxx-client/core/impl/internal_search_result.cxx +30 -22
- package/deps/couchbase-cxx-client/core/impl/internal_search_result.hxx +10 -9
- package/deps/couchbase-cxx-client/core/impl/internal_search_row.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/internal_search_row.hxx +16 -16
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_location.hxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.cxx +68 -65
- package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.hxx +16 -13
- package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.cxx +16 -14
- package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.hxx +15 -15
- package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +73 -72
- package/deps/couchbase-cxx-client/core/impl/key_value_error_context.cxx +65 -65
- package/deps/couchbase-cxx-client/core/impl/logger.cxx +91 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +32 -29
- package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +33 -29
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.cxx +75 -68
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +30 -26
- package/deps/couchbase-cxx-client/core/impl/management_error_category.cxx +41 -40
- package/deps/couchbase-cxx-client/core/impl/match_all_query.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/match_none_query.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/match_phrase_query.cxx +13 -13
- package/deps/couchbase-cxx-client/core/impl/match_query.cxx +28 -28
- package/deps/couchbase-cxx-client/core/impl/network_error_category.cxx +39 -38
- package/deps/couchbase-cxx-client/core/impl/numeric_range.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/numeric_range_facet.cxx +22 -22
- package/deps/couchbase-cxx-client/core/impl/numeric_range_facet_result.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/numeric_range_query.cxx +22 -22
- package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +294 -277
- package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/observe_seqno.cxx +21 -18
- package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +31 -26
- package/deps/couchbase-cxx-client/core/impl/phrase_query.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/prefix_query.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/query.cxx +163 -154
- package/deps/couchbase-cxx-client/core/impl/query.hxx +6 -7
- package/deps/couchbase-cxx-client/core/impl/query_error_category.cxx +22 -21
- package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +45 -45
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +488 -408
- package/deps/couchbase-cxx-client/core/impl/query_string_query.cxx +7 -7
- package/deps/couchbase-cxx-client/core/impl/regexp_query.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/replica_utils.cxx +66 -0
- package/deps/couchbase-cxx-client/core/impl/replica_utils.hxx +48 -0
- package/deps/couchbase-cxx-client/core/impl/retry_action.cxx +3 -3
- package/deps/couchbase-cxx-client/core/impl/retry_reason.cxx +129 -56
- package/deps/couchbase-cxx-client/core/impl/retry_reason.hxx +28 -0
- package/deps/couchbase-cxx-client/core/impl/scan_result.cxx +53 -49
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +103 -94
- package/deps/couchbase-cxx-client/core/impl/search.cxx +139 -130
- package/deps/couchbase-cxx-client/core/impl/search.hxx +4 -4
- package/deps/couchbase-cxx-client/core/impl/search_error_category.cxx +18 -17
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +492 -390
- package/deps/couchbase-cxx-client/core/impl/search_meta_data.cxx +3 -3
- package/deps/couchbase-cxx-client/core/impl/search_request.cxx +78 -78
- package/deps/couchbase-cxx-client/core/impl/search_result.cxx +5 -5
- package/deps/couchbase-cxx-client/core/impl/search_row.cxx +7 -7
- package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +9 -8
- package/deps/couchbase-cxx-client/core/impl/search_row_locations.cxx +8 -7
- package/deps/couchbase-cxx-client/core/impl/search_sort_field.cxx +53 -53
- package/deps/couchbase-cxx-client/core/impl/search_sort_geo_distance.cxx +49 -48
- package/deps/couchbase-cxx-client/core/impl/search_sort_id.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/search_sort_score.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/streaming_json_lexer_error_category.cxx +70 -68
- package/deps/couchbase-cxx-client/core/impl/subdoc/array_add_unique.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/array_append.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/array_insert.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/array_prepend.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/command.hxx +5 -5
- package/deps/couchbase-cxx-client/core/impl/subdoc/command_bundle.hxx +11 -11
- package/deps/couchbase-cxx-client/core/impl/subdoc/count.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/counter.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/exists.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/get.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/insert.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/join_values.cxx +25 -25
- package/deps/couchbase-cxx-client/core/impl/subdoc/lookup_in_macro.cxx +61 -60
- package/deps/couchbase-cxx-client/core/impl/subdoc/lookup_in_specs.cxx +9 -9
- package/deps/couchbase-cxx-client/core/impl/subdoc/mutate_in_macro.cxx +48 -39
- package/deps/couchbase-cxx-client/core/impl/subdoc/mutate_in_specs.cxx +9 -9
- package/deps/couchbase-cxx-client/core/impl/subdoc/opcode.hxx +16 -16
- package/deps/couchbase-cxx-client/core/impl/subdoc/path_flags.hxx +40 -17
- package/deps/couchbase-cxx-client/core/impl/subdoc/remove.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/replace.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/subdoc/upsert.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/term_facet.cxx +8 -8
- package/deps/couchbase-cxx-client/core/impl/term_facet_result.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/term_query.cxx +25 -25
- package/deps/couchbase-cxx-client/core/impl/term_range_query.cxx +22 -22
- package/deps/couchbase-cxx-client/core/impl/transaction_error_category.cxx +21 -20
- package/deps/couchbase-cxx-client/core/impl/transaction_get_result.cxx +41 -30
- package/deps/couchbase-cxx-client/core/impl/transaction_op_error_category.cxx +55 -56
- package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +15 -10
- package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +9 -9
- package/deps/couchbase-cxx-client/core/impl/view_error_category.cxx +17 -16
- package/deps/couchbase-cxx-client/core/impl/wildcard_query.cxx +10 -10
- package/deps/couchbase-cxx-client/core/impl/with_legacy_durability.hxx +30 -29
- package/deps/couchbase-cxx-client/core/io/dns_client.cxx +257 -232
- package/deps/couchbase-cxx-client/core/io/dns_client.hxx +19 -18
- package/deps/couchbase-cxx-client/core/io/dns_codec.hxx +156 -154
- package/deps/couchbase-cxx-client/core/io/dns_config.cxx +114 -109
- package/deps/couchbase-cxx-client/core/io/dns_config.hxx +15 -13
- package/deps/couchbase-cxx-client/core/io/dns_message.hxx +365 -342
- package/deps/couchbase-cxx-client/core/io/http_command.hxx +155 -134
- package/deps/couchbase-cxx-client/core/io/http_context.hxx +5 -5
- package/deps/couchbase-cxx-client/core/io/http_message.hxx +75 -71
- package/deps/couchbase-cxx-client/core/io/http_parser.cxx +70 -67
- package/deps/couchbase-cxx-client/core/io/http_parser.hxx +18 -18
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +620 -520
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +406 -315
- package/deps/couchbase-cxx-client/core/io/http_traits.hxx +7 -0
- package/deps/couchbase-cxx-client/core/io/ip_protocol.hxx +3 -3
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +298 -278
- package/deps/couchbase-cxx-client/core/io/mcbp_context.hxx +7 -6
- package/deps/couchbase-cxx-client/core/io/mcbp_message.cxx +8 -8
- package/deps/couchbase-cxx-client/core/io/mcbp_message.hxx +19 -19
- package/deps/couchbase-cxx-client/core/io/mcbp_parser.cxx +60 -51
- package/deps/couchbase-cxx-client/core/io/mcbp_parser.hxx +21 -17
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +1769 -1616
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +63 -57
- package/deps/couchbase-cxx-client/core/io/query_cache.hxx +34 -34
- package/deps/couchbase-cxx-client/core/io/retry_context.hxx +45 -45
- package/deps/couchbase-cxx-client/core/io/retry_orchestrator.hxx +52 -42
- package/deps/couchbase-cxx-client/core/io/streams.hxx +210 -193
- package/deps/couchbase-cxx-client/core/json_string.hxx +47 -47
- package/deps/couchbase-cxx-client/core/key_value_config.cxx +8 -8
- package/deps/couchbase-cxx-client/core/key_value_config.hxx +12 -11
- package/deps/couchbase-cxx-client/core/logger/configuration.hxx +35 -35
- package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.cxx +73 -72
- package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.hxx +20 -18
- package/deps/couchbase-cxx-client/core/logger/level.hxx +9 -1
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +279 -252
- package/deps/couchbase-cxx-client/core/logger/logger.hxx +110 -58
- package/deps/couchbase-cxx-client/core/management/analytics_dataset.hxx +4 -4
- package/deps/couchbase-cxx-client/core/management/analytics_index.hxx +4 -4
- package/deps/couchbase-cxx-client/core/management/analytics_link_azure_blob_external.cxx +35 -33
- package/deps/couchbase-cxx-client/core/management/analytics_link_azure_blob_external.hxx +36 -35
- package/deps/couchbase-cxx-client/core/management/analytics_link_azure_blob_external_json.hxx +24 -20
- package/deps/couchbase-cxx-client/core/management/analytics_link_couchbase_remote.cxx +66 -65
- package/deps/couchbase-cxx-client/core/management/analytics_link_couchbase_remote.hxx +77 -70
- package/deps/couchbase-cxx-client/core/management/analytics_link_couchbase_remote_json.hxx +38 -32
- package/deps/couchbase-cxx-client/core/management/analytics_link_s3_external.cxx +26 -25
- package/deps/couchbase-cxx-client/core/management/analytics_link_s3_external.hxx +30 -30
- package/deps/couchbase-cxx-client/core/management/analytics_link_s3_external_json.hxx +18 -16
- package/deps/couchbase-cxx-client/core/management/bucket_settings.hxx +109 -91
- package/deps/couchbase-cxx-client/core/management/bucket_settings_json.hxx +112 -94
- package/deps/couchbase-cxx-client/core/management/design_document.hxx +9 -9
- package/deps/couchbase-cxx-client/core/management/eventing_function.hxx +124 -121
- package/deps/couchbase-cxx-client/core/management/eventing_function_json.hxx +228 -184
- package/deps/couchbase-cxx-client/core/management/eventing_status.hxx +41 -41
- package/deps/couchbase-cxx-client/core/management/eventing_status_json.hxx +53 -45
- package/deps/couchbase-cxx-client/core/management/rbac.hxx +33 -28
- package/deps/couchbase-cxx-client/core/management/rbac_fmt.hxx +21 -21
- package/deps/couchbase-cxx-client/core/management/rbac_json.hxx +132 -125
- package/deps/couchbase-cxx-client/core/management/search_index.cxx +79 -0
- package/deps/couchbase-cxx-client/core/management/search_index.hxx +11 -10
- package/deps/couchbase-cxx-client/core/management/search_index_json.hxx +27 -26
- package/deps/couchbase-cxx-client/core/mcbp/barrier_frame.hxx +4 -3
- package/deps/couchbase-cxx-client/core/mcbp/big_endian.cxx +22 -22
- package/deps/couchbase-cxx-client/core/mcbp/buffer_writer.cxx +22 -19
- package/deps/couchbase-cxx-client/core/mcbp/buffer_writer.hxx +9 -9
- package/deps/couchbase-cxx-client/core/mcbp/codec.cxx +419 -397
- package/deps/couchbase-cxx-client/core/mcbp/codec.hxx +14 -12
- package/deps/couchbase-cxx-client/core/mcbp/command_code.cxx +48 -48
- package/deps/couchbase-cxx-client/core/mcbp/completion_token.hxx +33 -33
- package/deps/couchbase-cxx-client/core/mcbp/datatype.hxx +3 -3
- package/deps/couchbase-cxx-client/core/mcbp/durability_level.hxx +8 -7
- package/deps/couchbase-cxx-client/core/mcbp/durability_level_frame.hxx +3 -2
- package/deps/couchbase-cxx-client/core/mcbp/durability_timeout_frame.hxx +4 -3
- package/deps/couchbase-cxx-client/core/mcbp/open_tracing_frame.hxx +3 -2
- package/deps/couchbase-cxx-client/core/mcbp/operation_consumer.cxx +3 -3
- package/deps/couchbase-cxx-client/core/mcbp/operation_consumer.hxx +9 -9
- package/deps/couchbase-cxx-client/core/mcbp/operation_queue.cxx +76 -70
- package/deps/couchbase-cxx-client/core/mcbp/operation_queue.hxx +18 -17
- package/deps/couchbase-cxx-client/core/mcbp/packet.cxx +65 -51
- package/deps/couchbase-cxx-client/core/mcbp/packet.hxx +25 -25
- package/deps/couchbase-cxx-client/core/mcbp/preserve_expiry_frame.hxx +4 -2
- package/deps/couchbase-cxx-client/core/mcbp/queue_callback.hxx +3 -2
- package/deps/couchbase-cxx-client/core/mcbp/queue_request.cxx +65 -62
- package/deps/couchbase-cxx-client/core/mcbp/queue_request.hxx +54 -52
- package/deps/couchbase-cxx-client/core/mcbp/queue_request_connection_info.hxx +3 -3
- package/deps/couchbase-cxx-client/core/mcbp/queue_response.hxx +7 -7
- package/deps/couchbase-cxx-client/core/mcbp/read_units_frame.hxx +3 -2
- package/deps/couchbase-cxx-client/core/mcbp/server_duration.cxx +7 -7
- package/deps/couchbase-cxx-client/core/mcbp/server_duration_frame.hxx +3 -2
- package/deps/couchbase-cxx-client/core/mcbp/stream_id_frame.hxx +3 -2
- package/deps/couchbase-cxx-client/core/mcbp/unsupported_frame.hxx +4 -3
- package/deps/couchbase-cxx-client/core/mcbp/user_impersonation_frame.hxx +1 -1
- package/deps/couchbase-cxx-client/core/mcbp/write_units_frame.hxx +3 -2
- package/deps/couchbase-cxx-client/core/meta/features.hxx +58 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +255 -204
- package/deps/couchbase-cxx-client/core/meta/version.hxx +31 -20
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +160 -154
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.hxx +16 -15
- package/deps/couchbase-cxx-client/core/metrics/logging_meter_options.hxx +1 -1
- package/deps/couchbase-cxx-client/core/metrics/noop_meter.hxx +14 -13
- package/deps/couchbase-cxx-client/core/mozilla_ca_bundle.hxx +2 -2
- package/deps/couchbase-cxx-client/core/n1ql_query_options.cxx +31 -31
- package/deps/couchbase-cxx-client/core/n1ql_query_options.hxx +22 -21
- package/deps/couchbase-cxx-client/core/operation_map.hxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +187 -176
- package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +79 -71
- package/deps/couchbase-cxx-client/core/operations/document_append.cxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/document_append.hxx +18 -16
- package/deps/couchbase-cxx-client/core/operations/document_decrement.cxx +26 -23
- package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +24 -20
- package/deps/couchbase-cxx-client/core/operations/document_exists.cxx +23 -21
- package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +25 -23
- package/deps/couchbase-cxx-client/core/operations/document_get.cxx +17 -15
- package/deps/couchbase-cxx-client/core/operations/document_get.hxx +17 -15
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +121 -92
- package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.cxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +21 -17
- package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.cxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +22 -18
- package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +111 -82
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +193 -184
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +25 -21
- package/deps/couchbase-cxx-client/core/operations/document_increment.cxx +26 -23
- package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +24 -20
- package/deps/couchbase-cxx-client/core/operations/document_insert.cxx +23 -20
- package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +20 -18
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in.cxx +80 -67
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +31 -27
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +187 -149
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +190 -145
- package/deps/couchbase-cxx-client/core/operations/document_mutate_in.cxx +98 -80
- package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +38 -33
- package/deps/couchbase-cxx-client/core/operations/document_prepend.cxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +18 -16
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +367 -356
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +83 -79
- package/deps/couchbase-cxx-client/core/operations/document_remove.cxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +18 -16
- package/deps/couchbase-cxx-client/core/operations/document_replace.cxx +27 -24
- package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +22 -20
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +322 -308
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +125 -121
- package/deps/couchbase-cxx-client/core/operations/document_touch.cxx +16 -14
- package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +19 -17
- package/deps/couchbase-cxx-client/core/operations/document_unlock.cxx +16 -14
- package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +19 -17
- package/deps/couchbase-cxx-client/core/operations/document_upsert.cxx +26 -23
- package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +21 -19
- package/deps/couchbase-cxx-client/core/operations/document_view.cxx +169 -159
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +68 -65
- package/deps/couchbase-cxx-client/core/operations/http_noop.cxx +38 -35
- package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +12 -10
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.cxx +58 -56
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +20 -17
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.cxx +49 -44
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.cxx +46 -43
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +16 -13
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.cxx +48 -43
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.cxx +48 -43
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.cxx +38 -35
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +16 -14
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.cxx +68 -66
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +20 -17
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.cxx +56 -51
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.cxx +44 -42
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +16 -13
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.cxx +49 -43
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +23 -20
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.cxx +52 -51
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +33 -30
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.cxx +46 -42
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +22 -19
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.cxx +70 -67
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +22 -19
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +92 -85
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +27 -24
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.cxx +52 -51
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +33 -30
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_utils.hxx +6 -4
- package/deps/couchbase-cxx-client/core/operations/management/analytics_problem.hxx +2 -2
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.cxx +158 -149
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +14 -12
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +118 -42
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +47 -22
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +19 -18
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +25 -24
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +24 -22
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +14 -12
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.cxx +25 -23
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.cxx +112 -107
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +15 -13
- package/deps/couchbase-cxx-client/core/operations/management/change_password.cxx +22 -20
- package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.cxx +52 -50
- package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +31 -29
- package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.cxx +14 -12
- package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +48 -46
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +37 -35
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +16 -14
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +49 -47
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.cxx +11 -9
- package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +17 -13
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +210 -198
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.hxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.cxx +30 -28
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.cxx +31 -29
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.cxx +49 -43
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.cxx +29 -27
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.cxx +45 -39
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.cxx +30 -28
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_problem.hxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.cxx +30 -28
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.cxx +30 -28
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.cxx +328 -318
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/freeform.cxx +23 -22
- package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +19 -17
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.cxx +18 -17
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/group_get.cxx +25 -23
- package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +14 -12
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.cxx +23 -22
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.cxx +58 -55
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +14 -12
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.cxx +53 -48
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +25 -22
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +75 -67
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +128 -122
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +31 -28
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +95 -93
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +26 -24
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +97 -93
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +24 -21
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.cxx +66 -62
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +24 -22
- package/deps/couchbase-cxx-client/core/operations/management/role_get_all.cxx +24 -22
- package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +38 -36
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +15 -13
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +33 -32
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +15 -13
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +27 -25
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +14 -12
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.cxx +12 -10
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +13 -11
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +72 -67
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +20 -18
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +62 -59
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +62 -59
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +19 -17
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +62 -59
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +19 -16
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +58 -55
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +59 -56
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +18 -16
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +51 -46
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +18 -15
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +66 -61
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +19 -17
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.cxx +38 -36
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +17 -14
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +98 -95
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +20 -17
- package/deps/couchbase-cxx-client/core/operations/management/user_drop.cxx +18 -17
- package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +16 -12
- package/deps/couchbase-cxx-client/core/operations/management/user_get.cxx +25 -23
- package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +17 -13
- package/deps/couchbase-cxx-client/core/operations/management/user_get_all.cxx +24 -22
- package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +16 -12
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +63 -60
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +17 -13
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +16 -12
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +15 -13
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +40 -35
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +16 -14
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +73 -69
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +16 -13
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +39 -35
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +15 -12
- package/deps/couchbase-cxx-client/core/origin.cxx +259 -249
- package/deps/couchbase-cxx-client/core/origin.hxx +55 -49
- package/deps/couchbase-cxx-client/core/pending_operation.hxx +3 -3
- package/deps/couchbase-cxx-client/core/ping_collector.hxx +3 -3
- package/deps/couchbase-cxx-client/core/ping_options.hxx +30 -30
- package/deps/couchbase-cxx-client/core/ping_reporter.hxx +3 -3
- package/deps/couchbase-cxx-client/core/platform/backtrace.c +100 -91
- package/deps/couchbase-cxx-client/core/platform/base64.cc +135 -134
- package/deps/couchbase-cxx-client/core/platform/dirutils.cc +66 -63
- package/deps/couchbase-cxx-client/core/platform/random.cc +43 -42
- package/deps/couchbase-cxx-client/core/platform/random.h +4 -4
- package/deps/couchbase-cxx-client/core/platform/string_hex.cc +42 -40
- package/deps/couchbase-cxx-client/core/platform/terminate_handler.cc +54 -52
- package/deps/couchbase-cxx-client/core/platform/uuid.cc +47 -47
- package/deps/couchbase-cxx-client/core/protocol/client_opcode.hxx +336 -327
- package/deps/couchbase-cxx-client/core/protocol/client_opcode_fmt.hxx +291 -291
- package/deps/couchbase-cxx-client/core/protocol/client_request.cxx +13 -10
- package/deps/couchbase-cxx-client/core/protocol/client_request.hxx +133 -130
- package/deps/couchbase-cxx-client/core/protocol/client_response.cxx +40 -40
- package/deps/couchbase-cxx-client/core/protocol/client_response.hxx +153 -150
- package/deps/couchbase-cxx-client/core/protocol/cmd_append.cxx +24 -23
- package/deps/couchbase-cxx-client/core/protocol/cmd_append.hxx +65 -65
- package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.cxx +25 -21
- package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.hxx +33 -25
- package/deps/couchbase-cxx-client/core/protocol/cmd_decrement.cxx +38 -38
- package/deps/couchbase-cxx-client/core/protocol/cmd_decrement.hxx +87 -87
- package/deps/couchbase-cxx-client/core/protocol/cmd_get.cxx +17 -17
- package/deps/couchbase-cxx-client/core/protocol/cmd_get.hxx +59 -59
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_lock.cxx +20 -20
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_lock.hxx +72 -72
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_touch.cxx +20 -20
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_touch.hxx +72 -72
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_cluster_config.cxx +46 -39
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_cluster_config.hxx +57 -49
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_collection_id.cxx +17 -17
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_collection_id.hxx +59 -59
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_collections_manifest.cxx +16 -14
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_collections_manifest.hxx +39 -39
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_error_map.cxx +18 -17
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_error_map.hxx +62 -62
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_meta.cxx +24 -23
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_meta.hxx +81 -79
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_replica.cxx +23 -23
- package/deps/couchbase-cxx-client/core/protocol/cmd_get_replica.hxx +44 -44
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.cxx +28 -27
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +106 -105
- package/deps/couchbase-cxx-client/core/protocol/cmd_increment.cxx +38 -38
- package/deps/couchbase-cxx-client/core/protocol/cmd_increment.hxx +87 -87
- package/deps/couchbase-cxx-client/core/protocol/cmd_info.hxx +3 -3
- package/deps/couchbase-cxx-client/core/protocol/cmd_insert.cxx +27 -27
- package/deps/couchbase-cxx-client/core/protocol/cmd_insert.hxx +81 -81
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in.cxx +54 -51
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in.hxx +90 -90
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.cxx +54 -51
- package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.hxx +88 -88
- package/deps/couchbase-cxx-client/core/protocol/cmd_mutate_in.cxx +105 -97
- package/deps/couchbase-cxx-client/core/protocol/cmd_mutate_in.hxx +161 -153
- package/deps/couchbase-cxx-client/core/protocol/cmd_noop.cxx +4 -4
- package/deps/couchbase-cxx-client/core/protocol/cmd_noop.hxx +32 -32
- package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.cxx +36 -34
- package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.hxx +89 -89
- package/deps/couchbase-cxx-client/core/protocol/cmd_prepend.cxx +22 -22
- package/deps/couchbase-cxx-client/core/protocol/cmd_prepend.hxx +63 -63
- package/deps/couchbase-cxx-client/core/protocol/cmd_remove.cxx +23 -23
- package/deps/couchbase-cxx-client/core/protocol/cmd_remove.hxx +54 -54
- package/deps/couchbase-cxx-client/core/protocol/cmd_replace.cxx +28 -28
- package/deps/couchbase-cxx-client/core/protocol/cmd_replace.hxx +88 -88
- package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_auth.cxx +17 -15
- package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_auth.hxx +56 -56
- package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_list_mechs.cxx +24 -19
- package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_list_mechs.hxx +39 -39
- package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_step.cxx +17 -15
- package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_step.hxx +56 -56
- package/deps/couchbase-cxx-client/core/protocol/cmd_select_bucket.cxx +6 -6
- package/deps/couchbase-cxx-client/core/protocol/cmd_select_bucket.hxx +36 -36
- package/deps/couchbase-cxx-client/core/protocol/cmd_touch.cxx +8 -8
- package/deps/couchbase-cxx-client/core/protocol/cmd_touch.hxx +38 -38
- package/deps/couchbase-cxx-client/core/protocol/cmd_unlock.cxx +5 -5
- package/deps/couchbase-cxx-client/core/protocol/cmd_unlock.hxx +36 -36
- package/deps/couchbase-cxx-client/core/protocol/cmd_upsert.cxx +28 -28
- package/deps/couchbase-cxx-client/core/protocol/cmd_upsert.hxx +83 -83
- package/deps/couchbase-cxx-client/core/protocol/datatype.hxx +19 -18
- package/deps/couchbase-cxx-client/core/protocol/frame_info_id.hxx +108 -103
- package/deps/couchbase-cxx-client/core/protocol/frame_info_id_fmt.hxx +45 -45
- package/deps/couchbase-cxx-client/core/protocol/frame_info_utils.cxx +24 -21
- package/deps/couchbase-cxx-client/core/protocol/frame_info_utils.hxx +3 -1
- package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +211 -175
- package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +93 -90
- package/deps/couchbase-cxx-client/core/protocol/magic.hxx +24 -24
- package/deps/couchbase-cxx-client/core/protocol/magic_fmt.hxx +30 -30
- package/deps/couchbase-cxx-client/core/protocol/server_opcode.hxx +11 -11
- package/deps/couchbase-cxx-client/core/protocol/server_opcode_fmt.hxx +18 -18
- package/deps/couchbase-cxx-client/core/protocol/server_request.hxx +90 -86
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +138 -138
- package/deps/couchbase-cxx-client/core/protocol/status.hxx +86 -86
- package/deps/couchbase-cxx-client/core/query_context.hxx +44 -43
- package/deps/couchbase-cxx-client/core/range_scan_load_balancer.cxx +51 -50
- package/deps/couchbase-cxx-client/core/range_scan_load_balancer.hxx +26 -25
- package/deps/couchbase-cxx-client/core/range_scan_options.cxx +2 -2
- package/deps/couchbase-cxx-client/core/range_scan_options.hxx +62 -59
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +515 -470
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +23 -18
- package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +10 -10
- package/deps/couchbase-cxx-client/core/resource_units.hxx +2 -2
- package/deps/couchbase-cxx-client/core/response_handler.hxx +8 -8
- package/deps/couchbase-cxx-client/core/retry_orchestrator.cxx +27 -19
- package/deps/couchbase-cxx-client/core/retry_orchestrator.hxx +3 -2
- package/deps/couchbase-cxx-client/core/sasl/client.cc +22 -18
- package/deps/couchbase-cxx-client/core/sasl/client.h +66 -62
- package/deps/couchbase-cxx-client/core/sasl/context.cc +4 -4
- package/deps/couchbase-cxx-client/core/sasl/context.h +19 -19
- package/deps/couchbase-cxx-client/core/sasl/error.h +12 -1
- package/deps/couchbase-cxx-client/core/sasl/error_fmt.h +42 -42
- package/deps/couchbase-cxx-client/core/sasl/mechanism.cc +13 -10
- package/deps/couchbase-cxx-client/core/sasl/mechanism.h +8 -3
- package/deps/couchbase-cxx-client/core/sasl/plain/plain.cc +8 -8
- package/deps/couchbase-cxx-client/core/sasl/plain/plain.h +25 -24
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/scram-sha.cc +225 -218
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/scram-sha.h +133 -115
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.cc +20 -20
- package/deps/couchbase-cxx-client/core/scan_result.cxx +38 -38
- package/deps/couchbase-cxx-client/core/scan_result.hxx +16 -16
- package/deps/couchbase-cxx-client/core/search_highlight_style.hxx +4 -1
- package/deps/couchbase-cxx-client/core/search_query_options.cxx +21 -21
- package/deps/couchbase-cxx-client/core/search_query_options.hxx +19 -18
- package/deps/couchbase-cxx-client/core/search_scan_consistency.hxx +3 -1
- package/deps/couchbase-cxx-client/core/seed_config.cxx +10 -7
- package/deps/couchbase-cxx-client/core/seed_config.hxx +8 -8
- package/deps/couchbase-cxx-client/core/service_type.hxx +7 -7
- package/deps/couchbase-cxx-client/core/service_type_fmt.hxx +33 -33
- package/deps/couchbase-cxx-client/core/stats_options.hxx +13 -13
- package/deps/couchbase-cxx-client/core/subdoc_options.hxx +60 -58
- package/deps/couchbase-cxx-client/core/tls_verify_mode.hxx +2 -2
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +83 -83
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +111 -111
- package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +14 -14
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_fmt.hxx +23 -21
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +26 -25
- package/deps/couchbase-cxx-client/core/topology/configuration.cxx +213 -192
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +104 -91
- package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +131 -128
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +276 -242
- package/deps/couchbase-cxx-client/core/topology/error_map.hxx +5 -5
- package/deps/couchbase-cxx-client/core/topology/error_map_json.hxx +65 -60
- package/deps/couchbase-cxx-client/core/tracing/constants.hxx +153 -153
- package/deps/couchbase-cxx-client/core/tracing/noop_tracer.hxx +29 -28
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_options.hxx +30 -30
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +354 -344
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.hxx +12 -12
- package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.cxx +153 -33
- package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.hxx +30 -118
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.cxx +8 -2
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +163 -127
- package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +358 -334
- package/deps/couchbase-cxx-client/core/transactions/atr_ids.cxx +270 -185
- package/deps/couchbase-cxx-client/core/transactions/atr_ids.hxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.cxx +9 -5
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +194 -154
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +3278 -2159
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +446 -573
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.cxx +15 -10
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.hxx +58 -49
- package/deps/couchbase-cxx-client/core/transactions/attempt_state.hxx +72 -72
- package/deps/couchbase-cxx-client/core/transactions/binary.cxx +3 -3
- package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.cxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.hxx +28 -24
- package/deps/couchbase-cxx-client/core/transactions/document_metadata.hxx +68 -68
- package/deps/couchbase-cxx-client/core/transactions/durability_level.hxx +53 -53
- package/deps/couchbase-cxx-client/core/transactions/error_class.hxx +12 -12
- package/deps/couchbase-cxx-client/core/transactions/error_list.hxx +22 -22
- package/deps/couchbase-cxx-client/core/transactions/exceptions.cxx +167 -114
- package/deps/couchbase-cxx-client/core/transactions/exceptions.hxx +170 -139
- package/deps/couchbase-cxx-client/core/transactions/exceptions_fmt.hxx +105 -0
- package/deps/couchbase-cxx-client/core/transactions/forward_compat.cxx +220 -0
- package/deps/couchbase-cxx-client/core/transactions/forward_compat.hxx +63 -207
- package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +110 -102
- package/deps/couchbase-cxx-client/core/transactions/internal/atr_entry.hxx +144 -144
- package/deps/couchbase-cxx-client/core/transactions/internal/client_record.hxx +53 -50
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.cxx +5 -5
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +38 -35
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record_fmt.hxx +17 -16
- package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +238 -281
- package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal_fmt.hxx +103 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +52 -29
- package/deps/couchbase-cxx-client/core/transactions/internal/transaction_attempt.hxx +3 -3
- package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +136 -120
- package/deps/couchbase-cxx-client/core/transactions/internal/transaction_fields.hxx +2 -1
- package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +127 -122
- package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +244 -219
- package/deps/couchbase-cxx-client/core/transactions/result.cxx +41 -40
- package/deps/couchbase-cxx-client/core/transactions/result.hxx +143 -141
- package/deps/couchbase-cxx-client/core/transactions/result_fmt.hxx +21 -20
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +759 -627
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +175 -156
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +231 -179
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.cxx +185 -198
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +207 -222
- package/deps/couchbase-cxx-client/core/transactions/transaction_keyspace.cxx +15 -11
- package/deps/couchbase-cxx-client/core/transactions/transaction_links.cxx +11 -7
- package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +222 -201
- package/deps/couchbase-cxx-client/core/transactions/transaction_options.cxx +44 -41
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +167 -125
- package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +491 -424
- package/deps/couchbase-cxx-client/core/transactions/transactions_config.cxx +25 -19
- package/deps/couchbase-cxx-client/core/transactions/uid_generator.cxx +3 -3
- package/deps/couchbase-cxx-client/core/transactions/uid_generator.hxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/utils.cxx +82 -69
- package/deps/couchbase-cxx-client/core/transactions/waitable_op_list.hxx +154 -140
- package/deps/couchbase-cxx-client/core/transactions.hxx +184 -180
- package/deps/couchbase-cxx-client/core/utils/binary.cxx +3 -3
- package/deps/couchbase-cxx-client/core/utils/binary.hxx +19 -15
- package/deps/couchbase-cxx-client/core/utils/byteswap.hxx +17 -17
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +395 -328
- package/deps/couchbase-cxx-client/core/utils/connection_string.hxx +37 -36
- package/deps/couchbase-cxx-client/core/utils/crc32.hxx +42 -34
- package/deps/couchbase-cxx-client/core/utils/duration_parser.cxx +142 -133
- package/deps/couchbase-cxx-client/core/utils/duration_parser.hxx +9 -9
- package/deps/couchbase-cxx-client/core/utils/join_strings.hxx +24 -24
- package/deps/couchbase-cxx-client/core/utils/json.cxx +234 -228
- package/deps/couchbase-cxx-client/core/utils/json.hxx +12 -12
- package/deps/couchbase-cxx-client/core/utils/json_stream_control.hxx +8 -8
- package/deps/couchbase-cxx-client/core/utils/json_streaming_lexer.cxx +288 -263
- package/deps/couchbase-cxx-client/core/utils/json_streaming_lexer.hxx +20 -17
- package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +22 -21
- package/deps/couchbase-cxx-client/core/utils/movable_function.hxx +78 -76
- package/deps/couchbase-cxx-client/core/utils/mutation_token.cxx +7 -3
- package/deps/couchbase-cxx-client/core/utils/mutation_token.hxx +3 -1
- package/deps/couchbase-cxx-client/core/utils/name_codec.hxx +13 -13
- package/deps/couchbase-cxx-client/core/utils/split_string.cxx +9 -9
- package/deps/couchbase-cxx-client/core/utils/split_string.hxx +2 -2
- package/deps/couchbase-cxx-client/core/utils/unsigned_leb128.hxx +92 -88
- package/deps/couchbase-cxx-client/core/utils/url_codec.cxx +301 -297
- package/deps/couchbase-cxx-client/core/utils/url_codec.hxx +35 -35
- package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +4 -1
- package/deps/couchbase-cxx-client/core/view_on_error.hxx +4 -3
- package/deps/couchbase-cxx-client/core/view_query_options.cxx +21 -21
- package/deps/couchbase-cxx-client/core/view_query_options.hxx +23 -22
- package/deps/couchbase-cxx-client/core/view_scan_consistency.hxx +3 -3
- package/deps/couchbase-cxx-client/core/view_sort_order.hxx +4 -1
- package/deps/couchbase-cxx-client/core/wait_until_ready_options.hxx +11 -10
- package/deps/couchbase-cxx-client/couchbase/allow_querying_search_index_options.hxx +11 -11
- package/deps/couchbase-cxx-client/couchbase/analytics_index_manager.hxx +423 -405
- package/deps/couchbase-cxx-client/couchbase/analytics_meta_data.hxx +105 -105
- package/deps/couchbase-cxx-client/couchbase/analytics_metrics.hxx +120 -118
- package/deps/couchbase-cxx-client/couchbase/analytics_options.hxx +318 -292
- package/deps/couchbase-cxx-client/couchbase/analytics_result.hxx +56 -55
- package/deps/couchbase-cxx-client/couchbase/analytics_scan_consistency.hxx +24 -21
- package/deps/couchbase-cxx-client/couchbase/analytics_status.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/analytics_warning.hxx +44 -43
- package/deps/couchbase-cxx-client/couchbase/analyze_document_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/append_options.hxx +51 -47
- package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +75 -69
- package/deps/couchbase-cxx-client/couchbase/best_effort_retry_strategy.hxx +12 -10
- package/deps/couchbase-cxx-client/couchbase/binary_collection.hxx +213 -183
- package/deps/couchbase-cxx-client/couchbase/boolean_field_query.hxx +38 -38
- package/deps/couchbase-cxx-client/couchbase/boolean_query.hxx +166 -157
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +69 -68
- package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +97 -88
- package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +22 -21
- package/deps/couchbase-cxx-client/couchbase/cas.hxx +74 -73
- package/deps/couchbase-cxx-client/couchbase/certificate_authenticator.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +266 -310
- package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +235 -241
- package/deps/couchbase-cxx-client/couchbase/codec/binary_noop_serializer.hxx +11 -11
- package/deps/couchbase-cxx-client/couchbase/codec/codec_flags.hxx +39 -35
- package/deps/couchbase-cxx-client/couchbase/codec/encoded_value.hxx +15 -2
- package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +17 -15
- package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +19 -17
- package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +31 -24
- package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +20 -18
- package/deps/couchbase-cxx-client/couchbase/codec/tao_json_serializer.hxx +38 -30
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +1007 -902
- package/deps/couchbase-cxx-client/couchbase/collection_manager.hxx +115 -107
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +200 -188
- package/deps/couchbase-cxx-client/couchbase/common_durability_options.hxx +68 -62
- package/deps/couchbase-cxx-client/couchbase/common_options.hxx +67 -67
- package/deps/couchbase-cxx-client/couchbase/compression_options.hxx +33 -33
- package/deps/couchbase-cxx-client/couchbase/configuration_profile.hxx +12 -11
- package/deps/couchbase-cxx-client/couchbase/configuration_profiles_registry.hxx +24 -22
- package/deps/couchbase-cxx-client/couchbase/conjunction_query.hxx +47 -45
- package/deps/couchbase-cxx-client/couchbase/connect_link_analytics_options.hxx +74 -72
- package/deps/couchbase-cxx-client/couchbase/counter_result.hxx +32 -32
- package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +9 -10
- package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +35 -34
- package/deps/couchbase-cxx-client/couchbase/create_dataset_analytics_options.hxx +76 -76
- package/deps/couchbase-cxx-client/couchbase/create_dataverse_analytics_options.hxx +44 -44
- package/deps/couchbase-cxx-client/couchbase/create_index_analytics_options.hxx +60 -60
- package/deps/couchbase-cxx-client/couchbase/create_link_analytics_options.hxx +25 -25
- package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +95 -94
- package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +97 -96
- package/deps/couchbase-cxx-client/couchbase/create_scope_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/date_range.hxx +29 -27
- package/deps/couchbase-cxx-client/couchbase/date_range_facet.hxx +20 -20
- package/deps/couchbase-cxx-client/couchbase/date_range_facet_result.hxx +14 -14
- package/deps/couchbase-cxx-client/couchbase/date_range_query.hxx +219 -205
- package/deps/couchbase-cxx-client/couchbase/decrement_options.hxx +93 -91
- package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +42 -41
- package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +82 -83
- package/deps/couchbase-cxx-client/couchbase/disallow_querying_search_index_options.hxx +11 -10
- package/deps/couchbase-cxx-client/couchbase/disconnect_link_analytics_options.hxx +62 -62
- package/deps/couchbase-cxx-client/couchbase/disjunction_query.hxx +61 -60
- package/deps/couchbase-cxx-client/couchbase/dns_options.hxx +30 -30
- package/deps/couchbase-cxx-client/couchbase/doc_id_query.hxx +69 -69
- package/deps/couchbase-cxx-client/couchbase/drop_bucket_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/drop_collection_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/drop_dataset_analytics_options.hxx +60 -60
- package/deps/couchbase-cxx-client/couchbase/drop_dataverse_analytics_options.hxx +44 -44
- package/deps/couchbase-cxx-client/couchbase/drop_index_analytics_options.hxx +60 -60
- package/deps/couchbase-cxx-client/couchbase/drop_link_analytics_options.hxx +25 -25
- package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +58 -58
- package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +44 -44
- package/deps/couchbase-cxx-client/couchbase/drop_scope_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/drop_search_index_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/durability_level.hxx +32 -29
- package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +171 -171
- package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +166 -169
- package/deps/couchbase-cxx-client/couchbase/error.hxx +51 -0
- package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +975 -940
- package/deps/couchbase-cxx-client/couchbase/error_context.hxx +19 -152
- package/deps/couchbase-cxx-client/couchbase/exists_options.hxx +25 -24
- package/deps/couchbase-cxx-client/couchbase/exists_result.hxx +32 -32
- package/deps/couchbase-cxx-client/couchbase/fail_fast_retry_strategy.hxx +4 -4
- package/deps/couchbase-cxx-client/couchbase/flush_bucket_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/fmt/analytics_scan_consistency.hxx +18 -18
- package/deps/couchbase-cxx-client/couchbase/fmt/analytics_status.hxx +42 -42
- package/deps/couchbase-cxx-client/couchbase/fmt/cas.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/fmt/durability_level.hxx +24 -24
- package/deps/couchbase-cxx-client/couchbase/fmt/error.hxx +53 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/error_context.hxx +43 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/mutation_token.hxx +15 -11
- package/deps/couchbase-cxx-client/couchbase/fmt/query_profile.hxx +21 -21
- package/deps/couchbase-cxx-client/couchbase/fmt/query_scan_consistency.hxx +18 -18
- package/deps/couchbase-cxx-client/couchbase/fmt/query_status.hxx +42 -42
- package/deps/couchbase-cxx-client/couchbase/fmt/retry_reason.hxx +75 -75
- package/deps/couchbase-cxx-client/couchbase/fmt/search_scan_consistency.hxx +15 -15
- package/deps/couchbase-cxx-client/couchbase/fmt/tls_verify_mode.hxx +18 -18
- package/deps/couchbase-cxx-client/couchbase/fmt/transaction_keyspace.hxx +15 -11
- package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +12 -12
- package/deps/couchbase-cxx-client/couchbase/freeze_plan_search_index_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/geo_bounding_box_query.hxx +71 -64
- package/deps/couchbase-cxx-client/couchbase/geo_distance_query.hxx +73 -66
- package/deps/couchbase-cxx-client/couchbase/geo_point.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/geo_polygon_query.hxx +40 -39
- package/deps/couchbase-cxx-client/couchbase/get_all_buckets_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/get_all_datasets_analytics_options.hxx +25 -25
- package/deps/couchbase-cxx-client/couchbase/get_all_indexes_analytics_options.hxx +26 -25
- package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +27 -25
- package/deps/couchbase-cxx-client/couchbase/get_all_replicas_options.hxx +49 -26
- package/deps/couchbase-cxx-client/couchbase/get_all_scopes_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/get_all_search_indexes_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +25 -24
- package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +25 -24
- package/deps/couchbase-cxx-client/couchbase/get_any_replica_options.hxx +49 -26
- package/deps/couchbase-cxx-client/couchbase/get_bucket_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/get_indexed_search_index_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +74 -74
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +63 -60
- package/deps/couchbase-cxx-client/couchbase/get_pending_mutations_analytics_options.hxx +30 -28
- package/deps/couchbase-cxx-client/couchbase/get_replica_result.hxx +79 -75
- package/deps/couchbase-cxx-client/couchbase/get_result.hxx +86 -80
- package/deps/couchbase-cxx-client/couchbase/get_search_index_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/highlight_style.hxx +14 -14
- package/deps/couchbase-cxx-client/couchbase/increment_options.hxx +94 -91
- package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +62 -59
- package/deps/couchbase-cxx-client/couchbase/ip_protocol.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/logger.hxx +51 -0
- package/deps/couchbase-cxx-client/couchbase/lookup_in_all_replicas_options.hxx +54 -43
- package/deps/couchbase-cxx-client/couchbase/lookup_in_any_replica_options.hxx +54 -44
- package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +40 -40
- package/deps/couchbase-cxx-client/couchbase/lookup_in_replica_result.hxx +38 -35
- package/deps/couchbase-cxx-client/couchbase/lookup_in_result.hxx +222 -216
- package/deps/couchbase-cxx-client/couchbase/lookup_in_specs.hxx +101 -101
- package/deps/couchbase-cxx-client/couchbase/management/analytics_dataset.hxx +16 -16
- package/deps/couchbase-cxx-client/couchbase/management/analytics_index.hxx +16 -16
- package/deps/couchbase-cxx-client/couchbase/management/analytics_link.hxx +193 -189
- package/deps/couchbase-cxx-client/couchbase/management/bucket_settings.hxx +91 -75
- package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +4 -4
- package/deps/couchbase-cxx-client/couchbase/management/query_index.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/management/scope_spec.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/management/search_index.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/match_all_query.hxx +10 -9
- package/deps/couchbase-cxx-client/couchbase/match_none_query.hxx +10 -9
- package/deps/couchbase-cxx-client/couchbase/match_operator.hxx +15 -14
- package/deps/couchbase-cxx-client/couchbase/match_phrase_query.hxx +70 -65
- package/deps/couchbase-cxx-client/couchbase/match_query.hxx +115 -114
- package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +33 -30
- package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +86 -74
- package/deps/couchbase-cxx-client/couchbase/metrics_options.hxx +34 -34
- package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +160 -149
- package/deps/couchbase-cxx-client/couchbase/mutate_in_result.hxx +130 -123
- package/deps/couchbase-cxx-client/couchbase/mutate_in_specs.hxx +473 -454
- package/deps/couchbase-cxx-client/couchbase/mutation_result.hxx +32 -32
- package/deps/couchbase-cxx-client/couchbase/mutation_state.hxx +35 -34
- package/deps/couchbase-cxx-client/couchbase/mutation_token.hxx +78 -78
- package/deps/couchbase-cxx-client/couchbase/network_options.hxx +101 -72
- package/deps/couchbase-cxx-client/couchbase/numeric_range.hxx +26 -26
- package/deps/couchbase-cxx-client/couchbase/numeric_range_facet.hxx +20 -20
- package/deps/couchbase-cxx-client/couchbase/numeric_range_facet_result.hxx +14 -14
- package/deps/couchbase-cxx-client/couchbase/numeric_range_query.hxx +97 -95
- package/deps/couchbase-cxx-client/couchbase/password_authenticator.hxx +17 -17
- package/deps/couchbase-cxx-client/couchbase/pause_ingest_search_index_options.hxx +11 -10
- package/deps/couchbase-cxx-client/couchbase/persist_to.hxx +45 -44
- package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +69 -65
- package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +55 -54
- package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +79 -77
- package/deps/couchbase-cxx-client/couchbase/prefix_query.hxx +43 -40
- package/deps/couchbase-cxx-client/couchbase/prepend_options.hxx +51 -47
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +207 -199
- package/deps/couchbase-cxx-client/couchbase/query_meta_data.hxx +120 -120
- package/deps/couchbase-cxx-client/couchbase/query_metrics.hxx +135 -133
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +518 -493
- package/deps/couchbase-cxx-client/couchbase/query_profile.hxx +29 -26
- package/deps/couchbase-cxx-client/couchbase/query_result.hxx +56 -55
- package/deps/couchbase-cxx-client/couchbase/query_scan_consistency.hxx +24 -21
- package/deps/couchbase-cxx-client/couchbase/query_status.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/query_string_query.hxx +34 -29
- package/deps/couchbase-cxx-client/couchbase/query_warning.hxx +75 -71
- package/deps/couchbase-cxx-client/couchbase/read_preference.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/regexp_query.hxx +40 -39
- package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +51 -47
- package/deps/couchbase-cxx-client/couchbase/replace_link_analytics_options.hxx +25 -25
- package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +112 -104
- package/deps/couchbase-cxx-client/couchbase/replicate_to.hxx +28 -28
- package/deps/couchbase-cxx-client/couchbase/result.hxx +28 -28
- package/deps/couchbase-cxx-client/couchbase/resume_ingest_search_index_options.hxx +11 -10
- package/deps/couchbase-cxx-client/couchbase/retry_action.hxx +10 -10
- package/deps/couchbase-cxx-client/couchbase/retry_reason.hxx +53 -51
- package/deps/couchbase-cxx-client/couchbase/retry_request.hxx +7 -7
- package/deps/couchbase-cxx-client/couchbase/retry_strategy.hxx +4 -4
- package/deps/couchbase-cxx-client/couchbase/scan_options.hxx +114 -108
- package/deps/couchbase-cxx-client/couchbase/scan_result.hxx +97 -96
- package/deps/couchbase-cxx-client/couchbase/scan_result_item.hxx +120 -118
- package/deps/couchbase-cxx-client/couchbase/scan_type.hxx +237 -232
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +164 -157
- package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +263 -238
- package/deps/couchbase-cxx-client/couchbase/search_date_range.hxx +32 -29
- package/deps/couchbase-cxx-client/couchbase/search_facet.hxx +25 -25
- package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +11 -11
- package/deps/couchbase-cxx-client/couchbase/search_geo_distance_units.hxx +11 -1
- package/deps/couchbase-cxx-client/couchbase/search_index_manager.hxx +261 -238
- package/deps/couchbase-cxx-client/couchbase/search_meta_data.hxx +37 -37
- package/deps/couchbase-cxx-client/couchbase/search_metrics.hxx +84 -83
- package/deps/couchbase-cxx-client/couchbase/search_numeric_range.hxx +32 -32
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +449 -435
- package/deps/couchbase-cxx-client/couchbase/search_query.hxx +32 -30
- package/deps/couchbase-cxx-client/couchbase/search_request.hxx +69 -68
- package/deps/couchbase-cxx-client/couchbase/search_result.hxx +29 -26
- package/deps/couchbase-cxx-client/couchbase/search_row.hxx +52 -52
- package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +20 -20
- package/deps/couchbase-cxx-client/couchbase/search_row_locations.hxx +39 -38
- package/deps/couchbase-cxx-client/couchbase/search_scan_consistency.hxx +11 -10
- package/deps/couchbase-cxx-client/couchbase/search_sort.hxx +20 -20
- package/deps/couchbase-cxx-client/couchbase/search_sort_field.hxx +77 -71
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_missing.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_mode.hxx +3 -3
- package/deps/couchbase-cxx-client/couchbase/search_sort_field_type.hxx +4 -4
- package/deps/couchbase-cxx-client/couchbase/search_sort_geo_distance.hxx +41 -41
- package/deps/couchbase-cxx-client/couchbase/search_sort_id.hxx +23 -23
- package/deps/couchbase-cxx-client/couchbase/search_sort_score.hxx +23 -23
- package/deps/couchbase-cxx-client/couchbase/search_term_range.hxx +17 -17
- package/deps/couchbase-cxx-client/couchbase/security_options.hxx +50 -50
- package/deps/couchbase-cxx-client/couchbase/service_type.hxx +34 -34
- package/deps/couchbase-cxx-client/couchbase/store_semantics.hxx +28 -28
- package/deps/couchbase-cxx-client/couchbase/subdoc/array_add_unique.hxx +54 -54
- package/deps/couchbase-cxx-client/couchbase/subdoc/array_append.hxx +40 -40
- package/deps/couchbase-cxx-client/couchbase/subdoc/array_insert.hxx +41 -41
- package/deps/couchbase-cxx-client/couchbase/subdoc/array_prepend.hxx +41 -41
- package/deps/couchbase-cxx-client/couchbase/subdoc/count.hxx +24 -24
- package/deps/couchbase-cxx-client/couchbase/subdoc/counter.hxx +41 -41
- package/deps/couchbase-cxx-client/couchbase/subdoc/exists.hxx +24 -24
- package/deps/couchbase-cxx-client/couchbase/subdoc/get.hxx +45 -29
- package/deps/couchbase-cxx-client/couchbase/subdoc/insert.hxx +70 -54
- package/deps/couchbase-cxx-client/couchbase/subdoc/lookup_in_macro.hxx +13 -12
- package/deps/couchbase-cxx-client/couchbase/subdoc/mutate_in_macro.hxx +7 -2
- package/deps/couchbase-cxx-client/couchbase/subdoc/remove.hxx +24 -24
- package/deps/couchbase-cxx-client/couchbase/subdoc/replace.hxx +55 -39
- package/deps/couchbase-cxx-client/couchbase/subdoc/upsert.hxx +70 -54
- package/deps/couchbase-cxx-client/couchbase/term_facet.hxx +16 -16
- package/deps/couchbase-cxx-client/couchbase/term_facet_result.hxx +14 -14
- package/deps/couchbase-cxx-client/couchbase/term_query.hxx +107 -104
- package/deps/couchbase-cxx-client/couchbase/term_range_query.hxx +99 -96
- package/deps/couchbase-cxx-client/couchbase/timeout_options.hxx +118 -112
- package/deps/couchbase-cxx-client/couchbase/tls_verify_mode.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +25 -24
- package/deps/couchbase-cxx-client/couchbase/tracing/otel_tracer.hxx +45 -44
- package/deps/couchbase-cxx-client/couchbase/tracing/request_span.hxx +34 -34
- package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +27 -25
- package/deps/couchbase-cxx-client/couchbase/tracing_options.hxx +147 -142
- package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +149 -115
- package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +146 -95
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_get_result.hxx +52 -80
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +33 -29
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +101 -96
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +228 -223
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_result.hxx +11 -12
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_result.hxx +2 -3
- package/deps/couchbase-cxx-client/couchbase/transactions/transactions_cleanup_config.hxx +105 -104
- package/deps/couchbase-cxx-client/couchbase/transactions/transactions_config.hxx +191 -187
- package/deps/couchbase-cxx-client/couchbase/transactions/transactions_query_config.hxx +32 -32
- package/deps/couchbase-cxx-client/couchbase/transactions.hxx +56 -37
- package/deps/couchbase-cxx-client/couchbase/unfreeze_plan_search_index_options.hxx +11 -10
- package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +25 -24
- package/deps/couchbase-cxx-client/couchbase/update_bucket_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +35 -34
- package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +85 -80
- package/deps/couchbase-cxx-client/couchbase/upsert_search_index_options.hxx +9 -9
- package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +82 -62
- package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +51 -47
- package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +45 -41
- package/deps/couchbase-cxx-client/couchbase/wan_development_configuration_profile.hxx +13 -13
- package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +41 -41
- package/deps/couchbase-cxx-client/couchbase/wildcard_query.hxx +42 -41
- package/deps/couchbase-cxx-client/third_party/expected/include/tl/expected.hpp +1746 -1584
- package/deps/couchbase-cxx-client/third_party/jsonsl/jsonsl.c +2664 -2638
- package/deps/couchbase-cxx-client/third_party/jsonsl/jsonsl.h +359 -342
- package/dist/binding.d.ts +39 -4
- package/dist/binding.js +4 -1
- package/dist/collection.js +0 -1
- package/dist/diagnosticstypes.js +2 -2
- package/dist/searchtypes.d.ts +0 -4
- package/dist/searchtypes.js +0 -4
- package/dist/transactions.d.ts +1 -0
- package/dist/transactions.js +12 -2
- package/dist/vectorsearch.d.ts +4 -19
- package/dist/vectorsearch.js +24 -19
- package/package.json +28 -28
- package/src/constants.cpp +111 -75
- package/src/jstocbpp_autogen.hpp +146 -15
- package/src/jstocbpp_basic.hpp +23 -0
- package/src/jstocbpp_errors.hpp +9 -9
- package/src/jstocbpp_transactions.hpp +17 -12
- package/src/transaction.cpp +10 -5
- package/tools/gen-bindings-js.js +1 -0
- package/tools/gen-bindings-json.py +5 -2
- package/deps/couchbase-cxx-client/core/impl/internal_manager_error_context.cxx +0 -113
- package/deps/couchbase-cxx-client/core/impl/internal_manager_error_context.hxx +0 -60
- package/deps/couchbase-cxx-client/core/impl/manager_error_context.cxx +0 -100
- package/deps/couchbase-cxx-client/core/impl/search_error_context.cxx +0 -147
- package/deps/couchbase-cxx-client/couchbase/analytics_error_context.hxx +0 -143
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_error_map_attribute.hxx +0 -100
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +0 -269
- package/deps/couchbase-cxx-client/couchbase/key_value_error_context.hxx +0 -229
- package/deps/couchbase-cxx-client/couchbase/key_value_error_map_attribute.hxx +0 -136
- package/deps/couchbase-cxx-client/couchbase/key_value_error_map_info.hxx +0 -138
- package/deps/couchbase-cxx-client/couchbase/key_value_extended_error_info.hxx +0 -86
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +0 -109
- package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +0 -111
- package/deps/couchbase-cxx-client/couchbase/query_error_context.hxx +0 -145
- package/deps/couchbase-cxx-client/couchbase/search_error_context.hxx +0 -138
- package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +0 -147
- package/deps/couchbase-cxx-client/couchbase/transaction_op_error_context.hxx +0 -76
@@ -64,1682 +64,1829 @@ namespace
|
|
64
64
|
{
|
65
65
|
template<typename Container>
|
66
66
|
struct mcbp_header_view {
|
67
|
-
|
67
|
+
const Container& buf_;
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
mcbp_header_view(const Container& buf)
|
70
|
+
: buf_{ buf }
|
71
|
+
{
|
72
|
+
}
|
73
73
|
};
|
74
74
|
|
75
75
|
struct mcbp_header_layout {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
}
|
97
|
-
return "vbucket";
|
76
|
+
std::uint8_t magic;
|
77
|
+
std::uint8_t opcode;
|
78
|
+
union {
|
79
|
+
std::uint16_t normal;
|
80
|
+
struct {
|
81
|
+
std::uint8_t framing_extras;
|
82
|
+
std::uint8_t key;
|
83
|
+
} alt;
|
84
|
+
} keylen;
|
85
|
+
std::uint8_t extlen;
|
86
|
+
std::uint8_t datatype;
|
87
|
+
std::uint16_t specific;
|
88
|
+
std::uint32_t bodylen;
|
89
|
+
std::uint32_t opaque;
|
90
|
+
std::uint64_t cas;
|
91
|
+
|
92
|
+
[[nodiscard]] constexpr auto specific_name() const -> std::string_view
|
93
|
+
{
|
94
|
+
if (magic == 0x18 || magic == 0x81) {
|
95
|
+
return "status";
|
98
96
|
}
|
97
|
+
return "vbucket";
|
98
|
+
}
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
}
|
105
|
-
return couchbase::core::utils::byte_swap(keylen.normal);
|
100
|
+
[[nodiscard]] constexpr auto key_length() const -> std::uint16_t
|
101
|
+
{
|
102
|
+
if (magic == 0x18 || magic == 0x08) {
|
103
|
+
return keylen.alt.key;
|
106
104
|
}
|
105
|
+
return couchbase::core::utils::byte_swap(keylen.normal);
|
106
|
+
}
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
}
|
113
|
-
return 0;
|
108
|
+
[[nodiscard]] constexpr auto framing_extras_length() const -> std::uint8_t
|
109
|
+
{
|
110
|
+
if (magic == 0x18 || magic == 0x08) {
|
111
|
+
return keylen.alt.framing_extras;
|
114
112
|
}
|
113
|
+
return 0;
|
114
|
+
}
|
115
115
|
};
|
116
116
|
} // namespace
|
117
117
|
|
118
118
|
template<typename Container>
|
119
119
|
struct fmt::formatter<mcbp_header_view<Container>> {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
120
|
+
template<typename ParseContext>
|
121
|
+
constexpr auto parse(ParseContext& ctx)
|
122
|
+
{
|
123
|
+
return ctx.begin();
|
124
|
+
}
|
125
|
+
|
126
|
+
template<typename FormatContext>
|
127
|
+
auto format(const mcbp_header_view<Container>& view, FormatContext& ctx) const
|
128
|
+
{
|
129
|
+
if (view.buf_.size() < sizeof(couchbase::core::io::binary_header)) {
|
130
|
+
return format_to(ctx.out(), "{:n}", spdlog::to_hex(view.buf_));
|
124
131
|
}
|
125
132
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
header->specific_name(),
|
144
|
-
couchbase::core::utils::byte_swap(header->specific),
|
145
|
-
couchbase::core::utils::byte_swap(header->bodylen),
|
146
|
-
couchbase::core::utils::byte_swap(header->opaque),
|
147
|
-
couchbase::core::utils::byte_swap(header->cas));
|
148
|
-
}
|
133
|
+
const auto* header = reinterpret_cast<const mcbp_header_layout*>(view.buf_.data());
|
134
|
+
return format_to(ctx.out(),
|
135
|
+
"{{magic=0x{:x}, opcode=0x{:x}, fextlen={}, keylen={}, extlen={}, "
|
136
|
+
"datatype={}, {}={}, bodylen={}, "
|
137
|
+
"opaque={}, cas={}}}",
|
138
|
+
header->magic,
|
139
|
+
header->opcode,
|
140
|
+
header->framing_extras_length(),
|
141
|
+
header->key_length(),
|
142
|
+
header->extlen,
|
143
|
+
header->datatype,
|
144
|
+
header->specific_name(),
|
145
|
+
couchbase::core::utils::byte_swap(header->specific),
|
146
|
+
couchbase::core::utils::byte_swap(header->bodylen),
|
147
|
+
couchbase::core::utils::byte_swap(header->opaque),
|
148
|
+
couchbase::core::utils::byte_swap(header->cas));
|
149
|
+
}
|
149
150
|
};
|
150
151
|
|
151
152
|
namespace couchbase::core::io
|
152
153
|
{
|
153
154
|
struct connection_endpoints {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
{
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
155
|
+
connection_endpoints(asio::ip::tcp::endpoint remote_endpoint,
|
156
|
+
asio::ip::tcp::endpoint local_endpoint)
|
157
|
+
: remote{ std::move(remote_endpoint) }
|
158
|
+
, remote_address{ remote.address().to_string() }
|
159
|
+
, remote_address_with_port{ remote.protocol() == asio::ip::tcp::v6()
|
160
|
+
? fmt::format("[{}]:{}", remote_address, remote.port())
|
161
|
+
: fmt::format("{}:{}", remote_address, remote.port()) }
|
162
|
+
, local{ std::move(local_endpoint) }
|
163
|
+
, local_address{ local.address().to_string() }
|
164
|
+
, local_address_with_port{ local.protocol() == asio::ip::tcp::v6()
|
165
|
+
? fmt::format("[{}]:{}", local_address, local.port())
|
166
|
+
: fmt::format("{}:{}", local_address, local.port()) }
|
167
|
+
{
|
168
|
+
}
|
169
|
+
|
170
|
+
asio::ip::tcp::endpoint remote;
|
171
|
+
std::string remote_address{};
|
172
|
+
std::string remote_address_with_port{};
|
173
|
+
|
174
|
+
asio::ip::tcp::endpoint local;
|
175
|
+
std::string local_address{};
|
176
|
+
std::string local_address_with_port{};
|
173
177
|
};
|
174
178
|
|
175
179
|
class collection_cache
|
176
180
|
{
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
}
|
187
|
-
return std::nullopt;
|
188
|
-
}
|
189
|
-
|
190
|
-
void update(const std::string& path, std::uint32_t id)
|
191
|
-
{
|
192
|
-
Expects(!path.empty());
|
193
|
-
cid_map_[path] = id;
|
194
|
-
}
|
195
|
-
|
196
|
-
void reset()
|
197
|
-
{
|
198
|
-
cid_map_.clear();
|
199
|
-
cid_map_["_default._default"] = 0;
|
181
|
+
private:
|
182
|
+
std::map<std::string, std::uint32_t> cid_map_{ { "_default._default", 0 } };
|
183
|
+
|
184
|
+
public:
|
185
|
+
[[nodiscard]] auto get(const std::string& path) -> std::optional<std::uint32_t>
|
186
|
+
{
|
187
|
+
Expects(!path.empty());
|
188
|
+
if (auto ptr = cid_map_.find(path); ptr != cid_map_.end()) {
|
189
|
+
return ptr->second;
|
200
190
|
}
|
191
|
+
return std::nullopt;
|
192
|
+
}
|
193
|
+
|
194
|
+
void update(const std::string& path, std::uint32_t id)
|
195
|
+
{
|
196
|
+
Expects(!path.empty());
|
197
|
+
cid_map_[path] = id;
|
198
|
+
}
|
199
|
+
|
200
|
+
void reset()
|
201
|
+
{
|
202
|
+
cid_map_.clear();
|
203
|
+
cid_map_["_default._default"] = 0;
|
204
|
+
}
|
201
205
|
};
|
202
206
|
|
203
207
|
class mcbp_session_impl
|
204
208
|
: public std::enable_shared_from_this<mcbp_session_impl>
|
205
209
|
, public operation_map
|
206
210
|
{
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
public:
|
216
|
-
~bootstrap_handler()
|
217
|
-
{
|
218
|
-
stop();
|
219
|
-
}
|
220
|
-
|
221
|
-
void stop()
|
222
|
-
{
|
223
|
-
bool expected_state{ false };
|
224
|
-
stopped_.compare_exchange_strong(expected_state, true);
|
225
|
-
}
|
226
|
-
|
227
|
-
static auto sasl_mechanisms(const std::shared_ptr<mcbp_session_impl>& session) -> std::vector<std::string>
|
228
|
-
{
|
229
|
-
if (const auto user_mechanisms = session->origin_.credentials().allowed_sasl_mechanisms; user_mechanisms.has_value()) {
|
230
|
-
return user_mechanisms.value();
|
231
|
-
}
|
232
|
-
if (session->is_tls_) {
|
233
|
-
return { "PLAIN" };
|
234
|
-
}
|
235
|
-
return { "SCRAM-SHA512", "SCRAM-SHA256", "SCRAM-SHA1" };
|
236
|
-
}
|
237
|
-
|
238
|
-
std::string last_error_message() &&
|
239
|
-
{
|
240
|
-
return std::move(last_error_message_);
|
241
|
-
}
|
242
|
-
|
243
|
-
[[nodiscard]] const std::string& last_error_message() const&
|
244
|
-
{
|
245
|
-
return last_error_message_;
|
246
|
-
}
|
247
|
-
|
248
|
-
explicit bootstrap_handler(std::shared_ptr<mcbp_session_impl> session)
|
249
|
-
: session_(std::move(session))
|
250
|
-
, sasl_([origin = session_->origin_]() { return origin.username(); },
|
251
|
-
[origin = session_->origin_]() { return origin.password(); },
|
252
|
-
sasl_mechanisms(session_))
|
253
|
-
{
|
254
|
-
protocol::client_request<protocol::hello_request_body> hello_req;
|
255
|
-
if (session_->origin_.options().enable_unordered_execution) {
|
256
|
-
hello_req.body().enable_unordered_execution();
|
257
|
-
}
|
258
|
-
if (session_->origin_.options().enable_clustermap_notification) {
|
259
|
-
hello_req.body().enable_clustermap_change_notification();
|
260
|
-
hello_req.body().enable_deduplicate_not_my_vbucket_clustermap();
|
261
|
-
}
|
262
|
-
if (session_->origin_.options().enable_compression) {
|
263
|
-
hello_req.body().enable_compression();
|
264
|
-
}
|
265
|
-
if (session_->origin_.options().enable_mutation_tokens) {
|
266
|
-
hello_req.body().enable_mutation_tokens();
|
267
|
-
}
|
268
|
-
hello_req.opaque(session_->next_opaque());
|
269
|
-
auto user_agent =
|
270
|
-
meta::user_agent_for_mcbp(session_->client_id_, session_->id_, session_->origin_.options().user_agent_extra, 250);
|
271
|
-
hello_req.body().user_agent(user_agent);
|
272
|
-
CB_LOG_DEBUG("{} user_agent={}, requested_features=[{}]",
|
273
|
-
session_->log_prefix_,
|
274
|
-
user_agent,
|
275
|
-
utils::join_strings_fmt(hello_req.body().features(), ", "));
|
276
|
-
session_->write(hello_req.data());
|
277
|
-
|
278
|
-
if (!session_->origin_.credentials().uses_certificate()) {
|
279
|
-
protocol::client_request<protocol::sasl_list_mechs_request_body> list_req;
|
280
|
-
list_req.opaque(session_->next_opaque());
|
281
|
-
session_->write(list_req.data());
|
282
|
-
|
283
|
-
protocol::client_request<protocol::sasl_auth_request_body> auth_req;
|
284
|
-
auto [sasl_code, sasl_payload] = sasl_.start();
|
285
|
-
auth_req.opaque(session_->next_opaque());
|
286
|
-
auth_req.body().mechanism(sasl_.get_name());
|
287
|
-
auth_req.body().sasl_data(sasl_payload);
|
288
|
-
session_->write(auth_req.data());
|
289
|
-
}
|
290
|
-
|
291
|
-
session_->flush();
|
292
|
-
}
|
293
|
-
|
294
|
-
void complete(std::error_code ec)
|
295
|
-
{
|
296
|
-
if (bool expected_state{ false }; stopped_.compare_exchange_strong(expected_state, true)) {
|
297
|
-
session_->invoke_bootstrap_handler(ec);
|
298
|
-
}
|
299
|
-
}
|
300
|
-
|
301
|
-
void auth_success()
|
302
|
-
{
|
303
|
-
session_->authenticated_ = true;
|
304
|
-
if (session_->supports_feature(protocol::hello_feature::xerror)) {
|
305
|
-
protocol::client_request<protocol::get_error_map_request_body> errmap_req;
|
306
|
-
errmap_req.opaque(session_->next_opaque());
|
307
|
-
session_->write(errmap_req.data());
|
308
|
-
}
|
309
|
-
if (session_->bucket_name_) {
|
310
|
-
protocol::client_request<protocol::select_bucket_request_body> sb_req;
|
311
|
-
sb_req.opaque(session_->next_opaque());
|
312
|
-
sb_req.body().bucket_name(session_->bucket_name_.value());
|
313
|
-
session_->write(sb_req.data());
|
314
|
-
}
|
315
|
-
protocol::client_request<protocol::get_cluster_config_request_body> cfg_req;
|
316
|
-
cfg_req.opaque(session_->next_opaque());
|
317
|
-
session_->write(cfg_req.data());
|
318
|
-
session_->flush();
|
319
|
-
}
|
320
|
-
|
321
|
-
void handle(mcbp_message&& msg)
|
322
|
-
{
|
323
|
-
if (stopped_ || !session_) {
|
324
|
-
return;
|
325
|
-
}
|
326
|
-
Expects(protocol::is_valid_magic(msg.header.magic));
|
327
|
-
switch (auto magic = static_cast<protocol::magic>(msg.header.magic)) {
|
328
|
-
case protocol::magic::client_response:
|
329
|
-
case protocol::magic::alt_client_response:
|
330
|
-
Expects(protocol::is_valid_client_opcode(msg.header.opcode));
|
331
|
-
switch (auto status = static_cast<key_value_status_code>(msg.header.status())) {
|
332
|
-
case key_value_status_code::rate_limited_max_commands:
|
333
|
-
case key_value_status_code::rate_limited_max_connections:
|
334
|
-
case key_value_status_code::rate_limited_network_egress:
|
335
|
-
case key_value_status_code::rate_limited_network_ingress:
|
336
|
-
last_error_message_ = fmt::format(
|
337
|
-
"unable to bootstrap MCBP session (bucket={}, opcode={}, status={}), the user has reached rate limit",
|
338
|
-
session_->bucket_name_.value_or(""),
|
339
|
-
protocol::client_opcode(msg.header.opcode),
|
340
|
-
status);
|
341
|
-
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
342
|
-
return complete(errc::common::rate_limited);
|
343
|
-
|
344
|
-
case key_value_status_code::scope_size_limit_exceeded:
|
345
|
-
last_error_message_ = fmt::format(
|
346
|
-
"unable to bootstrap MCBP session (bucket={}, opcode={}, status={}), the user has reached quota limit",
|
347
|
-
session_->bucket_name_.value_or(""),
|
348
|
-
protocol::client_opcode(msg.header.opcode),
|
349
|
-
status);
|
350
|
-
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
351
|
-
return complete(errc::common::quota_limited);
|
352
|
-
|
353
|
-
default:
|
354
|
-
break;
|
355
|
-
}
|
356
|
-
switch (auto opcode = static_cast<protocol::client_opcode>(msg.header.opcode)) {
|
357
|
-
case protocol::client_opcode::hello: {
|
358
|
-
protocol::client_response<protocol::hello_response_body> resp(std::move(msg));
|
359
|
-
if (resp.status() == key_value_status_code::success) {
|
360
|
-
session_->supported_features_ = resp.body().supported_features();
|
361
|
-
CB_LOG_DEBUG("{} supported_features=[{}]",
|
362
|
-
session_->log_prefix_,
|
363
|
-
utils::join_strings_fmt(session_->supported_features_, ", "));
|
364
|
-
if (session_->origin_.credentials().uses_certificate()) {
|
365
|
-
CB_LOG_DEBUG("{} skip SASL authentication, because TLS certificate was specified",
|
366
|
-
session_->log_prefix_);
|
367
|
-
return auth_success();
|
368
|
-
}
|
369
|
-
} else {
|
370
|
-
last_error_message_ = fmt::format(
|
371
|
-
"unexpected message status during bootstrap: {} (opaque={})", resp.error_message(), resp.opaque());
|
372
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
373
|
-
return complete(errc::network::handshake_failure);
|
374
|
-
}
|
375
|
-
} break;
|
376
|
-
case protocol::client_opcode::sasl_list_mechs: {
|
377
|
-
protocol::client_response<protocol::sasl_list_mechs_response_body> resp(std::move(msg));
|
378
|
-
if (resp.status() != key_value_status_code::success) {
|
379
|
-
last_error_message_ = fmt::format(
|
380
|
-
"unexpected message status during bootstrap: {} (opaque={})", resp.error_message(), resp.opaque());
|
381
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
382
|
-
return complete(errc::common::authentication_failure);
|
383
|
-
}
|
384
|
-
} break;
|
385
|
-
case protocol::client_opcode::sasl_auth: {
|
386
|
-
protocol::client_response<protocol::sasl_auth_response_body> resp(std::move(msg));
|
387
|
-
if (resp.status() == key_value_status_code::success) {
|
388
|
-
return auth_success();
|
389
|
-
}
|
390
|
-
if (resp.status() == key_value_status_code::auth_continue) {
|
391
|
-
auto [sasl_code, sasl_payload] = sasl_.step(resp.body().value());
|
392
|
-
if (sasl_code == sasl::error::OK) {
|
393
|
-
return auth_success();
|
394
|
-
}
|
395
|
-
if (sasl_code == sasl::error::CONTINUE) {
|
396
|
-
protocol::client_request<protocol::sasl_step_request_body> req;
|
397
|
-
req.opaque(session_->next_opaque());
|
398
|
-
req.body().mechanism(sasl_.get_name());
|
399
|
-
req.body().sasl_data(sasl_payload);
|
400
|
-
session_->write_and_flush(req.data());
|
401
|
-
} else {
|
402
|
-
last_error_message_ =
|
403
|
-
fmt::format("unable to authenticate: (sasl_code={}, opaque={})", sasl_code, resp.opaque());
|
404
|
-
CB_LOG_ERROR("{} {}", session_->log_prefix_, last_error_message_);
|
405
|
-
return complete(errc::common::authentication_failure);
|
406
|
-
}
|
407
|
-
} else {
|
408
|
-
last_error_message_ = fmt::format("{} unexpected message status during bootstrap: {} (opaque={})",
|
409
|
-
session_->log_prefix_,
|
410
|
-
resp.error_message(),
|
411
|
-
resp.opaque());
|
412
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
413
|
-
return complete(errc::common::authentication_failure);
|
414
|
-
}
|
415
|
-
} break;
|
416
|
-
case protocol::client_opcode::sasl_step: {
|
417
|
-
protocol::client_response<protocol::sasl_step_response_body> resp(std::move(msg));
|
418
|
-
if (resp.status() == key_value_status_code::success) {
|
419
|
-
return auth_success();
|
420
|
-
}
|
421
|
-
last_error_message_ =
|
422
|
-
fmt::format("unable to authenticate (opcode={}, status={}, opaque={})", opcode, resp.status(), resp.opaque());
|
423
|
-
CB_LOG_ERROR("{} {}", session_->log_prefix_, last_error_message_);
|
424
|
-
return complete(errc::common::authentication_failure);
|
425
|
-
}
|
426
|
-
case protocol::client_opcode::get_error_map: {
|
427
|
-
protocol::client_response<protocol::get_error_map_response_body> resp(std::move(msg));
|
428
|
-
if (resp.status() == key_value_status_code::success) {
|
429
|
-
session_->error_map_.emplace(resp.body().errmap());
|
430
|
-
} else {
|
431
|
-
last_error_message_ = fmt::format("unexpected message status during bootstrap: {} (opaque={}, {:n})",
|
432
|
-
resp.error_message(),
|
433
|
-
resp.opaque(),
|
434
|
-
spdlog::to_hex(resp.header()));
|
435
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
436
|
-
return complete(errc::network::protocol_error);
|
437
|
-
}
|
438
|
-
} break;
|
439
|
-
case protocol::client_opcode::select_bucket: {
|
440
|
-
protocol::client_response<protocol::select_bucket_response_body> resp(std::move(msg));
|
441
|
-
if (resp.status() == key_value_status_code::success) {
|
442
|
-
CB_LOG_DEBUG("{} selected bucket: {}", session_->log_prefix_, session_->bucket_name_.value_or(""));
|
443
|
-
session_->bucket_selected_ = true;
|
444
|
-
} else if (resp.status() == key_value_status_code::not_found) {
|
445
|
-
last_error_message_ =
|
446
|
-
fmt::format("kv_engine node does not have configuration propagated yet (opcode={}, status={}, opaque={})",
|
447
|
-
opcode,
|
448
|
-
resp.status(),
|
449
|
-
resp.opaque());
|
450
|
-
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
451
|
-
return complete(errc::network::configuration_not_available);
|
452
|
-
} else if (resp.status() == key_value_status_code::no_access) {
|
453
|
-
last_error_message_ = fmt::format("unable to select bucket: {}, probably the bucket does not exist",
|
454
|
-
session_->bucket_name_.value_or(""));
|
455
|
-
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
456
|
-
session_->bucket_selected_ = false;
|
457
|
-
return complete(errc::common::bucket_not_found);
|
458
|
-
} else {
|
459
|
-
last_error_message_ = fmt::format("unexpected message status during bootstrap: {} (opaque={}, {:n})",
|
460
|
-
resp.error_message(),
|
461
|
-
resp.opaque(),
|
462
|
-
spdlog::to_hex(resp.header()));
|
463
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
464
|
-
return complete(errc::common::bucket_not_found);
|
465
|
-
}
|
466
|
-
} break;
|
467
|
-
case protocol::client_opcode::get_cluster_config: {
|
468
|
-
protocol::cmd_info info{ session_->connection_endpoints_.remote_address,
|
469
|
-
session_->connection_endpoints_.remote.port() };
|
470
|
-
if (session_->origin_.options().dump_configuration) {
|
471
|
-
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()), msg.body.size() };
|
472
|
-
CB_LOG_TRACE(
|
473
|
-
"{} configuration from get_cluster_config request (bootstrap, size={}, endpoint=\"{}:{}\"), {}",
|
474
|
-
session_->log_prefix_,
|
475
|
-
config_text.size(),
|
476
|
-
info.endpoint_address,
|
477
|
-
info.endpoint_port,
|
478
|
-
config_text);
|
479
|
-
}
|
480
|
-
protocol::client_response<protocol::get_cluster_config_response_body> resp(std::move(msg), info);
|
481
|
-
if (resp.status() == key_value_status_code::success) {
|
482
|
-
// MB-60405 fixes this for 7.6.2, but for earlier versions we need to protect against using a
|
483
|
-
// config that has an empty vbucket map. Ideally we don't timeout if we retry here, but a timeout
|
484
|
-
// would be more acceptable than a crash and if we do timeout, we have a clear indication of the
|
485
|
-
// problem (i.e. it is a server bug and we cannot use a config w/ an empty vbucket map).
|
486
|
-
if (resp.body().config().vbmap && resp.body().config().vbmap->size() == 0) {
|
487
|
-
CB_LOG_WARNING("{} received a configuration with an empty vbucket map, retrying",
|
488
|
-
session_->log_prefix_);
|
489
|
-
return complete(errc::network::configuration_not_available);
|
490
|
-
}
|
491
|
-
session_->update_configuration(resp.body().config());
|
492
|
-
complete({});
|
493
|
-
} else if (resp.status() == key_value_status_code::not_found) {
|
494
|
-
last_error_message_ =
|
495
|
-
fmt::format("kv_engine node does not have configuration propagated yet (opcode={}, status={}, opaque={})",
|
496
|
-
opcode,
|
497
|
-
resp.status(),
|
498
|
-
resp.opaque());
|
499
|
-
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
500
|
-
return complete(errc::network::configuration_not_available);
|
501
|
-
} else if (resp.status() == key_value_status_code::no_bucket && !session_->bucket_name_) {
|
502
|
-
// bucket-less session, but the server wants bucket
|
503
|
-
session_->supports_gcccp_ = false;
|
504
|
-
CB_LOG_WARNING("{} this server does not support GCCCP, open bucket before making any cluster-level command",
|
505
|
-
session_->log_prefix_);
|
506
|
-
session_->update_configuration(topology::make_blank_configuration(
|
507
|
-
session_->connection_endpoints_.remote_address, session_->connection_endpoints_.remote.port(), 0));
|
508
|
-
complete({});
|
509
|
-
} else {
|
510
|
-
last_error_message_ = fmt::format("unexpected message status during bootstrap: {} (opaque={}, {:n})",
|
511
|
-
resp.error_message(),
|
512
|
-
resp.opaque(),
|
513
|
-
spdlog::to_hex(resp.header()));
|
514
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
515
|
-
return complete(errc::network::protocol_error);
|
516
|
-
}
|
517
|
-
} break;
|
518
|
-
default:
|
519
|
-
last_error_message_ = fmt::format("unexpected message during bootstrap: {}", opcode);
|
520
|
-
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
521
|
-
return complete(errc::network::protocol_error);
|
522
|
-
}
|
523
|
-
break;
|
524
|
-
case protocol::magic::server_request:
|
525
|
-
Expects(protocol::is_valid_server_request_opcode(msg.header.opcode));
|
526
|
-
switch (static_cast<protocol::server_opcode>(msg.header.opcode)) {
|
527
|
-
case protocol::server_opcode::cluster_map_change_notification: {
|
528
|
-
protocol::cmd_info info{ session_->bootstrap_hostname_, session_->bootstrap_port_number_ };
|
529
|
-
if (session_->origin_.options().dump_configuration) {
|
530
|
-
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()), msg.body.size() };
|
531
|
-
CB_LOG_TRACE(
|
532
|
-
"{} configuration from cluster_map_change_notification request (size={}, endpoint=\"{}:{}\"), {}",
|
533
|
-
session_->log_prefix_,
|
534
|
-
config_text.size(),
|
535
|
-
info.endpoint_address,
|
536
|
-
info.endpoint_port,
|
537
|
-
config_text);
|
538
|
-
}
|
539
|
-
protocol::server_request<protocol::cluster_map_change_notification_request_body> req(std::move(msg), info);
|
540
|
-
std::optional<topology::configuration> config = req.body().config();
|
541
|
-
if (session_ && config.has_value()) {
|
542
|
-
if ((!config->bucket.has_value() && req.body().bucket().empty()) ||
|
543
|
-
(session_->bucket_name_.has_value() && !req.body().bucket().empty() &&
|
544
|
-
session_->bucket_name_.value() == req.body().bucket())) {
|
545
|
-
session_->update_configuration(std::move(config.value()));
|
546
|
-
}
|
547
|
-
}
|
548
|
-
} break;
|
549
|
-
default:
|
550
|
-
CB_LOG_WARNING("{} unexpected server request: opcode={:x}, opaque={}{:a}{:a}",
|
551
|
-
session_->log_prefix_,
|
552
|
-
msg.header.opcode,
|
553
|
-
utils::byte_swap(msg.header.opaque),
|
554
|
-
spdlog::to_hex(msg.header_data()),
|
555
|
-
spdlog::to_hex(msg.body));
|
556
|
-
}
|
557
|
-
break;
|
558
|
-
case protocol::magic::client_request:
|
559
|
-
case protocol::magic::alt_client_request:
|
560
|
-
case protocol::magic::server_response:
|
561
|
-
CB_LOG_WARNING("{} unexpected magic: {} (opcode={:x}, opaque={}){:a}{:a}",
|
562
|
-
session_->log_prefix_,
|
563
|
-
magic,
|
564
|
-
msg.header.opcode,
|
565
|
-
utils::byte_swap(msg.header.opaque),
|
566
|
-
spdlog::to_hex(msg.header_data()),
|
567
|
-
spdlog::to_hex(msg.body));
|
568
|
-
break;
|
569
|
-
}
|
570
|
-
}
|
571
|
-
};
|
572
|
-
|
573
|
-
class message_handler : public std::enable_shared_from_this<message_handler>
|
574
|
-
{
|
575
|
-
private:
|
576
|
-
std::shared_ptr<mcbp_session_impl> session_;
|
577
|
-
std::atomic_bool stopped_{ false };
|
578
|
-
|
579
|
-
public:
|
580
|
-
explicit message_handler(std::shared_ptr<mcbp_session_impl> session)
|
581
|
-
: session_(std::move(session))
|
582
|
-
{
|
583
|
-
}
|
584
|
-
|
585
|
-
~message_handler()
|
586
|
-
{
|
587
|
-
stop();
|
588
|
-
}
|
589
|
-
|
590
|
-
void start()
|
591
|
-
{
|
592
|
-
}
|
593
|
-
|
594
|
-
void stop()
|
595
|
-
{
|
596
|
-
}
|
597
|
-
|
598
|
-
void handle(mcbp_message&& msg)
|
599
|
-
{
|
600
|
-
if (stopped_ || !session_) {
|
601
|
-
return;
|
602
|
-
}
|
603
|
-
Expects(protocol::is_valid_magic(msg.header.magic));
|
604
|
-
switch (auto magic = static_cast<protocol::magic>(msg.header.magic)) {
|
605
|
-
case protocol::magic::client_response:
|
606
|
-
case protocol::magic::alt_client_response:
|
607
|
-
Expects(protocol::is_valid_client_opcode(msg.header.opcode));
|
608
|
-
switch (auto opcode = static_cast<protocol::client_opcode>(msg.header.opcode)) {
|
609
|
-
case protocol::client_opcode::get_cluster_config: {
|
610
|
-
protocol::cmd_info info{ session_->bootstrap_hostname_, session_->bootstrap_port_number_ };
|
611
|
-
if (session_->origin_.options().dump_configuration) {
|
612
|
-
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()), msg.body.size() };
|
613
|
-
CB_LOG_TRACE("{} configuration from get_cluster_config response (size={}, endpoint=\"{}:{}\"), {}",
|
614
|
-
session_->log_prefix_,
|
615
|
-
config_text.size(),
|
616
|
-
info.endpoint_address,
|
617
|
-
info.endpoint_port,
|
618
|
-
config_text);
|
619
|
-
}
|
620
|
-
protocol::client_response<protocol::get_cluster_config_response_body> resp(std::move(msg), info);
|
621
|
-
if (resp.status() == key_value_status_code::success) {
|
622
|
-
if (session_) {
|
623
|
-
session_->update_configuration(resp.body().config());
|
624
|
-
}
|
625
|
-
} else {
|
626
|
-
CB_LOG_WARNING("{} unexpected message status: {} (opaque={})",
|
627
|
-
session_->log_prefix_,
|
628
|
-
resp.error_message(),
|
629
|
-
resp.opaque());
|
630
|
-
}
|
631
|
-
} break;
|
632
|
-
case protocol::client_opcode::noop:
|
633
|
-
case protocol::client_opcode::get_collections_manifest:
|
634
|
-
case protocol::client_opcode::get_collection_id:
|
635
|
-
case protocol::client_opcode::get:
|
636
|
-
case protocol::client_opcode::get_and_lock:
|
637
|
-
case protocol::client_opcode::get_and_touch:
|
638
|
-
case protocol::client_opcode::get_meta:
|
639
|
-
case protocol::client_opcode::get_replica:
|
640
|
-
case protocol::client_opcode::touch:
|
641
|
-
case protocol::client_opcode::insert:
|
642
|
-
case protocol::client_opcode::replace:
|
643
|
-
case protocol::client_opcode::upsert:
|
644
|
-
case protocol::client_opcode::append:
|
645
|
-
case protocol::client_opcode::prepend:
|
646
|
-
case protocol::client_opcode::remove:
|
647
|
-
case protocol::client_opcode::observe_seqno:
|
648
|
-
case protocol::client_opcode::unlock:
|
649
|
-
case protocol::client_opcode::increment:
|
650
|
-
case protocol::client_opcode::range_scan_create:
|
651
|
-
case protocol::client_opcode::range_scan_continue:
|
652
|
-
case protocol::client_opcode::range_scan_cancel:
|
653
|
-
case protocol::client_opcode::decrement:
|
654
|
-
case protocol::client_opcode::subdoc_multi_lookup:
|
655
|
-
case protocol::client_opcode::subdoc_multi_mutation: {
|
656
|
-
std::uint16_t status = utils::byte_swap(msg.header.specific);
|
657
|
-
if (status == static_cast<std::uint16_t>(key_value_status_code::not_my_vbucket)) {
|
658
|
-
session_->handle_not_my_vbucket(msg);
|
659
|
-
}
|
660
|
-
|
661
|
-
std::uint32_t opaque = utils::byte_swap(msg.header.opaque);
|
662
|
-
if (session_->handle_request(opcode, status, opaque, std::move(msg))) {
|
663
|
-
CB_LOG_TRACE("{} MCBP invoked operation handler: opcode={}, opaque={}, status={}",
|
664
|
-
session_->log_prefix_,
|
665
|
-
opcode,
|
666
|
-
opaque,
|
667
|
-
protocol::status_to_string(status));
|
668
|
-
} else {
|
669
|
-
CB_LOG_DEBUG("{} unexpected orphan response: opcode={}, opaque={}, status={}",
|
670
|
-
session_->log_prefix_,
|
671
|
-
opcode,
|
672
|
-
opaque,
|
673
|
-
protocol::status_to_string(status));
|
674
|
-
}
|
675
|
-
} break;
|
676
|
-
default:
|
677
|
-
CB_LOG_WARNING("{} unexpected client response: opcode={}, opaque={}{:a}{:a})",
|
678
|
-
session_->log_prefix_,
|
679
|
-
opcode,
|
680
|
-
msg.header.opaque,
|
681
|
-
spdlog::to_hex(msg.header_data()),
|
682
|
-
spdlog::to_hex(msg.body));
|
683
|
-
}
|
684
|
-
break;
|
685
|
-
case protocol::magic::server_request:
|
686
|
-
Expects(protocol::is_valid_server_request_opcode(msg.header.opcode));
|
687
|
-
switch (static_cast<protocol::server_opcode>(msg.header.opcode)) {
|
688
|
-
case protocol::server_opcode::cluster_map_change_notification: {
|
689
|
-
protocol::cmd_info info{ session_->bootstrap_hostname_, session_->bootstrap_port_number_ };
|
690
|
-
if (session_->origin_.options().dump_configuration) {
|
691
|
-
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()), msg.body.size() };
|
692
|
-
CB_LOG_TRACE(
|
693
|
-
"{} configuration from cluster_map_change_notification request (size={}, endpoint=\"{}:{}\"), {}",
|
694
|
-
session_->log_prefix_,
|
695
|
-
config_text.size(),
|
696
|
-
info.endpoint_address,
|
697
|
-
info.endpoint_port,
|
698
|
-
config_text);
|
699
|
-
}
|
700
|
-
protocol::server_request<protocol::cluster_map_change_notification_request_body> req(std::move(msg), info);
|
701
|
-
std::optional<topology::configuration> config = req.body().config();
|
702
|
-
if (session_ && config.has_value()) {
|
703
|
-
if ((!config->bucket.has_value() && req.body().bucket().empty()) ||
|
704
|
-
(session_->bucket_name_.has_value() && !req.body().bucket().empty() &&
|
705
|
-
session_->bucket_name_.value() == req.body().bucket())) {
|
706
|
-
session_->update_configuration(std::move(config.value()));
|
707
|
-
}
|
708
|
-
}
|
709
|
-
} break;
|
710
|
-
default:
|
711
|
-
CB_LOG_WARNING("{} unexpected server request: opcode={:x}, opaque={}{:a}{:a}",
|
712
|
-
session_->log_prefix_,
|
713
|
-
msg.header.opcode,
|
714
|
-
msg.header.opaque,
|
715
|
-
spdlog::to_hex(msg.header_data()),
|
716
|
-
spdlog::to_hex(msg.body));
|
717
|
-
}
|
718
|
-
break;
|
719
|
-
case protocol::magic::client_request:
|
720
|
-
case protocol::magic::alt_client_request:
|
721
|
-
case protocol::magic::server_response:
|
722
|
-
CB_LOG_WARNING("{} unexpected magic: {} (opcode={:x}, opaque={}){:a}{:a}",
|
723
|
-
session_->log_prefix_,
|
724
|
-
magic,
|
725
|
-
msg.header.opcode,
|
726
|
-
msg.header.opaque,
|
727
|
-
spdlog::to_hex(msg.header_data()),
|
728
|
-
spdlog::to_hex(msg.body));
|
729
|
-
break;
|
730
|
-
}
|
731
|
-
}
|
732
|
-
};
|
211
|
+
class bootstrap_handler : public std::enable_shared_from_this<bootstrap_handler>
|
212
|
+
{
|
213
|
+
private:
|
214
|
+
std::shared_ptr<mcbp_session_impl> session_;
|
215
|
+
sasl::ClientContext sasl_;
|
216
|
+
std::atomic_bool stopped_{ false };
|
217
|
+
std::string last_error_message_;
|
733
218
|
|
734
219
|
public:
|
735
|
-
|
736
|
-
mcbp_session_impl(std::string_view client_id,
|
737
|
-
asio::io_context& ctx,
|
738
|
-
couchbase::core::origin origin,
|
739
|
-
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
740
|
-
std::optional<std::string> bucket_name = {},
|
741
|
-
std::vector<protocol::hello_feature> known_features = {})
|
742
|
-
: client_id_(client_id)
|
743
|
-
, ctx_(ctx)
|
744
|
-
, resolver_(ctx_)
|
745
|
-
, stream_(std::make_unique<plain_stream_impl>(ctx_))
|
746
|
-
, bootstrap_deadline_(ctx_)
|
747
|
-
, connection_deadline_(ctx_)
|
748
|
-
, retry_backoff_(ctx_)
|
749
|
-
, ping_deadline_(ctx_)
|
750
|
-
, origin_{ std::move(origin) }
|
751
|
-
, bucket_name_{ std::move(bucket_name) }
|
752
|
-
, supported_features_{ std::move(known_features) }
|
753
|
-
, is_tls_{ false }
|
754
|
-
, state_listener_{ std::move(state_listener) }
|
755
|
-
, codec_{ { supported_features_.begin(), supported_features_.end() } }
|
220
|
+
~bootstrap_handler()
|
756
221
|
{
|
757
|
-
|
758
|
-
}
|
759
|
-
|
760
|
-
mcbp_session_impl(std::string_view client_id,
|
761
|
-
asio::io_context& ctx,
|
762
|
-
asio::ssl::context& tls,
|
763
|
-
couchbase::core::origin origin,
|
764
|
-
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
765
|
-
std::optional<std::string> bucket_name = {},
|
766
|
-
std::vector<protocol::hello_feature> known_features = {})
|
767
|
-
: client_id_(client_id)
|
768
|
-
, ctx_(ctx)
|
769
|
-
, resolver_(ctx_)
|
770
|
-
, stream_(std::make_unique<tls_stream_impl>(ctx_, tls))
|
771
|
-
, bootstrap_deadline_(ctx_)
|
772
|
-
, connection_deadline_(ctx_)
|
773
|
-
, retry_backoff_(ctx_)
|
774
|
-
, ping_deadline_(ctx_)
|
775
|
-
, origin_(std::move(origin))
|
776
|
-
, bucket_name_(std::move(bucket_name))
|
777
|
-
, supported_features_(std::move(known_features))
|
778
|
-
, is_tls_{ true }
|
779
|
-
, state_listener_{ std::move(state_listener) }
|
780
|
-
, codec_{ { supported_features_.begin(), supported_features_.end() } }
|
781
|
-
{
|
782
|
-
log_prefix_ = fmt::format("[{}/{}/{}/{}]", client_id_, id_, stream_->log_prefix(), bucket_name_.value_or("-"));
|
222
|
+
stop();
|
783
223
|
}
|
784
224
|
|
785
|
-
|
225
|
+
void stop()
|
786
226
|
{
|
787
|
-
|
788
|
-
|
227
|
+
bool expected_state{ false };
|
228
|
+
stopped_.compare_exchange_strong(expected_state, true);
|
789
229
|
}
|
790
230
|
|
791
|
-
|
231
|
+
static auto sasl_mechanisms(const std::shared_ptr<mcbp_session_impl>& session)
|
232
|
+
-> std::vector<std::string>
|
792
233
|
{
|
793
|
-
|
234
|
+
if (const auto user_mechanisms = session->origin_.credentials().allowed_sasl_mechanisms;
|
235
|
+
user_mechanisms.has_value()) {
|
236
|
+
return user_mechanisms.value();
|
237
|
+
}
|
238
|
+
if (session->is_tls_) {
|
239
|
+
return { "PLAIN" };
|
240
|
+
}
|
241
|
+
return { "SCRAM-SHA512", "SCRAM-SHA256", "SCRAM-SHA1" };
|
794
242
|
}
|
795
243
|
|
796
|
-
|
244
|
+
auto last_error_message() && -> std::string
|
797
245
|
{
|
798
|
-
|
246
|
+
return std::move(last_error_message_);
|
799
247
|
}
|
800
248
|
|
801
|
-
|
249
|
+
[[nodiscard]] auto last_error_message() const& -> const std::string&
|
802
250
|
{
|
803
|
-
|
251
|
+
return last_error_message_;
|
804
252
|
}
|
805
253
|
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
bucket_name_ };
|
817
|
-
}
|
818
|
-
|
819
|
-
void ping(std::shared_ptr<diag::ping_reporter> handler, std::optional<std::chrono::milliseconds> timeout)
|
254
|
+
explicit bootstrap_handler(std::shared_ptr<mcbp_session_impl> session)
|
255
|
+
: session_(std::move(session))
|
256
|
+
, sasl_(
|
257
|
+
[origin = session_->origin_]() {
|
258
|
+
return origin.username();
|
259
|
+
},
|
260
|
+
[origin = session_->origin_]() {
|
261
|
+
return origin.password();
|
262
|
+
},
|
263
|
+
sasl_mechanisms(session_))
|
820
264
|
{
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
self->local_address(),
|
860
|
-
state,
|
861
|
-
self->bucket_name_,
|
862
|
-
error,
|
863
|
-
});
|
864
|
-
});
|
865
|
-
ping_deadline_.expires_after(timeout.value_or(origin_.options().key_value_timeout));
|
866
|
-
ping_deadline_.async_wait([self = this->shared_from_this(), opaque = req.opaque()](std::error_code ec) {
|
867
|
-
if (ec == asio::error::operation_aborted) {
|
868
|
-
return;
|
869
|
-
}
|
870
|
-
static_cast<void>(self->cancel(opaque, errc::common::unambiguous_timeout, retry_reason::do_not_retry));
|
871
|
-
});
|
265
|
+
protocol::client_request<protocol::hello_request_body> hello_req;
|
266
|
+
if (session_->origin_.options().enable_unordered_execution) {
|
267
|
+
hello_req.body().enable_unordered_execution();
|
268
|
+
}
|
269
|
+
if (session_->origin_.options().enable_clustermap_notification) {
|
270
|
+
hello_req.body().enable_clustermap_change_notification();
|
271
|
+
hello_req.body().enable_deduplicate_not_my_vbucket_clustermap();
|
272
|
+
}
|
273
|
+
if (session_->origin_.options().enable_compression) {
|
274
|
+
hello_req.body().enable_compression();
|
275
|
+
}
|
276
|
+
if (session_->origin_.options().enable_mutation_tokens) {
|
277
|
+
hello_req.body().enable_mutation_tokens();
|
278
|
+
}
|
279
|
+
hello_req.opaque(session_->next_opaque());
|
280
|
+
auto user_agent = meta::user_agent_for_mcbp(
|
281
|
+
session_->client_id_, session_->id_, session_->origin_.options().user_agent_extra, 250);
|
282
|
+
hello_req.body().user_agent(user_agent);
|
283
|
+
CB_LOG_DEBUG("{} user_agent={}, requested_features=[{}]",
|
284
|
+
session_->log_prefix_,
|
285
|
+
user_agent,
|
286
|
+
utils::join_strings_fmt(hello_req.body().features(), ", "));
|
287
|
+
session_->write(hello_req.data());
|
288
|
+
|
289
|
+
if (!session_->origin_.credentials().uses_certificate()) {
|
290
|
+
protocol::client_request<protocol::sasl_list_mechs_request_body> list_req;
|
291
|
+
list_req.opaque(session_->next_opaque());
|
292
|
+
session_->write(list_req.data());
|
293
|
+
|
294
|
+
protocol::client_request<protocol::sasl_auth_request_body> auth_req;
|
295
|
+
auto [sasl_code, sasl_payload] = sasl_.start();
|
296
|
+
auth_req.opaque(session_->next_opaque());
|
297
|
+
auth_req.body().mechanism(sasl_.get_name());
|
298
|
+
auth_req.body().sasl_data(sasl_payload);
|
299
|
+
session_->write(auth_req.data());
|
300
|
+
}
|
301
|
+
|
302
|
+
session_->flush();
|
872
303
|
}
|
873
304
|
|
874
|
-
|
305
|
+
void complete(std::error_code ec)
|
875
306
|
{
|
876
|
-
|
307
|
+
if (bool expected_state{ false }; stopped_.compare_exchange_strong(expected_state, true)) {
|
308
|
+
session_->invoke_bootstrap_handler(ec);
|
309
|
+
}
|
877
310
|
}
|
878
311
|
|
879
|
-
void
|
880
|
-
bool retry_on_bucket_not_found = false)
|
312
|
+
void auth_success()
|
881
313
|
{
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
}
|
899
|
-
self->stop(retry_reason::do_not_retry);
|
900
|
-
});
|
901
|
-
initiate_bootstrap();
|
314
|
+
session_->authenticated_ = true;
|
315
|
+
if (session_->supports_feature(protocol::hello_feature::xerror)) {
|
316
|
+
protocol::client_request<protocol::get_error_map_request_body> errmap_req;
|
317
|
+
errmap_req.opaque(session_->next_opaque());
|
318
|
+
session_->write(errmap_req.data());
|
319
|
+
}
|
320
|
+
if (session_->bucket_name_) {
|
321
|
+
protocol::client_request<protocol::select_bucket_request_body> sb_req;
|
322
|
+
sb_req.opaque(session_->next_opaque());
|
323
|
+
sb_req.body().bucket_name(session_->bucket_name_.value());
|
324
|
+
session_->write(sb_req.data());
|
325
|
+
}
|
326
|
+
protocol::client_request<protocol::get_cluster_config_request_body> cfg_req;
|
327
|
+
cfg_req.opaque(session_->next_opaque());
|
328
|
+
session_->write(cfg_req.data());
|
329
|
+
session_->flush();
|
902
330
|
}
|
903
331
|
|
904
|
-
void
|
332
|
+
void handle(mcbp_message&& msg)
|
905
333
|
{
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
334
|
+
if (stopped_ || !session_) {
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
Expects(protocol::is_valid_magic(msg.header.magic));
|
338
|
+
switch (auto magic = static_cast<protocol::magic>(msg.header.magic)) {
|
339
|
+
case protocol::magic::client_response:
|
340
|
+
case protocol::magic::alt_client_response:
|
341
|
+
Expects(protocol::is_valid_client_opcode(msg.header.opcode));
|
342
|
+
switch (auto status = static_cast<key_value_status_code>(msg.header.status())) {
|
343
|
+
case key_value_status_code::rate_limited_max_commands:
|
344
|
+
case key_value_status_code::rate_limited_max_connections:
|
345
|
+
case key_value_status_code::rate_limited_network_egress:
|
346
|
+
case key_value_status_code::rate_limited_network_ingress:
|
347
|
+
last_error_message_ =
|
348
|
+
fmt::format("unable to bootstrap MCBP session (bucket={}, opcode={}, status={}), "
|
349
|
+
"the user has reached rate limit",
|
350
|
+
session_->bucket_name_.value_or(""),
|
351
|
+
protocol::client_opcode(msg.header.opcode),
|
352
|
+
status);
|
353
|
+
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
354
|
+
return complete(errc::common::rate_limited);
|
355
|
+
|
356
|
+
case key_value_status_code::scope_size_limit_exceeded:
|
357
|
+
last_error_message_ =
|
358
|
+
fmt::format("unable to bootstrap MCBP session (bucket={}, opcode={}, status={}), "
|
359
|
+
"the user has reached quota limit",
|
360
|
+
session_->bucket_name_.value_or(""),
|
361
|
+
protocol::client_opcode(msg.header.opcode),
|
362
|
+
status);
|
363
|
+
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
364
|
+
return complete(errc::common::quota_limited);
|
365
|
+
|
366
|
+
default:
|
367
|
+
break;
|
368
|
+
}
|
369
|
+
switch (auto opcode = static_cast<protocol::client_opcode>(msg.header.opcode)) {
|
370
|
+
case protocol::client_opcode::hello: {
|
371
|
+
protocol::client_response<protocol::hello_response_body> resp(std::move(msg));
|
372
|
+
if (resp.status() == key_value_status_code::success) {
|
373
|
+
session_->supported_features_ = resp.body().supported_features();
|
374
|
+
CB_LOG_DEBUG("{} supported_features=[{}]",
|
375
|
+
session_->log_prefix_,
|
376
|
+
utils::join_strings_fmt(session_->supported_features_, ", "));
|
377
|
+
if (session_->origin_.credentials().uses_certificate()) {
|
378
|
+
CB_LOG_DEBUG("{} skip SASL authentication, because TLS certificate was specified",
|
379
|
+
session_->log_prefix_);
|
380
|
+
return auth_success();
|
932
381
|
}
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
382
|
+
} else {
|
383
|
+
last_error_message_ =
|
384
|
+
fmt::format("unexpected message status during bootstrap: {} (opaque={})",
|
385
|
+
resp.error_message(),
|
386
|
+
resp.opaque());
|
387
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
388
|
+
return complete(errc::network::handshake_failure);
|
389
|
+
}
|
390
|
+
} break;
|
391
|
+
case protocol::client_opcode::sasl_list_mechs: {
|
392
|
+
protocol::client_response<protocol::sasl_list_mechs_response_body> resp(
|
393
|
+
std::move(msg));
|
394
|
+
if (resp.status() != key_value_status_code::success) {
|
395
|
+
last_error_message_ =
|
396
|
+
fmt::format("unexpected message status during bootstrap: {} (opaque={})",
|
397
|
+
resp.error_message(),
|
398
|
+
resp.opaque());
|
399
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
400
|
+
return complete(errc::common::authentication_failure);
|
401
|
+
}
|
402
|
+
} break;
|
403
|
+
case protocol::client_opcode::sasl_auth: {
|
404
|
+
protocol::client_response<protocol::sasl_auth_response_body> resp(std::move(msg));
|
405
|
+
if (resp.status() == key_value_status_code::success) {
|
406
|
+
return auth_success();
|
407
|
+
}
|
408
|
+
if (resp.status() == key_value_status_code::auth_continue) {
|
409
|
+
auto [sasl_code, sasl_payload] = sasl_.step(resp.body().value());
|
410
|
+
if (sasl_code == sasl::error::OK) {
|
411
|
+
return auth_success();
|
412
|
+
}
|
413
|
+
if (sasl_code == sasl::error::CONTINUE) {
|
414
|
+
protocol::client_request<protocol::sasl_step_request_body> req;
|
415
|
+
req.opaque(session_->next_opaque());
|
416
|
+
req.body().mechanism(sasl_.get_name());
|
417
|
+
req.body().sasl_data(sasl_payload);
|
418
|
+
session_->write_and_flush(req.data());
|
419
|
+
} else {
|
420
|
+
last_error_message_ = fmt::format(
|
421
|
+
"unable to authenticate: (sasl_code={}, opaque={})", sasl_code, resp.opaque());
|
422
|
+
CB_LOG_ERROR("{} {}", session_->log_prefix_, last_error_message_);
|
423
|
+
return complete(errc::common::authentication_failure);
|
424
|
+
}
|
425
|
+
} else {
|
426
|
+
last_error_message_ =
|
427
|
+
fmt::format("{} unexpected message status during bootstrap: {} (opaque={})",
|
428
|
+
session_->log_prefix_,
|
429
|
+
resp.error_message(),
|
430
|
+
resp.opaque());
|
431
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
432
|
+
return complete(errc::common::authentication_failure);
|
433
|
+
}
|
434
|
+
} break;
|
435
|
+
case protocol::client_opcode::sasl_step: {
|
436
|
+
protocol::client_response<protocol::sasl_step_response_body> resp(std::move(msg));
|
437
|
+
if (resp.status() == key_value_status_code::success) {
|
438
|
+
return auth_success();
|
439
|
+
}
|
440
|
+
last_error_message_ =
|
441
|
+
fmt::format("unable to authenticate (opcode={}, status={}, opaque={})",
|
442
|
+
opcode,
|
443
|
+
resp.status(),
|
444
|
+
resp.opaque());
|
445
|
+
CB_LOG_ERROR("{} {}", session_->log_prefix_, last_error_message_);
|
446
|
+
return complete(errc::common::authentication_failure);
|
447
|
+
}
|
448
|
+
case protocol::client_opcode::get_error_map: {
|
449
|
+
protocol::client_response<protocol::get_error_map_response_body> resp(std::move(msg));
|
450
|
+
if (resp.status() == key_value_status_code::success) {
|
451
|
+
session_->error_map_.emplace(resp.body().errmap());
|
452
|
+
} else {
|
453
|
+
last_error_message_ =
|
454
|
+
fmt::format("unexpected message status during bootstrap: {} (opaque={}, {:n})",
|
455
|
+
resp.error_message(),
|
456
|
+
resp.opaque(),
|
457
|
+
spdlog::to_hex(resp.header()));
|
458
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
459
|
+
return complete(errc::network::protocol_error);
|
460
|
+
}
|
461
|
+
} break;
|
462
|
+
case protocol::client_opcode::select_bucket: {
|
463
|
+
protocol::client_response<protocol::select_bucket_response_body> resp(std::move(msg));
|
464
|
+
if (resp.status() == key_value_status_code::success) {
|
465
|
+
CB_LOG_DEBUG("{} selected bucket: {}",
|
466
|
+
session_->log_prefix_,
|
467
|
+
session_->bucket_name_.value_or(""));
|
468
|
+
session_->bucket_selected_ = true;
|
469
|
+
} else if (resp.status() == key_value_status_code::not_found) {
|
470
|
+
last_error_message_ =
|
471
|
+
fmt::format("kv_engine node does not have configuration propagated yet "
|
472
|
+
"(opcode={}, status={}, opaque={})",
|
473
|
+
opcode,
|
474
|
+
resp.status(),
|
475
|
+
resp.opaque());
|
476
|
+
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
477
|
+
return complete(errc::network::configuration_not_available);
|
478
|
+
} else if (resp.status() == key_value_status_code::no_access) {
|
479
|
+
last_error_message_ =
|
480
|
+
fmt::format("unable to select bucket: {}, probably the bucket does not exist",
|
481
|
+
session_->bucket_name_.value_or(""));
|
482
|
+
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
483
|
+
session_->bucket_selected_ = false;
|
484
|
+
return complete(errc::common::bucket_not_found);
|
485
|
+
} else {
|
486
|
+
last_error_message_ =
|
487
|
+
fmt::format("unexpected message status during bootstrap: {} (opaque={}, {:n})",
|
488
|
+
resp.error_message(),
|
489
|
+
resp.opaque(),
|
490
|
+
spdlog::to_hex(resp.header()));
|
491
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
492
|
+
return complete(errc::common::bucket_not_found);
|
493
|
+
}
|
494
|
+
} break;
|
495
|
+
case protocol::client_opcode::get_cluster_config: {
|
496
|
+
protocol::cmd_info info{ session_->connection_endpoints_.remote_address,
|
497
|
+
session_->connection_endpoints_.remote.port() };
|
498
|
+
protocol::client_response<protocol::get_cluster_config_response_body> resp(
|
499
|
+
std::move(msg), info);
|
500
|
+
if (session_->origin_.options().dump_configuration &&
|
501
|
+
resp.body().config_text().has_value()) {
|
502
|
+
CB_LOG_TRACE("{} configuration from get_cluster_config request (bootstrap, "
|
503
|
+
"size={}, endpoint=\"{}:{}\"), {}",
|
504
|
+
session_->log_prefix_,
|
505
|
+
resp.body().config_text().value().size(),
|
506
|
+
info.endpoint_address,
|
507
|
+
info.endpoint_port,
|
508
|
+
resp.body().config_text().value());
|
509
|
+
}
|
510
|
+
if (resp.status() == key_value_status_code::success) {
|
511
|
+
// MB-60405 fixes this for 7.6.2, but for earlier versions we need to protect
|
512
|
+
// against using a config that has an empty vbucket map. Ideally we don't timeout
|
513
|
+
// if we retry here, but a timeout would be more acceptable than a crash and if we
|
514
|
+
// do timeout, we have a clear indication of the problem (i.e. it is a server bug
|
515
|
+
// and we cannot use a config w/ an empty vbucket map).
|
516
|
+
if (resp.body().config().vbmap && resp.body().config().vbmap->size() == 0) {
|
517
|
+
CB_LOG_WARNING("{} received a configuration with an empty vbucket map, retrying",
|
518
|
+
session_->log_prefix_);
|
519
|
+
return complete(errc::network::configuration_not_available);
|
520
|
+
}
|
521
|
+
session_->update_configuration(resp.body().config());
|
522
|
+
complete({});
|
523
|
+
} else if (resp.status() == key_value_status_code::not_found) {
|
524
|
+
last_error_message_ =
|
525
|
+
fmt::format("kv_engine node does not have configuration propagated yet "
|
526
|
+
"(opcode={}, status={}, opaque={})",
|
527
|
+
opcode,
|
528
|
+
resp.status(),
|
529
|
+
resp.opaque());
|
530
|
+
CB_LOG_DEBUG("{} {}", session_->log_prefix_, last_error_message_);
|
531
|
+
return complete(errc::network::configuration_not_available);
|
532
|
+
} else if (resp.status() == key_value_status_code::no_bucket &&
|
533
|
+
!session_->bucket_name_) {
|
534
|
+
// bucket-less session, but the server wants bucket
|
535
|
+
session_->supports_gcccp_ = false;
|
536
|
+
CB_LOG_WARNING("{} this server does not support GCCCP, open bucket before making "
|
537
|
+
"any cluster-level command",
|
538
|
+
session_->log_prefix_);
|
539
|
+
session_->update_configuration(
|
540
|
+
topology::make_blank_configuration(session_->connection_endpoints_.remote_address,
|
541
|
+
session_->connection_endpoints_.remote.port(),
|
542
|
+
0));
|
543
|
+
complete({});
|
544
|
+
} else {
|
545
|
+
last_error_message_ =
|
546
|
+
fmt::format("unexpected message status during bootstrap: {} (opaque={}, {:n})",
|
547
|
+
resp.error_message(),
|
548
|
+
resp.opaque(),
|
549
|
+
spdlog::to_hex(resp.header()));
|
550
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
551
|
+
return complete(errc::network::protocol_error);
|
552
|
+
}
|
553
|
+
} break;
|
554
|
+
default:
|
555
|
+
last_error_message_ = fmt::format("unexpected message during bootstrap: {}", opcode);
|
556
|
+
CB_LOG_WARNING("{} {}", session_->log_prefix_, last_error_message_);
|
557
|
+
return complete(errc::network::protocol_error);
|
558
|
+
}
|
559
|
+
break;
|
560
|
+
case protocol::magic::server_request:
|
561
|
+
Expects(protocol::is_valid_server_request_opcode(msg.header.opcode));
|
562
|
+
switch (static_cast<protocol::server_opcode>(msg.header.opcode)) {
|
563
|
+
case protocol::server_opcode::cluster_map_change_notification: {
|
564
|
+
protocol::cmd_info info{ session_->bootstrap_hostname_,
|
565
|
+
session_->bootstrap_port_number_ };
|
566
|
+
protocol::server_request<protocol::cluster_map_change_notification_request_body> req(
|
567
|
+
std::move(msg), info);
|
568
|
+
if (session_->origin_.options().dump_configuration &&
|
569
|
+
req.body().config_text().has_value()) {
|
570
|
+
CB_LOG_TRACE("{} configuration from cluster_map_change_notification request "
|
571
|
+
"(size={}, endpoint=\"{}:{}\"), {}",
|
572
|
+
session_->log_prefix_,
|
573
|
+
req.body().config_text().value().size(),
|
574
|
+
info.endpoint_address,
|
575
|
+
info.endpoint_port,
|
576
|
+
req.body().config_text().value());
|
577
|
+
}
|
578
|
+
std::optional<topology::configuration> config = req.body().config();
|
579
|
+
if (session_ && config.has_value()) {
|
580
|
+
if ((!config->bucket.has_value() && req.body().bucket().empty()) ||
|
581
|
+
(session_->bucket_name_.has_value() && !req.body().bucket().empty() &&
|
582
|
+
session_->bucket_name_.value() == req.body().bucket())) {
|
583
|
+
session_->update_configuration(std::move(config.value()));
|
584
|
+
}
|
585
|
+
}
|
586
|
+
} break;
|
587
|
+
default:
|
588
|
+
CB_LOG_WARNING("{} unexpected server request: opcode={:x}, opaque={}{:a}{:a}",
|
589
|
+
session_->log_prefix_,
|
590
|
+
msg.header.opcode,
|
591
|
+
utils::byte_swap(msg.header.opaque),
|
592
|
+
spdlog::to_hex(msg.header_data()),
|
593
|
+
spdlog::to_hex(msg.body));
|
594
|
+
}
|
595
|
+
break;
|
596
|
+
case protocol::magic::client_request:
|
597
|
+
case protocol::magic::alt_client_request:
|
598
|
+
case protocol::magic::server_response:
|
599
|
+
CB_LOG_WARNING("{} unexpected magic: {} (opcode={:x}, opaque={}){:a}{:a}",
|
600
|
+
session_->log_prefix_,
|
601
|
+
magic,
|
602
|
+
msg.header.opcode,
|
603
|
+
utils::byte_swap(msg.header.opaque),
|
604
|
+
spdlog::to_hex(msg.header_data()),
|
605
|
+
spdlog::to_hex(msg.body));
|
606
|
+
break;
|
607
|
+
}
|
950
608
|
}
|
609
|
+
};
|
610
|
+
|
611
|
+
class message_handler : public std::enable_shared_from_this<message_handler>
|
612
|
+
{
|
613
|
+
private:
|
614
|
+
std::shared_ptr<mcbp_session_impl> session_;
|
615
|
+
std::atomic_bool stopped_{ false };
|
951
616
|
|
952
|
-
|
617
|
+
public:
|
618
|
+
explicit message_handler(std::shared_ptr<mcbp_session_impl> session)
|
619
|
+
: session_(std::move(session))
|
953
620
|
{
|
954
|
-
return id_;
|
955
621
|
}
|
956
622
|
|
957
|
-
|
623
|
+
~message_handler()
|
958
624
|
{
|
959
|
-
|
625
|
+
stop();
|
960
626
|
}
|
961
627
|
|
962
|
-
|
628
|
+
void start()
|
963
629
|
{
|
964
|
-
return bootstrapped_;
|
965
630
|
}
|
966
631
|
|
967
|
-
void
|
632
|
+
void stop()
|
968
633
|
{
|
969
|
-
on_stop_handler_ = std::move(handler);
|
970
634
|
}
|
971
635
|
|
972
|
-
void
|
636
|
+
void handle(mcbp_message&& msg)
|
973
637
|
{
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
if (handler) {
|
1002
|
-
CB_LOG_DEBUG("{} MCBP cancel operation during session close, opaque={}, ec={}", log_prefix_, opaque, ec.message());
|
1003
|
-
auto fun = std::move(handler);
|
1004
|
-
fun(ec, reason, {}, {});
|
638
|
+
if (stopped_ || !session_) {
|
639
|
+
return;
|
640
|
+
}
|
641
|
+
Expects(protocol::is_valid_magic(msg.header.magic));
|
642
|
+
switch (auto magic = static_cast<protocol::magic>(msg.header.magic)) {
|
643
|
+
case protocol::magic::client_response:
|
644
|
+
case protocol::magic::alt_client_response:
|
645
|
+
Expects(protocol::is_valid_client_opcode(msg.header.opcode));
|
646
|
+
switch (auto opcode = static_cast<protocol::client_opcode>(msg.header.opcode)) {
|
647
|
+
case protocol::client_opcode::get_cluster_config: {
|
648
|
+
protocol::cmd_info info{ session_->bootstrap_hostname_,
|
649
|
+
session_->bootstrap_port_number_ };
|
650
|
+
protocol::client_response<protocol::get_cluster_config_response_body> resp(
|
651
|
+
std::move(msg), info);
|
652
|
+
if (session_->origin_.options().dump_configuration &&
|
653
|
+
resp.body().config_text().has_value()) {
|
654
|
+
CB_LOG_TRACE("{} configuration from get_cluster_config response (size={}, "
|
655
|
+
"endpoint=\"{}:{}\"), {}",
|
656
|
+
session_->log_prefix_,
|
657
|
+
resp.body().config_text().value().size(),
|
658
|
+
info.endpoint_address,
|
659
|
+
info.endpoint_port,
|
660
|
+
resp.body().config_text().value());
|
661
|
+
}
|
662
|
+
if (resp.status() == key_value_status_code::success) {
|
663
|
+
if (session_) {
|
664
|
+
session_->update_configuration(resp.body().config());
|
1005
665
|
}
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
666
|
+
} else {
|
667
|
+
CB_LOG_WARNING("{} unexpected message status: {} (opaque={})",
|
668
|
+
session_->log_prefix_,
|
669
|
+
resp.error_message(),
|
670
|
+
resp.opaque());
|
671
|
+
}
|
672
|
+
} break;
|
673
|
+
case protocol::client_opcode::noop:
|
674
|
+
case protocol::client_opcode::get_collections_manifest:
|
675
|
+
case protocol::client_opcode::get_collection_id:
|
676
|
+
case protocol::client_opcode::get:
|
677
|
+
case protocol::client_opcode::get_and_lock:
|
678
|
+
case protocol::client_opcode::get_and_touch:
|
679
|
+
case protocol::client_opcode::get_meta:
|
680
|
+
case protocol::client_opcode::get_replica:
|
681
|
+
case protocol::client_opcode::touch:
|
682
|
+
case protocol::client_opcode::insert:
|
683
|
+
case protocol::client_opcode::replace:
|
684
|
+
case protocol::client_opcode::upsert:
|
685
|
+
case protocol::client_opcode::append:
|
686
|
+
case protocol::client_opcode::prepend:
|
687
|
+
case protocol::client_opcode::remove:
|
688
|
+
case protocol::client_opcode::observe_seqno:
|
689
|
+
case protocol::client_opcode::unlock:
|
690
|
+
case protocol::client_opcode::increment:
|
691
|
+
case protocol::client_opcode::range_scan_create:
|
692
|
+
case protocol::client_opcode::range_scan_continue:
|
693
|
+
case protocol::client_opcode::range_scan_cancel:
|
694
|
+
case protocol::client_opcode::decrement:
|
695
|
+
case protocol::client_opcode::subdoc_multi_lookup:
|
696
|
+
case protocol::client_opcode::subdoc_multi_mutation: {
|
697
|
+
std::uint16_t status = utils::byte_swap(msg.header.specific);
|
698
|
+
if (status == static_cast<std::uint16_t>(key_value_status_code::not_my_vbucket)) {
|
699
|
+
session_->handle_not_my_vbucket(msg);
|
700
|
+
}
|
701
|
+
|
702
|
+
std::uint32_t opaque = utils::byte_swap(msg.header.opaque);
|
703
|
+
if (session_->handle_request(opcode, status, opaque, std::move(msg))) {
|
704
|
+
CB_LOG_TRACE("{} MCBP invoked operation handler: opcode={}, opaque={}, status={}",
|
705
|
+
session_->log_prefix_,
|
706
|
+
opcode,
|
707
|
+
opaque,
|
708
|
+
protocol::status_to_string(status));
|
709
|
+
} else {
|
710
|
+
CB_LOG_DEBUG("{} unexpected orphan response: opcode={}, opaque={}, status={}",
|
711
|
+
session_->log_prefix_,
|
712
|
+
opcode,
|
713
|
+
opaque,
|
714
|
+
protocol::status_to_string(status));
|
715
|
+
}
|
716
|
+
} break;
|
717
|
+
default:
|
718
|
+
CB_LOG_WARNING("{} unexpected client response: opcode={}, opaque={}{:a}{:a})",
|
719
|
+
session_->log_prefix_,
|
720
|
+
opcode,
|
721
|
+
msg.header.opaque,
|
722
|
+
spdlog::to_hex(msg.header_data()),
|
723
|
+
spdlog::to_hex(msg.body));
|
724
|
+
}
|
725
|
+
break;
|
726
|
+
case protocol::magic::server_request:
|
727
|
+
Expects(protocol::is_valid_server_request_opcode(msg.header.opcode));
|
728
|
+
switch (static_cast<protocol::server_opcode>(msg.header.opcode)) {
|
729
|
+
case protocol::server_opcode::cluster_map_change_notification: {
|
730
|
+
protocol::cmd_info info{ session_->bootstrap_hostname_,
|
731
|
+
session_->bootstrap_port_number_ };
|
732
|
+
protocol::server_request<protocol::cluster_map_change_notification_request_body> req(
|
733
|
+
std::move(msg), info);
|
734
|
+
if (session_->origin_.options().dump_configuration &&
|
735
|
+
req.body().config_text().has_value()) {
|
736
|
+
CB_LOG_TRACE("{} configuration from cluster_map_change_notification request "
|
737
|
+
"(size={}, endpoint=\"{}:{}\"), {}",
|
738
|
+
session_->log_prefix_,
|
739
|
+
req.body().config_text().value().size(),
|
740
|
+
info.endpoint_address,
|
741
|
+
info.endpoint_port,
|
742
|
+
req.body().config_text().value());
|
743
|
+
}
|
744
|
+
std::optional<topology::configuration> config = req.body().config();
|
745
|
+
if (session_ && config.has_value()) {
|
746
|
+
if ((!config->bucket.has_value() && req.body().bucket().empty()) ||
|
747
|
+
(session_->bucket_name_.has_value() && !req.body().bucket().empty() &&
|
748
|
+
session_->bucket_name_.value() == req.body().bucket())) {
|
749
|
+
session_->update_configuration(std::move(config.value()));
|
1017
750
|
}
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
751
|
+
}
|
752
|
+
} break;
|
753
|
+
default:
|
754
|
+
CB_LOG_WARNING("{} unexpected server request: opcode={:x}, opaque={}{:a}{:a}",
|
755
|
+
session_->log_prefix_,
|
756
|
+
msg.header.opcode,
|
757
|
+
msg.header.opaque,
|
758
|
+
spdlog::to_hex(msg.header_data()),
|
759
|
+
spdlog::to_hex(msg.body));
|
760
|
+
}
|
761
|
+
break;
|
762
|
+
case protocol::magic::client_request:
|
763
|
+
case protocol::magic::alt_client_request:
|
764
|
+
case protocol::magic::server_response:
|
765
|
+
CB_LOG_WARNING("{} unexpected magic: {} (opcode={:x}, opaque={}){:a}{:a}",
|
766
|
+
session_->log_prefix_,
|
767
|
+
magic,
|
768
|
+
msg.header.opcode,
|
769
|
+
msg.header.opaque,
|
770
|
+
spdlog::to_hex(msg.header_data()),
|
771
|
+
spdlog::to_hex(msg.body));
|
772
|
+
break;
|
773
|
+
}
|
1026
774
|
}
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
775
|
+
};
|
776
|
+
|
777
|
+
public:
|
778
|
+
mcbp_session_impl() = delete;
|
779
|
+
mcbp_session_impl(std::string_view client_id,
|
780
|
+
asio::io_context& ctx,
|
781
|
+
couchbase::core::origin origin,
|
782
|
+
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
783
|
+
std::optional<std::string> bucket_name = {},
|
784
|
+
std::vector<protocol::hello_feature> known_features = {})
|
785
|
+
: client_id_(client_id)
|
786
|
+
, ctx_(ctx)
|
787
|
+
, resolver_(ctx_)
|
788
|
+
, stream_(std::make_unique<plain_stream_impl>(ctx_))
|
789
|
+
, bootstrap_deadline_(ctx_)
|
790
|
+
, connection_deadline_(ctx_)
|
791
|
+
, retry_backoff_(ctx_)
|
792
|
+
, ping_deadline_(ctx_)
|
793
|
+
, origin_{ std::move(origin) }
|
794
|
+
, bucket_name_{ std::move(bucket_name) }
|
795
|
+
, supported_features_{ std::move(known_features) }
|
796
|
+
, is_tls_{ false }
|
797
|
+
, state_listener_{ std::move(state_listener) }
|
798
|
+
, codec_{ { supported_features_.begin(), supported_features_.end() } }
|
799
|
+
{
|
800
|
+
log_prefix_ = fmt::format(
|
801
|
+
"[{}/{}/{}/{}]", client_id_, id_, stream_->log_prefix(), bucket_name_.value_or("-"));
|
802
|
+
}
|
803
|
+
|
804
|
+
mcbp_session_impl(std::string_view client_id,
|
805
|
+
asio::io_context& ctx,
|
806
|
+
asio::ssl::context& tls,
|
807
|
+
couchbase::core::origin origin,
|
808
|
+
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
809
|
+
std::optional<std::string> bucket_name = {},
|
810
|
+
std::vector<protocol::hello_feature> known_features = {})
|
811
|
+
: client_id_(client_id)
|
812
|
+
, ctx_(ctx)
|
813
|
+
, resolver_(ctx_)
|
814
|
+
, stream_(std::make_unique<tls_stream_impl>(ctx_, tls))
|
815
|
+
, bootstrap_deadline_(ctx_)
|
816
|
+
, connection_deadline_(ctx_)
|
817
|
+
, retry_backoff_(ctx_)
|
818
|
+
, ping_deadline_(ctx_)
|
819
|
+
, origin_(std::move(origin))
|
820
|
+
, bucket_name_(std::move(bucket_name))
|
821
|
+
, supported_features_(std::move(known_features))
|
822
|
+
, is_tls_{ true }
|
823
|
+
, state_listener_{ std::move(state_listener) }
|
824
|
+
, codec_{ { supported_features_.begin(), supported_features_.end() } }
|
825
|
+
{
|
826
|
+
log_prefix_ = fmt::format(
|
827
|
+
"[{}/{}/{}/{}]", client_id_, id_, stream_->log_prefix(), bucket_name_.value_or("-"));
|
828
|
+
}
|
829
|
+
|
830
|
+
~mcbp_session_impl()
|
831
|
+
{
|
832
|
+
CB_LOG_DEBUG("{} destroy MCBP connection", log_prefix_);
|
833
|
+
stop(retry_reason::do_not_retry);
|
834
|
+
}
|
835
|
+
|
836
|
+
[[nodiscard]] auto log_prefix() const -> const std::string&
|
837
|
+
{
|
838
|
+
return log_prefix_;
|
839
|
+
}
|
840
|
+
|
841
|
+
auto remote_address() const -> std::string
|
842
|
+
{
|
843
|
+
return connection_endpoints_.remote_address_with_port;
|
844
|
+
}
|
845
|
+
|
846
|
+
auto local_address() const -> std::string
|
847
|
+
{
|
848
|
+
return connection_endpoints_.local_address_with_port;
|
849
|
+
}
|
850
|
+
|
851
|
+
[[nodiscard]] auto diag_info() const -> diag::endpoint_diag_info
|
852
|
+
{
|
853
|
+
return { service_type::key_value,
|
854
|
+
id_,
|
855
|
+
last_active_.time_since_epoch().count() == 0
|
856
|
+
? std::nullopt
|
857
|
+
: std::make_optional(std::chrono::duration_cast<std::chrono::microseconds>(
|
858
|
+
std::chrono::steady_clock::now() - last_active_)),
|
859
|
+
remote_address(),
|
860
|
+
local_address(),
|
861
|
+
state_,
|
862
|
+
bucket_name_ };
|
863
|
+
}
|
864
|
+
|
865
|
+
void ping(std::shared_ptr<diag::ping_reporter> handler,
|
866
|
+
std::optional<std::chrono::milliseconds> timeout)
|
867
|
+
{
|
868
|
+
if (!bootstrapped_) {
|
869
|
+
handler->report({
|
870
|
+
service_type::key_value,
|
871
|
+
id_,
|
872
|
+
std::chrono::microseconds(0),
|
873
|
+
remote_address(),
|
874
|
+
local_address(),
|
875
|
+
diag::ping_state::error,
|
876
|
+
bucket_name_,
|
877
|
+
last_bootstrap_error_message_.has_value() ? last_bootstrap_error_message_.value()
|
878
|
+
: "Bootstrap incomplete, cannot perform ping.",
|
879
|
+
});
|
880
|
+
return;
|
1036
881
|
}
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
882
|
+
protocol::client_request<protocol::mcbp_noop_request_body> req;
|
883
|
+
req.opaque(next_opaque());
|
884
|
+
write_and_subscribe(
|
885
|
+
req.opaque(),
|
886
|
+
req.data(false),
|
887
|
+
[start = std::chrono::steady_clock::now(), self = shared_from_this(), handler](
|
888
|
+
std::error_code ec,
|
889
|
+
retry_reason reason,
|
890
|
+
io::mcbp_message&& /* msg */,
|
891
|
+
std::optional<key_value_error_map_info> /* error_info */) {
|
892
|
+
diag::ping_state state = diag::ping_state::ok;
|
893
|
+
std::optional<std::string> error{};
|
894
|
+
if (ec) {
|
895
|
+
if (ec == errc::common::unambiguous_timeout || ec == errc::common::ambiguous_timeout) {
|
896
|
+
state = diag::ping_state::timeout;
|
897
|
+
} else {
|
898
|
+
state = diag::ping_state::error;
|
899
|
+
}
|
900
|
+
error.emplace(
|
901
|
+
fmt::format("code={}, message={}, reason={}", ec.value(), ec.message(), reason));
|
902
|
+
}
|
903
|
+
handler->report({
|
904
|
+
service_type::key_value,
|
905
|
+
self->id_,
|
906
|
+
std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() -
|
907
|
+
start),
|
908
|
+
self->remote_address(),
|
909
|
+
self->local_address(),
|
910
|
+
state,
|
911
|
+
self->bucket_name_,
|
912
|
+
error,
|
913
|
+
});
|
914
|
+
});
|
915
|
+
ping_deadline_.expires_after(timeout.value_or(origin_.options().key_value_timeout));
|
916
|
+
ping_deadline_.async_wait(
|
917
|
+
[self = this->shared_from_this(), opaque = req.opaque()](std::error_code ec) {
|
918
|
+
if (ec == asio::error::operation_aborted) {
|
919
|
+
return;
|
920
|
+
}
|
921
|
+
static_cast<void>(
|
922
|
+
self->cancel(opaque, errc::common::unambiguous_timeout, retry_reason::do_not_retry));
|
923
|
+
});
|
924
|
+
}
|
925
|
+
|
926
|
+
[[nodiscard]] auto context() const -> mcbp_context
|
927
|
+
{
|
928
|
+
return { config_, supported_features_ };
|
929
|
+
}
|
930
|
+
|
931
|
+
void bootstrap(utils::movable_function<void(std::error_code, topology::configuration)>&& callback,
|
932
|
+
bool retry_on_bucket_not_found = false)
|
933
|
+
{
|
934
|
+
retry_bootstrap_on_bucket_not_found_ = retry_on_bucket_not_found;
|
935
|
+
bootstrap_callback_ = std::move(callback);
|
936
|
+
bootstrap_deadline_.expires_after(origin_.options().bootstrap_timeout);
|
937
|
+
bootstrap_deadline_.async_wait([self = shared_from_this()](std::error_code ec) {
|
938
|
+
if (ec == asio::error::operation_aborted || self->stopped_) {
|
939
|
+
return;
|
940
|
+
}
|
941
|
+
if (!ec) {
|
942
|
+
ec = errc::common::unambiguous_timeout;
|
943
|
+
}
|
944
|
+
if (self->state_listener_) {
|
945
|
+
self->state_listener_->report_bootstrap_error(
|
946
|
+
fmt::format("{}:{}", self->bootstrap_hostname_, self->bootstrap_port_), ec);
|
947
|
+
}
|
948
|
+
CB_LOG_WARNING("{} unable to bootstrap in time", self->log_prefix_);
|
949
|
+
if (auto h = std::move(self->bootstrap_callback_); h) {
|
950
|
+
h(ec, {});
|
951
|
+
}
|
952
|
+
self->stop(retry_reason::do_not_retry);
|
953
|
+
});
|
954
|
+
initiate_bootstrap();
|
955
|
+
}
|
956
|
+
|
957
|
+
void initiate_bootstrap()
|
958
|
+
{
|
959
|
+
if (stopped_) {
|
960
|
+
return;
|
1044
961
|
}
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
if (stopped_) {
|
1049
|
-
return;
|
1050
|
-
}
|
1051
|
-
write(std::move(buf));
|
1052
|
-
flush();
|
962
|
+
bootstrapped_ = false;
|
963
|
+
if (bootstrap_handler_) {
|
964
|
+
last_bootstrap_error_message_ = std::move(bootstrap_handler_)->last_error_message();
|
1053
965
|
}
|
1054
|
-
|
1055
|
-
|
1056
|
-
{
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
966
|
+
bootstrap_handler_ = nullptr;
|
967
|
+
state_ = diag::endpoint_state::connecting;
|
968
|
+
if (stream_->is_open()) {
|
969
|
+
std::string old_id = stream_->id();
|
970
|
+
stream_->reopen();
|
971
|
+
CB_LOG_TRACE(R"({} reopen socket connection "{}" -> "{}", host="{}", port={})",
|
972
|
+
log_prefix_,
|
973
|
+
old_id,
|
974
|
+
stream_->id(),
|
975
|
+
bootstrap_hostname_,
|
976
|
+
bootstrap_port_);
|
1061
977
|
}
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
978
|
+
if (origin_.exhausted()) {
|
979
|
+
auto backoff = std::chrono::milliseconds(500);
|
980
|
+
CB_LOG_DEBUG("{} reached the end of list of bootstrap nodes, waiting for {}ms before restart",
|
981
|
+
log_prefix_,
|
982
|
+
backoff.count());
|
983
|
+
retry_backoff_.expires_after(backoff);
|
984
|
+
retry_backoff_.async_wait([self = shared_from_this()](std::error_code ec) mutable {
|
985
|
+
if (ec == asio::error::operation_aborted || self->stopped_) {
|
986
|
+
return;
|
987
|
+
}
|
988
|
+
self->origin_.restart();
|
989
|
+
self->initiate_bootstrap();
|
990
|
+
});
|
991
|
+
return;
|
1068
992
|
}
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
993
|
+
std::tie(bootstrap_hostname_, bootstrap_port_) = origin_.next_address();
|
994
|
+
bootstrap_port_number_ =
|
995
|
+
gsl::narrow_cast<std::uint16_t>(std::stoul(bootstrap_port_, nullptr, 10));
|
996
|
+
bootstrap_address_ = fmt::format("{}:{}", bootstrap_hostname_, bootstrap_port_);
|
997
|
+
log_prefix_ = fmt::format("[{}/{}/{}/{}] <{}>",
|
998
|
+
client_id_,
|
999
|
+
id_,
|
1000
|
+
stream_->log_prefix(),
|
1001
|
+
bucket_name_.value_or("-"),
|
1002
|
+
bootstrap_address_);
|
1003
|
+
CB_LOG_DEBUG("{} attempt to establish MCBP connection", log_prefix_);
|
1004
|
+
|
1005
|
+
async_resolve(origin_.options().use_ip_protocol,
|
1006
|
+
resolver_,
|
1007
|
+
bootstrap_hostname_,
|
1008
|
+
bootstrap_port_,
|
1009
|
+
std::bind(&mcbp_session_impl::on_resolve,
|
1010
|
+
shared_from_this(),
|
1011
|
+
std::placeholders::_1,
|
1012
|
+
std::placeholders::_2));
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
[[nodiscard]] auto id() const -> const std::string&
|
1016
|
+
{
|
1017
|
+
return id_;
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
[[nodiscard]] auto is_stopped() const -> bool
|
1021
|
+
{
|
1022
|
+
return stopped_;
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
[[nodiscard]] auto is_bootstrapped() const -> bool
|
1026
|
+
{
|
1027
|
+
return bootstrapped_;
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
void on_stop(utils::movable_function<void()> handler)
|
1031
|
+
{
|
1032
|
+
on_stop_handler_ = std::move(handler);
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
void stop(retry_reason reason)
|
1036
|
+
{
|
1037
|
+
if (stopped_) {
|
1038
|
+
return;
|
1108
1039
|
}
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
CB_LOG_WARNING("cancel operation while trying to write to closed mcbp session, opaque={}", opaque);
|
1122
|
-
handler->handle_response(request, errc::common::request_canceled, retry_reason::socket_closed_while_in_flight, {}, {});
|
1123
|
-
return;
|
1124
|
-
}
|
1125
|
-
enqueue_request(opaque, std::move(request), std::move(handler));
|
1126
|
-
if (bootstrapped_ && stream_->is_open()) {
|
1127
|
-
write_and_flush(std::move(data.value()));
|
1128
|
-
} else {
|
1129
|
-
CB_LOG_DEBUG("{} the stream is not ready yet, put the message into pending buffer, opaque={}", log_prefix_, opaque);
|
1130
|
-
std::scoped_lock lock(pending_buffer_mutex_);
|
1131
|
-
if (bootstrapped_ && stream_->is_open()) {
|
1132
|
-
write_and_flush(std::move(data.value()));
|
1133
|
-
} else {
|
1134
|
-
pending_buffer_.emplace_back(data.value());
|
1135
|
-
}
|
1136
|
-
}
|
1040
|
+
state_ = diag::endpoint_state::disconnecting;
|
1041
|
+
CB_LOG_DEBUG("{} stop MCBP connection, reason={}", log_prefix_, reason);
|
1042
|
+
stopped_ = true;
|
1043
|
+
bootstrap_deadline_.cancel();
|
1044
|
+
connection_deadline_.cancel();
|
1045
|
+
retry_backoff_.cancel();
|
1046
|
+
ping_deadline_.cancel();
|
1047
|
+
resolver_.cancel();
|
1048
|
+
stream_->close([](std::error_code) {
|
1049
|
+
});
|
1050
|
+
if (auto h = std::move(bootstrap_handler_); h) {
|
1051
|
+
h->stop();
|
1137
1052
|
}
|
1138
|
-
|
1139
|
-
|
1140
|
-
{
|
1141
|
-
if (stopped_) {
|
1142
|
-
CB_LOG_WARNING("{} MCBP cancel operation, while trying to write to closed session, opaque={}", log_prefix_, opaque);
|
1143
|
-
handler(errc::common::request_canceled, retry_reason::socket_closed_while_in_flight, {}, {});
|
1144
|
-
return;
|
1145
|
-
}
|
1146
|
-
{
|
1147
|
-
std::scoped_lock lock(command_handlers_mutex_);
|
1148
|
-
command_handlers_.try_emplace(opaque, std::move(handler));
|
1149
|
-
}
|
1150
|
-
if (bootstrapped_ && stream_->is_open()) {
|
1151
|
-
write_and_flush(std::move(data));
|
1152
|
-
} else {
|
1153
|
-
CB_LOG_DEBUG("{} the stream is not ready yet, put the message into pending buffer, opaque={}", log_prefix_, opaque);
|
1154
|
-
std::scoped_lock lock(pending_buffer_mutex_);
|
1155
|
-
if (bootstrapped_ && stream_->is_open()) {
|
1156
|
-
write_and_flush(std::move(data));
|
1157
|
-
} else {
|
1158
|
-
pending_buffer_.emplace_back(data);
|
1159
|
-
}
|
1160
|
-
}
|
1053
|
+
if (auto h = std::move(handler_); h) {
|
1054
|
+
h->stop();
|
1161
1055
|
}
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
}
|
1168
|
-
command_handlers_mutex_.lock();
|
1169
|
-
if (auto handler = command_handlers_.find(opaque); handler != command_handlers_.end()) {
|
1170
|
-
CB_LOG_DEBUG("{} MCBP cancel operation, opaque={}, ec={} ({})", log_prefix_, opaque, ec.value(), ec.message());
|
1171
|
-
if (handler->second) {
|
1172
|
-
auto fun = std::move(handler->second);
|
1173
|
-
command_handlers_.erase(handler);
|
1174
|
-
command_handlers_mutex_.unlock();
|
1175
|
-
fun(ec, reason, {}, {});
|
1176
|
-
return true;
|
1177
|
-
}
|
1178
|
-
}
|
1179
|
-
command_handlers_mutex_.unlock();
|
1180
|
-
return false;
|
1056
|
+
std::error_code ec = errc::common::request_canceled;
|
1057
|
+
if (!bootstrapped_) {
|
1058
|
+
if (auto h = std::move(bootstrap_callback_); h) {
|
1059
|
+
h(ec, {});
|
1060
|
+
}
|
1181
1061
|
}
|
1182
|
-
|
1183
|
-
[[nodiscard]] bool supports_feature(protocol::hello_feature feature)
|
1184
1062
|
{
|
1185
|
-
|
1063
|
+
std::scoped_lock lock(command_handlers_mutex_);
|
1064
|
+
for (auto& [opaque, handler] : command_handlers_) {
|
1065
|
+
if (handler) {
|
1066
|
+
CB_LOG_DEBUG("{} MCBP cancel operation during session close, opaque={}, ec={}",
|
1067
|
+
log_prefix_,
|
1068
|
+
opaque,
|
1069
|
+
ec.message());
|
1070
|
+
auto fun = std::move(handler);
|
1071
|
+
fun(ec, reason, {}, {});
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
command_handlers_.clear();
|
1186
1075
|
}
|
1187
|
-
|
1188
|
-
[[nodiscard]] std::vector<protocol::hello_feature> supported_features() const
|
1189
1076
|
{
|
1190
|
-
|
1077
|
+
std::scoped_lock lock(operations_mutex_);
|
1078
|
+
auto operations = std::move(operations_);
|
1079
|
+
for (auto& [opaque, operation] : operations) {
|
1080
|
+
auto& [request, handler] = operation;
|
1081
|
+
if (handler) {
|
1082
|
+
CB_LOG_DEBUG("{} MCBP cancel operation during session close, opaque={}, ec={}",
|
1083
|
+
log_prefix_,
|
1084
|
+
opaque,
|
1085
|
+
ec.message());
|
1086
|
+
handler->handle_response(std::move(request), {}, reason, {}, {});
|
1087
|
+
}
|
1088
|
+
}
|
1089
|
+
operations_.clear();
|
1191
1090
|
}
|
1192
|
-
|
1193
|
-
|
1194
|
-
{
|
1195
|
-
|
1091
|
+
config_listeners_.clear();
|
1092
|
+
state_ = diag::endpoint_state::disconnected;
|
1093
|
+
if (auto on_stop = std::move(on_stop_handler_); on_stop) {
|
1094
|
+
on_stop();
|
1196
1095
|
}
|
1096
|
+
}
|
1197
1097
|
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1098
|
+
void write(std::vector<std::byte>&& buf)
|
1099
|
+
{
|
1100
|
+
if (stopped_) {
|
1101
|
+
return;
|
1201
1102
|
}
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1103
|
+
CB_LOG_TRACE("{} MCBP send {}", log_prefix_, mcbp_header_view(buf));
|
1104
|
+
std::scoped_lock lock(output_buffer_mutex_);
|
1105
|
+
output_buffer_.emplace_back(std::move(buf));
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
void flush()
|
1109
|
+
{
|
1110
|
+
if (stopped_) {
|
1111
|
+
return;
|
1206
1112
|
}
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1113
|
+
asio::post(asio::bind_executor(ctx_, [self = shared_from_this()]() {
|
1114
|
+
self->do_write();
|
1115
|
+
}));
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
void write_and_flush(std::vector<std::byte>&& buf)
|
1119
|
+
{
|
1120
|
+
if (stopped_) {
|
1121
|
+
return;
|
1212
1122
|
}
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1123
|
+
write(std::move(buf));
|
1124
|
+
flush();
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
void remove_request(std::shared_ptr<mcbp::queue_request> request) override
|
1128
|
+
{
|
1129
|
+
std::scoped_lock lock(operations_mutex_);
|
1130
|
+
if (auto iter = operations_.find(request->opaque_); iter != operations_.end()) {
|
1131
|
+
operations_.erase(iter);
|
1219
1132
|
}
|
1220
|
-
|
1221
|
-
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
void enqueue_request(std::uint32_t opaque,
|
1136
|
+
std::shared_ptr<mcbp::queue_request> request,
|
1137
|
+
std::shared_ptr<response_handler> handler)
|
1138
|
+
{
|
1139
|
+
std::scoped_lock lock(operations_mutex_);
|
1140
|
+
request->waiting_in_ = this;
|
1141
|
+
operations_.try_emplace(opaque, std::move(request), std::move(handler));
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
auto handle_request(protocol::client_opcode opcode,
|
1145
|
+
std::uint16_t status,
|
1146
|
+
std::uint32_t opaque,
|
1147
|
+
mcbp_message&& msg) -> bool
|
1148
|
+
{
|
1149
|
+
// handle request old style
|
1150
|
+
command_handler fun{};
|
1222
1151
|
{
|
1223
|
-
|
1152
|
+
std::scoped_lock lock(command_handlers_mutex_);
|
1153
|
+
if (auto handler = command_handlers_.find(opaque);
|
1154
|
+
handler != command_handlers_.end() && handler->second) {
|
1155
|
+
fun = std::move(handler->second);
|
1156
|
+
command_handlers_.erase(handler);
|
1157
|
+
}
|
1224
1158
|
}
|
1225
1159
|
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1160
|
+
auto reason = status == static_cast<std::uint16_t>(key_value_status_code::not_my_vbucket)
|
1161
|
+
? retry_reason::key_value_not_my_vbucket
|
1162
|
+
: retry_reason::do_not_retry;
|
1163
|
+
if (fun) {
|
1164
|
+
fun(protocol::map_status_code(opcode, status),
|
1165
|
+
reason,
|
1166
|
+
std::move(msg),
|
1167
|
+
decode_error_code(status));
|
1168
|
+
return true;
|
1229
1169
|
}
|
1230
1170
|
|
1231
|
-
|
1171
|
+
// handle request new style
|
1172
|
+
std::shared_ptr<mcbp::queue_request> request{};
|
1173
|
+
std::shared_ptr<response_handler> handler{};
|
1232
1174
|
{
|
1233
|
-
|
1175
|
+
std::scoped_lock lock(operations_mutex_);
|
1176
|
+
if (auto pair = operations_.find(opaque); pair != operations_.end() && pair->second.first) {
|
1177
|
+
request = pair->second.first;
|
1178
|
+
handler = pair->second.second;
|
1179
|
+
if (!request->persistent_) {
|
1180
|
+
operations_.erase(pair);
|
1181
|
+
}
|
1182
|
+
}
|
1234
1183
|
}
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1184
|
+
if (request) {
|
1185
|
+
handler->handle_response(std::move(request),
|
1186
|
+
protocol::map_status_code(opcode, status),
|
1187
|
+
reason,
|
1188
|
+
std::move(msg),
|
1189
|
+
decode_error_code(status));
|
1190
|
+
return true;
|
1239
1191
|
}
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1192
|
+
return false;
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
void write_and_subscribe(std::shared_ptr<mcbp::queue_request> request,
|
1196
|
+
std::shared_ptr<response_handler> handler)
|
1197
|
+
{
|
1198
|
+
auto opaque = request->opaque_;
|
1199
|
+
auto data = codec_.encode_packet(*request);
|
1200
|
+
if (!data) {
|
1201
|
+
CB_LOG_DEBUG("unable to encode packet. opaque={}, ec={}", opaque, data.error().message());
|
1202
|
+
request->try_callback({}, data.error());
|
1203
|
+
return;
|
1244
1204
|
}
|
1245
1205
|
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1206
|
+
if (stopped_) {
|
1207
|
+
CB_LOG_WARNING("cancel operation while trying to write to closed mcbp session, opaque={}",
|
1208
|
+
opaque);
|
1209
|
+
handler->handle_response(request,
|
1210
|
+
errc::common::request_canceled,
|
1211
|
+
retry_reason::socket_closed_while_in_flight,
|
1212
|
+
{},
|
1213
|
+
{});
|
1214
|
+
return;
|
1255
1215
|
}
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1216
|
+
enqueue_request(opaque, std::move(request), std::move(handler));
|
1217
|
+
if (bootstrapped_ && stream_->is_open()) {
|
1218
|
+
write_and_flush(std::move(data.value()));
|
1219
|
+
} else {
|
1220
|
+
CB_LOG_DEBUG("{} the stream is not ready yet, put the message into pending buffer, opaque={}",
|
1221
|
+
log_prefix_,
|
1222
|
+
opaque);
|
1223
|
+
std::scoped_lock lock(pending_buffer_mutex_);
|
1224
|
+
if (bootstrapped_ && stream_->is_open()) {
|
1225
|
+
write_and_flush(std::move(data.value()));
|
1226
|
+
} else {
|
1227
|
+
pending_buffer_.emplace_back(data.value());
|
1228
|
+
}
|
1260
1229
|
}
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
CB_LOG_DEBUG("{} received a configuration with an empty vbucket map, ignoring", log_prefix_);
|
1274
|
-
return;
|
1275
|
-
}
|
1276
|
-
if (config_) {
|
1277
|
-
if (config_->vbmap && config.vbmap && config_->vbmap->size() != config.vbmap->size()) {
|
1278
|
-
CB_LOG_DEBUG("{} received a configuration with a different number of vbuckets, ignoring", log_prefix_);
|
1279
|
-
return;
|
1280
|
-
}
|
1281
|
-
if (config == config_) {
|
1282
|
-
CB_LOG_TRACE("{} received a configuration with identical revision (new={}, old={}), ignoring",
|
1283
|
-
log_prefix_,
|
1284
|
-
config.rev_str(),
|
1285
|
-
config_->rev_str());
|
1286
|
-
return;
|
1287
|
-
}
|
1288
|
-
if (config < config_) {
|
1289
|
-
CB_LOG_DEBUG("{} received a configuration with older revision (new={}, old={}), ignoring",
|
1290
|
-
log_prefix_,
|
1291
|
-
config.rev_str(),
|
1292
|
-
config_->rev_str());
|
1293
|
-
return;
|
1294
|
-
}
|
1295
|
-
}
|
1296
|
-
bool this_node_found = false;
|
1297
|
-
for (auto& node : config.nodes) {
|
1298
|
-
if (node.hostname.empty()) {
|
1299
|
-
node.hostname = bootstrap_hostname_;
|
1300
|
-
}
|
1301
|
-
if (node.this_node) {
|
1302
|
-
this_node_found = true;
|
1303
|
-
}
|
1304
|
-
}
|
1305
|
-
if (!this_node_found) {
|
1306
|
-
for (auto& node : config.nodes) {
|
1307
|
-
if (node.hostname == bootstrap_hostname_) {
|
1308
|
-
if ((node.services_plain.key_value && std::to_string(node.services_plain.key_value.value()) == bootstrap_port_) ||
|
1309
|
-
(node.services_tls.key_value && std::to_string(node.services_tls.key_value.value()) == bootstrap_port_)) {
|
1310
|
-
node.this_node = true;
|
1311
|
-
}
|
1312
|
-
}
|
1313
|
-
}
|
1314
|
-
}
|
1315
|
-
config_.reset();
|
1316
|
-
config_.emplace(std::move(config));
|
1317
|
-
configured_ = true;
|
1318
|
-
for (const auto& listener : config_listeners_) {
|
1319
|
-
asio::post(
|
1320
|
-
asio::bind_executor(ctx_, [listener, c = config_.value()]() mutable { return listener->update_config(std::move(c)); }));
|
1321
|
-
}
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
void write_and_subscribe(std::uint32_t opaque,
|
1233
|
+
std::vector<std::byte>&& data,
|
1234
|
+
command_handler&& handler)
|
1235
|
+
{
|
1236
|
+
if (stopped_) {
|
1237
|
+
CB_LOG_WARNING("{} MCBP cancel operation, while trying to write to closed session, opaque={}",
|
1238
|
+
log_prefix_,
|
1239
|
+
opaque);
|
1240
|
+
handler(errc::common::request_canceled, retry_reason::socket_closed_while_in_flight, {}, {});
|
1241
|
+
return;
|
1322
1242
|
}
|
1323
|
-
|
1324
|
-
void handle_not_my_vbucket(const io::mcbp_message& msg)
|
1325
1243
|
{
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1244
|
+
std::scoped_lock lock(command_handlers_mutex_);
|
1245
|
+
command_handlers_.try_emplace(opaque, std::move(handler));
|
1246
|
+
}
|
1247
|
+
if (bootstrapped_ && stream_->is_open()) {
|
1248
|
+
write_and_flush(std::move(data));
|
1249
|
+
} else {
|
1250
|
+
CB_LOG_DEBUG("{} the stream is not ready yet, put the message into pending buffer, opaque={}",
|
1251
|
+
log_prefix_,
|
1252
|
+
opaque);
|
1253
|
+
std::scoped_lock lock(pending_buffer_mutex_);
|
1254
|
+
if (bootstrapped_ && stream_->is_open()) {
|
1255
|
+
write_and_flush(std::move(data));
|
1256
|
+
} else {
|
1257
|
+
pending_buffer_.emplace_back(data);
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
}
|
1340
1261
|
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1262
|
+
[[nodiscard]] auto cancel(std::uint32_t opaque, std::error_code ec, retry_reason reason) -> bool
|
1263
|
+
{
|
1264
|
+
if (stopped_) {
|
1265
|
+
return false;
|
1266
|
+
}
|
1267
|
+
command_handlers_mutex_.lock();
|
1268
|
+
if (auto handler = command_handlers_.find(opaque); handler != command_handlers_.end()) {
|
1269
|
+
CB_LOG_DEBUG("{} MCBP cancel operation, opaque={}, ec={} ({})",
|
1270
|
+
log_prefix_,
|
1271
|
+
opaque,
|
1272
|
+
ec.value(),
|
1273
|
+
ec.message());
|
1274
|
+
if (handler->second) {
|
1275
|
+
auto fun = std::move(handler->second);
|
1276
|
+
command_handlers_.erase(handler);
|
1277
|
+
command_handlers_mutex_.unlock();
|
1278
|
+
fun(ec, reason, {}, {});
|
1279
|
+
return true;
|
1280
|
+
}
|
1281
|
+
}
|
1282
|
+
command_handlers_mutex_.unlock();
|
1283
|
+
return false;
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
[[nodiscard]] auto supports_feature(protocol::hello_feature feature) -> bool
|
1287
|
+
{
|
1288
|
+
return std::find(supported_features_.begin(), supported_features_.end(), feature) !=
|
1289
|
+
supported_features_.end();
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
[[nodiscard]] auto supported_features() const -> std::vector<protocol::hello_feature>
|
1293
|
+
{
|
1294
|
+
return supported_features_;
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
[[nodiscard]] auto supports_gcccp() const -> bool
|
1298
|
+
{
|
1299
|
+
return supports_gcccp_;
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
auto config() const -> std::optional<topology::configuration>
|
1303
|
+
{
|
1304
|
+
return config_;
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
[[nodiscard]] auto has_config() const -> bool
|
1308
|
+
{
|
1309
|
+
return configured_;
|
1310
|
+
}
|
1311
|
+
|
1312
|
+
[[nodiscard]] auto config() -> topology::configuration
|
1313
|
+
{
|
1314
|
+
std::scoped_lock lock(config_mutex_);
|
1315
|
+
return config_.value();
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
[[nodiscard]] auto index() const -> std::size_t
|
1319
|
+
{
|
1320
|
+
std::scoped_lock lock(config_mutex_);
|
1321
|
+
Expects(config_.has_value());
|
1322
|
+
return config_->index_for_this_node();
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
[[nodiscard]] auto bootstrap_address() const -> const std::string&
|
1326
|
+
{
|
1327
|
+
return bootstrap_address_;
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
[[nodiscard]] auto bootstrap_hostname() const -> const std::string&
|
1331
|
+
{
|
1332
|
+
return bootstrap_hostname_;
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
[[nodiscard]] auto bootstrap_port() const -> const std::string&
|
1336
|
+
{
|
1337
|
+
return bootstrap_port_;
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
[[nodiscard]] auto bootstrap_port_number() const -> std::uint16_t
|
1341
|
+
{
|
1342
|
+
return bootstrap_port_number_;
|
1343
|
+
}
|
1344
|
+
|
1345
|
+
[[nodiscard]] auto next_opaque() -> std::uint32_t
|
1346
|
+
{
|
1347
|
+
return ++opaque_;
|
1348
|
+
}
|
1349
|
+
|
1350
|
+
auto decode_error_code(std::uint16_t code) -> std::optional<key_value_error_map_info>
|
1351
|
+
{
|
1352
|
+
if (error_map_) {
|
1353
|
+
auto info = error_map_->errors.find(code);
|
1354
|
+
if (info != error_map_->errors.end()) {
|
1355
|
+
return info->second;
|
1356
|
+
}
|
1362
1357
|
}
|
1358
|
+
return {};
|
1359
|
+
}
|
1360
|
+
|
1361
|
+
void on_configuration_update(std::shared_ptr<config_listener> handler)
|
1362
|
+
{
|
1363
|
+
config_listeners_.emplace_back(std::move(handler));
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
void update_configuration(topology::configuration&& config)
|
1367
|
+
{
|
1368
|
+
if (stopped_) {
|
1369
|
+
return;
|
1370
|
+
}
|
1371
|
+
std::scoped_lock lock(config_mutex_);
|
1372
|
+
// MB-60405 fixes this for 7.6.2, but for earlier versions we need to protect against using a
|
1373
|
+
// config that has an empty vbucket map. We should be okay to ignore at this point b/c we
|
1374
|
+
// should already have a config w/ a non-empty vbucket map (bootstrap will not complete
|
1375
|
+
// successfully unless we have a config w/ a non-empty vbucket map).
|
1376
|
+
if (config.vbmap && config.vbmap->size() == 0) {
|
1377
|
+
CB_LOG_DEBUG("{} received a configuration with an empty vbucket map, ignoring", log_prefix_);
|
1378
|
+
return;
|
1379
|
+
}
|
1380
|
+
if (config_) {
|
1381
|
+
if (config_->vbmap && config.vbmap && config_->vbmap->size() != config.vbmap->size()) {
|
1382
|
+
CB_LOG_DEBUG("{} received a configuration with a different number of vbuckets, ignoring",
|
1383
|
+
log_prefix_);
|
1384
|
+
return;
|
1385
|
+
}
|
1386
|
+
if (config == config_) {
|
1387
|
+
CB_LOG_TRACE(
|
1388
|
+
"{} received a configuration with identical revision (new={}, old={}), ignoring",
|
1389
|
+
log_prefix_,
|
1390
|
+
config.rev_str(),
|
1391
|
+
config_->rev_str());
|
1392
|
+
return;
|
1393
|
+
}
|
1394
|
+
if (config < config_) {
|
1395
|
+
CB_LOG_DEBUG("{} received a configuration with older revision (new={}, old={}), ignoring",
|
1396
|
+
log_prefix_,
|
1397
|
+
config.rev_str(),
|
1398
|
+
config_->rev_str());
|
1399
|
+
return;
|
1400
|
+
}
|
1401
|
+
}
|
1402
|
+
bool this_node_found = false;
|
1403
|
+
for (auto& node : config.nodes) {
|
1404
|
+
if (node.hostname.empty()) {
|
1405
|
+
node.hostname = bootstrap_hostname_;
|
1406
|
+
}
|
1407
|
+
if (node.this_node) {
|
1408
|
+
this_node_found = true;
|
1409
|
+
}
|
1410
|
+
}
|
1411
|
+
if (!this_node_found) {
|
1412
|
+
for (auto& node : config.nodes) {
|
1413
|
+
if (node.hostname == bootstrap_hostname_) {
|
1414
|
+
if ((node.services_plain.key_value &&
|
1415
|
+
std::to_string(node.services_plain.key_value.value()) == bootstrap_port_) ||
|
1416
|
+
(node.services_tls.key_value &&
|
1417
|
+
std::to_string(node.services_tls.key_value.value()) == bootstrap_port_)) {
|
1418
|
+
node.this_node = true;
|
1419
|
+
}
|
1420
|
+
}
|
1421
|
+
}
|
1422
|
+
}
|
1423
|
+
config_.reset();
|
1424
|
+
config_.emplace(std::move(config));
|
1425
|
+
configured_ = true;
|
1426
|
+
for (const auto& listener : config_listeners_) {
|
1427
|
+
asio::post(asio::bind_executor(ctx_, [listener, c = config_.value()]() mutable {
|
1428
|
+
return listener->update_config(std::move(c));
|
1429
|
+
}));
|
1430
|
+
}
|
1431
|
+
}
|
1363
1432
|
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1433
|
+
void handle_not_my_vbucket(const io::mcbp_message& msg)
|
1434
|
+
{
|
1435
|
+
if (stopped_) {
|
1436
|
+
return;
|
1437
|
+
}
|
1438
|
+
Expects(msg.header.magic == static_cast<std::uint8_t>(protocol::magic::alt_client_response) ||
|
1439
|
+
msg.header.magic == static_cast<std::uint8_t>(protocol::magic::client_response));
|
1440
|
+
if (protocol::has_json_datatype(msg.header.datatype)) {
|
1441
|
+
auto magic = static_cast<protocol::magic>(msg.header.magic);
|
1442
|
+
std::uint8_t extras_size = msg.header.extlen;
|
1443
|
+
std::uint8_t framing_extras_size = 0;
|
1444
|
+
std::uint16_t key_size = utils::byte_swap(msg.header.keylen);
|
1445
|
+
if (magic == protocol::magic::alt_client_response) {
|
1446
|
+
framing_extras_size = static_cast<std::uint8_t>(msg.header.keylen >> 8U);
|
1447
|
+
key_size = msg.header.keylen & 0xffU;
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
std::vector<std::uint8_t>::difference_type offset =
|
1451
|
+
framing_extras_size + key_size + extras_size;
|
1452
|
+
if (utils::byte_swap(msg.header.bodylen) - offset > 0) {
|
1453
|
+
std::string_view config_text{ reinterpret_cast<const char*>(msg.body.data()) + offset,
|
1454
|
+
msg.body.size() - static_cast<std::size_t>(offset) };
|
1455
|
+
if (origin_.options().dump_configuration) {
|
1456
|
+
CB_LOG_TRACE(
|
1457
|
+
"{} configuration from not_my_vbucket response (size={}, endpoint=\"{}:{}\"), {}",
|
1458
|
+
log_prefix_,
|
1459
|
+
config_text.size(),
|
1460
|
+
bootstrap_hostname_,
|
1461
|
+
bootstrap_port_number_,
|
1462
|
+
config_text);
|
1463
|
+
}
|
1464
|
+
auto config =
|
1465
|
+
protocol::parse_config(config_text, bootstrap_hostname_, bootstrap_port_number_);
|
1466
|
+
CB_LOG_DEBUG(
|
1467
|
+
"{} received not_my_vbucket status for {}, opaque={} with config rev={} in the payload",
|
1468
|
+
log_prefix_,
|
1469
|
+
protocol::client_opcode(msg.header.opcode),
|
1470
|
+
utils::byte_swap(msg.header.opaque),
|
1471
|
+
config.rev_str());
|
1472
|
+
update_configuration(std::move(config));
|
1473
|
+
}
|
1367
1474
|
}
|
1475
|
+
}
|
1368
1476
|
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1477
|
+
auto get_collection_uid(const std::string& collection_path) -> std::optional<std::uint32_t>
|
1478
|
+
{
|
1479
|
+
return collection_cache_.get(collection_path);
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
void update_collection_uid(const std::string& path, std::uint32_t uid)
|
1483
|
+
{
|
1484
|
+
if (stopped_) {
|
1485
|
+
return;
|
1375
1486
|
}
|
1487
|
+
collection_cache_.update(path, uid);
|
1488
|
+
}
|
1376
1489
|
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1490
|
+
private:
|
1491
|
+
void invoke_bootstrap_handler(std::error_code ec)
|
1492
|
+
{
|
1493
|
+
retry_backoff_.cancel();
|
1381
1494
|
|
1382
|
-
|
1383
|
-
|
1384
|
-
}
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1495
|
+
if (ec && state_listener_) {
|
1496
|
+
state_listener_->report_bootstrap_error(
|
1497
|
+
fmt::format("{}:{}", bootstrap_hostname_, bootstrap_port_), ec);
|
1498
|
+
}
|
1499
|
+
if (ec == errc::network::configuration_not_available) {
|
1500
|
+
return initiate_bootstrap();
|
1501
|
+
}
|
1502
|
+
if (retry_bootstrap_on_bucket_not_found_ && ec == errc::common::bucket_not_found) {
|
1503
|
+
CB_LOG_DEBUG(R"({} server returned {} ({}), it must be transient condition, retrying)",
|
1504
|
+
log_prefix_,
|
1505
|
+
ec.value(),
|
1506
|
+
ec.message());
|
1507
|
+
return initiate_bootstrap();
|
1508
|
+
}
|
1509
|
+
if (!origin_.exhausted() && ec == errc::common::authentication_failure) {
|
1510
|
+
CB_LOG_DEBUG(
|
1511
|
+
R"({} server returned authentication_failure, but the bootstrap list is not exhausted yet. It must be transient condition, retrying)",
|
1512
|
+
log_prefix_);
|
1513
|
+
return initiate_bootstrap();
|
1514
|
+
}
|
1398
1515
|
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
return stop(retry_reason::node_not_available);
|
1416
|
-
}
|
1417
|
-
state_ = diag::endpoint_state::connected;
|
1418
|
-
std::scoped_lock lock(pending_buffer_mutex_);
|
1419
|
-
bootstrapped_ = true;
|
1420
|
-
bootstrap_handler_->stop();
|
1421
|
-
handler_ = std::make_shared<message_handler>(shared_from_this());
|
1422
|
-
handler_->start();
|
1423
|
-
if (!pending_buffer_.empty()) {
|
1424
|
-
for (auto& buf : pending_buffer_) {
|
1425
|
-
write(std::move(buf));
|
1426
|
-
}
|
1427
|
-
pending_buffer_.clear();
|
1428
|
-
flush();
|
1429
|
-
}
|
1516
|
+
if (!bootstrapped_ && bootstrap_callback_) {
|
1517
|
+
bootstrap_deadline_.cancel();
|
1518
|
+
if (config_ && state_listener_) {
|
1519
|
+
std::vector<std::string> endpoints;
|
1520
|
+
endpoints.reserve(config_.value().nodes.size());
|
1521
|
+
for (const auto& node : config_.value().nodes) {
|
1522
|
+
if (auto endpoint =
|
1523
|
+
node.endpoint(origin_.options().network, service_type::key_value, is_tls_);
|
1524
|
+
endpoint) {
|
1525
|
+
endpoints.push_back(endpoint.value());
|
1526
|
+
}
|
1527
|
+
}
|
1528
|
+
state_listener_->report_bootstrap_success(endpoints);
|
1529
|
+
}
|
1530
|
+
auto h = std::move(bootstrap_callback_);
|
1531
|
+
h(ec, config_.value_or(topology::configuration{}));
|
1430
1532
|
}
|
1533
|
+
if (ec) {
|
1534
|
+
return stop(retry_reason::node_not_available);
|
1535
|
+
}
|
1536
|
+
state_ = diag::endpoint_state::connected;
|
1537
|
+
std::scoped_lock lock(pending_buffer_mutex_);
|
1538
|
+
bootstrapped_ = true;
|
1539
|
+
bootstrap_handler_->stop();
|
1540
|
+
handler_ = std::make_shared<message_handler>(shared_from_this());
|
1541
|
+
handler_->start();
|
1542
|
+
if (!pending_buffer_.empty()) {
|
1543
|
+
for (auto& buf : pending_buffer_) {
|
1544
|
+
write(std::move(buf));
|
1545
|
+
}
|
1546
|
+
pending_buffer_.clear();
|
1547
|
+
flush();
|
1548
|
+
}
|
1549
|
+
}
|
1431
1550
|
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1551
|
+
void on_resolve(std::error_code ec, const asio::ip::tcp::resolver::results_type& endpoints)
|
1552
|
+
{
|
1553
|
+
if (ec == asio::error::operation_aborted || stopped_) {
|
1554
|
+
return;
|
1555
|
+
}
|
1556
|
+
last_active_ = std::chrono::steady_clock::now();
|
1557
|
+
if (ec) {
|
1558
|
+
CB_LOG_ERROR("{} error on resolve: {} ({})", log_prefix_, ec.value(), ec.message());
|
1559
|
+
return initiate_bootstrap();
|
1560
|
+
}
|
1561
|
+
endpoints_ = endpoints;
|
1562
|
+
CB_LOG_TRACE("{} resolved \"{}:{}\" to {} endpoint(s)",
|
1563
|
+
log_prefix_,
|
1564
|
+
bootstrap_hostname_,
|
1565
|
+
bootstrap_port_,
|
1566
|
+
endpoints_.size());
|
1567
|
+
do_connect(endpoints_.begin());
|
1568
|
+
connection_deadline_.expires_after(origin_.options().resolve_timeout);
|
1569
|
+
connection_deadline_.async_wait([self = shared_from_this()](const auto timer_ec) {
|
1570
|
+
if (timer_ec == asio::error::operation_aborted || self->stopped_) {
|
1571
|
+
return;
|
1572
|
+
}
|
1573
|
+
return self->stream_->close([self](std::error_code) {
|
1574
|
+
self->initiate_bootstrap();
|
1575
|
+
});
|
1576
|
+
});
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
void do_connect(asio::ip::tcp::resolver::results_type::iterator it)
|
1580
|
+
{
|
1581
|
+
if (stopped_) {
|
1582
|
+
return;
|
1583
|
+
}
|
1584
|
+
last_active_ = std::chrono::steady_clock::now();
|
1585
|
+
if (it != endpoints_.end()) {
|
1586
|
+
auto hostname = it->endpoint().address().to_string();
|
1587
|
+
auto port = it->endpoint().port();
|
1588
|
+
CB_LOG_DEBUG("{} connecting to {}:{} (\"{}:{}\"), timeout={}ms",
|
1589
|
+
log_prefix_,
|
1590
|
+
hostname,
|
1591
|
+
port,
|
1592
|
+
bootstrap_hostname_,
|
1593
|
+
bootstrap_port_,
|
1594
|
+
origin_.options().connect_timeout.count());
|
1595
|
+
connection_deadline_.expires_after(origin_.options().connect_timeout);
|
1596
|
+
connection_deadline_.async_wait(
|
1597
|
+
[self = shared_from_this(), hostname, port](const auto timer_ec) {
|
1598
|
+
if (timer_ec == asio::error::operation_aborted || self->stopped_) {
|
1435
1599
|
return;
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
connection_deadline_.async_wait([self = shared_from_this()](const auto timer_ec) {
|
1447
|
-
if (timer_ec == asio::error::operation_aborted || self->stopped_) {
|
1448
|
-
return;
|
1449
|
-
}
|
1450
|
-
return self->stream_->close([self](std::error_code) { self->initiate_bootstrap(); });
|
1600
|
+
}
|
1601
|
+
CB_LOG_DEBUG("{} unable to connect to {}:{} (\"{}:{}\") in time, reconnecting",
|
1602
|
+
self->log_prefix_,
|
1603
|
+
hostname,
|
1604
|
+
port,
|
1605
|
+
self->bootstrap_hostname_,
|
1606
|
+
self->bootstrap_port_);
|
1607
|
+
return self->stream_->close([self](std::error_code) {
|
1608
|
+
self->initiate_bootstrap();
|
1609
|
+
});
|
1451
1610
|
});
|
1611
|
+
stream_->async_connect(
|
1612
|
+
it->endpoint(),
|
1613
|
+
std::bind(&mcbp_session_impl::on_connect, shared_from_this(), std::placeholders::_1, it));
|
1614
|
+
} else {
|
1615
|
+
CB_LOG_ERROR("{} no more endpoints left to connect to \"{}:{}\", will try another address",
|
1616
|
+
log_prefix_,
|
1617
|
+
bootstrap_hostname_,
|
1618
|
+
bootstrap_port_);
|
1619
|
+
if (state_listener_) {
|
1620
|
+
state_listener_->report_bootstrap_error(
|
1621
|
+
fmt::format("{}:{}", bootstrap_hostname_, bootstrap_port_),
|
1622
|
+
errc::network::no_endpoints_left);
|
1623
|
+
}
|
1624
|
+
return initiate_bootstrap();
|
1452
1625
|
}
|
1626
|
+
}
|
1453
1627
|
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
}
|
1459
|
-
last_active_ = std::chrono::steady_clock::now();
|
1460
|
-
if (it != endpoints_.end()) {
|
1461
|
-
auto hostname = it->endpoint().address().to_string();
|
1462
|
-
auto port = it->endpoint().port();
|
1463
|
-
CB_LOG_DEBUG("{} connecting to {}:{} (\"{}:{}\"), timeout={}ms",
|
1464
|
-
log_prefix_,
|
1465
|
-
hostname,
|
1466
|
-
port,
|
1467
|
-
bootstrap_hostname_,
|
1468
|
-
bootstrap_port_,
|
1469
|
-
origin_.options().connect_timeout.count());
|
1470
|
-
connection_deadline_.expires_after(origin_.options().connect_timeout);
|
1471
|
-
connection_deadline_.async_wait([self = shared_from_this(), hostname, port](const auto timer_ec) {
|
1472
|
-
if (timer_ec == asio::error::operation_aborted || self->stopped_) {
|
1473
|
-
return;
|
1474
|
-
}
|
1475
|
-
CB_LOG_DEBUG("{} unable to connect to {}:{} (\"{}:{}\") in time, reconnecting",
|
1476
|
-
self->log_prefix_,
|
1477
|
-
hostname,
|
1478
|
-
port,
|
1479
|
-
self->bootstrap_hostname_,
|
1480
|
-
self->bootstrap_port_);
|
1481
|
-
return self->stream_->close([self](std::error_code) { self->initiate_bootstrap(); });
|
1482
|
-
});
|
1483
|
-
stream_->async_connect(it->endpoint(),
|
1484
|
-
std::bind(&mcbp_session_impl::on_connect, shared_from_this(), std::placeholders::_1, it));
|
1485
|
-
} else {
|
1486
|
-
CB_LOG_ERROR("{} no more endpoints left to connect to \"{}:{}\", will try another address",
|
1487
|
-
log_prefix_,
|
1488
|
-
bootstrap_hostname_,
|
1489
|
-
bootstrap_port_);
|
1490
|
-
if (state_listener_) {
|
1491
|
-
state_listener_->report_bootstrap_error(fmt::format("{}:{}", bootstrap_hostname_, bootstrap_port_),
|
1492
|
-
errc::network::no_endpoints_left);
|
1493
|
-
}
|
1494
|
-
return initiate_bootstrap();
|
1495
|
-
}
|
1628
|
+
void on_connect(const std::error_code& ec, asio::ip::tcp::resolver::results_type::iterator it)
|
1629
|
+
{
|
1630
|
+
if (ec == asio::error::operation_aborted || stopped_) {
|
1631
|
+
return;
|
1496
1632
|
}
|
1497
|
-
|
1498
|
-
|
1499
|
-
{
|
1500
|
-
if (ec == asio::error::operation_aborted || stopped_) {
|
1501
|
-
return;
|
1502
|
-
}
|
1503
|
-
last_active_ = std::chrono::steady_clock::now();
|
1504
|
-
if (!stream_->is_open() || ec) {
|
1633
|
+
last_active_ = std::chrono::steady_clock::now();
|
1634
|
+
if (!stream_->is_open() || ec) {
|
1505
1635
|
#ifdef COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1636
|
+
auto error_message = (ec.category() == asio::error::ssl_category)
|
1637
|
+
? ERR_error_string(static_cast<std::uint32_t>(ec.value()), nullptr)
|
1638
|
+
: ec.message();
|
1509
1639
|
#else
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1640
|
+
auto error_message = (ec.category() == asio::error::ssl_category)
|
1641
|
+
? ERR_error_string(static_cast<unsigned long>(ec.value()), nullptr)
|
1642
|
+
: ec.message();
|
1513
1643
|
#endif
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1644
|
+
CB_LOG_WARNING("{} unable to connect to {}:{}: {} ({}){}. is_open={}",
|
1645
|
+
log_prefix_,
|
1646
|
+
it->endpoint().address().to_string(),
|
1647
|
+
it->endpoint().port(),
|
1648
|
+
ec.value(),
|
1649
|
+
error_message,
|
1650
|
+
(ec == asio::error::connection_refused)
|
1651
|
+
? ", check server ports and cluster encryption setting"
|
1652
|
+
: "",
|
1653
|
+
stream_->is_open());
|
1654
|
+
if (stream_->is_open()) {
|
1655
|
+
stream_->close(std::bind(&mcbp_session_impl::do_connect, shared_from_this(), ++it));
|
1656
|
+
} else {
|
1657
|
+
do_connect(++it);
|
1658
|
+
}
|
1659
|
+
} else {
|
1660
|
+
stream_->set_options();
|
1661
|
+
connection_endpoints_ = { it->endpoint(), stream_->local_endpoint() };
|
1662
|
+
CB_LOG_DEBUG("{} connected to {}:{}",
|
1663
|
+
log_prefix_,
|
1664
|
+
connection_endpoints_.remote_address,
|
1665
|
+
connection_endpoints_.remote.port());
|
1666
|
+
log_prefix_ = fmt::format("[{}/{}/{}/{}] <{}/{}:{}>",
|
1667
|
+
client_id_,
|
1668
|
+
id_,
|
1669
|
+
stream_->log_prefix(),
|
1670
|
+
bucket_name_.value_or("-"),
|
1671
|
+
bootstrap_hostname_,
|
1672
|
+
connection_endpoints_.remote_address,
|
1673
|
+
connection_endpoints_.remote.port());
|
1674
|
+
parser_.reset();
|
1675
|
+
bootstrap_handler_ = std::make_shared<bootstrap_handler>(shared_from_this());
|
1676
|
+
connection_deadline_.cancel();
|
1543
1677
|
}
|
1678
|
+
}
|
1544
1679
|
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
}
|
1550
|
-
if (connection_deadline_.expiry() <= asio::steady_timer::clock_type::now()) {
|
1551
|
-
stream_->close([](std::error_code) {});
|
1552
|
-
}
|
1553
|
-
connection_deadline_.async_wait(std::bind(&mcbp_session_impl::check_deadline, shared_from_this(), std::placeholders::_1));
|
1680
|
+
void check_deadline(std::error_code ec)
|
1681
|
+
{
|
1682
|
+
if (ec == asio::error::operation_aborted || stopped_) {
|
1683
|
+
return;
|
1554
1684
|
}
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1685
|
+
if (connection_deadline_.expiry() <= asio::steady_timer::clock_type::now()) {
|
1686
|
+
stream_->close([](std::error_code) {
|
1687
|
+
});
|
1688
|
+
}
|
1689
|
+
connection_deadline_.async_wait(
|
1690
|
+
std::bind(&mcbp_session_impl::check_deadline, shared_from_this(), std::placeholders::_1));
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
void do_read()
|
1694
|
+
{
|
1695
|
+
if (stopped_ || reading_ || !stream_->is_open()) {
|
1696
|
+
return;
|
1697
|
+
}
|
1698
|
+
reading_ = true;
|
1699
|
+
stream_->async_read_some(
|
1700
|
+
asio::buffer(input_buffer_),
|
1701
|
+
[self = shared_from_this(), stream_id = stream_->id()](std::error_code ec,
|
1702
|
+
std::size_t bytes_transferred) {
|
1703
|
+
if (ec == asio::error::operation_aborted || self->stopped_) {
|
1704
|
+
CB_LOG_PROTOCOL("[MCBP, IN] host=\"{}\", port={}, rc={}, bytes_received={}",
|
1705
|
+
self->connection_endpoints_.remote_address,
|
1706
|
+
self->connection_endpoints_.remote.port(),
|
1707
|
+
ec ? ec.message() : "ok",
|
1708
|
+
bytes_transferred);
|
1709
|
+
return;
|
1710
|
+
} else {
|
1711
|
+
CB_LOG_PROTOCOL("[MCBP, IN] host=\"{}\", port={}, rc={}, bytes_received={}{:a}",
|
1712
|
+
self->connection_endpoints_.remote_address,
|
1713
|
+
self->connection_endpoints_.remote.port(),
|
1714
|
+
ec ? ec.message() : "ok",
|
1715
|
+
bytes_transferred,
|
1716
|
+
spdlog::to_hex(self->input_buffer_.data(),
|
1717
|
+
self->input_buffer_.data() +
|
1718
|
+
static_cast<std::ptrdiff_t>(bytes_transferred)));
|
1719
|
+
}
|
1720
|
+
self->last_active_ = std::chrono::steady_clock::now();
|
1721
|
+
if (ec) {
|
1722
|
+
if (stream_id != self->stream_->id()) {
|
1723
|
+
CB_LOG_ERROR(
|
1724
|
+
R"({} ignore IO error while reading from the socket: {} ({}), old_id="{}", new_id="{}")",
|
1725
|
+
self->log_prefix_,
|
1726
|
+
ec.value(),
|
1727
|
+
ec.message(),
|
1728
|
+
stream_id,
|
1729
|
+
self->stream_->id());
|
1559
1730
|
return;
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
spdlog::to_hex(self->input_buffer_.data(),
|
1579
|
-
self->input_buffer_.data() + static_cast<std::ptrdiff_t>(bytes_transferred)));
|
1580
|
-
}
|
1581
|
-
self->last_active_ = std::chrono::steady_clock::now();
|
1582
|
-
if (ec) {
|
1583
|
-
if (stream_id != self->stream_->id()) {
|
1584
|
-
CB_LOG_ERROR(R"({} ignore IO error while reading from the socket: {} ({}), old_id="{}", new_id="{}")",
|
1585
|
-
self->log_prefix_,
|
1586
|
-
ec.value(),
|
1587
|
-
ec.message(),
|
1588
|
-
stream_id,
|
1589
|
-
self->stream_->id());
|
1590
|
-
return;
|
1591
|
-
}
|
1592
|
-
CB_LOG_ERROR(R"({} IO error while reading from the socket("{}"): {} ({}))",
|
1593
|
-
self->log_prefix_,
|
1594
|
-
self->stream_->id(),
|
1595
|
-
ec.value(),
|
1596
|
-
ec.message());
|
1597
|
-
return self->stop(retry_reason::socket_closed_while_in_flight);
|
1731
|
+
}
|
1732
|
+
CB_LOG_ERROR(R"({} IO error while reading from the socket("{}"): {} ({}))",
|
1733
|
+
self->log_prefix_,
|
1734
|
+
self->stream_->id(),
|
1735
|
+
ec.value(),
|
1736
|
+
ec.message());
|
1737
|
+
return self->stop(retry_reason::socket_closed_while_in_flight);
|
1738
|
+
}
|
1739
|
+
self->parser_.feed(self->input_buffer_.data(),
|
1740
|
+
self->input_buffer_.data() +
|
1741
|
+
static_cast<std::ptrdiff_t>(bytes_transferred));
|
1742
|
+
|
1743
|
+
for (;;) {
|
1744
|
+
mcbp_message msg{};
|
1745
|
+
switch (self->parser_.next(msg)) {
|
1746
|
+
case mcbp_parser::result::ok: {
|
1747
|
+
if (self->stopped_) {
|
1748
|
+
return;
|
1598
1749
|
}
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
if (self->stopped_) {
|
1606
|
-
return;
|
1607
|
-
}
|
1608
|
-
CB_LOG_TRACE("{} MCBP recv {}", self->log_prefix_, mcbp_header_view(msg.header_data()));
|
1609
|
-
if (self->bootstrapped_) {
|
1610
|
-
self->handler_->handle(std::move(msg));
|
1611
|
-
} else if (self->bootstrap_handler_) {
|
1612
|
-
self->bootstrap_handler_->handle(std::move(msg));
|
1613
|
-
}
|
1614
|
-
if (self->stopped_) {
|
1615
|
-
return;
|
1616
|
-
}
|
1617
|
-
} break;
|
1618
|
-
case mcbp_parser::result::need_data:
|
1619
|
-
self->reading_ = false;
|
1620
|
-
if (!self->stopped_ && self->stream_->is_open()) {
|
1621
|
-
self->do_read();
|
1622
|
-
}
|
1623
|
-
return;
|
1624
|
-
case mcbp_parser::result::failure:
|
1625
|
-
return self->stop(retry_reason::key_value_temporary_failure);
|
1626
|
-
}
|
1750
|
+
CB_LOG_TRACE(
|
1751
|
+
"{} MCBP recv {}", self->log_prefix_, mcbp_header_view(msg.header_data()));
|
1752
|
+
if (self->bootstrapped_) {
|
1753
|
+
self->handler_->handle(std::move(msg));
|
1754
|
+
} else if (self->bootstrap_handler_) {
|
1755
|
+
self->bootstrap_handler_->handle(std::move(msg));
|
1627
1756
|
}
|
1628
|
-
|
1629
|
-
}
|
1630
|
-
|
1631
|
-
void do_write()
|
1632
|
-
{
|
1633
|
-
if (stopped_ || !stream_->is_open()) {
|
1634
|
-
return;
|
1635
|
-
}
|
1636
|
-
std::scoped_lock lock(writing_buffer_mutex_, output_buffer_mutex_);
|
1637
|
-
if (!writing_buffer_.empty() || output_buffer_.empty()) {
|
1638
|
-
return;
|
1639
|
-
}
|
1640
|
-
std::swap(writing_buffer_, output_buffer_);
|
1641
|
-
std::vector<asio::const_buffer> buffers;
|
1642
|
-
buffers.reserve(writing_buffer_.size());
|
1643
|
-
for (auto& buf : writing_buffer_) {
|
1644
|
-
CB_LOG_PROTOCOL("[MCBP, OUT] host=\"{}\", port={}, buffer_size={}{:a}",
|
1645
|
-
connection_endpoints_.remote_address,
|
1646
|
-
connection_endpoints_.remote.port(),
|
1647
|
-
buf.size(),
|
1648
|
-
spdlog::to_hex(buf));
|
1649
|
-
buffers.emplace_back(asio::buffer(buf));
|
1650
|
-
}
|
1651
|
-
stream_->async_write(buffers, [self = shared_from_this()](std::error_code ec, std::size_t bytes_transferred) {
|
1652
|
-
CB_LOG_PROTOCOL("[MCBP, OUT] host=\"{}\", port={}, rc={}, bytes_sent={}",
|
1653
|
-
self->connection_endpoints_.remote_address,
|
1654
|
-
self->connection_endpoints_.remote.port(),
|
1655
|
-
ec ? ec.message() : "ok",
|
1656
|
-
bytes_transferred);
|
1657
|
-
if (ec == asio::error::operation_aborted || self->stopped_) {
|
1757
|
+
if (self->stopped_) {
|
1658
1758
|
return;
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
self->log_prefix_,
|
1665
|
-
self->stream_->id(),
|
1666
|
-
ec.value(),
|
1667
|
-
ec.message());
|
1668
|
-
return self->stop(retry_reason::socket_closed_while_in_flight);
|
1669
|
-
}
|
1670
|
-
{
|
1671
|
-
std::scoped_lock inner_lock(self->writing_buffer_mutex_);
|
1672
|
-
self->writing_buffer_.clear();
|
1673
|
-
}
|
1674
|
-
asio::post(asio::bind_executor(self->ctx_, [self]() {
|
1675
|
-
self->do_write();
|
1759
|
+
}
|
1760
|
+
} break;
|
1761
|
+
case mcbp_parser::result::need_data:
|
1762
|
+
self->reading_ = false;
|
1763
|
+
if (!self->stopped_ && self->stream_->is_open()) {
|
1676
1764
|
self->do_read();
|
1677
|
-
|
1678
|
-
|
1765
|
+
}
|
1766
|
+
return;
|
1767
|
+
case mcbp_parser::result::failure:
|
1768
|
+
return self->stop(retry_reason::key_value_temporary_failure);
|
1769
|
+
}
|
1770
|
+
}
|
1771
|
+
});
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
void do_write()
|
1775
|
+
{
|
1776
|
+
if (stopped_ || !stream_->is_open()) {
|
1777
|
+
return;
|
1778
|
+
}
|
1779
|
+
std::scoped_lock lock(writing_buffer_mutex_, output_buffer_mutex_);
|
1780
|
+
if (!writing_buffer_.empty() || output_buffer_.empty()) {
|
1781
|
+
return;
|
1679
1782
|
}
|
1783
|
+
std::swap(writing_buffer_, output_buffer_);
|
1784
|
+
std::vector<asio::const_buffer> buffers;
|
1785
|
+
buffers.reserve(writing_buffer_.size());
|
1786
|
+
for (auto& buf : writing_buffer_) {
|
1787
|
+
CB_LOG_PROTOCOL("[MCBP, OUT] host=\"{}\", port={}, buffer_size={}{:a}",
|
1788
|
+
connection_endpoints_.remote_address,
|
1789
|
+
connection_endpoints_.remote.port(),
|
1790
|
+
buf.size(),
|
1791
|
+
spdlog::to_hex(buf));
|
1792
|
+
buffers.emplace_back(asio::buffer(buf));
|
1793
|
+
}
|
1794
|
+
stream_->async_write(
|
1795
|
+
buffers, [self = shared_from_this()](std::error_code ec, std::size_t bytes_transferred) {
|
1796
|
+
CB_LOG_PROTOCOL("[MCBP, OUT] host=\"{}\", port={}, rc={}, bytes_sent={}",
|
1797
|
+
self->connection_endpoints_.remote_address,
|
1798
|
+
self->connection_endpoints_.remote.port(),
|
1799
|
+
ec ? ec.message() : "ok",
|
1800
|
+
bytes_transferred);
|
1801
|
+
if (ec == asio::error::operation_aborted || self->stopped_) {
|
1802
|
+
return;
|
1803
|
+
}
|
1804
|
+
self->last_active_ = std::chrono::steady_clock::now();
|
1680
1805
|
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1806
|
+
if (ec) {
|
1807
|
+
CB_LOG_ERROR(R"({} IO error while writing to the socket("{}"): {} ({}))",
|
1808
|
+
self->log_prefix_,
|
1809
|
+
self->stream_->id(),
|
1810
|
+
ec.value(),
|
1811
|
+
ec.message());
|
1812
|
+
return self->stop(retry_reason::socket_closed_while_in_flight);
|
1813
|
+
}
|
1814
|
+
{
|
1815
|
+
std::scoped_lock inner_lock(self->writing_buffer_mutex_);
|
1816
|
+
self->writing_buffer_.clear();
|
1817
|
+
}
|
1818
|
+
asio::post(asio::bind_executor(self->ctx_, [self]() {
|
1819
|
+
self->do_write();
|
1820
|
+
self->do_read();
|
1821
|
+
}));
|
1822
|
+
});
|
1823
|
+
}
|
1824
|
+
|
1825
|
+
const std::string client_id_;
|
1826
|
+
const std::string id_{ uuid::to_string(uuid::random()) };
|
1827
|
+
asio::io_context& ctx_;
|
1828
|
+
asio::ip::tcp::resolver resolver_;
|
1829
|
+
std::unique_ptr<stream_impl> stream_;
|
1830
|
+
asio::steady_timer bootstrap_deadline_;
|
1831
|
+
asio::steady_timer connection_deadline_;
|
1832
|
+
asio::steady_timer retry_backoff_;
|
1833
|
+
asio::steady_timer ping_deadline_;
|
1834
|
+
couchbase::core::origin origin_;
|
1835
|
+
std::optional<std::string> bucket_name_;
|
1836
|
+
mcbp_parser parser_;
|
1837
|
+
std::shared_ptr<bootstrap_handler> bootstrap_handler_{ nullptr };
|
1838
|
+
std::optional<std::string> last_bootstrap_error_message_;
|
1839
|
+
std::shared_ptr<message_handler> handler_{ nullptr };
|
1840
|
+
utils::movable_function<void(std::error_code, const topology::configuration&)>
|
1841
|
+
bootstrap_callback_{};
|
1842
|
+
std::mutex command_handlers_mutex_{};
|
1843
|
+
std::map<std::uint32_t, command_handler> command_handlers_{};
|
1844
|
+
std::vector<std::shared_ptr<config_listener>> config_listeners_{};
|
1845
|
+
utils::movable_function<void()> on_stop_handler_{};
|
1846
|
+
|
1847
|
+
std::atomic_bool bootstrapped_{ false };
|
1848
|
+
std::atomic_bool stopped_{ false };
|
1849
|
+
bool authenticated_{ false };
|
1850
|
+
bool bucket_selected_{ false };
|
1851
|
+
bool supports_gcccp_{ true };
|
1852
|
+
bool retry_bootstrap_on_bucket_not_found_{ false };
|
1853
|
+
|
1854
|
+
std::atomic<std::uint32_t> opaque_{ 0 };
|
1855
|
+
|
1856
|
+
std::array<std::byte, 16384> input_buffer_{};
|
1857
|
+
std::vector<std::vector<std::byte>> output_buffer_{};
|
1858
|
+
std::vector<std::vector<std::byte>> pending_buffer_{};
|
1859
|
+
std::vector<std::vector<std::byte>> writing_buffer_{};
|
1860
|
+
std::mutex output_buffer_mutex_{};
|
1861
|
+
std::mutex pending_buffer_mutex_{};
|
1862
|
+
std::mutex writing_buffer_mutex_{};
|
1863
|
+
std::string bootstrap_hostname_{};
|
1864
|
+
std::string bootstrap_port_{};
|
1865
|
+
std::string bootstrap_address_{};
|
1866
|
+
std::uint16_t bootstrap_port_number_{};
|
1867
|
+
connection_endpoints connection_endpoints_{ {}, {} };
|
1868
|
+
asio::ip::tcp::resolver::results_type endpoints_;
|
1869
|
+
std::vector<protocol::hello_feature> supported_features_;
|
1870
|
+
std::optional<topology::configuration> config_;
|
1871
|
+
mutable std::mutex config_mutex_{};
|
1872
|
+
std::atomic_bool configured_{ false };
|
1873
|
+
std::optional<error_map> error_map_;
|
1874
|
+
collection_cache collection_cache_;
|
1875
|
+
|
1876
|
+
const bool is_tls_;
|
1877
|
+
std::shared_ptr<impl::bootstrap_state_listener> state_listener_{ nullptr };
|
1878
|
+
|
1879
|
+
mcbp::codec codec_;
|
1880
|
+
std::recursive_mutex operations_mutex_{};
|
1881
|
+
std::map<std::uint32_t,
|
1882
|
+
std::pair<std::shared_ptr<mcbp::queue_request>, std::shared_ptr<response_handler>>>
|
1883
|
+
operations_{};
|
1884
|
+
|
1885
|
+
std::atomic_bool reading_{ false };
|
1886
|
+
|
1887
|
+
std::string log_prefix_{};
|
1888
|
+
std::chrono::time_point<std::chrono::steady_clock> last_active_{};
|
1889
|
+
std::atomic<diag::endpoint_state> state_{ diag::endpoint_state::disconnected };
|
1743
1890
|
};
|
1744
1891
|
|
1745
1892
|
mcbp_session::mcbp_session(std::string client_id,
|
@@ -1774,196 +1921,202 @@ mcbp_session::mcbp_session(std::string client_id,
|
|
1774
1921
|
{
|
1775
1922
|
}
|
1776
1923
|
|
1777
|
-
|
1778
|
-
mcbp_session::log_prefix() const
|
1924
|
+
auto
|
1925
|
+
mcbp_session::log_prefix() const -> const std::string&
|
1779
1926
|
{
|
1780
|
-
|
1927
|
+
return impl_->log_prefix();
|
1781
1928
|
}
|
1782
1929
|
|
1783
|
-
|
1784
|
-
mcbp_session::cancel(std::uint32_t opaque, std::error_code ec, retry_reason reason)
|
1930
|
+
auto
|
1931
|
+
mcbp_session::cancel(std::uint32_t opaque, std::error_code ec, retry_reason reason) -> bool
|
1785
1932
|
{
|
1786
|
-
|
1933
|
+
return impl_->cancel(opaque, ec, reason);
|
1787
1934
|
}
|
1788
1935
|
|
1789
|
-
|
1790
|
-
mcbp_session::is_stopped() const
|
1936
|
+
auto
|
1937
|
+
mcbp_session::is_stopped() const -> bool
|
1791
1938
|
{
|
1792
|
-
|
1939
|
+
return impl_->is_stopped();
|
1793
1940
|
}
|
1794
1941
|
|
1795
|
-
|
1796
|
-
mcbp_session::is_bootstrapped() const
|
1942
|
+
auto
|
1943
|
+
mcbp_session::is_bootstrapped() const -> bool
|
1797
1944
|
{
|
1798
|
-
|
1945
|
+
return impl_->is_bootstrapped();
|
1799
1946
|
}
|
1800
1947
|
|
1801
|
-
|
1802
|
-
mcbp_session::next_opaque()
|
1948
|
+
auto
|
1949
|
+
mcbp_session::next_opaque() -> std::uint32_t
|
1803
1950
|
{
|
1804
|
-
|
1951
|
+
return impl_->next_opaque();
|
1805
1952
|
}
|
1806
1953
|
|
1807
|
-
|
1808
|
-
mcbp_session::get_collection_uid(const std::string& collection_path)
|
1954
|
+
auto
|
1955
|
+
mcbp_session::get_collection_uid(const std::string& collection_path) -> std::optional<std::uint32_t>
|
1809
1956
|
{
|
1810
|
-
|
1957
|
+
return impl_->get_collection_uid(collection_path);
|
1811
1958
|
}
|
1812
1959
|
|
1813
|
-
|
1814
|
-
mcbp_session::context() const
|
1960
|
+
auto
|
1961
|
+
mcbp_session::context() const -> mcbp_context
|
1815
1962
|
{
|
1816
|
-
|
1963
|
+
return impl_->context();
|
1817
1964
|
}
|
1818
1965
|
|
1819
|
-
|
1820
|
-
mcbp_session::supports_feature(protocol::hello_feature feature)
|
1966
|
+
auto
|
1967
|
+
mcbp_session::supports_feature(protocol::hello_feature feature) -> bool
|
1821
1968
|
{
|
1822
|
-
|
1969
|
+
return impl_->supports_feature(feature);
|
1823
1970
|
}
|
1824
1971
|
|
1825
|
-
|
1826
|
-
mcbp_session::id() const
|
1972
|
+
auto
|
1973
|
+
mcbp_session::id() const -> const std::string&
|
1827
1974
|
{
|
1828
|
-
|
1975
|
+
return impl_->id();
|
1829
1976
|
}
|
1830
1977
|
|
1831
|
-
|
1832
|
-
mcbp_session::bootstrap_address() const
|
1978
|
+
auto
|
1979
|
+
mcbp_session::bootstrap_address() const -> const std::string&
|
1833
1980
|
{
|
1834
|
-
|
1981
|
+
return impl_->bootstrap_address();
|
1835
1982
|
}
|
1836
1983
|
|
1837
|
-
|
1838
|
-
mcbp_session::remote_address() const
|
1984
|
+
auto
|
1985
|
+
mcbp_session::remote_address() const -> std::string
|
1839
1986
|
{
|
1840
|
-
|
1987
|
+
return impl_->remote_address();
|
1841
1988
|
}
|
1842
1989
|
|
1843
|
-
|
1844
|
-
mcbp_session::local_address() const
|
1990
|
+
auto
|
1991
|
+
mcbp_session::local_address() const -> std::string
|
1845
1992
|
{
|
1846
|
-
|
1993
|
+
return impl_->local_address();
|
1847
1994
|
}
|
1848
1995
|
|
1849
|
-
|
1850
|
-
mcbp_session::bootstrap_hostname() const
|
1996
|
+
auto
|
1997
|
+
mcbp_session::bootstrap_hostname() const -> const std::string&
|
1851
1998
|
{
|
1852
|
-
|
1999
|
+
return impl_->bootstrap_hostname();
|
1853
2000
|
}
|
1854
2001
|
|
1855
|
-
|
1856
|
-
mcbp_session::bootstrap_port() const
|
2002
|
+
auto
|
2003
|
+
mcbp_session::bootstrap_port() const -> const std::string&
|
1857
2004
|
{
|
1858
|
-
|
2005
|
+
return impl_->bootstrap_port();
|
1859
2006
|
}
|
1860
2007
|
|
1861
|
-
|
1862
|
-
mcbp_session::bootstrap_port_number() const
|
2008
|
+
auto
|
2009
|
+
mcbp_session::bootstrap_port_number() const -> std::uint16_t
|
1863
2010
|
{
|
1864
|
-
|
2011
|
+
return impl_->bootstrap_port_number();
|
1865
2012
|
}
|
1866
2013
|
|
1867
2014
|
void
|
1868
|
-
mcbp_session::write_and_subscribe(std::uint32_t opaque,
|
2015
|
+
mcbp_session::write_and_subscribe(std::uint32_t opaque,
|
2016
|
+
std::vector<std::byte>&& data,
|
2017
|
+
command_handler&& handler)
|
1869
2018
|
{
|
1870
|
-
|
2019
|
+
return impl_->write_and_subscribe(opaque, std::move(data), std::move(handler));
|
1871
2020
|
}
|
1872
2021
|
|
1873
2022
|
void
|
1874
|
-
mcbp_session::bootstrap(
|
2023
|
+
mcbp_session::bootstrap(
|
2024
|
+
utils::movable_function<void(std::error_code, topology::configuration)>&& handler,
|
2025
|
+
bool retry_on_bucket_not_found)
|
1875
2026
|
{
|
1876
|
-
|
2027
|
+
return impl_->bootstrap(std::move(handler), retry_on_bucket_not_found);
|
1877
2028
|
}
|
1878
2029
|
|
1879
2030
|
void
|
1880
2031
|
mcbp_session::on_stop(utils::movable_function<void()> handler)
|
1881
2032
|
{
|
1882
|
-
|
2033
|
+
return impl_->on_stop(std::move(handler));
|
1883
2034
|
}
|
1884
2035
|
|
1885
2036
|
void
|
1886
2037
|
mcbp_session::stop(retry_reason reason)
|
1887
2038
|
{
|
1888
|
-
|
2039
|
+
return impl_->stop(reason);
|
1889
2040
|
}
|
1890
2041
|
|
1891
|
-
|
1892
|
-
mcbp_session::index() const
|
2042
|
+
auto
|
2043
|
+
mcbp_session::index() const -> std::size_t
|
1893
2044
|
{
|
1894
|
-
|
2045
|
+
return impl_->index();
|
1895
2046
|
}
|
1896
2047
|
|
1897
|
-
|
1898
|
-
mcbp_session::config() const
|
2048
|
+
auto
|
2049
|
+
mcbp_session::config() const -> std::optional<topology::configuration>
|
1899
2050
|
{
|
1900
|
-
|
2051
|
+
return impl_->config();
|
1901
2052
|
}
|
1902
2053
|
|
1903
|
-
|
1904
|
-
mcbp_session::has_config() const
|
2054
|
+
auto
|
2055
|
+
mcbp_session::has_config() const -> bool
|
1905
2056
|
{
|
1906
|
-
|
2057
|
+
return impl_->has_config();
|
1907
2058
|
}
|
1908
2059
|
|
1909
|
-
|
1910
|
-
mcbp_session::diag_info() const
|
2060
|
+
auto
|
2061
|
+
mcbp_session::diag_info() const -> diag::endpoint_diag_info
|
1911
2062
|
{
|
1912
|
-
|
2063
|
+
return impl_->diag_info();
|
1913
2064
|
}
|
1914
2065
|
|
1915
2066
|
void
|
1916
2067
|
mcbp_session::on_configuration_update(std::shared_ptr<config_listener> handler)
|
1917
2068
|
{
|
1918
|
-
|
2069
|
+
return impl_->on_configuration_update(std::move(handler));
|
1919
2070
|
}
|
1920
2071
|
|
1921
|
-
|
1922
|
-
mcbp_session::supported_features() const
|
2072
|
+
auto
|
2073
|
+
mcbp_session::supported_features() const -> std::vector<protocol::hello_feature>
|
1923
2074
|
{
|
1924
|
-
|
2075
|
+
return impl_->supported_features();
|
1925
2076
|
}
|
1926
2077
|
|
1927
2078
|
void
|
1928
|
-
mcbp_session::ping(std::shared_ptr<diag::ping_reporter> handler,
|
2079
|
+
mcbp_session::ping(std::shared_ptr<diag::ping_reporter> handler,
|
2080
|
+
std::optional<std::chrono::milliseconds> timeout) const
|
1929
2081
|
{
|
1930
|
-
|
2082
|
+
return impl_->ping(std::move(handler), std::move(timeout));
|
1931
2083
|
}
|
1932
2084
|
|
1933
|
-
|
1934
|
-
mcbp_session::supports_gcccp() const
|
2085
|
+
auto
|
2086
|
+
mcbp_session::supports_gcccp() const -> bool
|
1935
2087
|
{
|
1936
|
-
|
2088
|
+
return impl_->supports_gcccp();
|
1937
2089
|
}
|
1938
2090
|
|
1939
|
-
|
1940
|
-
mcbp_session::decode_error_code(std::uint16_t code)
|
2091
|
+
auto
|
2092
|
+
mcbp_session::decode_error_code(std::uint16_t code) -> std::optional<key_value_error_map_info>
|
1941
2093
|
{
|
1942
|
-
|
2094
|
+
return impl_->decode_error_code(code);
|
1943
2095
|
}
|
1944
2096
|
|
1945
2097
|
void
|
1946
2098
|
mcbp_session::handle_not_my_vbucket(const mcbp_message& msg) const
|
1947
2099
|
{
|
1948
|
-
|
2100
|
+
return impl_->handle_not_my_vbucket(msg);
|
1949
2101
|
}
|
1950
2102
|
|
1951
2103
|
void
|
1952
2104
|
mcbp_session::update_collection_uid(const std::string& path, std::uint32_t uid)
|
1953
2105
|
{
|
1954
|
-
|
2106
|
+
return impl_->update_collection_uid(path, uid);
|
1955
2107
|
}
|
1956
2108
|
|
1957
2109
|
void
|
1958
|
-
mcbp_session::write_and_subscribe(std::shared_ptr<mcbp::queue_request> request,
|
2110
|
+
mcbp_session::write_and_subscribe(std::shared_ptr<mcbp::queue_request> request,
|
2111
|
+
std::shared_ptr<response_handler> handler)
|
1959
2112
|
{
|
1960
|
-
|
2113
|
+
return impl_->write_and_subscribe(std::move(request), std::move(handler));
|
1961
2114
|
}
|
1962
2115
|
|
1963
2116
|
void
|
1964
2117
|
mcbp_session::write_and_flush(std::vector<std::byte>&& buffer)
|
1965
2118
|
{
|
1966
|
-
|
2119
|
+
return impl_->write_and_flush(std::move(buffer));
|
1967
2120
|
}
|
1968
2121
|
|
1969
2122
|
} // namespace couchbase::core::io
|