couchbase 3.8.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/CMakeLists.txt +16 -1
- data/ext/cache/cpm/{CPM_0.42.0.cmake → CPM_0.43.1.cmake} +18 -2
- data/ext/cache/extconf_include.rb +6 -6
- data/ext/cache/mozilla-ca-bundle.crt +214 -155
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/couchbase/CMakeLists.txt +130 -21
- data/ext/couchbase/cmake/APKBUILD.in +25 -4
- data/ext/couchbase/cmake/Bundler.cmake +143 -34
- data/ext/couchbase/cmake/CPM.cmake +126 -12
- data/ext/couchbase/cmake/Cache.cmake +7 -1
- data/ext/couchbase/cmake/CompilerOptions.cmake +1 -1
- data/ext/couchbase/cmake/CompilerWarnings.cmake +17 -6
- data/ext/couchbase/cmake/GrpcProtobuf.cmake +481 -0
- data/ext/couchbase/cmake/OpenSSL.cmake +10 -3
- data/ext/couchbase/cmake/Packaging.cmake +519 -65
- data/ext/couchbase/cmake/Protostellar.cmake +250 -0
- data/ext/couchbase/cmake/Sanitizers.cmake +61 -50
- data/ext/couchbase/cmake/StaticAnalyzers.cmake +16 -5
- data/ext/couchbase/cmake/TestFramework.cmake +283 -0
- data/ext/couchbase/cmake/TestFrameworkAddTests.cmake +51 -0
- data/ext/couchbase/cmake/Testing.cmake +27 -9
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +141 -8
- data/ext/couchbase/cmake/VersionInfo.cmake +50 -0
- data/ext/couchbase/cmake/build_config.hxx.in +2 -1
- data/ext/couchbase/cmake/couchbase-cxx-client.spec.in +101 -23
- data/ext/couchbase/cmake/couchbase_cxx_client_static-config.cmake.in +7 -0
- data/ext/couchbase/cmake/couchbase_cxx_client_static.pc.in +2 -0
- data/ext/couchbase/cmake/gRPC_Generate.cmake +58 -0
- data/ext/couchbase/cmake/protobuf_Generate.cmake +69 -0
- data/ext/couchbase/cmake/require-git-checkout.cmake +25 -0
- data/ext/couchbase/cmake/tarball_glob.txt +49 -0
- data/ext/couchbase/core/agent_group.cxx +0 -8
- data/ext/couchbase/core/agent_group.hxx +0 -4
- data/ext/couchbase/core/analytics_stream.cxx +314 -0
- data/ext/couchbase/core/analytics_stream.hxx +129 -0
- data/ext/couchbase/core/analytics_stream_component.cxx +245 -0
- data/ext/couchbase/core/analytics_stream_component.hxx +67 -0
- data/ext/couchbase/core/app_telemetry_meter.cxx +25 -3
- data/ext/couchbase/core/app_telemetry_meter.hxx +77 -0
- data/ext/couchbase/core/app_telemetry_reporter.cxx +7 -6
- data/ext/couchbase/core/bucket.cxx +381 -87
- data/ext/couchbase/core/bucket.hxx +105 -25
- data/ext/couchbase/core/bucket_unit_test_api.hxx +57 -0
- data/ext/couchbase/core/capella.hxx +91 -0
- data/ext/couchbase/core/cluster.cxx +1554 -398
- data/ext/couchbase/core/cluster.hxx +39 -8
- data/ext/couchbase/core/cluster_agent.cxx +0 -8
- data/ext/couchbase/core/cluster_agent.hxx +0 -4
- data/ext/couchbase/core/cluster_options.hxx +26 -3
- data/ext/couchbase/core/collections_component.cxx +39 -15
- data/ext/couchbase/core/config_profiles.cxx +1 -1
- data/ext/couchbase/core/crud_component.cxx +2 -2
- data/ext/couchbase/core/crud_options.hxx +34 -0
- data/ext/couchbase/core/crypto/cbcrypto.cc +18 -13
- data/ext/couchbase/core/document_id_redaction.hxx +81 -0
- data/ext/couchbase/core/error_context/base_error_context.hxx +7 -6
- data/ext/couchbase/core/error_context/key_value.cxx +25 -2
- data/ext/couchbase/core/error_context/key_value.hxx +60 -33
- data/ext/couchbase/core/error_context/key_value_error_context.hxx +16 -15
- data/ext/couchbase/core/error_context/search.hxx +5 -0
- data/ext/couchbase/core/error_context/search_json.hxx +3 -0
- data/ext/couchbase/core/error_context/subdocument_error_context.hxx +19 -18
- data/ext/couchbase/core/error_context/view.hxx +5 -0
- data/ext/couchbase/core/free_form_http_request.cxx +237 -4
- data/ext/couchbase/core/free_form_http_request.hxx +41 -8
- data/ext/couchbase/core/http_component.cxx +300 -284
- data/ext/couchbase/core/http_component.hxx +0 -4
- data/ext/couchbase/core/impl/analytics.cxx +38 -5
- data/ext/couchbase/core/impl/analytics.hxx +34 -0
- data/ext/couchbase/core/impl/bootstrap_error.hxx +0 -3
- data/ext/couchbase/core/impl/collection.cxx +215 -202
- data/ext/couchbase/core/impl/collection_manager.cxx +1 -1
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +45 -18
- data/ext/couchbase/core/impl/error.cxx +22 -2
- data/ext/couchbase/core/impl/internal_analytics_stream_result.hxx +111 -0
- data/ext/couchbase/core/impl/internal_query_stream_result.hxx +110 -0
- data/ext/couchbase/core/impl/invoke_with_node_id.hxx +15 -7
- data/ext/couchbase/core/impl/key_value_error_category.cxx +6 -0
- data/ext/couchbase/core/impl/lookup_in_replica.cxx +10 -10
- data/ext/couchbase/core/impl/lookup_in_replica.hxx +4 -4
- data/ext/couchbase/core/impl/node_id.cxx +49 -13
- data/ext/couchbase/core/impl/observability_recorder.cxx +12 -2
- data/ext/couchbase/core/impl/observe_poll.cxx +63 -23
- data/ext/couchbase/core/impl/public_analytics_stream_result.cxx +372 -0
- data/ext/couchbase/core/impl/public_bucket.cxx +48 -2
- data/ext/couchbase/core/impl/public_cluster.cxx +325 -25
- data/ext/couchbase/core/impl/public_query_stream_result.cxx +380 -0
- data/ext/couchbase/core/impl/public_transaction_get_multi_replicas_from_preferred_server_group_result.cxx +42 -0
- data/ext/couchbase/core/impl/public_transaction_get_multi_result.cxx +42 -0
- data/ext/couchbase/core/impl/query.cxx +76 -7
- data/ext/couchbase/core/impl/query.hxx +36 -0
- data/ext/couchbase/core/impl/query_index_manager.cxx +54 -1
- data/ext/couchbase/core/impl/replica_utils.cxx +101 -0
- data/ext/couchbase/core/impl/replica_utils.hxx +64 -0
- data/ext/couchbase/core/impl/resolve_node_id.hxx +125 -0
- data/ext/couchbase/core/impl/scope.cxx +70 -0
- data/ext/couchbase/core/impl/search.cxx +31 -1
- data/ext/couchbase/core/impl/transactions.cxx +130 -0
- data/ext/couchbase/core/impl/wait_until_ready.cxx +439 -0
- data/ext/couchbase/core/impl/wait_until_ready.hxx +110 -0
- data/ext/couchbase/core/impl/with_bucket_config_or_timeout.hxx +180 -0
- data/ext/couchbase/core/impl/with_cancellation.hxx +11 -3
- data/ext/couchbase/core/io/configuration_belongs_to_session.hxx +66 -0
- data/ext/couchbase/core/io/dns_client.cxx +122 -45
- data/ext/couchbase/core/io/dns_codec.hxx +21 -21
- data/ext/couchbase/core/io/dns_config.cxx +21 -6
- data/ext/couchbase/core/io/http_command.hxx +149 -121
- data/ext/couchbase/core/io/http_error.hxx +107 -0
- data/ext/couchbase/core/io/http_parser.cxx +4 -0
- data/ext/couchbase/core/io/http_session.cxx +606 -154
- data/ext/couchbase/core/io/http_session.hxx +147 -30
- data/ext/couchbase/core/io/http_session_manager.hxx +329 -382
- data/ext/couchbase/core/io/http_streaming_parser.cxx +4 -0
- data/ext/couchbase/core/io/http_streaming_response.cxx +328 -43
- data/ext/couchbase/core/io/http_streaming_response.hxx +37 -3
- data/ext/couchbase/core/io/mcbp_buffer_pool.hxx +122 -0
- data/ext/couchbase/core/io/mcbp_command.hxx +150 -51
- data/ext/couchbase/core/io/mcbp_command_id.hxx +45 -0
- data/ext/couchbase/core/io/mcbp_message.cxx +9 -1
- data/ext/couchbase/core/io/mcbp_message.hxx +19 -0
- data/ext/couchbase/core/io/mcbp_output_queue.hxx +150 -0
- data/ext/couchbase/core/io/mcbp_parser.cxx +24 -7
- data/ext/couchbase/core/io/mcbp_session.cxx +316 -317
- data/ext/couchbase/core/io/mcbp_session.hxx +27 -18
- data/ext/couchbase/core/io/opaque_ring_table.hxx +145 -0
- data/ext/couchbase/core/io/retry_orchestrator.hxx +6 -5
- data/ext/couchbase/core/io/stream_deadline.hxx +50 -0
- data/ext/couchbase/core/io/streams.cxx +275 -14
- data/ext/couchbase/core/io/streams.hxx +53 -0
- data/ext/couchbase/core/logger/logger.cxx +36 -0
- data/ext/couchbase/core/logger/logger.hxx +46 -6
- data/ext/couchbase/core/logger/redaction.hxx +503 -0
- data/ext/couchbase/core/management/eventing_status.hxx +10 -0
- data/ext/couchbase/core/management/eventing_status_json.hxx +4 -0
- data/ext/couchbase/core/mcbp/big_endian.cxx +1 -1
- data/ext/couchbase/core/mcbp/codec.cxx +27 -18
- data/ext/couchbase/core/mcbp/operation_queue.cxx +2 -2
- data/ext/couchbase/core/mcbp/packet.hxx +2 -2
- data/ext/couchbase/core/mcbp/queue_request.cxx +23 -6
- data/ext/couchbase/core/mcbp/queue_request.hxx +21 -0
- data/ext/couchbase/core/meta/features.hxx +13 -0
- data/ext/couchbase/core/meta/version.cxx +6 -3
- data/ext/couchbase/core/metrics/logging_meter.cxx +5 -10
- data/ext/couchbase/core/metrics/meter_wrapper.cxx +63 -33
- data/ext/couchbase/core/metrics/meter_wrapper.hxx +55 -3
- data/ext/couchbase/core/operations/analytics_response_parsing.cxx +177 -0
- data/ext/couchbase/core/operations/analytics_response_parsing.hxx +55 -0
- data/ext/couchbase/core/operations/document_analytics.cxx +48 -130
- data/ext/couchbase/core/operations/document_analytics.hxx +14 -2
- data/ext/couchbase/core/operations/document_get_all_replicas.hxx +15 -7
- data/ext/couchbase/core/operations/document_get_any_replica.hxx +19 -8
- data/ext/couchbase/core/operations/document_get_projected.cxx +1 -1
- data/ext/couchbase/core/{impl/get_replica.cxx → operations/document_get_replica.cxx} +21 -3
- data/ext/couchbase/core/{impl/get_replica.hxx → operations/document_get_replica.hxx} +31 -4
- data/ext/couchbase/core/operations/document_lookup_in.cxx +10 -10
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +228 -198
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +215 -217
- data/ext/couchbase/core/operations/document_query.cxx +108 -221
- data/ext/couchbase/core/operations/document_query.hxx +18 -4
- data/ext/couchbase/core/operations/document_search.cxx +52 -8
- data/ext/couchbase/core/operations/document_search.hxx +3 -0
- data/ext/couchbase/core/operations/document_view.cxx +3 -3
- data/ext/couchbase/core/operations/management/analytics_dataset_create.cxx +15 -8
- data/ext/couchbase/core/operations/management/analytics_dataset_create.hxx +4 -0
- data/ext/couchbase/core/operations/management/analytics_dataset_drop.cxx +11 -6
- data/ext/couchbase/core/operations/management/analytics_dataset_get_all.cxx +3 -2
- data/ext/couchbase/core/operations/management/analytics_dataverse_create.cxx +10 -5
- data/ext/couchbase/core/operations/management/analytics_dataverse_drop.cxx +10 -5
- data/ext/couchbase/core/operations/management/analytics_get_pending_mutations.cxx +2 -1
- data/ext/couchbase/core/operations/management/analytics_index_create.cxx +33 -8
- data/ext/couchbase/core/operations/management/analytics_index_drop.cxx +12 -7
- data/ext/couchbase/core/operations/management/analytics_index_get_all.cxx +3 -2
- data/ext/couchbase/core/operations/management/analytics_link_connect.cxx +11 -6
- data/ext/couchbase/core/operations/management/analytics_link_create.cxx +3 -3
- data/ext/couchbase/core/operations/management/analytics_link_disconnect.cxx +10 -4
- data/ext/couchbase/core/operations/management/analytics_link_drop.cxx +6 -4
- data/ext/couchbase/core/operations/management/analytics_link_get_all.cxx +4 -3
- data/ext/couchbase/core/operations/management/analytics_link_replace.cxx +3 -3
- data/ext/couchbase/core/operations/management/analytics_link_utils.hxx +1 -1
- data/ext/couchbase/core/operations/management/bucket_create.cxx +37 -38
- data/ext/couchbase/core/operations/management/bucket_update.cxx +26 -28
- data/ext/couchbase/core/operations/management/change_password.cxx +2 -0
- data/ext/couchbase/core/operations/management/collection_drop.cxx +5 -1
- data/ext/couchbase/core/operations/management/error_utils.cxx +59 -5
- data/ext/couchbase/core/operations/management/error_utils.hxx +29 -1
- data/ext/couchbase/core/operations/management/eventing_deploy_function.cxx +9 -3
- data/ext/couchbase/core/operations/management/eventing_drop_function.cxx +8 -3
- data/ext/couchbase/core/operations/management/eventing_get_all_functions.cxx +4 -2
- data/ext/couchbase/core/operations/management/eventing_get_function.cxx +5 -3
- data/ext/couchbase/core/operations/management/eventing_get_status.cxx +4 -2
- data/ext/couchbase/core/operations/management/eventing_pause_function.cxx +9 -3
- data/ext/couchbase/core/operations/management/eventing_resume_function.cxx +9 -3
- data/ext/couchbase/core/operations/management/eventing_undeploy_function.cxx +9 -3
- data/ext/couchbase/core/operations/management/eventing_upsert_function.cxx +9 -3
- data/ext/couchbase/core/operations/management/group_drop.cxx +3 -1
- data/ext/couchbase/core/operations/management/group_get.cxx +3 -1
- data/ext/couchbase/core/operations/management/group_upsert.cxx +11 -8
- data/ext/couchbase/core/operations/management/query_index_build.cxx +5 -2
- data/ext/couchbase/core/operations/management/query_index_create.cxx +9 -3
- data/ext/couchbase/core/operations/management/query_index_drop.cxx +11 -4
- data/ext/couchbase/core/operations/management/query_index_get_all.cxx +1 -1
- data/ext/couchbase/core/operations/management/query_index_get_all_deferred.cxx +1 -1
- data/ext/couchbase/core/operations/management/scope_drop.cxx +5 -1
- data/ext/couchbase/core/operations/management/scope_get_all.cxx +6 -1
- data/ext/couchbase/core/operations/management/search_get_stats.cxx +10 -0
- data/ext/couchbase/core/operations/management/search_index_analyze_document.cxx +3 -2
- data/ext/couchbase/core/operations/management/search_index_control_ingest.cxx +4 -3
- data/ext/couchbase/core/operations/management/search_index_control_plan_freeze.cxx +4 -3
- data/ext/couchbase/core/operations/management/search_index_control_query.cxx +4 -3
- data/ext/couchbase/core/operations/management/search_index_drop.cxx +2 -2
- data/ext/couchbase/core/operations/management/search_index_get.cxx +2 -2
- data/ext/couchbase/core/operations/management/search_index_get_documents_count.cxx +3 -2
- data/ext/couchbase/core/operations/management/search_index_get_stats.cxx +3 -1
- data/ext/couchbase/core/operations/management/search_index_upsert.cxx +2 -2
- data/ext/couchbase/core/operations/management/user_drop.cxx +3 -1
- data/ext/couchbase/core/operations/management/user_get.cxx +3 -1
- data/ext/couchbase/core/operations/management/user_upsert.cxx +12 -9
- data/ext/couchbase/core/operations/management/view_index_drop.cxx +1 -1
- data/ext/couchbase/core/operations/management/view_index_get.cxx +1 -1
- data/ext/couchbase/core/operations/management/view_index_upsert.cxx +1 -1
- data/ext/couchbase/core/operations/operation_traits.hxx +18 -0
- data/ext/couchbase/core/operations/query_response_parsing.cxx +211 -0
- data/ext/couchbase/core/operations/query_response_parsing.hxx +60 -0
- data/ext/couchbase/core/operations_fwd.hxx +3 -3
- data/ext/couchbase/core/origin.cxx +54 -26
- data/ext/couchbase/core/origin.hxx +12 -0
- data/ext/couchbase/core/orphan_reporter.cxx +2 -1
- data/ext/couchbase/core/platform/random.cc +7 -7
- data/ext/couchbase/core/protocol/client_request.cxx +2 -2
- data/ext/couchbase/core/protocol/client_request.hxx +38 -21
- data/ext/couchbase/core/protocol/client_response.cxx +11 -3
- data/ext/couchbase/core/protocol/client_response.hxx +27 -6
- data/ext/couchbase/core/protocol/cmd_append.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_cluster_map_change_notification.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_decrement.cxx +6 -6
- data/ext/couchbase/core/protocol/cmd_get.cxx +1 -1
- data/ext/couchbase/core/protocol/cmd_get_and_lock.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_get_and_touch.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_get_cluster_config.cxx +6 -4
- data/ext/couchbase/core/protocol/cmd_get_collection_id.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_get_error_map.cxx +1 -1
- data/ext/couchbase/core/protocol/cmd_get_meta.cxx +4 -4
- data/ext/couchbase/core/protocol/cmd_get_replica.cxx +1 -1
- data/ext/couchbase/core/protocol/cmd_hello.cxx +1 -1
- data/ext/couchbase/core/protocol/cmd_increment.cxx +6 -6
- data/ext/couchbase/core/protocol/cmd_insert.cxx +4 -4
- data/ext/couchbase/core/protocol/cmd_lookup_in.cxx +4 -3
- data/ext/couchbase/core/protocol/cmd_lookup_in_replica.cxx +4 -3
- data/ext/couchbase/core/protocol/cmd_mutate_in.cxx +10 -9
- data/ext/couchbase/core/protocol/cmd_mutate_in.hxx +10 -10
- data/ext/couchbase/core/protocol/cmd_observe_seqno.cxx +7 -7
- data/ext/couchbase/core/protocol/cmd_prepend.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_remove.cxx +2 -2
- data/ext/couchbase/core/protocol/cmd_replace.cxx +4 -4
- data/ext/couchbase/core/protocol/cmd_touch.cxx +1 -1
- data/ext/couchbase/core/protocol/cmd_upsert.cxx +4 -4
- data/ext/couchbase/core/protocol/datatype.hxx +118 -1
- data/ext/couchbase/core/protocol/frame_info_utils.cxx +1 -1
- data/ext/couchbase/core/protocol/magic.hxx +4 -0
- data/ext/couchbase/core/protocol/magic_fmt.hxx +3 -0
- data/ext/couchbase/core/protocol/server_request.hxx +3 -1
- data/ext/couchbase/core/protocol/status.cxx +1 -1
- data/ext/couchbase/core/protostellar/analytics_converter.hxx +171 -0
- data/ext/couchbase/core/protostellar/bucket_admin_converter.hxx +301 -0
- data/ext/couchbase/core/protostellar/collection_admin_converter.hxx +92 -0
- data/ext/couchbase/core/protostellar/component.cxx +2445 -0
- data/ext/couchbase/core/protostellar/component.hxx +391 -0
- data/ext/couchbase/core/{columnar/bootstrap_notification_subscriber.hxx → protostellar/compression_settings.hxx} +11 -10
- data/ext/couchbase/core/protostellar/credentials.cxx +233 -0
- data/ext/couchbase/core/protostellar/credentials.hxx +88 -0
- data/ext/couchbase/core/protostellar/dispatcher.cxx +57 -0
- data/ext/couchbase/core/protostellar/dispatcher.hxx +482 -0
- data/ext/couchbase/core/protostellar/error_utils.cxx +293 -0
- data/ext/couchbase/core/protostellar/error_utils.hxx +97 -0
- data/ext/couchbase/core/protostellar/json_payload.hxx +49 -0
- data/ext/couchbase/core/protostellar/kv_converter.cxx +70 -0
- data/ext/couchbase/core/protostellar/kv_converter.hxx +600 -0
- data/ext/couchbase/core/protostellar/query_converter.hxx +265 -0
- data/ext/couchbase/core/protostellar/query_index_admin_converter.hxx +291 -0
- data/ext/couchbase/core/protostellar/query_proto.hxx +73 -0
- data/ext/couchbase/core/protostellar/search_converter.hxx +244 -0
- data/ext/couchbase/core/protostellar/search_index_admin_converter.hxx +156 -0
- data/ext/couchbase/core/protostellar/view_converter.hxx +158 -0
- data/ext/couchbase/core/query_stream.cxx +447 -0
- data/ext/couchbase/core/query_stream.hxx +141 -0
- data/ext/couchbase/core/query_stream_component.cxx +243 -0
- data/ext/couchbase/core/query_stream_component.hxx +68 -0
- data/ext/couchbase/core/range_scan_load_balancer.cxx +15 -8
- data/ext/couchbase/core/range_scan_orchestrator.cxx +15 -3
- data/ext/couchbase/core/response_handler.hxx +41 -4
- data/ext/couchbase/core/row_streamer.cxx +332 -46
- data/ext/couchbase/core/row_streamer.hxx +31 -1
- data/ext/couchbase/core/row_streamer_options.hxx +55 -0
- data/ext/couchbase/core/sasl/client.h +3 -0
- data/ext/couchbase/core/search_scoring.hxx +66 -0
- data/ext/couchbase/core/stream_error_details.hxx +69 -0
- data/ext/couchbase/core/timeout_defaults.hxx +0 -1
- data/ext/couchbase/core/topology/capabilities.hxx +6 -0
- data/ext/couchbase/core/topology/capabilities_fmt.hxx +3 -0
- data/ext/couchbase/core/topology/configuration.cxx +21 -6
- data/ext/couchbase/core/topology/configuration.hxx +29 -8
- data/ext/couchbase/core/topology/configuration_json.hxx +3 -0
- data/ext/couchbase/core/topology/error_map_json.hxx +3 -1
- data/ext/couchbase/core/tracing/threshold_logging_tracer.cxx +70 -4
- data/ext/couchbase/core/tracing/threshold_logging_tracer.hxx +10 -0
- data/ext/couchbase/core/transactions/active_transaction_record.cxx +0 -34
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +362 -241
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +24 -3
- data/ext/couchbase/core/transactions/error_list.hxx +2 -2
- data/ext/couchbase/core/transactions/get_multi_fetch.hxx +160 -0
- data/ext/couchbase/core/transactions/get_multi_orchestrator.cxx +326 -125
- data/ext/couchbase/core/transactions/get_multi_transaction_id.hxx +62 -0
- data/ext/couchbase/core/transactions/internal/atr_entry.hxx +22 -2
- data/ext/couchbase/core/transactions/internal/transaction_context.hxx +2 -2
- data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +23 -1
- data/ext/couchbase/core/transactions/internal/utils.hxx +50 -14
- data/ext/couchbase/core/transactions/staged_mutation.cxx +23 -18
- data/ext/couchbase/core/transactions/staged_mutation.hxx +15 -4
- data/ext/couchbase/core/transactions/transaction_context.cxx +55 -40
- data/ext/couchbase/core/transactions/transaction_get_result.hxx +16 -0
- data/ext/couchbase/core/transactions/transactions.cxx +3 -55
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +194 -66
- data/ext/couchbase/core/transactions/transactions_config.cxx +0 -11
- data/ext/couchbase/core/transactions/utils.cxx +10 -0
- data/ext/couchbase/core/transactions/waitable_op_list.hxx +15 -4
- data/ext/couchbase/core/transactions.hxx +9 -9
- data/ext/couchbase/core/utils/byteswap.hxx +166 -9
- data/ext/couchbase/core/utils/connection_string.cxx +50 -85
- data/ext/couchbase/core/utils/connection_string.hxx +15 -0
- data/ext/couchbase/core/{columnar/backoff_calculator.hxx → utils/deadline.hxx} +13 -13
- data/ext/couchbase/core/utils/duration_parser.cxx +1 -1
- data/ext/couchbase/core/utils/json_streaming_lexer.cxx +48 -5
- data/ext/couchbase/core/utils/json_streaming_lexer.hxx +4 -1
- data/ext/couchbase/core/utils/movable_function.hxx +301 -52
- data/ext/couchbase/core/utils/name_codec.hxx +154 -11
- data/ext/couchbase/core/{columnar/retry_info.hxx → utils/process_id.hxx} +18 -13
- data/ext/couchbase/core/utils/url_codec.cxx +12 -51
- data/ext/couchbase/core/websocket_codec.cxx +3 -29
- data/ext/couchbase/couchbase/analytics_options.hxx +21 -10
- data/ext/couchbase/couchbase/analytics_row.hxx +105 -0
- data/ext/couchbase/couchbase/analytics_stream_result.hxx +266 -0
- data/ext/couchbase/couchbase/boolean_query.hxx +3 -3
- data/ext/couchbase/couchbase/bucket.hxx +57 -0
- data/ext/couchbase/couchbase/cluster.hxx +216 -5
- data/ext/couchbase/{core/columnar/security_options.hxx → couchbase/cluster_state.hxx} +18 -14
- data/ext/couchbase/couchbase/codec/lenient_json_transcoder.hxx +69 -0
- data/ext/couchbase/couchbase/collection.hxx +234 -14
- data/ext/couchbase/couchbase/common_durability_options.hxx +18 -3
- data/ext/couchbase/couchbase/conjunction_query.hxx +1 -1
- data/ext/couchbase/couchbase/create_dataset_analytics_options.hxx +6 -1
- data/ext/couchbase/couchbase/date_range_query.hxx +2 -2
- data/ext/couchbase/couchbase/decrement_options.hxx +1 -1
- data/ext/couchbase/couchbase/disjunction_query.hxx +1 -1
- data/ext/couchbase/couchbase/error.hxx +32 -0
- data/ext/couchbase/couchbase/error_codes.hxx +32 -0
- data/ext/couchbase/couchbase/geo_bounding_box_query.hxx +1 -1
- data/ext/couchbase/couchbase/geo_distance_query.hxx +1 -1
- data/ext/couchbase/couchbase/geo_polygon_query.hxx +1 -1
- data/ext/couchbase/couchbase/get_replica_options.hxx +68 -0
- data/ext/couchbase/couchbase/get_replica_result.hxx +5 -3
- data/ext/couchbase/couchbase/get_replica_strategy.hxx +161 -0
- data/ext/couchbase/couchbase/get_result.hxx +1 -0
- data/ext/couchbase/couchbase/increment_options.hxx +1 -1
- data/ext/couchbase/couchbase/insert_options.hxx +1 -1
- data/ext/couchbase/couchbase/match_phrase_query.hxx +1 -1
- data/ext/couchbase/couchbase/match_query.hxx +1 -1
- data/ext/couchbase/couchbase/mutate_in_options.hxx +3 -3
- data/ext/couchbase/couchbase/network_options.hxx +1 -1
- data/ext/couchbase/couchbase/node_id.hxx +42 -14
- data/ext/couchbase/couchbase/node_id_for_options.hxx +7 -1
- data/ext/couchbase/couchbase/node_ids_options.hxx +8 -2
- data/ext/couchbase/couchbase/numeric_range_query.hxx +1 -1
- data/ext/couchbase/couchbase/phrase_query.hxx +1 -1
- data/ext/couchbase/couchbase/prefix_query.hxx +1 -1
- data/ext/couchbase/couchbase/query_options.hxx +23 -12
- data/ext/couchbase/couchbase/query_row.hxx +111 -0
- data/ext/couchbase/couchbase/query_stream_result.hxx +302 -0
- data/ext/couchbase/couchbase/query_string_query.hxx +3 -3
- data/ext/couchbase/couchbase/regexp_query.hxx +1 -1
- data/ext/couchbase/couchbase/replace_options.hxx +3 -3
- data/ext/couchbase/couchbase/result.hxx +14 -3
- data/ext/couchbase/couchbase/scan_result_item.hxx +1 -0
- data/ext/couchbase/couchbase/scope.hxx +85 -2
- data/ext/couchbase/couchbase/search_options.hxx +58 -8
- data/ext/couchbase/couchbase/search_scoring.hxx +94 -0
- data/ext/couchbase/couchbase/search_scoring_none.hxx +51 -0
- data/ext/couchbase/couchbase/search_scoring_reciprocal_rank_fusion.hxx +88 -0
- data/ext/couchbase/couchbase/search_scoring_relative_score_fusion.hxx +70 -0
- data/ext/couchbase/couchbase/term_range_query.hxx +1 -1
- data/ext/couchbase/couchbase/tracing/request_span.hxx +46 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_result.hxx +23 -21
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_result.hxx +24 -19
- data/ext/couchbase/couchbase/transactions/transaction_get_result.hxx +17 -3
- data/ext/couchbase/couchbase/transactions/transactions_config.hxx +4 -2
- data/ext/couchbase/couchbase/transactions.hxx +27 -18
- data/ext/couchbase/couchbase/upsert_options.hxx +3 -3
- data/ext/couchbase/couchbase/vector_query.hxx +1 -1
- data/ext/couchbase/couchbase/wait_until_ready_options.hxx +111 -0
- data/ext/couchbase/couchbase/wildcard_query.hxx +1 -1
- data/ext/extconf.rb +15 -10
- data/ext/rcb_analytics.cxx +82 -102
- data/ext/rcb_backend.cxx +42 -36
- data/ext/rcb_backend.hxx +2 -0
- data/ext/rcb_buckets.cxx +47 -59
- data/ext/rcb_collections.cxx +42 -52
- data/ext/rcb_crud.cxx +345 -224
- data/ext/rcb_diagnostics.cxx +117 -27
- data/ext/rcb_exceptions.cxx +152 -99
- data/ext/rcb_exceptions.hxx +25 -0
- data/ext/rcb_extras.cxx +18 -19
- data/ext/rcb_hdr_histogram.cxx +19 -4
- data/ext/rcb_logger.cxx +202 -27
- data/ext/rcb_logger.hxx +12 -0
- data/ext/rcb_multi.cxx +40 -40
- data/ext/rcb_observability.cxx +7 -5
- data/ext/rcb_query.cxx +99 -142
- data/ext/rcb_range_scan.cxx +41 -35
- data/ext/rcb_search.cxx +98 -99
- data/ext/rcb_users.cxx +36 -56
- data/ext/rcb_utils.cxx +100 -37
- data/ext/rcb_utils.hxx +287 -33
- data/ext/rcb_version.cxx +1 -1
- data/ext/rcb_views.cxx +55 -51
- data/lib/active_support/cache/couchbase_store.rb +77 -12
- data/lib/couchbase/bucket.rb +20 -0
- data/lib/couchbase/cluster.rb +33 -14
- data/lib/couchbase/collection.rb +36 -1
- data/lib/couchbase/errors.rb +18 -0
- data/lib/couchbase/fork_hooks.rb +16 -7
- data/lib/couchbase/get_replica_strategy.rb +89 -0
- data/lib/couchbase/logger.rb +1 -1
- data/lib/couchbase/management/analytics_index_manager.rb +15 -15
- data/lib/couchbase/management/bucket_manager.rb +6 -6
- data/lib/couchbase/management/collection_manager.rb +6 -6
- data/lib/couchbase/management/query_index_manager.rb +7 -7
- data/lib/couchbase/management/search_index_manager.rb +13 -13
- data/lib/couchbase/management/user_manager.rb +10 -10
- data/lib/couchbase/management/view_index_manager.rb +5 -5
- data/lib/couchbase/options.rb +181 -44
- data/lib/couchbase/protostellar/bucket.rb +4 -0
- data/lib/couchbase/protostellar/cluster.rb +4 -0
- data/lib/couchbase/protostellar/collection.rb +4 -0
- data/lib/couchbase/protostellar/error_handling.rb +2 -1
- data/lib/couchbase/protostellar/request.rb +1 -0
- data/lib/couchbase/protostellar/request_generator/kv.rb +16 -2
- data/lib/couchbase/protostellar/request_generator/search.rb +17 -1
- data/lib/couchbase/protostellar/retry/orchestrator.rb +3 -2
- data/lib/couchbase/protostellar/retry/strategies/fail_fast.rb +33 -0
- data/lib/couchbase/protostellar/retry/strategies.rb +1 -0
- data/lib/couchbase/search_options.rb +95 -6
- data/lib/couchbase/version.rb +1 -1
- metadata +92 -33
- data/ext/0001-fix-build-for-mingw-w64-ucrt-x86_64-toolchain.patch +0 -40
- data/ext/couchbase/core/columnar/agent.hxx +0 -71
- data/ext/couchbase/core/columnar/agent_config.hxx +0 -59
- data/ext/couchbase/core/columnar/background_bootstrap_listener.hxx +0 -42
- data/ext/couchbase/core/columnar/backoff_calculator.cxx +0 -62
- data/ext/couchbase/core/columnar/columnar_agent.cxx +0 -147
- data/ext/couchbase/core/columnar/columnar_agent_config.cxx +0 -48
- data/ext/couchbase/core/columnar/columnar_error.cxx +0 -51
- data/ext/couchbase/core/columnar/database_management_options.hxx +0 -56
- data/ext/couchbase/core/columnar/error.hxx +0 -51
- data/ext/couchbase/core/columnar/error_codes.cxx +0 -107
- data/ext/couchbase/core/columnar/error_codes.hxx +0 -75
- data/ext/couchbase/core/columnar/management_component.cxx +0 -300
- data/ext/couchbase/core/columnar/management_component.hxx +0 -56
- data/ext/couchbase/core/columnar/query_component.cxx +0 -523
- data/ext/couchbase/core/columnar/query_component.hxx +0 -57
- data/ext/couchbase/core/columnar/query_options.hxx +0 -59
- data/ext/couchbase/core/columnar/query_result.cxx +0 -130
- data/ext/couchbase/core/columnar/query_result.hxx +0 -78
- data/ext/couchbase/core/io/config_tracker.cxx +0 -687
- data/ext/couchbase/core/io/config_tracker.hxx +0 -123
data/ext/rcb_analytics.cxx
CHANGED
|
@@ -87,10 +87,8 @@ cb_Backend_analytics_get_pending_mutations(VALUE self, VALUE options, VALUE obse
|
|
|
87
87
|
}
|
|
88
88
|
return res;
|
|
89
89
|
} catch (const std::system_error& se) {
|
|
90
|
-
|
|
90
|
+
throw ruby_exception(cb_map_error_code(
|
|
91
91
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
92
|
-
} catch (const ruby_exception& e) {
|
|
93
|
-
rb_exc_raise(e.exception_object());
|
|
94
92
|
}
|
|
95
93
|
return Qnil;
|
|
96
94
|
}
|
|
@@ -135,10 +133,8 @@ cb_Backend_analytics_dataset_get_all(VALUE self, VALUE options, VALUE observabil
|
|
|
135
133
|
}
|
|
136
134
|
return res;
|
|
137
135
|
} catch (const std::system_error& se) {
|
|
138
|
-
|
|
136
|
+
throw ruby_exception(cb_map_error_code(
|
|
139
137
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
140
|
-
} catch (const ruby_exception& e) {
|
|
141
|
-
rb_exc_raise(e.exception_object());
|
|
142
138
|
}
|
|
143
139
|
return Qnil;
|
|
144
140
|
}
|
|
@@ -151,7 +147,7 @@ cb_Backend_analytics_dataset_drop(VALUE self,
|
|
|
151
147
|
{
|
|
152
148
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
153
149
|
|
|
154
|
-
|
|
150
|
+
cb_check_type(dataset_name, T_STRING);
|
|
155
151
|
|
|
156
152
|
try {
|
|
157
153
|
core::operations::management::analytics_dataset_drop_request req{};
|
|
@@ -192,10 +188,8 @@ cb_Backend_analytics_dataset_drop(VALUE self,
|
|
|
192
188
|
}
|
|
193
189
|
return Qtrue;
|
|
194
190
|
} catch (const std::system_error& se) {
|
|
195
|
-
|
|
191
|
+
throw ruby_exception(cb_map_error_code(
|
|
196
192
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
197
|
-
} catch (const ruby_exception& e) {
|
|
198
|
-
rb_exc_raise(e.exception_object());
|
|
199
193
|
}
|
|
200
194
|
return Qnil;
|
|
201
195
|
}
|
|
@@ -209,8 +203,8 @@ cb_Backend_analytics_dataset_create(VALUE self,
|
|
|
209
203
|
{
|
|
210
204
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
211
205
|
|
|
212
|
-
|
|
213
|
-
|
|
206
|
+
cb_check_type(dataset_name, T_STRING);
|
|
207
|
+
cb_check_type(bucket_name, T_STRING);
|
|
214
208
|
|
|
215
209
|
try {
|
|
216
210
|
core::operations::management::analytics_dataset_create_request req{};
|
|
@@ -247,10 +241,8 @@ cb_Backend_analytics_dataset_create(VALUE self,
|
|
|
247
241
|
}
|
|
248
242
|
return Qtrue;
|
|
249
243
|
} catch (const std::system_error& se) {
|
|
250
|
-
|
|
244
|
+
throw ruby_exception(cb_map_error_code(
|
|
251
245
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
252
|
-
} catch (const ruby_exception& e) {
|
|
253
|
-
rb_exc_raise(e.exception_object());
|
|
254
246
|
}
|
|
255
247
|
return Qnil;
|
|
256
248
|
}
|
|
@@ -263,7 +255,7 @@ cb_Backend_analytics_dataverse_drop(VALUE self,
|
|
|
263
255
|
{
|
|
264
256
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
265
257
|
|
|
266
|
-
|
|
258
|
+
cb_check_type(dataverse_name, T_STRING);
|
|
267
259
|
|
|
268
260
|
try {
|
|
269
261
|
core::operations::management::analytics_dataverse_drop_request req{};
|
|
@@ -292,10 +284,8 @@ cb_Backend_analytics_dataverse_drop(VALUE self,
|
|
|
292
284
|
}
|
|
293
285
|
return Qtrue;
|
|
294
286
|
} catch (const std::system_error& se) {
|
|
295
|
-
|
|
287
|
+
throw ruby_exception(cb_map_error_code(
|
|
296
288
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
297
|
-
} catch (const ruby_exception& e) {
|
|
298
|
-
rb_exc_raise(e.exception_object());
|
|
299
289
|
}
|
|
300
290
|
return Qnil;
|
|
301
291
|
}
|
|
@@ -308,9 +298,9 @@ cb_Backend_analytics_dataverse_create(VALUE self,
|
|
|
308
298
|
{
|
|
309
299
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
310
300
|
|
|
311
|
-
|
|
301
|
+
cb_check_type(dataverse_name, T_STRING);
|
|
312
302
|
if (!NIL_P(dataverse_name)) {
|
|
313
|
-
|
|
303
|
+
cb_check_type(dataverse_name, T_STRING);
|
|
314
304
|
}
|
|
315
305
|
|
|
316
306
|
try {
|
|
@@ -341,10 +331,8 @@ cb_Backend_analytics_dataverse_create(VALUE self,
|
|
|
341
331
|
}
|
|
342
332
|
return Qtrue;
|
|
343
333
|
} catch (const std::system_error& se) {
|
|
344
|
-
|
|
334
|
+
throw ruby_exception(cb_map_error_code(
|
|
345
335
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
346
|
-
} catch (const ruby_exception& e) {
|
|
347
|
-
rb_exc_raise(e.exception_object());
|
|
348
336
|
}
|
|
349
337
|
return Qnil;
|
|
350
338
|
}
|
|
@@ -387,10 +375,8 @@ cb_Backend_analytics_index_get_all(VALUE self, VALUE options, VALUE observabilit
|
|
|
387
375
|
}
|
|
388
376
|
return res;
|
|
389
377
|
} catch (const std::system_error& se) {
|
|
390
|
-
|
|
378
|
+
throw ruby_exception(cb_map_error_code(
|
|
391
379
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
392
|
-
} catch (const ruby_exception& e) {
|
|
393
|
-
rb_exc_raise(e.exception_object());
|
|
394
380
|
}
|
|
395
381
|
return Qnil;
|
|
396
382
|
}
|
|
@@ -405,9 +391,9 @@ cb_Backend_analytics_index_create(VALUE self,
|
|
|
405
391
|
{
|
|
406
392
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
407
393
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
394
|
+
cb_check_type(index_name, T_STRING);
|
|
395
|
+
cb_check_type(dataset_name, T_STRING);
|
|
396
|
+
cb_check_type(fields, T_ARRAY);
|
|
411
397
|
|
|
412
398
|
try {
|
|
413
399
|
core::operations::management::analytics_index_create_request req{};
|
|
@@ -417,7 +403,7 @@ cb_Backend_analytics_index_create(VALUE self,
|
|
|
417
403
|
auto fields_num = static_cast<std::size_t>(RARRAY_LEN(fields));
|
|
418
404
|
for (std::size_t i = 0; i < fields_num; ++i) {
|
|
419
405
|
VALUE entry = rb_ary_entry(fields, static_cast<long>(i));
|
|
420
|
-
|
|
406
|
+
cb_check_type(entry, T_ARRAY);
|
|
421
407
|
if (RARRAY_LEN(entry) == 2) {
|
|
422
408
|
VALUE field = rb_ary_entry(entry, 0);
|
|
423
409
|
VALUE type = rb_ary_entry(entry, 1);
|
|
@@ -457,10 +443,8 @@ cb_Backend_analytics_index_create(VALUE self,
|
|
|
457
443
|
}
|
|
458
444
|
return Qtrue;
|
|
459
445
|
} catch (const std::system_error& se) {
|
|
460
|
-
|
|
446
|
+
throw ruby_exception(cb_map_error_code(
|
|
461
447
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
462
|
-
} catch (const ruby_exception& e) {
|
|
463
|
-
rb_exc_raise(e.exception_object());
|
|
464
448
|
}
|
|
465
449
|
return Qnil;
|
|
466
450
|
}
|
|
@@ -474,8 +458,8 @@ cb_Backend_analytics_index_drop(VALUE self,
|
|
|
474
458
|
{
|
|
475
459
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
476
460
|
|
|
477
|
-
|
|
478
|
-
|
|
461
|
+
cb_check_type(index_name, T_STRING);
|
|
462
|
+
cb_check_type(dataset_name, T_STRING);
|
|
479
463
|
|
|
480
464
|
try {
|
|
481
465
|
core::operations::management::analytics_index_drop_request req{};
|
|
@@ -512,10 +496,8 @@ cb_Backend_analytics_index_drop(VALUE self,
|
|
|
512
496
|
}
|
|
513
497
|
return Qtrue;
|
|
514
498
|
} catch (const std::system_error& se) {
|
|
515
|
-
|
|
499
|
+
throw ruby_exception(cb_map_error_code(
|
|
516
500
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
517
|
-
} catch (const ruby_exception& e) {
|
|
518
|
-
rb_exc_raise(e.exception_object());
|
|
519
501
|
}
|
|
520
502
|
return Qnil;
|
|
521
503
|
}
|
|
@@ -558,10 +540,8 @@ cb_Backend_analytics_link_connect(VALUE self, VALUE options, VALUE observability
|
|
|
558
540
|
}
|
|
559
541
|
return Qtrue;
|
|
560
542
|
} catch (const std::system_error& se) {
|
|
561
|
-
|
|
543
|
+
throw ruby_exception(cb_map_error_code(
|
|
562
544
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
563
|
-
} catch (const ruby_exception& e) {
|
|
564
|
-
rb_exc_raise(e.exception_object());
|
|
565
545
|
}
|
|
566
546
|
return Qnil;
|
|
567
547
|
}
|
|
@@ -603,10 +583,8 @@ cb_Backend_analytics_link_disconnect(VALUE self, VALUE options, VALUE observabil
|
|
|
603
583
|
}
|
|
604
584
|
return Qtrue;
|
|
605
585
|
} catch (const std::system_error& se) {
|
|
606
|
-
|
|
586
|
+
throw ruby_exception(cb_map_error_code(
|
|
607
587
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
608
|
-
} catch (const ruby_exception& e) {
|
|
609
|
-
rb_exc_raise(e.exception_object());
|
|
610
588
|
}
|
|
611
589
|
return Qnil;
|
|
612
590
|
}
|
|
@@ -667,13 +645,13 @@ cb_Backend_analytics_link_create(VALUE self, VALUE link, VALUE options, VALUE ob
|
|
|
667
645
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
668
646
|
|
|
669
647
|
if (!NIL_P(options)) {
|
|
670
|
-
|
|
648
|
+
cb_check_type(options, T_HASH);
|
|
671
649
|
}
|
|
672
650
|
|
|
673
651
|
try {
|
|
674
652
|
VALUE link_type = Qnil;
|
|
675
653
|
cb_extract_option_symbol(link_type, link, "type");
|
|
676
|
-
if (ID type =
|
|
654
|
+
if (ID type = cb_sym2id(link_type); type == rb_intern("couchbase")) {
|
|
677
655
|
core::operations::management::analytics_link_create_request<
|
|
678
656
|
core::management::analytics::couchbase_remote_link>
|
|
679
657
|
req{};
|
|
@@ -782,10 +760,8 @@ cb_Backend_analytics_link_create(VALUE self, VALUE link, VALUE options, VALUE ob
|
|
|
782
760
|
|
|
783
761
|
return Qtrue;
|
|
784
762
|
} catch (const std::system_error& se) {
|
|
785
|
-
|
|
763
|
+
throw ruby_exception(cb_map_error_code(
|
|
786
764
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
787
|
-
} catch (const ruby_exception& e) {
|
|
788
|
-
rb_exc_raise(e.exception_object());
|
|
789
765
|
}
|
|
790
766
|
return Qnil;
|
|
791
767
|
}
|
|
@@ -799,14 +775,14 @@ cb_Backend_analytics_link_replace(VALUE self,
|
|
|
799
775
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
800
776
|
|
|
801
777
|
if (!NIL_P(options)) {
|
|
802
|
-
|
|
778
|
+
cb_check_type(options, T_HASH);
|
|
803
779
|
}
|
|
804
780
|
|
|
805
781
|
try {
|
|
806
782
|
VALUE link_type = Qnil;
|
|
807
783
|
cb_extract_option_symbol(link_type, link, "type");
|
|
808
784
|
|
|
809
|
-
if (ID type =
|
|
785
|
+
if (ID type = cb_sym2id(link_type); type == rb_intern("couchbase")) {
|
|
810
786
|
core::operations::management::analytics_link_replace_request<
|
|
811
787
|
core::management::analytics::couchbase_remote_link>
|
|
812
788
|
req{};
|
|
@@ -916,10 +892,8 @@ cb_Backend_analytics_link_replace(VALUE self,
|
|
|
916
892
|
|
|
917
893
|
return Qtrue;
|
|
918
894
|
} catch (const std::system_error& se) {
|
|
919
|
-
|
|
895
|
+
throw ruby_exception(cb_map_error_code(
|
|
920
896
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
921
|
-
} catch (const ruby_exception& e) {
|
|
922
|
-
rb_exc_raise(e.exception_object());
|
|
923
897
|
}
|
|
924
898
|
return Qnil;
|
|
925
899
|
}
|
|
@@ -933,10 +907,10 @@ cb_Backend_analytics_link_drop(VALUE self,
|
|
|
933
907
|
{
|
|
934
908
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
935
909
|
|
|
936
|
-
|
|
937
|
-
|
|
910
|
+
cb_check_type(link, T_STRING);
|
|
911
|
+
cb_check_type(dataverse, T_STRING);
|
|
938
912
|
if (!NIL_P(options)) {
|
|
939
|
-
|
|
913
|
+
cb_check_type(options, T_HASH);
|
|
940
914
|
}
|
|
941
915
|
|
|
942
916
|
try {
|
|
@@ -975,10 +949,8 @@ cb_Backend_analytics_link_drop(VALUE self,
|
|
|
975
949
|
|
|
976
950
|
return Qtrue;
|
|
977
951
|
} catch (const std::system_error& se) {
|
|
978
|
-
|
|
952
|
+
throw ruby_exception(cb_map_error_code(
|
|
979
953
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
980
|
-
} catch (const ruby_exception& e) {
|
|
981
|
-
rb_exc_raise(e.exception_object());
|
|
982
954
|
}
|
|
983
955
|
return Qnil;
|
|
984
956
|
}
|
|
@@ -989,7 +961,7 @@ cb_Backend_analytics_link_get_all(VALUE self, VALUE options, VALUE observability
|
|
|
989
961
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
990
962
|
|
|
991
963
|
if (!NIL_P(options)) {
|
|
992
|
-
|
|
964
|
+
cb_check_type(options, T_HASH);
|
|
993
965
|
}
|
|
994
966
|
|
|
995
967
|
try {
|
|
@@ -1082,10 +1054,8 @@ cb_Backend_analytics_link_get_all(VALUE self, VALUE options, VALUE observability
|
|
|
1082
1054
|
|
|
1083
1055
|
return res;
|
|
1084
1056
|
} catch (const std::system_error& se) {
|
|
1085
|
-
|
|
1057
|
+
throw ruby_exception(cb_map_error_code(
|
|
1086
1058
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
1087
|
-
} catch (const ruby_exception& e) {
|
|
1088
|
-
rb_exc_raise(e.exception_object());
|
|
1089
1059
|
}
|
|
1090
1060
|
return Qnil;
|
|
1091
1061
|
}
|
|
@@ -1121,17 +1091,6 @@ cb_analytics_status_str(core::operations::analytics_response::analytics_status s
|
|
|
1121
1091
|
return "unknown";
|
|
1122
1092
|
}
|
|
1123
1093
|
|
|
1124
|
-
int
|
|
1125
|
-
cb_for_each_named_param_analytics(VALUE key, VALUE value, VALUE arg)
|
|
1126
|
-
{
|
|
1127
|
-
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
|
|
1128
|
-
auto* preq = reinterpret_cast<core::operations::analytics_request*>(arg);
|
|
1129
|
-
cb_check_type(key, T_STRING);
|
|
1130
|
-
cb_check_type(value, T_STRING);
|
|
1131
|
-
preq->named_parameters[cb_string_new(key)] = cb_string_new(value);
|
|
1132
|
-
return ST_CONTINUE;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
1094
|
VALUE
|
|
1136
1095
|
cb_Backend_document_analytics(VALUE self,
|
|
1137
1096
|
VALUE statement,
|
|
@@ -1140,9 +1099,9 @@ cb_Backend_document_analytics(VALUE self,
|
|
|
1140
1099
|
{
|
|
1141
1100
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
1142
1101
|
|
|
1143
|
-
|
|
1102
|
+
cb_check_type(statement, T_STRING);
|
|
1144
1103
|
if (!NIL_P(options)) {
|
|
1145
|
-
|
|
1104
|
+
cb_check_type(options, T_HASH);
|
|
1146
1105
|
}
|
|
1147
1106
|
|
|
1148
1107
|
try {
|
|
@@ -1171,9 +1130,7 @@ cb_Backend_document_analytics(VALUE self,
|
|
|
1171
1130
|
if (VALUE named_params = rb_hash_aref(options, rb_id2sym(rb_intern("named_parameters")));
|
|
1172
1131
|
!NIL_P(named_params)) {
|
|
1173
1132
|
cb_check_type(named_params, T_HASH);
|
|
1174
|
-
|
|
1175
|
-
rb_hash_foreach(
|
|
1176
|
-
named_params, cb_for_each_named_param_analytics, reinterpret_cast<VALUE>(&req));
|
|
1133
|
+
cb_extract_string_hash(req.named_parameters, named_params, "named_parameters");
|
|
1177
1134
|
}
|
|
1178
1135
|
if (VALUE scan_consistency = rb_hash_aref(options, rb_id2sym(rb_intern("scan_consistency")));
|
|
1179
1136
|
!NIL_P(scan_consistency)) {
|
|
@@ -1206,8 +1163,7 @@ cb_Backend_document_analytics(VALUE self,
|
|
|
1206
1163
|
if (VALUE raw_params = rb_hash_aref(options, rb_id2sym(rb_intern("raw_parameters")));
|
|
1207
1164
|
!NIL_P(raw_params)) {
|
|
1208
1165
|
cb_check_type(raw_params, T_HASH);
|
|
1209
|
-
|
|
1210
|
-
rb_hash_foreach(raw_params, cb_for_each_named_param_analytics, reinterpret_cast<VALUE>(&req));
|
|
1166
|
+
cb_extract_string_hash(req.raw, raw_params, "raw_parameters");
|
|
1211
1167
|
}
|
|
1212
1168
|
|
|
1213
1169
|
auto parent_span = cb_create_parent_span(req, self);
|
|
@@ -1268,10 +1224,8 @@ cb_Backend_document_analytics(VALUE self,
|
|
|
1268
1224
|
|
|
1269
1225
|
return res;
|
|
1270
1226
|
} catch (const std::system_error& se) {
|
|
1271
|
-
|
|
1227
|
+
throw ruby_exception(cb_map_error_code(
|
|
1272
1228
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
1273
|
-
} catch (const ruby_exception& e) {
|
|
1274
|
-
rb_exc_raise(e.exception_object());
|
|
1275
1229
|
}
|
|
1276
1230
|
return Qnil;
|
|
1277
1231
|
}
|
|
@@ -1281,25 +1235,51 @@ cb_Backend_document_analytics(VALUE self,
|
|
|
1281
1235
|
void
|
|
1282
1236
|
init_analytics(VALUE cBackend)
|
|
1283
1237
|
{
|
|
1284
|
-
rb_define_method(
|
|
1238
|
+
rb_define_method(
|
|
1239
|
+
cBackend, "document_analytics", cb_method<cb_Backend_document_analytics>::invoke, 3);
|
|
1285
1240
|
|
|
1286
1241
|
// Management APIs
|
|
1242
|
+
rb_define_method(cBackend,
|
|
1243
|
+
"analytics_get_pending_mutations",
|
|
1244
|
+
cb_method<cb_Backend_analytics_get_pending_mutations>::invoke,
|
|
1245
|
+
2);
|
|
1246
|
+
rb_define_method(cBackend,
|
|
1247
|
+
"analytics_dataverse_drop",
|
|
1248
|
+
cb_method<cb_Backend_analytics_dataverse_drop>::invoke,
|
|
1249
|
+
3);
|
|
1250
|
+
rb_define_method(cBackend,
|
|
1251
|
+
"analytics_dataverse_create",
|
|
1252
|
+
cb_method<cb_Backend_analytics_dataverse_create>::invoke,
|
|
1253
|
+
3);
|
|
1254
|
+
rb_define_method(cBackend,
|
|
1255
|
+
"analytics_dataset_create",
|
|
1256
|
+
cb_method<cb_Backend_analytics_dataset_create>::invoke,
|
|
1257
|
+
4);
|
|
1258
|
+
rb_define_method(
|
|
1259
|
+
cBackend, "analytics_dataset_drop", cb_method<cb_Backend_analytics_dataset_drop>::invoke, 3);
|
|
1260
|
+
rb_define_method(cBackend,
|
|
1261
|
+
"analytics_dataset_get_all",
|
|
1262
|
+
cb_method<cb_Backend_analytics_dataset_get_all>::invoke,
|
|
1263
|
+
2);
|
|
1264
|
+
rb_define_method(
|
|
1265
|
+
cBackend, "analytics_index_get_all", cb_method<cb_Backend_analytics_index_get_all>::invoke, 2);
|
|
1266
|
+
rb_define_method(
|
|
1267
|
+
cBackend, "analytics_index_create", cb_method<cb_Backend_analytics_index_create>::invoke, 5);
|
|
1268
|
+
rb_define_method(
|
|
1269
|
+
cBackend, "analytics_index_drop", cb_method<cb_Backend_analytics_index_drop>::invoke, 4);
|
|
1270
|
+
rb_define_method(
|
|
1271
|
+
cBackend, "analytics_link_connect", cb_method<cb_Backend_analytics_link_connect>::invoke, 2);
|
|
1272
|
+
rb_define_method(cBackend,
|
|
1273
|
+
"analytics_link_disconnect",
|
|
1274
|
+
cb_method<cb_Backend_analytics_link_disconnect>::invoke,
|
|
1275
|
+
2);
|
|
1276
|
+
rb_define_method(
|
|
1277
|
+
cBackend, "analytics_link_create", cb_method<cb_Backend_analytics_link_create>::invoke, 3);
|
|
1278
|
+
rb_define_method(
|
|
1279
|
+
cBackend, "analytics_link_replace", cb_method<cb_Backend_analytics_link_replace>::invoke, 3);
|
|
1287
1280
|
rb_define_method(
|
|
1288
|
-
cBackend, "
|
|
1289
|
-
rb_define_method(cBackend, "analytics_dataverse_drop", cb_Backend_analytics_dataverse_drop, 3);
|
|
1281
|
+
cBackend, "analytics_link_drop", cb_method<cb_Backend_analytics_link_drop>::invoke, 4);
|
|
1290
1282
|
rb_define_method(
|
|
1291
|
-
cBackend, "
|
|
1292
|
-
rb_define_method(cBackend, "analytics_dataset_create", cb_Backend_analytics_dataset_create, 4);
|
|
1293
|
-
rb_define_method(cBackend, "analytics_dataset_drop", cb_Backend_analytics_dataset_drop, 3);
|
|
1294
|
-
rb_define_method(cBackend, "analytics_dataset_get_all", cb_Backend_analytics_dataset_get_all, 2);
|
|
1295
|
-
rb_define_method(cBackend, "analytics_index_get_all", cb_Backend_analytics_index_get_all, 2);
|
|
1296
|
-
rb_define_method(cBackend, "analytics_index_create", cb_Backend_analytics_index_create, 5);
|
|
1297
|
-
rb_define_method(cBackend, "analytics_index_drop", cb_Backend_analytics_index_drop, 4);
|
|
1298
|
-
rb_define_method(cBackend, "analytics_link_connect", cb_Backend_analytics_link_connect, 2);
|
|
1299
|
-
rb_define_method(cBackend, "analytics_link_disconnect", cb_Backend_analytics_link_disconnect, 2);
|
|
1300
|
-
rb_define_method(cBackend, "analytics_link_create", cb_Backend_analytics_link_create, 3);
|
|
1301
|
-
rb_define_method(cBackend, "analytics_link_replace", cb_Backend_analytics_link_replace, 3);
|
|
1302
|
-
rb_define_method(cBackend, "analytics_link_drop", cb_Backend_analytics_link_drop, 4);
|
|
1303
|
-
rb_define_method(cBackend, "analytics_link_get_all", cb_Backend_analytics_link_get_all, 2);
|
|
1283
|
+
cBackend, "analytics_link_get_all", cb_method<cb_Backend_analytics_link_get_all>::invoke, 2);
|
|
1304
1284
|
}
|
|
1305
1285
|
} // namespace couchbase::ruby
|
data/ext/rcb_backend.cxx
CHANGED
|
@@ -64,7 +64,8 @@ public:
|
|
|
64
64
|
known_instances_.remove(instance);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
// Returns the rb_protect state of a failed logger flush during prepare, or zero.
|
|
68
|
+
int notify_fork(couchbase::fork_event event)
|
|
68
69
|
{
|
|
69
70
|
if (event != couchbase::fork_event::prepare) {
|
|
70
71
|
init_logger();
|
|
@@ -78,9 +79,18 @@ public:
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
if (event == couchbase::fork_event::prepare) {
|
|
81
|
-
|
|
82
|
+
// The fork hook defers interrupts from :prepare until the fork, but a blocked logger must
|
|
83
|
+
// still be interruptible by Timeout or Thread#kill.
|
|
84
|
+
int state = try_flush_logger_interruptible();
|
|
82
85
|
couchbase::core::logger::shutdown();
|
|
86
|
+
if (state != 0) {
|
|
87
|
+
// The fork does not happen, so the instances stopped above are restarted as in the
|
|
88
|
+
// parent of a completed fork.
|
|
89
|
+
notify_fork(couchbase::fork_event::parent);
|
|
90
|
+
}
|
|
91
|
+
return state;
|
|
83
92
|
}
|
|
93
|
+
return 0;
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
private:
|
|
@@ -97,21 +107,22 @@ cb_Backend_notify_fork(VALUE self, VALUE event)
|
|
|
97
107
|
static const auto id_parent{ rb_intern("parent") };
|
|
98
108
|
static const auto id_child{ rb_intern("child") };
|
|
99
109
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
cb_check_type(event, T_SYMBOL);
|
|
111
|
+
int state = 0;
|
|
112
|
+
if (rb_sym2id(event) == id_prepare) {
|
|
113
|
+
state = instances.notify_fork(couchbase::fork_event::prepare);
|
|
114
|
+
} else if (rb_sym2id(event) == id_parent) {
|
|
115
|
+
instances.notify_fork(couchbase::fork_event::parent);
|
|
116
|
+
} else if (rb_sym2id(event) == id_child) {
|
|
117
|
+
instances.notify_fork(couchbase::fork_event::child);
|
|
118
|
+
} else {
|
|
119
|
+
throw ruby_exception(rb_eTypeError,
|
|
120
|
+
cb_sprintf("unexpected fork event type %" PRIsVALUE "", event));
|
|
121
|
+
}
|
|
122
|
+
if (state != 0) {
|
|
123
|
+
// notify_fork has already restarted the instances. Only the interrupt check that ends
|
|
124
|
+
// Thread.handle_interrupt can have run Ruby code since the flush failed.
|
|
125
|
+
throw ruby_jump(state);
|
|
115
126
|
}
|
|
116
127
|
|
|
117
128
|
return Qnil;
|
|
@@ -308,7 +319,7 @@ initialize_cluster_options(const core::utils::connection_string& connstr,
|
|
|
308
319
|
} else {
|
|
309
320
|
throw ruby_exception(
|
|
310
321
|
exc_invalid_argument(),
|
|
311
|
-
|
|
322
|
+
cb_sprintf("Failed to select verification mode for TLS: %+" PRIsVALUE, mode.value()));
|
|
312
323
|
}
|
|
313
324
|
}
|
|
314
325
|
|
|
@@ -336,7 +347,7 @@ initialize_cluster_options(const core::utils::connection_string& connstr,
|
|
|
336
347
|
} else {
|
|
337
348
|
throw ruby_exception(
|
|
338
349
|
exc_invalid_argument(),
|
|
339
|
-
|
|
350
|
+
cb_sprintf("Failed to setect preferred IP protocol: %+" PRIsVALUE, proto.value()));
|
|
340
351
|
}
|
|
341
352
|
}
|
|
342
353
|
|
|
@@ -497,12 +508,12 @@ cb_Backend_open(VALUE self, VALUE connstr, VALUE credentials, VALUE options)
|
|
|
497
508
|
|
|
498
509
|
if (backend->instance != nullptr) {
|
|
499
510
|
CB_LOG_TRACE("Trying to open the same backend twice: {}, instance={}",
|
|
500
|
-
|
|
511
|
+
cb_sprintf("%+" PRIsVALUE ", connection_string=%+" PRIsVALUE, self, connstr),
|
|
501
512
|
static_cast<const void*>(backend->instance.get()));
|
|
502
513
|
return Qnil;
|
|
503
514
|
}
|
|
504
515
|
|
|
505
|
-
|
|
516
|
+
cb_check_type(connstr, T_STRING);
|
|
506
517
|
|
|
507
518
|
try {
|
|
508
519
|
auto connection_string = cb_string_new(connstr);
|
|
@@ -535,10 +546,8 @@ cb_Backend_open(VALUE self, VALUE connstr, VALUE credentials, VALUE options)
|
|
|
535
546
|
backend->instance = std::make_unique<couchbase::cluster>(std::move(cluster));
|
|
536
547
|
instances.add(backend->instance.get());
|
|
537
548
|
} catch (const std::system_error& se) {
|
|
538
|
-
|
|
549
|
+
throw ruby_exception(cb_map_error_code(
|
|
539
550
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
540
|
-
} catch (const ruby_exception& e) {
|
|
541
|
-
rb_exc_raise(e.exception_object());
|
|
542
551
|
}
|
|
543
552
|
return Qnil;
|
|
544
553
|
}
|
|
@@ -558,7 +567,7 @@ cb_Backend_open_bucket(VALUE self, VALUE bucket, VALUE wait_until_ready)
|
|
|
558
567
|
{
|
|
559
568
|
const auto& cluster = cb_backend_to_core_api_cluster(self);
|
|
560
569
|
|
|
561
|
-
|
|
570
|
+
cb_check_type(bucket, T_STRING);
|
|
562
571
|
bool wait = RTEST(wait_until_ready);
|
|
563
572
|
|
|
564
573
|
try {
|
|
@@ -579,10 +588,8 @@ cb_Backend_open_bucket(VALUE self, VALUE bucket, VALUE wait_until_ready)
|
|
|
579
588
|
});
|
|
580
589
|
}
|
|
581
590
|
} catch (const std::system_error& se) {
|
|
582
|
-
|
|
591
|
+
throw ruby_exception(cb_map_error_code(
|
|
583
592
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
|
584
|
-
} catch (const ruby_exception& e) {
|
|
585
|
-
rb_exc_raise(e.exception_object());
|
|
586
593
|
}
|
|
587
594
|
return Qnil;
|
|
588
595
|
}
|
|
@@ -610,10 +617,8 @@ cb_Backend_update_credentials(VALUE self, VALUE credentials)
|
|
|
610
617
|
cb_throw_error(err, "failed to update authenticator");
|
|
611
618
|
}
|
|
612
619
|
} catch (const std::system_error& se) {
|
|
613
|
-
|
|
620
|
+
throw ruby_exception(cb_map_error_code(
|
|
614
621
|
se.code(), fmt::format("failed to update authenticator {}: {}", __func__, se.what()), false));
|
|
615
|
-
} catch (const ruby_exception& e) {
|
|
616
|
-
rb_exc_raise(e.exception_object());
|
|
617
622
|
}
|
|
618
623
|
|
|
619
624
|
return Qnil;
|
|
@@ -626,12 +631,13 @@ init_backend(VALUE mCouchbase)
|
|
|
626
631
|
{
|
|
627
632
|
VALUE cBackend = rb_define_class_under(mCouchbase, "Backend", rb_cObject);
|
|
628
633
|
rb_define_alloc_func(cBackend, cb_Backend_allocate);
|
|
629
|
-
rb_define_method(cBackend, "open", cb_Backend_open, 3);
|
|
630
|
-
rb_define_method(cBackend, "open_bucket", cb_Backend_open_bucket, 2);
|
|
634
|
+
rb_define_method(cBackend, "open", cb_method<cb_Backend_open>::invoke, 3);
|
|
635
|
+
rb_define_method(cBackend, "open_bucket", cb_method<cb_Backend_open_bucket>::invoke, 2);
|
|
631
636
|
rb_define_method(cBackend, "close", cb_Backend_close, 0);
|
|
632
|
-
rb_define_method(
|
|
637
|
+
rb_define_method(
|
|
638
|
+
cBackend, "update_credentials", cb_method<cb_Backend_update_credentials>::invoke, 1);
|
|
633
639
|
|
|
634
|
-
rb_define_singleton_method(cBackend, "notify_fork", cb_Backend_notify_fork, 1);
|
|
640
|
+
rb_define_singleton_method(cBackend, "notify_fork", cb_method<cb_Backend_notify_fork>::invoke, 1);
|
|
635
641
|
return cBackend;
|
|
636
642
|
}
|
|
637
643
|
|
|
@@ -642,7 +648,7 @@ cb_backend_to_public_api_cluster(VALUE self) -> couchbase::cluster
|
|
|
642
648
|
TypedData_Get_Struct(self, cb_backend_data, &cb_backend_type, backend);
|
|
643
649
|
|
|
644
650
|
if (backend->instance == nullptr) {
|
|
645
|
-
|
|
651
|
+
throw ruby_exception(exc_cluster_closed(), "Cluster has been closed already");
|
|
646
652
|
}
|
|
647
653
|
|
|
648
654
|
return *backend->instance;
|
data/ext/rcb_backend.hxx
CHANGED
|
@@ -33,6 +33,8 @@ class cluster;
|
|
|
33
33
|
|
|
34
34
|
namespace couchbase::ruby
|
|
35
35
|
{
|
|
36
|
+
// Both throw ruby_exception with Error::ClusterClosed once the backend is closed, so they may be
|
|
37
|
+
// called only from a method body registered through cb_method.
|
|
36
38
|
auto
|
|
37
39
|
cb_backend_to_public_api_cluster(VALUE self) -> couchbase::cluster;
|
|
38
40
|
|