couchbase 3.7.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/ext/CMakeLists.txt +4 -1
- data/ext/cache/extconf_include.rb +4 -3
- data/ext/cache/mozilla-ca-bundle.crt +66 -665
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/couchbase/CMakeLists.txt +26 -11
- data/ext/couchbase/cmake/APKBUILD.in +17 -1
- data/ext/couchbase/cmake/Bundler.cmake +9 -1
- data/ext/couchbase/cmake/Cache.cmake +48 -19
- data/ext/couchbase/cmake/CompilerOptions.cmake +3 -1
- data/ext/couchbase/cmake/OpenSSL.cmake +10 -2
- data/ext/couchbase/cmake/Packaging.cmake +48 -8
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +43 -1
- data/ext/couchbase/cmake/build_config.hxx.in +2 -0
- data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +18 -0
- data/ext/couchbase/cmake/tarball_glob.txt +10 -0
- data/ext/couchbase/core/app_telemetry_meter.cxx +1 -0
- data/ext/couchbase/core/app_telemetry_reporter.cxx +45 -43
- data/ext/couchbase/core/app_telemetry_reporter.hxx +4 -3
- data/ext/couchbase/core/bucket.cxx +128 -13
- data/ext/couchbase/core/bucket.hxx +12 -2
- data/ext/couchbase/core/cluster.cxx +304 -152
- data/ext/couchbase/core/cluster.hxx +32 -0
- data/ext/couchbase/core/cluster_credentials.cxx +25 -0
- data/ext/couchbase/core/cluster_credentials.hxx +5 -0
- data/ext/couchbase/core/cluster_label_listener.cxx +72 -0
- data/ext/couchbase/core/cluster_label_listener.hxx +46 -0
- data/ext/couchbase/core/cluster_options.hxx +4 -0
- data/ext/couchbase/core/deprecation_utils.hxx +26 -0
- data/ext/couchbase/core/error.hxx +27 -0
- data/ext/couchbase/core/error_context/base_error_context.hxx +32 -0
- data/ext/couchbase/core/error_context/key_value.cxx +1 -0
- data/ext/couchbase/core/error_context/key_value.hxx +23 -0
- data/ext/couchbase/core/error_context/key_value_error_context.hxx +35 -0
- data/ext/couchbase/core/error_context/subdocument_error_context.hxx +41 -0
- data/ext/couchbase/core/free_form_http_request.hxx +0 -2
- data/ext/couchbase/core/http_component.cxx +12 -48
- data/ext/couchbase/core/impl/analytics.cxx +3 -2
- data/ext/couchbase/core/impl/analytics.hxx +2 -1
- data/ext/couchbase/core/impl/analytics_index_manager.cxx +249 -137
- data/ext/couchbase/core/impl/binary_collection.cxx +239 -128
- data/ext/couchbase/core/impl/bucket_manager.cxx +87 -35
- data/ext/couchbase/core/impl/collection.cxx +914 -372
- data/ext/couchbase/core/impl/collection_manager.cxx +89 -49
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +4 -4
- data/ext/couchbase/core/impl/error.cxx +49 -17
- data/ext/couchbase/core/impl/error.hxx +15 -10
- data/ext/couchbase/core/impl/get_all_replicas.hxx +1 -1
- data/ext/couchbase/core/impl/get_any_replica.hxx +2 -1
- data/ext/couchbase/core/impl/get_replica.hxx +2 -0
- data/ext/couchbase/core/impl/invoke_with_node_id.hxx +44 -0
- data/ext/couchbase/core/impl/lookup_in_replica.hxx +1 -1
- data/ext/couchbase/core/impl/node_id.cxx +110 -0
- data/ext/couchbase/core/impl/node_id.hxx +40 -0
- data/ext/couchbase/core/impl/observability_recorder.cxx +161 -0
- data/ext/couchbase/core/impl/observability_recorder.hxx +77 -0
- data/ext/couchbase/core/impl/observe_seqno.hxx +2 -0
- data/ext/couchbase/core/impl/public_bucket.cxx +31 -7
- data/ext/couchbase/core/impl/public_cluster.cxx +107 -19
- data/ext/couchbase/core/impl/query.cxx +6 -3
- data/ext/couchbase/core/impl/query.hxx +3 -1
- data/ext/couchbase/core/impl/query_index_manager.cxx +267 -102
- data/ext/couchbase/core/impl/scope.cxx +53 -11
- data/ext/couchbase/core/impl/search.cxx +8 -4
- data/ext/couchbase/core/impl/search.hxx +6 -2
- data/ext/couchbase/core/impl/search_index_manager.cxx +131 -41
- data/ext/couchbase/core/impl/with_cancellation.hxx +75 -0
- data/ext/couchbase/core/io/config_tracker.cxx +9 -9
- data/ext/couchbase/core/io/config_tracker.hxx +2 -1
- data/ext/couchbase/core/io/http_command.hxx +98 -49
- data/ext/couchbase/core/io/http_context.hxx +2 -0
- data/ext/couchbase/core/io/http_session.cxx +23 -10
- data/ext/couchbase/core/io/http_session.hxx +17 -9
- data/ext/couchbase/core/io/http_session_manager.hxx +245 -270
- data/ext/couchbase/core/io/http_traits.hxx +0 -7
- data/ext/couchbase/core/io/mcbp_command.hxx +123 -44
- data/ext/couchbase/core/io/mcbp_session.cxx +251 -26
- data/ext/couchbase/core/io/mcbp_session.hxx +9 -1
- data/ext/couchbase/core/io/mcbp_traits.hxx +0 -8
- data/ext/couchbase/core/io/streams.cxx +3 -3
- data/ext/couchbase/core/io/streams.hxx +3 -2
- data/ext/couchbase/core/meta/features.hxx +15 -0
- data/ext/couchbase/core/meta/version.cxx +13 -0
- data/ext/couchbase/core/meta/version.hxx +3 -0
- data/ext/couchbase/core/metrics/constants.hxx +23 -0
- data/ext/couchbase/core/metrics/logging_meter.cxx +5 -5
- data/ext/couchbase/core/metrics/meter_wrapper.cxx +65 -63
- data/ext/couchbase/core/metrics/meter_wrapper.hxx +12 -10
- data/ext/couchbase/core/operations/document_analytics.hxx +0 -5
- data/ext/couchbase/core/operations/document_append.hxx +0 -4
- data/ext/couchbase/core/operations/document_decrement.hxx +0 -5
- data/ext/couchbase/core/operations/document_exists.hxx +0 -7
- data/ext/couchbase/core/operations/document_get.hxx +0 -7
- data/ext/couchbase/core/operations/document_get_all_replicas.hxx +89 -29
- data/ext/couchbase/core/operations/document_get_and_lock.hxx +0 -9
- data/ext/couchbase/core/operations/document_get_and_touch.hxx +0 -9
- data/ext/couchbase/core/operations/document_get_any_replica.hxx +83 -2
- data/ext/couchbase/core/operations/document_get_projected.cxx +3 -4
- data/ext/couchbase/core/operations/document_get_projected.hxx +0 -9
- data/ext/couchbase/core/operations/document_increment.hxx +0 -5
- data/ext/couchbase/core/operations/document_insert.hxx +0 -4
- data/ext/couchbase/core/operations/document_lookup_in.hxx +0 -9
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +50 -4
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +121 -43
- data/ext/couchbase/core/operations/document_mutate_in.hxx +0 -5
- data/ext/couchbase/core/operations/document_prepend.hxx +0 -4
- data/ext/couchbase/core/operations/document_query.cxx +12 -12
- data/ext/couchbase/core/operations/document_query.hxx +0 -4
- data/ext/couchbase/core/operations/document_remove.hxx +0 -4
- data/ext/couchbase/core/operations/document_replace.hxx +0 -4
- data/ext/couchbase/core/operations/document_search.hxx +0 -7
- data/ext/couchbase/core/operations/document_touch.hxx +0 -7
- data/ext/couchbase/core/operations/document_unlock.hxx +0 -6
- data/ext/couchbase/core/operations/document_upsert.hxx +0 -4
- data/ext/couchbase/core/operations/document_view.cxx +2 -0
- data/ext/couchbase/core/operations/document_view.hxx +10 -13
- data/ext/couchbase/core/operations/http_noop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataverse_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_dataverse_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_index_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_index_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_connect.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_disconnect.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/analytics_link_replace.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_describe.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_flush.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/bucket_update.hxx +2 -0
- data/ext/couchbase/core/operations/management/change_password.hxx +2 -0
- data/ext/couchbase/core/operations/management/cluster_describe.hxx +2 -0
- data/ext/couchbase/core/operations/management/cluster_developer_preview_enable.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_create.cxx +11 -11
- data/ext/couchbase/core/operations/management/collection_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_drop.cxx +11 -11
- data/ext/couchbase/core/operations/management/collection_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_update.cxx +11 -11
- data/ext/couchbase/core/operations/management/collection_update.hxx +2 -0
- data/ext/couchbase/core/operations/management/collections_manifest_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/error_utils.cxx +13 -7
- data/ext/couchbase/core/operations/management/eventing_deploy_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_drop_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_get_all_functions.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_get_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_get_status.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_pause_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_resume_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_undeploy_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/eventing_upsert_function.hxx +2 -0
- data/ext/couchbase/core/operations/management/freeform.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/group_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_build.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_build_deferred.hxx +68 -30
- data/ext/couchbase/core/operations/management/query_index_create.cxx +5 -4
- data/ext/couchbase/core/operations/management/query_index_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_drop.cxx +7 -6
- data/ext/couchbase/core/operations/management/query_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/query_index_get_all.hxx +4 -3
- data/ext/couchbase/core/operations/management/query_index_get_all_deferred.hxx +2 -1
- data/ext/couchbase/core/operations/management/role_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/scope_create.cxx +12 -13
- data/ext/couchbase/core/operations/management/scope_create.hxx +2 -0
- data/ext/couchbase/core/operations/management/scope_drop.cxx +8 -9
- data/ext/couchbase/core/operations/management/scope_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/scope_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_get_stats.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_analyze_document.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_control_ingest.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_control_query.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get_documents_count.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_get_stats.hxx +2 -0
- data/ext/couchbase/core/operations/management/search_index_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/user_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_drop.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_get.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_get_all.hxx +2 -0
- data/ext/couchbase/core/operations/management/view_index_upsert.hxx +2 -0
- data/ext/couchbase/core/operations/operation_traits.hxx +6 -0
- data/ext/couchbase/core/operations.hxx +0 -1
- data/ext/couchbase/core/operations_fwd.hxx +8 -0
- data/ext/couchbase/core/origin.cxx +67 -12
- data/ext/couchbase/core/origin.hxx +13 -8
- data/ext/couchbase/core/orphan_reporter.cxx +164 -0
- data/ext/couchbase/core/orphan_reporter.hxx +65 -0
- data/ext/couchbase/core/sasl/CMakeLists.txt +1 -0
- data/ext/couchbase/core/sasl/client.cc +6 -0
- data/ext/couchbase/core/sasl/mechanism.cc +2 -1
- data/ext/couchbase/core/sasl/mechanism.h +2 -1
- data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.cc +41 -0
- data/ext/couchbase/core/sasl/oauthbearer/oauthbearer.h +47 -0
- data/ext/couchbase/core/tls_context_provider.cxx +44 -0
- data/ext/couchbase/core/tls_context_provider.hxx +44 -0
- data/ext/couchbase/core/topology/configuration.cxx +21 -0
- data/ext/couchbase/core/topology/configuration.hxx +28 -0
- data/ext/couchbase/core/tracing/attribute_helpers.hxx +45 -0
- data/ext/couchbase/core/tracing/constants.hxx +148 -68
- data/ext/couchbase/core/tracing/threshold_logging_options.hxx +0 -3
- data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +122 -170
- data/ext/couchbase/core/tracing/tracer_wrapper.cxx +17 -24
- data/ext/couchbase/core/tracing/tracer_wrapper.hxx +8 -10
- data/ext/couchbase/core/tracing/wrapper_sdk_tracer.cxx +114 -0
- data/ext/couchbase/core/tracing/wrapper_sdk_tracer.hxx +85 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +16 -14
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +4 -4
- data/ext/couchbase/core/transactions/transactions.cxx +1 -1
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +1 -2
- data/ext/couchbase/core/utils/byteswap.hxx +12 -0
- data/ext/couchbase/core/utils/concurrent_fixed_priority_queue.hxx +102 -0
- data/ext/couchbase/core/utils/connection_string.cxx +2 -0
- data/ext/couchbase/core/utils/contains_string.cxx +61 -0
- data/ext/couchbase/core/utils/contains_string.hxx +26 -0
- data/ext/couchbase/couchbase/certificate_authenticator.hxx +1 -0
- data/ext/couchbase/couchbase/cluster.hxx +47 -0
- data/ext/couchbase/couchbase/cluster_options.hxx +16 -0
- data/ext/couchbase/couchbase/collection.hxx +133 -15
- data/ext/couchbase/couchbase/error.hxx +16 -0
- data/ext/couchbase/couchbase/error_codes.hxx +48 -48
- data/ext/couchbase/couchbase/jwt_authenticator.hxx +52 -0
- data/ext/couchbase/couchbase/metrics/meter.hxx +2 -1
- data/ext/couchbase/couchbase/metrics/otel_meter.hxx +75 -80
- data/ext/couchbase/couchbase/network_options.hxx +19 -0
- data/ext/couchbase/couchbase/node_id.hxx +123 -0
- data/ext/couchbase/couchbase/node_id_for_options.hxx +61 -0
- data/ext/couchbase/couchbase/node_ids_options.hxx +62 -0
- data/ext/couchbase/couchbase/password_authenticator.hxx +1 -0
- data/ext/couchbase/couchbase/result.hxx +42 -0
- data/ext/couchbase/couchbase/tracing/otel_tracer.hxx +15 -17
- data/ext/couchbase/couchbase/tracing/request_span.hxx +2 -2
- data/ext/couchbase.cxx +4 -0
- data/ext/extconf.rb +1 -0
- data/ext/rcb_analytics.cxx +157 -47
- data/ext/rcb_backend.cxx +118 -71
- data/ext/rcb_buckets.cxx +39 -16
- data/ext/rcb_collections.cxx +36 -12
- data/ext/rcb_crud.cxx +589 -294
- data/ext/rcb_hdr_histogram.cxx +219 -0
- data/ext/rcb_hdr_histogram.hxx +28 -0
- data/ext/rcb_logger.cxx +15 -17
- data/ext/rcb_multi.cxx +142 -59
- data/ext/rcb_observability.cxx +132 -0
- data/ext/rcb_observability.hxx +49 -0
- data/ext/rcb_query.cxx +77 -27
- data/ext/rcb_search.cxx +92 -31
- data/ext/rcb_users.cxx +69 -26
- data/ext/rcb_utils.cxx +91 -0
- data/ext/rcb_utils.hxx +141 -168
- data/ext/rcb_views.cxx +36 -12
- data/lib/active_support/cache/couchbase_store.rb +6 -6
- data/lib/couchbase/authenticator.rb +14 -0
- data/lib/couchbase/binary_collection.rb +37 -22
- data/lib/couchbase/bucket.rb +46 -31
- data/lib/couchbase/cluster.rb +146 -61
- data/lib/couchbase/collection.rb +257 -186
- data/lib/couchbase/datastructures/couchbase_list.rb +82 -50
- data/lib/couchbase/datastructures/couchbase_map.rb +87 -50
- data/lib/couchbase/datastructures/couchbase_queue.rb +65 -38
- data/lib/couchbase/datastructures/couchbase_set.rb +58 -41
- data/lib/couchbase/deprecations.rb +1 -1
- data/lib/couchbase/diagnostics.rb +8 -8
- data/lib/couchbase/errors.rb +7 -1
- data/lib/couchbase/json_transcoder.rb +1 -1
- data/lib/couchbase/management/analytics_index_manager.rb +90 -59
- data/lib/couchbase/management/bucket_manager.rb +73 -45
- data/lib/couchbase/management/collection_manager.rb +86 -43
- data/lib/couchbase/management/collection_query_index_manager.rb +56 -33
- data/lib/couchbase/management/query_index_manager.rb +88 -36
- data/lib/couchbase/management/scope_search_index_manager.rb +119 -52
- data/lib/couchbase/management/search_index_manager.rb +401 -178
- data/lib/couchbase/management/user_manager.rb +343 -174
- data/lib/couchbase/management/view_index_manager.rb +166 -73
- data/lib/couchbase/metrics/logging_meter.rb +108 -0
- data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
- data/lib/couchbase/metrics/meter.rb +27 -0
- data/lib/couchbase/metrics/noop_meter.rb +30 -0
- data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
- data/lib/couchbase/metrics/value_recorder.rb +25 -0
- data/lib/couchbase/options.rb +71 -5
- data/lib/couchbase/protostellar/client.rb +0 -2
- data/lib/couchbase/protostellar/cluster.rb +7 -0
- data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_pb.rb +54 -0
- data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_services_pb.rb +51 -0
- data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +5 -24
- data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +16 -0
- data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +5 -24
- data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +16 -0
- data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +5 -24
- data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +18 -0
- data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +2 -23
- data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +23 -0
- data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +4 -25
- data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +10 -0
- data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +6 -25
- data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +18 -0
- data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_pb.rb +46 -0
- data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_services_pb.rb +56 -0
- data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +3 -26
- data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +47 -0
- data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +4 -26
- data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +10 -0
- data/lib/couchbase/protostellar/generated/routing/v2/routing_pb.rb +26 -0
- data/lib/couchbase/protostellar/generated/routing/v2/routing_services_pb.rb +43 -0
- data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +5 -26
- data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +11 -0
- data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +2 -23
- data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +30 -0
- data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +2 -23
- data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +9 -0
- data/lib/couchbase/protostellar/request_generator/admin/collection.rb +4 -2
- data/lib/couchbase/protostellar/request_generator/admin/query.rb +2 -0
- data/lib/couchbase/protostellar/request_generator/kv.rb +1 -1
- data/lib/couchbase/protostellar/scope.rb +4 -0
- data/lib/couchbase/scope.rb +62 -48
- data/lib/couchbase/search_options.rb +18 -18
- data/lib/couchbase/tracing/noop_span.rb +29 -0
- data/lib/couchbase/tracing/noop_tracer.rb +29 -0
- data/lib/couchbase/tracing/request_span.rb +34 -0
- data/lib/couchbase/tracing/request_tracer.rb +28 -0
- data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
- data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
- data/lib/couchbase/utils/hdr_histogram.rb +55 -0
- data/lib/couchbase/utils/observability.rb +263 -0
- data/lib/couchbase/utils/observability_constants.rb +200 -0
- data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -3
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase.rb +2 -2
- metadata +72 -8
- data/lib/couchbase/protostellar/generated/routing/v1/routing_pb.rb +0 -52
- data/lib/couchbase/protostellar/generated/routing/v1/routing_services_pb.rb +0 -30
|
@@ -240,19 +240,6 @@ class mcbp_session_impl
|
|
|
240
240
|
stopped_.compare_exchange_strong(expected_state, true);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
static auto sasl_mechanisms(const std::shared_ptr<mcbp_session_impl>& session)
|
|
244
|
-
-> std::vector<std::string>
|
|
245
|
-
{
|
|
246
|
-
if (const auto user_mechanisms = session->origin_.credentials().allowed_sasl_mechanisms;
|
|
247
|
-
user_mechanisms.has_value()) {
|
|
248
|
-
return user_mechanisms.value();
|
|
249
|
-
}
|
|
250
|
-
if (session->is_tls_) {
|
|
251
|
-
return { "PLAIN" };
|
|
252
|
-
}
|
|
253
|
-
return { "SCRAM-SHA512", "SCRAM-SHA256", "SCRAM-SHA1" };
|
|
254
|
-
}
|
|
255
|
-
|
|
256
243
|
auto last_bootstrap_error() && -> impl::bootstrap_error
|
|
257
244
|
{
|
|
258
245
|
return std::move(last_bootstrap_error_);
|
|
@@ -265,14 +252,7 @@ class mcbp_session_impl
|
|
|
265
252
|
|
|
266
253
|
explicit bootstrap_handler(std::shared_ptr<mcbp_session_impl> session)
|
|
267
254
|
: session_(std::move(session))
|
|
268
|
-
, sasl_(
|
|
269
|
-
[origin = session_->origin_]() {
|
|
270
|
-
return origin.username();
|
|
271
|
-
},
|
|
272
|
-
[origin = session_->origin_]() {
|
|
273
|
-
return origin.password();
|
|
274
|
-
},
|
|
275
|
-
sasl_mechanisms(session_))
|
|
255
|
+
, sasl_(session_->new_sasl_context())
|
|
276
256
|
{
|
|
277
257
|
protocol::client_request<protocol::hello_request_body> hello_req;
|
|
278
258
|
if (session_->origin_.options().enable_unordered_execution) {
|
|
@@ -749,6 +729,12 @@ class mcbp_session_impl
|
|
|
749
729
|
if (session_) {
|
|
750
730
|
session_->update_configuration(resp.body().config());
|
|
751
731
|
}
|
|
732
|
+
} else if (resp.status() == key_value_status_code::auth_stale) {
|
|
733
|
+
CB_LOG_WARNING("{} received auth stale status for {}, opaque={}",
|
|
734
|
+
session_->log_prefix_,
|
|
735
|
+
resp.opcode(),
|
|
736
|
+
resp.opaque());
|
|
737
|
+
session_->stop(retry_reason::do_not_retry);
|
|
752
738
|
} else {
|
|
753
739
|
CB_LOG_WARNING("{} unexpected message status: {} (opaque={})",
|
|
754
740
|
session_->log_prefix_,
|
|
@@ -779,11 +765,20 @@ class mcbp_session_impl
|
|
|
779
765
|
case protocol::client_opcode::range_scan_cancel:
|
|
780
766
|
case protocol::client_opcode::decrement:
|
|
781
767
|
case protocol::client_opcode::subdoc_multi_lookup:
|
|
782
|
-
case protocol::client_opcode::subdoc_multi_mutation:
|
|
768
|
+
case protocol::client_opcode::subdoc_multi_mutation:
|
|
769
|
+
case protocol::client_opcode::sasl_auth: {
|
|
783
770
|
const std::uint16_t status = utils::byte_swap(msg.header.specific);
|
|
784
771
|
if (status == static_cast<std::uint16_t>(key_value_status_code::not_my_vbucket)) {
|
|
785
772
|
session_->handle_not_my_vbucket(msg);
|
|
786
773
|
}
|
|
774
|
+
if (status == static_cast<std::uint16_t>(key_value_status_code::auth_stale)) {
|
|
775
|
+
CB_LOG_WARNING("{} received auth stale status for {}, opaque={}",
|
|
776
|
+
session_->log_prefix_,
|
|
777
|
+
protocol::client_opcode(msg.header.opcode),
|
|
778
|
+
utils::byte_swap(msg.header.opaque));
|
|
779
|
+
session_->stop(retry_reason::do_not_retry);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
787
782
|
|
|
788
783
|
std::uint32_t opaque = utils::byte_swap(msg.header.opaque);
|
|
789
784
|
if (session_->handle_request(opcode, status, opaque, std::move(msg))) {
|
|
@@ -880,6 +875,7 @@ public:
|
|
|
880
875
|
, bootstrap_deadline_(ctx_)
|
|
881
876
|
, resolve_deadline_(ctx_)
|
|
882
877
|
, connection_deadline_(ctx_)
|
|
878
|
+
, reauth_deadline_(ctx_)
|
|
883
879
|
, retry_backoff_(ctx_)
|
|
884
880
|
, ping_timeout_(ctx_)
|
|
885
881
|
, origin_{ std::move(origin) }
|
|
@@ -896,7 +892,7 @@ public:
|
|
|
896
892
|
mcbp_session_impl(std::string_view client_id,
|
|
897
893
|
std::string_view node_uuid,
|
|
898
894
|
asio::io_context& ctx,
|
|
899
|
-
|
|
895
|
+
tls_context_provider& tls,
|
|
900
896
|
couchbase::core::origin origin,
|
|
901
897
|
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
|
902
898
|
std::optional<std::string> bucket_name = {},
|
|
@@ -909,6 +905,7 @@ public:
|
|
|
909
905
|
, bootstrap_deadline_(ctx_)
|
|
910
906
|
, resolve_deadline_(ctx_)
|
|
911
907
|
, connection_deadline_(ctx_)
|
|
908
|
+
, reauth_deadline_(ctx_)
|
|
912
909
|
, retry_backoff_(ctx_)
|
|
913
910
|
, ping_timeout_(ctx_)
|
|
914
911
|
, origin_(std::move(origin))
|
|
@@ -943,6 +940,16 @@ public:
|
|
|
943
940
|
return connection_endpoints_.remote_address_with_port;
|
|
944
941
|
}
|
|
945
942
|
|
|
943
|
+
auto remote_hostname() const -> std::string
|
|
944
|
+
{
|
|
945
|
+
return connection_endpoints_.remote_address;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
auto remote_port() const -> std::uint16_t
|
|
949
|
+
{
|
|
950
|
+
return connection_endpoints_.remote.port();
|
|
951
|
+
}
|
|
952
|
+
|
|
946
953
|
auto local_address() const -> std::string
|
|
947
954
|
{
|
|
948
955
|
return connection_endpoints_.local_address_with_port;
|
|
@@ -962,6 +969,37 @@ public:
|
|
|
962
969
|
bucket_name_ };
|
|
963
970
|
}
|
|
964
971
|
|
|
972
|
+
auto sasl_mechanisms() -> std::vector<std::string>
|
|
973
|
+
{
|
|
974
|
+
auto credentials = origin_.credentials();
|
|
975
|
+
if (const auto user_mechanisms = credentials.allowed_sasl_mechanisms;
|
|
976
|
+
user_mechanisms.has_value()) {
|
|
977
|
+
return user_mechanisms.value();
|
|
978
|
+
}
|
|
979
|
+
if (credentials.uses_jwt()) {
|
|
980
|
+
return { "OAUTHBEARER" };
|
|
981
|
+
}
|
|
982
|
+
if (is_tls_) {
|
|
983
|
+
return { "PLAIN" };
|
|
984
|
+
}
|
|
985
|
+
return { "SCRAM-SHA512", "SCRAM-SHA256", "SCRAM-SHA1" };
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
auto new_sasl_context() -> sasl::ClientContext
|
|
989
|
+
{
|
|
990
|
+
return { [this] {
|
|
991
|
+
return origin_.username();
|
|
992
|
+
},
|
|
993
|
+
[this] {
|
|
994
|
+
auto credentials = origin_.credentials();
|
|
995
|
+
if (credentials.uses_jwt()) {
|
|
996
|
+
return credentials.jwt_token;
|
|
997
|
+
}
|
|
998
|
+
return credentials.password;
|
|
999
|
+
},
|
|
1000
|
+
sasl_mechanisms() };
|
|
1001
|
+
}
|
|
1002
|
+
|
|
965
1003
|
void ping(const std::shared_ptr<diag::ping_reporter>& handler,
|
|
966
1004
|
std::optional<std::chrono::milliseconds> timeout)
|
|
967
1005
|
{
|
|
@@ -1028,6 +1066,132 @@ public:
|
|
|
1028
1066
|
return { config_, supported_features_ };
|
|
1029
1067
|
}
|
|
1030
1068
|
|
|
1069
|
+
void reauthenticate()
|
|
1070
|
+
{
|
|
1071
|
+
if (!bootstrapped_ || stopped_) {
|
|
1072
|
+
CB_LOG_DEBUG("{} Cannot reauthenticate as trying to reauthenticate on non-bootstrapped or "
|
|
1073
|
+
"stopped session",
|
|
1074
|
+
log_prefix_);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
if (reauth_in_progress_) {
|
|
1079
|
+
CB_LOG_DEBUG("{} Attempted to reauthenticate but reauthentication already in progress",
|
|
1080
|
+
log_prefix_);
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
reauth_in_progress_ = true;
|
|
1085
|
+
|
|
1086
|
+
auto sasl = new_sasl_context();
|
|
1087
|
+
protocol::client_request<protocol::sasl_auth_request_body> req;
|
|
1088
|
+
auto [sasl_code, sasl_payload] = sasl.start();
|
|
1089
|
+
req.opaque(next_opaque());
|
|
1090
|
+
req.body().mechanism(sasl.get_name());
|
|
1091
|
+
req.body().sasl_data(sasl_payload);
|
|
1092
|
+
|
|
1093
|
+
CB_LOG_TRACE("{} starting reauthentication (opaque={}).", log_prefix_, req.opaque());
|
|
1094
|
+
|
|
1095
|
+
reauth_deadline_.expires_after(origin_.options().key_value_timeout);
|
|
1096
|
+
reauth_deadline_.async_wait(
|
|
1097
|
+
[self = shared_from_this(), opaque = req.opaque()](std::error_code ec) {
|
|
1098
|
+
if (ec == asio::error::operation_aborted || self->stopped_) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
CB_LOG_DEBUG("{} Reauthentication timed out (opaque={}).", self->log_prefix_, opaque);
|
|
1102
|
+
static_cast<void>(
|
|
1103
|
+
self->cancel(opaque, errc::common::ambiguous_timeout, retry_reason::do_not_retry));
|
|
1104
|
+
});
|
|
1105
|
+
initiate_reauthenticate(std::move(req));
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
void initiate_reauthenticate(protocol::client_request<protocol::sasl_auth_request_body> req)
|
|
1109
|
+
{
|
|
1110
|
+
auto opaque = req.opaque();
|
|
1111
|
+
auto data = req.data();
|
|
1112
|
+
write_and_subscribe(
|
|
1113
|
+
opaque,
|
|
1114
|
+
std::move(data),
|
|
1115
|
+
[self = shared_from_this(), req = std::move(req)](
|
|
1116
|
+
std::error_code ec,
|
|
1117
|
+
retry_reason reason,
|
|
1118
|
+
io::mcbp_message&& msg,
|
|
1119
|
+
const std::optional<key_value_error_map_info>& /* error_info */) -> void {
|
|
1120
|
+
if (ec == asio::error::operation_aborted || ec == errc::common::request_canceled) {
|
|
1121
|
+
self->reauth_in_progress_ = false;
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
key_value_status_code status = key_value_status_code::invalid;
|
|
1126
|
+
std::optional<key_value_error_map_info> error_code;
|
|
1127
|
+
if (protocol::is_valid_status(msg.header.status())) {
|
|
1128
|
+
status = static_cast<key_value_status_code>(msg.header.status());
|
|
1129
|
+
} else {
|
|
1130
|
+
error_code = self->decode_error_code(msg.header.status());
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
if (status == key_value_status_code::success) {
|
|
1134
|
+
self->reauth_deadline_.cancel();
|
|
1135
|
+
self->reauth_in_progress_ = false;
|
|
1136
|
+
CB_LOG_DEBUG(
|
|
1137
|
+
"{} reauthentication succeeded (opaque={})", self->log_prefix_, req.opaque());
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
if (status == key_value_status_code::auth_continue) {
|
|
1142
|
+
self->reauth_deadline_.cancel();
|
|
1143
|
+
self->reauth_in_progress_ = false;
|
|
1144
|
+
CB_LOG_DEBUG("{} reauthentication received unexpected auth_continue (opaque={})",
|
|
1145
|
+
self->log_prefix_,
|
|
1146
|
+
req.opaque());
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
if (error_code && error_code.value().has_retry_attribute()) {
|
|
1151
|
+
reason = retry_reason::key_value_error_map_retry_indicated;
|
|
1152
|
+
} else {
|
|
1153
|
+
switch (status) {
|
|
1154
|
+
case key_value_status_code::temporary_failure:
|
|
1155
|
+
reason = retry_reason::key_value_temporary_failure;
|
|
1156
|
+
default:
|
|
1157
|
+
break;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
if (reason == retry_reason::do_not_retry || reason == retry_reason::unknown) {
|
|
1162
|
+
CB_LOG_WARNING("{} reauthentication failed (code={}, message={}, reason={}, opaque={})",
|
|
1163
|
+
self->log_prefix_,
|
|
1164
|
+
ec.value(),
|
|
1165
|
+
ec.message(),
|
|
1166
|
+
reason,
|
|
1167
|
+
req.opaque());
|
|
1168
|
+
self->reauth_deadline_.cancel();
|
|
1169
|
+
self->reauth_in_progress_ = false;
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
CB_LOG_DEBUG("{} reauthentication failed (code={}, reason={}, opaque={}), scheduling retry",
|
|
1174
|
+
self->log_prefix_,
|
|
1175
|
+
ec.value(),
|
|
1176
|
+
reason,
|
|
1177
|
+
req.opaque());
|
|
1178
|
+
|
|
1179
|
+
auto backoff = std::chrono::milliseconds(300);
|
|
1180
|
+
self->retry_backoff_.expires_after(backoff);
|
|
1181
|
+
self->retry_backoff_.async_wait([self, req = req](std::error_code ec) -> void {
|
|
1182
|
+
if (ec == asio::error::operation_aborted || !self->reauth_in_progress_) {
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
self->initiate_reauthenticate(req);
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
void update_credentials(cluster_credentials credentials)
|
|
1191
|
+
{
|
|
1192
|
+
origin_.update_credentials(std::move(credentials));
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1031
1195
|
void bootstrap(utils::movable_function<void(std::error_code, topology::configuration)>&& callback,
|
|
1032
1196
|
bool retry_on_bucket_not_found = false)
|
|
1033
1197
|
{
|
|
@@ -1225,6 +1389,7 @@ public:
|
|
|
1225
1389
|
bootstrap_deadline_.cancel();
|
|
1226
1390
|
resolve_deadline_.cancel();
|
|
1227
1391
|
connection_deadline_.cancel();
|
|
1392
|
+
reauth_deadline_.cancel();
|
|
1228
1393
|
retry_backoff_.cancel();
|
|
1229
1394
|
ping_timeout_.cancel();
|
|
1230
1395
|
resolver_.cancel();
|
|
@@ -1533,6 +1698,16 @@ public:
|
|
|
1533
1698
|
return bootstrap_port_number_;
|
|
1534
1699
|
}
|
|
1535
1700
|
|
|
1701
|
+
[[nodiscard]] auto canonical_hostname() const -> const std::string&
|
|
1702
|
+
{
|
|
1703
|
+
return canonical_hostname_;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
[[nodiscard]] auto canonical_port_number() const -> std::uint16_t
|
|
1707
|
+
{
|
|
1708
|
+
return canonical_port_number_;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1536
1711
|
[[nodiscard]] auto next_opaque() -> std::uint32_t
|
|
1537
1712
|
{
|
|
1538
1713
|
return ++opaque_;
|
|
@@ -1743,10 +1918,18 @@ private:
|
|
|
1743
1918
|
if (ec) {
|
|
1744
1919
|
return stop(retry_reason::node_not_available);
|
|
1745
1920
|
}
|
|
1746
|
-
if (
|
|
1921
|
+
if (config_.has_value()) {
|
|
1747
1922
|
for (const auto& node : config_.value().nodes) {
|
|
1748
1923
|
if (node.this_node) {
|
|
1749
|
-
node_uuid_
|
|
1924
|
+
if (node_uuid_.empty()) {
|
|
1925
|
+
node_uuid_ = node.node_uuid;
|
|
1926
|
+
}
|
|
1927
|
+
if (canonical_hostname_.empty()) {
|
|
1928
|
+
canonical_hostname_ = node.hostname;
|
|
1929
|
+
}
|
|
1930
|
+
if (canonical_port_number_ == 0) {
|
|
1931
|
+
canonical_port_number_ = node.port_or(service_type::key_value, is_tls_, 0);
|
|
1932
|
+
}
|
|
1750
1933
|
}
|
|
1751
1934
|
}
|
|
1752
1935
|
}
|
|
@@ -2068,6 +2251,7 @@ private:
|
|
|
2068
2251
|
asio::steady_timer bootstrap_deadline_;
|
|
2069
2252
|
asio::steady_timer resolve_deadline_;
|
|
2070
2253
|
asio::steady_timer connection_deadline_;
|
|
2254
|
+
asio::steady_timer reauth_deadline_;
|
|
2071
2255
|
asio::steady_timer retry_backoff_;
|
|
2072
2256
|
asio::steady_timer ping_timeout_;
|
|
2073
2257
|
couchbase::core::origin origin_;
|
|
@@ -2085,6 +2269,7 @@ private:
|
|
|
2085
2269
|
|
|
2086
2270
|
std::atomic_bool bootstrapped_{ false };
|
|
2087
2271
|
std::atomic_bool stopped_{ false };
|
|
2272
|
+
std::atomic_bool reauth_in_progress_{ false };
|
|
2088
2273
|
bool authenticated_{ false };
|
|
2089
2274
|
bool bucket_selected_{ false };
|
|
2090
2275
|
bool supports_gcccp_{ true };
|
|
@@ -2112,6 +2297,10 @@ private:
|
|
|
2112
2297
|
std::optional<error_map> error_map_;
|
|
2113
2298
|
collection_cache collection_cache_;
|
|
2114
2299
|
|
|
2300
|
+
// Only used for tracing & metrics. They represent the address of the node as given in the config.
|
|
2301
|
+
std::string canonical_hostname_{};
|
|
2302
|
+
std::uint16_t canonical_port_number_{};
|
|
2303
|
+
|
|
2115
2304
|
const bool is_tls_;
|
|
2116
2305
|
std::shared_ptr<impl::bootstrap_state_listener> state_listener_{ nullptr };
|
|
2117
2306
|
|
|
@@ -2153,7 +2342,7 @@ mcbp_session::mcbp_session(const std::string& client_id,
|
|
|
2153
2342
|
mcbp_session::mcbp_session(const std::string& client_id,
|
|
2154
2343
|
const std::string& node_uuid,
|
|
2155
2344
|
asio::io_context& ctx,
|
|
2156
|
-
|
|
2345
|
+
tls_context_provider& tls,
|
|
2157
2346
|
core::origin origin,
|
|
2158
2347
|
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
|
2159
2348
|
std::optional<std::string> bucket_name,
|
|
@@ -2241,6 +2430,18 @@ mcbp_session::remote_address() const -> std::string
|
|
|
2241
2430
|
return impl_->remote_address();
|
|
2242
2431
|
}
|
|
2243
2432
|
|
|
2433
|
+
auto
|
|
2434
|
+
mcbp_session::remote_hostname() const -> std::string
|
|
2435
|
+
{
|
|
2436
|
+
return impl_->remote_hostname();
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
auto
|
|
2440
|
+
mcbp_session::remote_port() const -> std::uint16_t
|
|
2441
|
+
{
|
|
2442
|
+
return impl_->remote_port();
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2244
2445
|
auto
|
|
2245
2446
|
mcbp_session::local_address() const -> std::string
|
|
2246
2447
|
{
|
|
@@ -2277,6 +2478,18 @@ mcbp_session::last_bootstrap_error() const& -> const std::optional<impl::bootstr
|
|
|
2277
2478
|
return impl_->last_bootstrap_error();
|
|
2278
2479
|
}
|
|
2279
2480
|
|
|
2481
|
+
auto
|
|
2482
|
+
mcbp_session::canonical_hostname() const -> const std::string&
|
|
2483
|
+
{
|
|
2484
|
+
return impl_->canonical_hostname();
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
auto
|
|
2488
|
+
mcbp_session::canonical_port_number() const -> std::uint16_t
|
|
2489
|
+
{
|
|
2490
|
+
return impl_->canonical_port_number();
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2280
2493
|
void
|
|
2281
2494
|
mcbp_session::write_and_subscribe(std::uint32_t opaque,
|
|
2282
2495
|
std::vector<std::byte>&& data,
|
|
@@ -2293,6 +2506,18 @@ mcbp_session::bootstrap(
|
|
|
2293
2506
|
return impl_->bootstrap(std::move(handler), retry_on_bucket_not_found);
|
|
2294
2507
|
}
|
|
2295
2508
|
|
|
2509
|
+
void
|
|
2510
|
+
mcbp_session::reauthenticate()
|
|
2511
|
+
{
|
|
2512
|
+
return impl_->reauthenticate();
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
void
|
|
2516
|
+
mcbp_session::update_credentials(cluster_credentials credentials)
|
|
2517
|
+
{
|
|
2518
|
+
return impl_->update_credentials(std::move(credentials));
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2296
2521
|
void
|
|
2297
2522
|
mcbp_session::on_stop(utils::movable_function<void()> handler)
|
|
2298
2523
|
{
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
#include <couchbase/build_config.hxx>
|
|
21
21
|
|
|
22
|
+
#include "core/cluster_credentials.hxx"
|
|
22
23
|
#include "core/protocol/hello_feature.hxx"
|
|
23
24
|
#include "core/response_handler.hxx"
|
|
25
|
+
#include "core/tls_context_provider.hxx"
|
|
24
26
|
#include "core/utils/movable_function.hxx"
|
|
25
27
|
#include "mcbp_context.hxx"
|
|
26
28
|
#include "mcbp_message.hxx"
|
|
@@ -100,7 +102,7 @@ public:
|
|
|
100
102
|
mcbp_session(const std::string& client_id,
|
|
101
103
|
const std::string& node_uuid,
|
|
102
104
|
asio::io_context& ctx,
|
|
103
|
-
|
|
105
|
+
tls_context_provider& tls,
|
|
104
106
|
couchbase::core::origin origin,
|
|
105
107
|
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
|
106
108
|
std::optional<std::string> bucket_name = {},
|
|
@@ -119,6 +121,8 @@ public:
|
|
|
119
121
|
[[nodiscard]] auto id() const -> const std::string&;
|
|
120
122
|
[[nodiscard]] auto node_uuid() const -> const std::string&;
|
|
121
123
|
[[nodiscard]] auto remote_address() const -> std::string;
|
|
124
|
+
[[nodiscard]] auto remote_hostname() const -> std::string;
|
|
125
|
+
[[nodiscard]] auto remote_port() const -> std::uint16_t;
|
|
122
126
|
[[nodiscard]] auto local_address() const -> std::string;
|
|
123
127
|
[[nodiscard]] auto bootstrap_address() const -> const std::string&;
|
|
124
128
|
[[nodiscard]] auto bootstrap_hostname() const -> const std::string&;
|
|
@@ -126,6 +130,8 @@ public:
|
|
|
126
130
|
[[nodiscard]] auto bootstrap_port_number() const -> std::uint16_t;
|
|
127
131
|
[[nodiscard]] auto last_bootstrap_error() && -> std::optional<impl::bootstrap_error>;
|
|
128
132
|
[[nodiscard]] auto last_bootstrap_error() const& -> const std::optional<impl::bootstrap_error>&;
|
|
133
|
+
[[nodiscard]] auto canonical_hostname() const -> const std::string&;
|
|
134
|
+
[[nodiscard]] auto canonical_port_number() const -> std::uint16_t;
|
|
129
135
|
void write_and_flush(std::vector<std::byte>&& buffer);
|
|
130
136
|
void write_and_subscribe(const std::shared_ptr<mcbp::queue_request>&,
|
|
131
137
|
const std::shared_ptr<response_handler>& handler);
|
|
@@ -134,6 +140,8 @@ public:
|
|
|
134
140
|
command_handler&& handler);
|
|
135
141
|
void bootstrap(utils::movable_function<void(std::error_code, topology::configuration)>&& handler,
|
|
136
142
|
bool retry_on_bucket_not_found = false);
|
|
143
|
+
void reauthenticate();
|
|
144
|
+
void update_credentials(cluster_credentials credentials);
|
|
137
145
|
void on_stop(utils::movable_function<void()> handler);
|
|
138
146
|
void stop(retry_reason reason);
|
|
139
147
|
[[nodiscard]] auto index() const -> std::size_t;
|
|
@@ -27,12 +27,4 @@ struct supports_durability : public std::false_type {
|
|
|
27
27
|
|
|
28
28
|
template<typename T>
|
|
29
29
|
inline constexpr bool supports_durability_v = supports_durability<T>::value;
|
|
30
|
-
|
|
31
|
-
template<typename T>
|
|
32
|
-
struct supports_parent_span : public std::false_type {
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
template<typename T>
|
|
36
|
-
inline constexpr bool supports_parent_span_v = supports_parent_span<T>::value;
|
|
37
|
-
|
|
38
30
|
} // namespace couchbase::core::io::mcbp_traits
|
|
@@ -140,12 +140,12 @@ plain_stream_impl::async_read_some(
|
|
|
140
140
|
return stream_->async_read_some(buffer, std::move(handler));
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
tls_stream_impl::tls_stream_impl(asio::io_context& ctx,
|
|
143
|
+
tls_stream_impl::tls_stream_impl(asio::io_context& ctx, tls_context_provider& tls)
|
|
144
144
|
: stream_impl(ctx, true)
|
|
145
145
|
, tls_(tls)
|
|
146
146
|
, stream_(
|
|
147
147
|
std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(asio::ip::tcp::socket(strand_),
|
|
148
|
-
tls_))
|
|
148
|
+
*tls_.get_ctx()))
|
|
149
149
|
{
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -204,7 +204,7 @@ tls_stream_impl::async_connect(const asio::ip::tcp::resolver::results_type::endp
|
|
|
204
204
|
if (!stream_) {
|
|
205
205
|
id_ = uuid::to_string(uuid::random());
|
|
206
206
|
stream_ = std::make_shared<asio::ssl::stream<asio::ip::tcp::socket>>(
|
|
207
|
-
asio::ip::tcp::socket(strand_), tls_);
|
|
207
|
+
asio::ip::tcp::socket(strand_), *tls_.get_ctx());
|
|
208
208
|
}
|
|
209
209
|
return stream_->lowest_layer().async_connect(
|
|
210
210
|
endpoint, [stream = stream_, handler = std::move(handler)](std::error_code ec_connect) mutable {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
#pragma once
|
|
19
19
|
|
|
20
|
+
#include "core/tls_context_provider.hxx"
|
|
20
21
|
#include "core/utils/movable_function.hxx"
|
|
21
22
|
#include "ip_protocol.hxx"
|
|
22
23
|
|
|
@@ -129,11 +130,11 @@ public:
|
|
|
129
130
|
class tls_stream_impl : public stream_impl
|
|
130
131
|
{
|
|
131
132
|
private:
|
|
132
|
-
|
|
133
|
+
tls_context_provider& tls_;
|
|
133
134
|
std::shared_ptr<asio::ssl::stream<asio::ip::tcp::socket>> stream_;
|
|
134
135
|
|
|
135
136
|
public:
|
|
136
|
-
tls_stream_impl(asio::io_context& ctx,
|
|
137
|
+
tls_stream_impl(asio::io_context& ctx, tls_context_provider& tls);
|
|
137
138
|
|
|
138
139
|
[[nodiscard]] auto local_endpoint() const -> asio::ip::tcp::endpoint override;
|
|
139
140
|
|
|
@@ -253,3 +253,18 @@
|
|
|
253
253
|
* couchbase::vector_query has a prefilter option.
|
|
254
254
|
*/
|
|
255
255
|
#define COUCHBASE_CXX_CLIENT_HAS_VECTOR_SEARCH_PREFILTER 1
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* couchbase::cluster has set_authenticator() method.
|
|
259
|
+
*/
|
|
260
|
+
#define COUCHBASE_CXX_CLIENT_HAS_SET_AUTHENTICATOR 1
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Support for the jwt_authenticator
|
|
264
|
+
*/
|
|
265
|
+
#define COUCHBASE_CXX_CLIENT_HAS_JWT_AUTHENTICATOR 1
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Support for the stable OpenTelemetry conventions (Observability RFC revisions 26 & 27)
|
|
269
|
+
*/
|
|
270
|
+
#define COUCHBASE_CXX_CLIENT_STABLE_OTEL_CONVENTIONS 1
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
#include <snappy-stubs-public.h>
|
|
35
35
|
#include <spdlog/fmt/bundled/core.h>
|
|
36
36
|
#include <spdlog/version.h>
|
|
37
|
+
#ifdef COUCHBASE_CXX_CLIENT_BUILD_OPENTELEMETRY
|
|
38
|
+
#include <opentelemetry/version.h>
|
|
39
|
+
#endif
|
|
37
40
|
|
|
38
41
|
#include <regex>
|
|
39
42
|
|
|
@@ -168,10 +171,20 @@ sdk_build_info() -> std::map<std::string, std::string>
|
|
|
168
171
|
#if defined(__GLIBC__)
|
|
169
172
|
info["libc"] = fmt::format("glibc {}.{}", __GLIBC__, __GLIBC_MINOR__);
|
|
170
173
|
#endif
|
|
174
|
+
#ifdef COUCHBASE_CXX_CLIENT_BUILD_OPENTELEMETRY
|
|
175
|
+
info["opentelemetry"] = OPENTELEMETRY_VERSION;
|
|
176
|
+
info["opentelemetry_abi"] = OPENTELEMETRY_ABI_VERSION;
|
|
177
|
+
#endif
|
|
171
178
|
|
|
172
179
|
return info;
|
|
173
180
|
}
|
|
174
181
|
|
|
182
|
+
auto
|
|
183
|
+
is_debug() -> bool
|
|
184
|
+
{
|
|
185
|
+
return COUCHBASE_CXX_CLIENT_DEBUG_BUILD;
|
|
186
|
+
}
|
|
187
|
+
|
|
175
188
|
auto
|
|
176
189
|
sdk_build_info_json() -> std::string
|
|
177
190
|
{
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025-Present Couchbase, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
namespace couchbase::core::metrics
|
|
21
|
+
{
|
|
22
|
+
constexpr auto operation_meter_name = "db.client.operation.duration";
|
|
23
|
+
} // namespace couchbase::core::metrics
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
|
|
20
20
|
#include "couchbase/build_info.hxx"
|
|
21
21
|
|
|
22
|
+
#include "constants.hxx"
|
|
22
23
|
#include "core/logger/logger.hxx"
|
|
24
|
+
#include "core/tracing/constants.hxx"
|
|
23
25
|
#include "core/utils/json.hxx"
|
|
24
26
|
#include "noop_meter.hxx"
|
|
25
27
|
|
|
@@ -209,18 +211,16 @@ logging_meter::get_value_recorder(const std::string& name,
|
|
|
209
211
|
std::make_shared<noop_value_recorder>()
|
|
210
212
|
};
|
|
211
213
|
|
|
212
|
-
if (
|
|
214
|
+
if (name != operation_meter_name) {
|
|
213
215
|
return noop_recorder;
|
|
214
216
|
}
|
|
215
217
|
|
|
216
|
-
|
|
217
|
-
const auto service = tags.find(service_tag);
|
|
218
|
+
const auto service = tags.find(tracing::attributes::op::service);
|
|
218
219
|
if (service == tags.end()) {
|
|
219
220
|
return noop_recorder;
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
|
|
223
|
-
const auto operation = tags.find(operation_tag);
|
|
223
|
+
const auto operation = tags.find(tracing::attributes::op::operation_name);
|
|
224
224
|
if (operation == tags.end()) {
|
|
225
225
|
return noop_recorder;
|
|
226
226
|
}
|