couchbase 3.7.0 → 3.8.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 +3 -3
- data/ext/CMakeLists.txt +4 -1
- data/ext/cache/extconf_include.rb +4 -3
- data/ext/cache/mozilla-ca-bundle.crt +66 -93
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/couchbase/CMakeLists.txt +24 -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/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 +134 -58
- data/ext/couchbase/core/impl/bucket_manager.cxx +87 -35
- data/ext/couchbase/core/impl/collection.cxx +560 -245
- 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 +20 -13
- 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/lookup_in_replica.hxx +1 -1
- 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 +163 -228
- 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 +77 -27
- 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.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 +46 -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.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.hxx +2 -0
- data/ext/couchbase/core/operations/management/collection_drop.hxx +2 -0
- 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 +4 -1
- 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.hxx +2 -0
- 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.hxx +2 -0
- 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/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/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 +60 -15
- 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/password_authenticator.hxx +1 -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 +587 -294
- data/ext/rcb_hdr_histogram.cxx +219 -0
- data/ext/rcb_hdr_histogram.hxx +28 -0
- 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 +81 -50
- data/lib/couchbase/datastructures/couchbase_map.rb +86 -50
- data/lib/couchbase/datastructures/couchbase_queue.rb +64 -38
- data/lib/couchbase/datastructures/couchbase_set.rb +57 -41
- data/lib/couchbase/deprecations.rb +1 -1
- data/lib/couchbase/diagnostics.rb +8 -8
- data/lib/couchbase/errors.rb +6 -0
- 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 +69 -3
- data/lib/couchbase/protostellar/cluster.rb +3 -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 +257 -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 +58 -6
data/ext/rcb_backend.cxx
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
#include <core/cluster.hxx>
|
|
24
24
|
#include <core/logger/logger.hxx>
|
|
25
|
+
#include <core/tracing/wrapper_sdk_tracer.hxx>
|
|
25
26
|
#include <core/utils/connection_string.hxx>
|
|
26
27
|
|
|
27
28
|
#include <asio/io_context.hpp>
|
|
@@ -178,17 +179,21 @@ cb_Backend_allocate(VALUE klass)
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
auto
|
|
181
|
-
|
|
182
|
+
construct_authenticator(VALUE credentials) -> std::variant<couchbase::password_authenticator,
|
|
183
|
+
couchbase::certificate_authenticator,
|
|
184
|
+
couchbase::jwt_authenticator>
|
|
182
185
|
{
|
|
183
186
|
cb_check_type(credentials, T_HASH);
|
|
184
187
|
|
|
185
188
|
static const auto sym_certificate_path{ rb_id2sym(rb_intern("certificate_path")) };
|
|
186
189
|
static const auto sym_key_path{ rb_id2sym(rb_intern("key_path")) };
|
|
190
|
+
static const auto sym_jwt{ rb_id2sym(rb_intern("jwt")) };
|
|
187
191
|
|
|
188
192
|
const VALUE certificate_path = rb_hash_aref(credentials, sym_certificate_path);
|
|
189
193
|
const VALUE key_path = rb_hash_aref(credentials, sym_key_path);
|
|
194
|
+
const VALUE jwt = rb_hash_aref(credentials, sym_jwt);
|
|
190
195
|
|
|
191
|
-
if (NIL_P(certificate_path)
|
|
196
|
+
if (NIL_P(certificate_path) && NIL_P(key_path) && NIL_P(jwt)) {
|
|
192
197
|
static const auto sym_username = rb_id2sym(rb_intern("username"));
|
|
193
198
|
static const auto sym_password = rb_id2sym(rb_intern("password"));
|
|
194
199
|
|
|
@@ -198,11 +203,48 @@ construct_cluster_options(VALUE credentials, bool tls_enabled) -> couchbase::clu
|
|
|
198
203
|
cb_check_type(username, T_STRING);
|
|
199
204
|
cb_check_type(password, T_STRING);
|
|
200
205
|
|
|
201
|
-
return
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
return couchbase::password_authenticator{
|
|
207
|
+
cb_string_new(username),
|
|
208
|
+
cb_string_new(password),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (NIL_P(jwt)) {
|
|
213
|
+
cb_check_type(certificate_path, T_STRING);
|
|
214
|
+
cb_check_type(key_path, T_STRING);
|
|
215
|
+
|
|
216
|
+
return couchbase::certificate_authenticator{
|
|
217
|
+
cb_string_new(certificate_path),
|
|
218
|
+
cb_string_new(key_path),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
cb_check_type(jwt, T_STRING);
|
|
223
|
+
return couchbase::jwt_authenticator{
|
|
224
|
+
cb_string_new(jwt),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
auto
|
|
229
|
+
construct_cluster_options(VALUE credentials, bool tls_enabled) -> couchbase::cluster_options
|
|
230
|
+
{
|
|
231
|
+
auto authenticator = construct_authenticator(credentials);
|
|
232
|
+
|
|
233
|
+
if (std::holds_alternative<couchbase::password_authenticator>(authenticator)) {
|
|
234
|
+
return couchbase::cluster_options{
|
|
235
|
+
std::get<couchbase::password_authenticator>(std::move(authenticator)),
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (std::holds_alternative<couchbase::jwt_authenticator>(authenticator)) {
|
|
240
|
+
if (!tls_enabled) {
|
|
241
|
+
throw ruby_exception(
|
|
242
|
+
exc_invalid_argument(),
|
|
243
|
+
"JWT authenticator requires TLS connection, check the connection string");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return couchbase::cluster_options{
|
|
247
|
+
std::get<couchbase::jwt_authenticator>(std::move(authenticator)),
|
|
206
248
|
};
|
|
207
249
|
}
|
|
208
250
|
|
|
@@ -212,14 +254,8 @@ construct_cluster_options(VALUE credentials, bool tls_enabled) -> couchbase::clu
|
|
|
212
254
|
"Certificate authenticator requires TLS connection, check the connection string");
|
|
213
255
|
}
|
|
214
256
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return cluster_options{
|
|
219
|
-
certificate_authenticator{
|
|
220
|
-
cb_string_new(certificate_path),
|
|
221
|
-
cb_string_new(key_path),
|
|
222
|
-
},
|
|
257
|
+
return couchbase::cluster_options{
|
|
258
|
+
std::get<couchbase::certificate_authenticator>(std::move(authenticator)),
|
|
223
259
|
};
|
|
224
260
|
}
|
|
225
261
|
|
|
@@ -408,68 +444,46 @@ initialize_cluster_options(const core::utils::connection_string& connstr,
|
|
|
408
444
|
cluster_options.network().max_http_connections(param.value());
|
|
409
445
|
}
|
|
410
446
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
cluster_options.tracing().enable(param.value());
|
|
414
|
-
}
|
|
415
|
-
static const auto sym_orphaned_emit_interval = rb_id2sym(rb_intern("orphaned_emit_interval"));
|
|
416
|
-
if (auto param = options::get_milliseconds(options, sym_orphaned_emit_interval); param) {
|
|
417
|
-
cluster_options.tracing().orphaned_emit_interval(param.value());
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
static const auto sym_orphaned_sample_size = rb_id2sym(rb_intern("orphaned_sample_size"));
|
|
421
|
-
if (auto param = options::get_size_t(options, sym_orphaned_sample_size); param) {
|
|
422
|
-
cluster_options.tracing().orphaned_sample_size(param.value());
|
|
423
|
-
}
|
|
447
|
+
cluster_options.tracing().tracer(
|
|
448
|
+
std::make_shared<couchbase::core::tracing::wrapper_sdk_tracer>());
|
|
424
449
|
|
|
425
|
-
|
|
426
|
-
if (auto param = options::get_milliseconds(options, sym_threshold_emit_interval); param) {
|
|
427
|
-
cluster_options.tracing().threshold_emit_interval(param.value());
|
|
428
|
-
}
|
|
450
|
+
cluster_options.metrics().enable(false); // Metrics are handled on the wrapper-side
|
|
429
451
|
|
|
430
|
-
static const auto
|
|
431
|
-
if (auto
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
static const auto sym_query_threshold = rb_id2sym(rb_intern("query_threshold"));
|
|
441
|
-
if (auto param = options::get_milliseconds(options, sym_query_threshold); param) {
|
|
442
|
-
cluster_options.tracing().query_threshold(param.value());
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
static const auto sym_view_threshold = rb_id2sym(rb_intern("view_threshold"));
|
|
446
|
-
if (auto param = options::get_milliseconds(options, sym_view_threshold); param) {
|
|
447
|
-
cluster_options.tracing().view_threshold(param.value());
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
static const auto sym_search_threshold = rb_id2sym(rb_intern("search_threshold"));
|
|
451
|
-
if (auto param = options::get_milliseconds(options, sym_search_threshold); param) {
|
|
452
|
-
cluster_options.tracing().search_threshold(param.value());
|
|
453
|
-
}
|
|
452
|
+
static const auto sym_app_telemetry = rb_id2sym(rb_intern("application_telemetry"));
|
|
453
|
+
if (auto app_telemetry_options = options::get_hash(options, sym_app_telemetry);
|
|
454
|
+
app_telemetry_options) {
|
|
455
|
+
static const auto sym_enable_app_telemetry = rb_id2sym(rb_intern("enable"));
|
|
456
|
+
if (auto param = options::get_bool(app_telemetry_options.value(), sym_enable_app_telemetry);
|
|
457
|
+
param) {
|
|
458
|
+
cluster_options.application_telemetry().enable(param.value());
|
|
459
|
+
}
|
|
454
460
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
461
|
+
static const auto sym_app_telemetry_endpoint = rb_id2sym(rb_intern("override_endpoint"));
|
|
462
|
+
if (auto param = options::get_string(app_telemetry_options.value(), sym_app_telemetry_endpoint);
|
|
463
|
+
param) {
|
|
464
|
+
cluster_options.application_telemetry().override_endpoint(param.value());
|
|
465
|
+
}
|
|
459
466
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
467
|
+
static const auto sym_app_telemetry_backoff = rb_id2sym(rb_intern("backoff"));
|
|
468
|
+
if (auto param =
|
|
469
|
+
options::get_milliseconds(app_telemetry_options.value(), sym_app_telemetry_backoff);
|
|
470
|
+
param) {
|
|
471
|
+
cluster_options.application_telemetry().backoff_interval(param.value());
|
|
472
|
+
}
|
|
464
473
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
474
|
+
static const auto sym_app_telemetry_ping_interval = rb_id2sym(rb_intern("ping_interval"));
|
|
475
|
+
if (auto param =
|
|
476
|
+
options::get_milliseconds(app_telemetry_options.value(), sym_app_telemetry_ping_interval);
|
|
477
|
+
param) {
|
|
478
|
+
cluster_options.application_telemetry().ping_interval(param.value());
|
|
479
|
+
}
|
|
469
480
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
481
|
+
static const auto sym_app_telemetry_ping_timeout = rb_id2sym(rb_intern("ping_timeout"));
|
|
482
|
+
if (auto param =
|
|
483
|
+
options::get_milliseconds(app_telemetry_options.value(), sym_app_telemetry_ping_timeout);
|
|
484
|
+
param) {
|
|
485
|
+
cluster_options.application_telemetry().ping_timeout(param.value());
|
|
486
|
+
}
|
|
473
487
|
}
|
|
474
488
|
|
|
475
489
|
return cluster_options;
|
|
@@ -573,6 +587,38 @@ cb_Backend_open_bucket(VALUE self, VALUE bucket, VALUE wait_until_ready)
|
|
|
573
587
|
return Qnil;
|
|
574
588
|
}
|
|
575
589
|
|
|
590
|
+
VALUE
|
|
591
|
+
cb_Backend_update_credentials(VALUE self, VALUE credentials)
|
|
592
|
+
{
|
|
593
|
+
auto cluster = cb_backend_to_public_api_cluster(self);
|
|
594
|
+
|
|
595
|
+
try {
|
|
596
|
+
auto authenticator = construct_authenticator(credentials);
|
|
597
|
+
|
|
598
|
+
couchbase::error err{};
|
|
599
|
+
if (std::holds_alternative<couchbase::password_authenticator>(authenticator)) {
|
|
600
|
+
err = cluster.set_authenticator(
|
|
601
|
+
std::get<couchbase::password_authenticator>(std::move(authenticator)));
|
|
602
|
+
} else if (std::holds_alternative<couchbase::jwt_authenticator>(authenticator)) {
|
|
603
|
+
err =
|
|
604
|
+
cluster.set_authenticator(std::get<couchbase::jwt_authenticator>(std::move(authenticator)));
|
|
605
|
+
} else {
|
|
606
|
+
err = cluster.set_authenticator(
|
|
607
|
+
std::get<couchbase::certificate_authenticator>(std::move(authenticator)));
|
|
608
|
+
}
|
|
609
|
+
if (err) {
|
|
610
|
+
cb_throw_error(err, "failed to update authenticator");
|
|
611
|
+
}
|
|
612
|
+
} catch (const std::system_error& se) {
|
|
613
|
+
rb_exc_raise(cb_map_error_code(
|
|
614
|
+
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
|
+
}
|
|
618
|
+
|
|
619
|
+
return Qnil;
|
|
620
|
+
}
|
|
621
|
+
|
|
576
622
|
} // namespace
|
|
577
623
|
|
|
578
624
|
VALUE
|
|
@@ -583,6 +629,7 @@ init_backend(VALUE mCouchbase)
|
|
|
583
629
|
rb_define_method(cBackend, "open", cb_Backend_open, 3);
|
|
584
630
|
rb_define_method(cBackend, "open_bucket", cb_Backend_open_bucket, 2);
|
|
585
631
|
rb_define_method(cBackend, "close", cb_Backend_close, 0);
|
|
632
|
+
rb_define_method(cBackend, "update_credentials", cb_Backend_update_credentials, 1);
|
|
586
633
|
|
|
587
634
|
rb_define_singleton_method(cBackend, "notify_fork", cb_Backend_notify_fork, 1);
|
|
588
635
|
return cBackend;
|
data/ext/rcb_buckets.cxx
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
#include <ruby.h>
|
|
33
33
|
|
|
34
34
|
#include "rcb_backend.hxx"
|
|
35
|
+
#include "rcb_observability.hxx"
|
|
35
36
|
#include "rcb_utils.hxx"
|
|
36
37
|
|
|
37
38
|
namespace couchbase::ruby
|
|
@@ -273,7 +274,10 @@ cb_generate_bucket_settings(VALUE bucket,
|
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
VALUE
|
|
276
|
-
cb_Backend_bucket_create(VALUE self,
|
|
277
|
+
cb_Backend_bucket_create(VALUE self,
|
|
278
|
+
VALUE bucket_settings,
|
|
279
|
+
VALUE options,
|
|
280
|
+
VALUE observability_handler)
|
|
277
281
|
{
|
|
278
282
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
279
283
|
|
|
@@ -286,12 +290,15 @@ cb_Backend_bucket_create(VALUE self, VALUE bucket_settings, VALUE options)
|
|
|
286
290
|
core::operations::management::bucket_create_request req{};
|
|
287
291
|
cb_extract_timeout(req, options);
|
|
288
292
|
cb_generate_bucket_settings(bucket_settings, req.bucket, true);
|
|
293
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
289
294
|
std::promise<core::operations::management::bucket_create_response> promise;
|
|
290
295
|
auto f = promise.get_future();
|
|
291
296
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
292
297
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
293
298
|
});
|
|
294
|
-
|
|
299
|
+
auto resp = cb_wait_for_future(f);
|
|
300
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
301
|
+
if (resp.ctx.ec) {
|
|
295
302
|
cb_throw_error(resp.ctx,
|
|
296
303
|
fmt::format("unable to create bucket \"{}\" on the cluster ({})",
|
|
297
304
|
req.bucket.name,
|
|
@@ -309,7 +316,10 @@ cb_Backend_bucket_create(VALUE self, VALUE bucket_settings, VALUE options)
|
|
|
309
316
|
}
|
|
310
317
|
|
|
311
318
|
VALUE
|
|
312
|
-
cb_Backend_bucket_update(VALUE self,
|
|
319
|
+
cb_Backend_bucket_update(VALUE self,
|
|
320
|
+
VALUE bucket_settings,
|
|
321
|
+
VALUE options,
|
|
322
|
+
VALUE observability_handler)
|
|
313
323
|
{
|
|
314
324
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
315
325
|
|
|
@@ -321,12 +331,15 @@ cb_Backend_bucket_update(VALUE self, VALUE bucket_settings, VALUE options)
|
|
|
321
331
|
core::operations::management::bucket_update_request req{};
|
|
322
332
|
cb_extract_timeout(req, options);
|
|
323
333
|
cb_generate_bucket_settings(bucket_settings, req.bucket, false);
|
|
334
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
324
335
|
std::promise<core::operations::management::bucket_update_response> promise;
|
|
325
336
|
auto f = promise.get_future();
|
|
326
337
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
327
338
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
328
339
|
});
|
|
329
|
-
|
|
340
|
+
auto resp = cb_wait_for_future(f);
|
|
341
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
342
|
+
if (resp.ctx.ec) {
|
|
330
343
|
cb_throw_error(resp.ctx,
|
|
331
344
|
fmt::format("unable to update bucket \"{}\" on the cluster ({})",
|
|
332
345
|
req.bucket.name,
|
|
@@ -343,7 +356,7 @@ cb_Backend_bucket_update(VALUE self, VALUE bucket_settings, VALUE options)
|
|
|
343
356
|
}
|
|
344
357
|
|
|
345
358
|
VALUE
|
|
346
|
-
cb_Backend_bucket_drop(VALUE self, VALUE bucket_name, VALUE options)
|
|
359
|
+
cb_Backend_bucket_drop(VALUE self, VALUE bucket_name, VALUE options, VALUE observability_handler)
|
|
347
360
|
{
|
|
348
361
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
349
362
|
|
|
@@ -355,12 +368,15 @@ cb_Backend_bucket_drop(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
355
368
|
try {
|
|
356
369
|
core::operations::management::bucket_drop_request req{ cb_string_new(bucket_name) };
|
|
357
370
|
cb_extract_timeout(req, options);
|
|
371
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
358
372
|
std::promise<core::operations::management::bucket_drop_response> promise;
|
|
359
373
|
auto f = promise.get_future();
|
|
360
374
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
361
375
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
362
376
|
});
|
|
363
|
-
|
|
377
|
+
auto resp = cb_wait_for_future(f);
|
|
378
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
379
|
+
if (resp.ctx.ec) {
|
|
364
380
|
cb_throw_error(resp.ctx,
|
|
365
381
|
fmt::format("unable to remove bucket \"{}\" on the cluster", req.name));
|
|
366
382
|
}
|
|
@@ -375,7 +391,7 @@ cb_Backend_bucket_drop(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
375
391
|
}
|
|
376
392
|
|
|
377
393
|
VALUE
|
|
378
|
-
cb_Backend_bucket_flush(VALUE self, VALUE bucket_name, VALUE options)
|
|
394
|
+
cb_Backend_bucket_flush(VALUE self, VALUE bucket_name, VALUE options, VALUE observability_handler)
|
|
379
395
|
{
|
|
380
396
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
381
397
|
|
|
@@ -387,12 +403,15 @@ cb_Backend_bucket_flush(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
387
403
|
try {
|
|
388
404
|
core::operations::management::bucket_flush_request req{ cb_string_new(bucket_name) };
|
|
389
405
|
cb_extract_timeout(req, options);
|
|
406
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
390
407
|
std::promise<core::operations::management::bucket_flush_response> promise;
|
|
391
408
|
auto f = promise.get_future();
|
|
392
409
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
393
410
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
394
411
|
});
|
|
395
|
-
|
|
412
|
+
auto resp = cb_wait_for_future(f);
|
|
413
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
414
|
+
if (resp.ctx.ec) {
|
|
396
415
|
cb_throw_error(resp.ctx,
|
|
397
416
|
fmt::format("unable to flush bucket \"{}\" on the cluster", req.name));
|
|
398
417
|
}
|
|
@@ -562,7 +581,7 @@ cb_extract_bucket_settings(const core::management::cluster::bucket_settings& ent
|
|
|
562
581
|
}
|
|
563
582
|
|
|
564
583
|
VALUE
|
|
565
|
-
cb_Backend_bucket_get_all(VALUE self, VALUE options)
|
|
584
|
+
cb_Backend_bucket_get_all(VALUE self, VALUE options, VALUE observability_handler)
|
|
566
585
|
{
|
|
567
586
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
568
587
|
|
|
@@ -573,12 +592,14 @@ cb_Backend_bucket_get_all(VALUE self, VALUE options)
|
|
|
573
592
|
try {
|
|
574
593
|
core::operations::management::bucket_get_all_request req{};
|
|
575
594
|
cb_extract_timeout(req, options);
|
|
595
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
576
596
|
std::promise<core::operations::management::bucket_get_all_response> promise;
|
|
577
597
|
auto f = promise.get_future();
|
|
578
598
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
579
599
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
580
600
|
});
|
|
581
601
|
auto resp = cb_wait_for_future(f);
|
|
602
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
582
603
|
if (resp.ctx.ec) {
|
|
583
604
|
cb_throw_error(resp.ctx, "unable to get list of the buckets of the cluster");
|
|
584
605
|
}
|
|
@@ -601,7 +622,7 @@ cb_Backend_bucket_get_all(VALUE self, VALUE options)
|
|
|
601
622
|
}
|
|
602
623
|
|
|
603
624
|
VALUE
|
|
604
|
-
cb_Backend_bucket_get(VALUE self, VALUE bucket_name, VALUE options)
|
|
625
|
+
cb_Backend_bucket_get(VALUE self, VALUE bucket_name, VALUE options, VALUE observability_handler)
|
|
605
626
|
{
|
|
606
627
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
607
628
|
|
|
@@ -613,12 +634,14 @@ cb_Backend_bucket_get(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
613
634
|
try {
|
|
614
635
|
core::operations::management::bucket_get_request req{ cb_string_new(bucket_name) };
|
|
615
636
|
cb_extract_timeout(req, options);
|
|
637
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
616
638
|
std::promise<core::operations::management::bucket_get_response> promise;
|
|
617
639
|
auto f = promise.get_future();
|
|
618
640
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
619
641
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
620
642
|
});
|
|
621
643
|
auto resp = cb_wait_for_future(f);
|
|
644
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
622
645
|
if (resp.ctx.ec) {
|
|
623
646
|
cb_throw_error(resp.ctx,
|
|
624
647
|
fmt::format("unable to locate bucket \"{}\" on the cluster", req.name));
|
|
@@ -640,11 +663,11 @@ cb_Backend_bucket_get(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
640
663
|
void
|
|
641
664
|
init_buckets(VALUE cBackend)
|
|
642
665
|
{
|
|
643
|
-
rb_define_method(cBackend, "bucket_create", cb_Backend_bucket_create,
|
|
644
|
-
rb_define_method(cBackend, "bucket_update", cb_Backend_bucket_update,
|
|
645
|
-
rb_define_method(cBackend, "bucket_drop", cb_Backend_bucket_drop,
|
|
646
|
-
rb_define_method(cBackend, "bucket_flush", cb_Backend_bucket_flush,
|
|
647
|
-
rb_define_method(cBackend, "bucket_get_all", cb_Backend_bucket_get_all,
|
|
648
|
-
rb_define_method(cBackend, "bucket_get", cb_Backend_bucket_get,
|
|
666
|
+
rb_define_method(cBackend, "bucket_create", cb_Backend_bucket_create, 3);
|
|
667
|
+
rb_define_method(cBackend, "bucket_update", cb_Backend_bucket_update, 3);
|
|
668
|
+
rb_define_method(cBackend, "bucket_drop", cb_Backend_bucket_drop, 3);
|
|
669
|
+
rb_define_method(cBackend, "bucket_flush", cb_Backend_bucket_flush, 3);
|
|
670
|
+
rb_define_method(cBackend, "bucket_get_all", cb_Backend_bucket_get_all, 2);
|
|
671
|
+
rb_define_method(cBackend, "bucket_get", cb_Backend_bucket_get, 3);
|
|
649
672
|
}
|
|
650
673
|
} // namespace couchbase::ruby
|
data/ext/rcb_collections.cxx
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
#include <ruby.h>
|
|
32
32
|
|
|
33
33
|
#include "rcb_backend.hxx"
|
|
34
|
+
#include "rcb_observability.hxx"
|
|
34
35
|
#include "rcb_utils.hxx"
|
|
35
36
|
|
|
36
37
|
namespace couchbase::ruby
|
|
@@ -38,7 +39,7 @@ namespace couchbase::ruby
|
|
|
38
39
|
namespace
|
|
39
40
|
{
|
|
40
41
|
VALUE
|
|
41
|
-
cb_Backend_scope_get_all(VALUE self, VALUE bucket_name, VALUE options)
|
|
42
|
+
cb_Backend_scope_get_all(VALUE self, VALUE bucket_name, VALUE options, VALUE observability_handler)
|
|
42
43
|
{
|
|
43
44
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
44
45
|
|
|
@@ -50,12 +51,14 @@ cb_Backend_scope_get_all(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
50
51
|
try {
|
|
51
52
|
core::operations::management::scope_get_all_request req{ cb_string_new(bucket_name) };
|
|
52
53
|
cb_extract_timeout(req, options);
|
|
54
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
53
55
|
std::promise<core::operations::management::scope_get_all_response> promise;
|
|
54
56
|
auto f = promise.get_future();
|
|
55
57
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
56
58
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
57
59
|
});
|
|
58
60
|
auto resp = cb_wait_for_future(f);
|
|
61
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
59
62
|
if (resp.ctx.ec) {
|
|
60
63
|
cb_throw_error(
|
|
61
64
|
resp.ctx,
|
|
@@ -97,7 +100,11 @@ cb_Backend_scope_get_all(VALUE self, VALUE bucket_name, VALUE options)
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
VALUE
|
|
100
|
-
cb_Backend_scope_create(VALUE self,
|
|
103
|
+
cb_Backend_scope_create(VALUE self,
|
|
104
|
+
VALUE bucket_name,
|
|
105
|
+
VALUE scope_name,
|
|
106
|
+
VALUE options,
|
|
107
|
+
VALUE observability_handler)
|
|
101
108
|
{
|
|
102
109
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
103
110
|
|
|
@@ -111,12 +118,14 @@ cb_Backend_scope_create(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE o
|
|
|
111
118
|
core::operations::management::scope_create_request req{ cb_string_new(bucket_name),
|
|
112
119
|
cb_string_new(scope_name) };
|
|
113
120
|
cb_extract_timeout(req, options);
|
|
121
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
114
122
|
std::promise<core::operations::management::scope_create_response> promise;
|
|
115
123
|
auto f = promise.get_future();
|
|
116
124
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
117
125
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
118
126
|
});
|
|
119
127
|
auto resp = cb_wait_for_future(f);
|
|
128
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
120
129
|
|
|
121
130
|
if (resp.ctx.ec) {
|
|
122
131
|
cb_throw_error(resp.ctx,
|
|
@@ -135,7 +144,11 @@ cb_Backend_scope_create(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE o
|
|
|
135
144
|
}
|
|
136
145
|
|
|
137
146
|
VALUE
|
|
138
|
-
cb_Backend_scope_drop(VALUE self,
|
|
147
|
+
cb_Backend_scope_drop(VALUE self,
|
|
148
|
+
VALUE bucket_name,
|
|
149
|
+
VALUE scope_name,
|
|
150
|
+
VALUE options,
|
|
151
|
+
VALUE observability_handler)
|
|
139
152
|
{
|
|
140
153
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
141
154
|
|
|
@@ -149,12 +162,14 @@ cb_Backend_scope_drop(VALUE self, VALUE bucket_name, VALUE scope_name, VALUE opt
|
|
|
149
162
|
core::operations::management::scope_drop_request req{ cb_string_new(bucket_name),
|
|
150
163
|
cb_string_new(scope_name) };
|
|
151
164
|
cb_extract_timeout(req, options);
|
|
165
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
152
166
|
std::promise<core::operations::management::scope_drop_response> promise;
|
|
153
167
|
auto f = promise.get_future();
|
|
154
168
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
155
169
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
156
170
|
});
|
|
157
171
|
auto resp = cb_wait_for_future(f);
|
|
172
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
158
173
|
if (resp.ctx.ec) {
|
|
159
174
|
cb_throw_error(resp.ctx,
|
|
160
175
|
fmt::format(R"(unable to drop the scope "{}" on the bucket "{}")",
|
|
@@ -177,7 +192,8 @@ cb_Backend_collection_create(VALUE self,
|
|
|
177
192
|
VALUE scope_name,
|
|
178
193
|
VALUE collection_name,
|
|
179
194
|
VALUE settings,
|
|
180
|
-
VALUE options
|
|
195
|
+
VALUE options,
|
|
196
|
+
VALUE observability_handler)
|
|
181
197
|
{
|
|
182
198
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
183
199
|
|
|
@@ -220,6 +236,7 @@ cb_Backend_collection_create(VALUE self,
|
|
|
220
236
|
req.history = RTEST(history);
|
|
221
237
|
}
|
|
222
238
|
}
|
|
239
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
223
240
|
|
|
224
241
|
std::promise<core::operations::management::collection_create_response> promise;
|
|
225
242
|
auto f = promise.get_future();
|
|
@@ -227,6 +244,7 @@ cb_Backend_collection_create(VALUE self,
|
|
|
227
244
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
228
245
|
});
|
|
229
246
|
auto resp = cb_wait_for_future(f);
|
|
247
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
230
248
|
if (resp.ctx.ec) {
|
|
231
249
|
cb_throw_error(resp.ctx,
|
|
232
250
|
fmt::format(R"(unable create the collection "{}.{}" on the bucket "{}")",
|
|
@@ -250,7 +268,8 @@ cb_Backend_collection_update(VALUE self,
|
|
|
250
268
|
VALUE scope_name,
|
|
251
269
|
VALUE collection_name,
|
|
252
270
|
VALUE settings,
|
|
253
|
-
VALUE options
|
|
271
|
+
VALUE options,
|
|
272
|
+
VALUE observability_handler)
|
|
254
273
|
{
|
|
255
274
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
256
275
|
|
|
@@ -293,6 +312,7 @@ cb_Backend_collection_update(VALUE self,
|
|
|
293
312
|
req.history = RTEST(history);
|
|
294
313
|
}
|
|
295
314
|
}
|
|
315
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
296
316
|
|
|
297
317
|
std::promise<core::operations::management::collection_update_response> promise;
|
|
298
318
|
auto f = promise.get_future();
|
|
@@ -300,6 +320,7 @@ cb_Backend_collection_update(VALUE self,
|
|
|
300
320
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
301
321
|
});
|
|
302
322
|
auto resp = cb_wait_for_future(f);
|
|
323
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
303
324
|
if (resp.ctx.ec) {
|
|
304
325
|
cb_throw_error(resp.ctx,
|
|
305
326
|
fmt::format(R"(unable update the collection "{}.{}" on the bucket "{}")",
|
|
@@ -322,7 +343,8 @@ cb_Backend_collection_drop(VALUE self,
|
|
|
322
343
|
VALUE bucket_name,
|
|
323
344
|
VALUE scope_name,
|
|
324
345
|
VALUE collection_name,
|
|
325
|
-
VALUE options
|
|
346
|
+
VALUE options,
|
|
347
|
+
VALUE observability_handler)
|
|
326
348
|
{
|
|
327
349
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
328
350
|
|
|
@@ -338,6 +360,7 @@ cb_Backend_collection_drop(VALUE self,
|
|
|
338
360
|
cb_string_new(scope_name),
|
|
339
361
|
cb_string_new(collection_name) };
|
|
340
362
|
cb_extract_timeout(req, options);
|
|
363
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
341
364
|
|
|
342
365
|
std::promise<core::operations::management::collection_drop_response> promise;
|
|
343
366
|
auto f = promise.get_future();
|
|
@@ -345,6 +368,7 @@ cb_Backend_collection_drop(VALUE self,
|
|
|
345
368
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
346
369
|
});
|
|
347
370
|
auto resp = cb_wait_for_future(f);
|
|
371
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
348
372
|
if (resp.ctx.ec) {
|
|
349
373
|
cb_throw_error(resp.ctx,
|
|
350
374
|
fmt::format(R"(unable to drop the collection "{}.{}" on the bucket "{}")",
|
|
@@ -367,11 +391,11 @@ cb_Backend_collection_drop(VALUE self,
|
|
|
367
391
|
void
|
|
368
392
|
init_collections(VALUE cBackend)
|
|
369
393
|
{
|
|
370
|
-
rb_define_method(cBackend, "scope_get_all", cb_Backend_scope_get_all,
|
|
371
|
-
rb_define_method(cBackend, "scope_create", cb_Backend_scope_create,
|
|
372
|
-
rb_define_method(cBackend, "scope_drop", cb_Backend_scope_drop,
|
|
373
|
-
rb_define_method(cBackend, "collection_create", cb_Backend_collection_create,
|
|
374
|
-
rb_define_method(cBackend, "collection_update", cb_Backend_collection_update,
|
|
375
|
-
rb_define_method(cBackend, "collection_drop", cb_Backend_collection_drop,
|
|
394
|
+
rb_define_method(cBackend, "scope_get_all", cb_Backend_scope_get_all, 3);
|
|
395
|
+
rb_define_method(cBackend, "scope_create", cb_Backend_scope_create, 4);
|
|
396
|
+
rb_define_method(cBackend, "scope_drop", cb_Backend_scope_drop, 4);
|
|
397
|
+
rb_define_method(cBackend, "collection_create", cb_Backend_collection_create, 6);
|
|
398
|
+
rb_define_method(cBackend, "collection_update", cb_Backend_collection_update, 6);
|
|
399
|
+
rb_define_method(cBackend, "collection_drop", cb_Backend_collection_drop, 5);
|
|
376
400
|
}
|
|
377
401
|
} // namespace couchbase::ruby
|