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_utils.hxx
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
#include <couchbase/cas.hxx>
|
|
22
22
|
#include <couchbase/durability_level.hxx>
|
|
23
|
+
#include <couchbase/expiry.hxx>
|
|
23
24
|
#include <couchbase/persist_to.hxx>
|
|
24
25
|
#include <couchbase/read_preference.hxx>
|
|
25
26
|
#include <couchbase/replicate_to.hxx>
|
|
@@ -106,6 +107,9 @@ get_uint16_t(VALUE options, VALUE name);
|
|
|
106
107
|
std::optional<VALUE>
|
|
107
108
|
get_symbol(VALUE options, VALUE name);
|
|
108
109
|
|
|
110
|
+
std::optional<VALUE>
|
|
111
|
+
get_hash(VALUE options, VALUE name);
|
|
112
|
+
|
|
109
113
|
std::optional<std::string>
|
|
110
114
|
get_string(VALUE options, VALUE name);
|
|
111
115
|
} // namespace options
|
|
@@ -129,6 +133,43 @@ cb_extract_timeout(Request& req, VALUE options)
|
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
|
|
136
|
+
template<typename Request>
|
|
137
|
+
inline void
|
|
138
|
+
cb_extract_durability_level(Request& req, VALUE options)
|
|
139
|
+
{
|
|
140
|
+
if (NIL_P(options)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (TYPE(options) != T_HASH) {
|
|
145
|
+
throw ruby_exception(rb_eArgError,
|
|
146
|
+
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static VALUE property_name = rb_id2sym(rb_intern("durability_level"));
|
|
150
|
+
|
|
151
|
+
VALUE val = rb_hash_aref(options, property_name);
|
|
152
|
+
if (NIL_P(val)) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (TYPE(val) != T_SYMBOL) {
|
|
156
|
+
throw ruby_exception(
|
|
157
|
+
rb_eArgError, rb_sprintf("durability_level must be a Symbol, but given %+" PRIsVALUE, val));
|
|
158
|
+
}
|
|
159
|
+
if (ID level = rb_sym2id(val); level == rb_intern("none")) {
|
|
160
|
+
req.durability_level = couchbase::durability_level::none;
|
|
161
|
+
} else if (level == rb_intern("majority")) {
|
|
162
|
+
req.durability_level = couchbase::durability_level::majority;
|
|
163
|
+
} else if (level == rb_intern("majority_and_persist_to_active")) {
|
|
164
|
+
req.durability_level = couchbase::durability_level::majority_and_persist_to_active;
|
|
165
|
+
} else if (level == rb_intern("persist_to_majority")) {
|
|
166
|
+
req.durability_level = couchbase::durability_level::persist_to_majority;
|
|
167
|
+
} else {
|
|
168
|
+
throw ruby_exception(rb_eArgError,
|
|
169
|
+
rb_sprintf("unexpected durability_level, given %+" PRIsVALUE, val));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
132
173
|
template<typename Request>
|
|
133
174
|
inline void
|
|
134
175
|
cb_extract_read_preference(Request& req, VALUE options)
|
|
@@ -179,6 +220,26 @@ cb_extract_duration(Field& field, VALUE options, const char* name)
|
|
|
179
220
|
}
|
|
180
221
|
}
|
|
181
222
|
|
|
223
|
+
void
|
|
224
|
+
cb_extract_content(std::vector<std::byte>& field, VALUE content);
|
|
225
|
+
|
|
226
|
+
template<typename Request>
|
|
227
|
+
inline void
|
|
228
|
+
cb_extract_content(Request& req, VALUE options)
|
|
229
|
+
{
|
|
230
|
+
cb_extract_content(req.value, options);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
void
|
|
234
|
+
cb_extract_flags(std::uint32_t& field, VALUE flags);
|
|
235
|
+
|
|
236
|
+
template<typename Request>
|
|
237
|
+
inline void
|
|
238
|
+
cb_extract_flags(Request& req, VALUE options)
|
|
239
|
+
{
|
|
240
|
+
cb_extract_flags(req.flags, options);
|
|
241
|
+
}
|
|
242
|
+
|
|
182
243
|
void
|
|
183
244
|
cb_extract_timeout(std::chrono::milliseconds& field, VALUE options);
|
|
184
245
|
|
|
@@ -263,6 +324,41 @@ cb_extract_option_array(VALUE& val, VALUE options, const char* name);
|
|
|
263
324
|
void
|
|
264
325
|
cb_extract_cas(couchbase::cas& field, VALUE cas);
|
|
265
326
|
|
|
327
|
+
template<typename Request>
|
|
328
|
+
inline void
|
|
329
|
+
cb_extract_cas(Request& req, VALUE options)
|
|
330
|
+
{
|
|
331
|
+
if (NIL_P(options) || TYPE(options) != T_HASH) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
static VALUE property_name = rb_id2sym(rb_intern("cas"));
|
|
335
|
+
VALUE cas_value = rb_hash_aref(options, property_name);
|
|
336
|
+
if (NIL_P(cas_value)) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
cb_extract_cas(req.cas, cas_value);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
void
|
|
343
|
+
cb_extract_expiry(std::uint32_t& field, VALUE options);
|
|
344
|
+
|
|
345
|
+
void
|
|
346
|
+
cb_extract_expiry(std::optional<std::uint32_t>& field, VALUE options);
|
|
347
|
+
|
|
348
|
+
template<typename Request>
|
|
349
|
+
inline void
|
|
350
|
+
cb_extract_expiry(Request& req, VALUE options)
|
|
351
|
+
{
|
|
352
|
+
cb_extract_expiry(req.expiry, options);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
template<typename Request>
|
|
356
|
+
inline void
|
|
357
|
+
cb_extract_preserve_expiry(Request& req, VALUE options)
|
|
358
|
+
{
|
|
359
|
+
cb_extract_option_bool(req.preserve_expiry, options, "preserve_expiry");
|
|
360
|
+
}
|
|
361
|
+
|
|
266
362
|
VALUE
|
|
267
363
|
cb_cas_to_num(const couchbase::cas& cas);
|
|
268
364
|
|
|
@@ -272,6 +368,24 @@ cb_num_to_cas(VALUE num);
|
|
|
272
368
|
VALUE
|
|
273
369
|
to_cas_value(couchbase::cas cas);
|
|
274
370
|
|
|
371
|
+
template<typename Response>
|
|
372
|
+
inline VALUE
|
|
373
|
+
cb_create_mutation_result(Response resp)
|
|
374
|
+
{
|
|
375
|
+
VALUE res = rb_hash_new();
|
|
376
|
+
rb_hash_aset(res, rb_id2sym(rb_intern("cas")), to_cas_value(resp.cas));
|
|
377
|
+
|
|
378
|
+
VALUE token = rb_hash_new();
|
|
379
|
+
rb_hash_aset(token, rb_id2sym(rb_intern("partition_uuid")), ULL2NUM(resp.token.partition_uuid()));
|
|
380
|
+
rb_hash_aset(
|
|
381
|
+
token, rb_id2sym(rb_intern("sequence_number")), ULL2NUM(resp.token.sequence_number()));
|
|
382
|
+
rb_hash_aset(token, rb_id2sym(rb_intern("partition_id")), UINT2NUM(resp.token.partition_id()));
|
|
383
|
+
rb_hash_aset(token, rb_id2sym(rb_intern("bucket_name")), cb_str_new(resp.token.bucket_name()));
|
|
384
|
+
rb_hash_aset(res, rb_id2sym(rb_intern("mutation_token")), token);
|
|
385
|
+
|
|
386
|
+
return res;
|
|
387
|
+
}
|
|
388
|
+
|
|
275
389
|
template<typename Response>
|
|
276
390
|
inline VALUE
|
|
277
391
|
to_mutation_result_value(Response resp)
|
|
@@ -361,66 +475,6 @@ set_expiry(CommandOptions& opts, VALUE options)
|
|
|
361
475
|
}
|
|
362
476
|
}
|
|
363
477
|
|
|
364
|
-
template<typename CommandOptions>
|
|
365
|
-
inline void
|
|
366
|
-
set_access_deleted(CommandOptions& opts, VALUE options)
|
|
367
|
-
{
|
|
368
|
-
static VALUE property_name = rb_id2sym(rb_intern("access_deleted"));
|
|
369
|
-
if (!NIL_P(options)) {
|
|
370
|
-
if (TYPE(options) != T_HASH) {
|
|
371
|
-
throw ruby_exception(rb_eArgError,
|
|
372
|
-
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
373
|
-
}
|
|
374
|
-
VALUE val = rb_hash_aref(options, property_name);
|
|
375
|
-
if (NIL_P(val)) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
switch (TYPE(val)) {
|
|
379
|
-
case T_TRUE:
|
|
380
|
-
opts.access_deleted(true);
|
|
381
|
-
break;
|
|
382
|
-
case T_FALSE:
|
|
383
|
-
opts.access_deleted(false);
|
|
384
|
-
break;
|
|
385
|
-
|
|
386
|
-
default:
|
|
387
|
-
throw ruby_exception(
|
|
388
|
-
rb_eArgError,
|
|
389
|
-
rb_sprintf("access_deleted must be an Boolean, but given %+" PRIsVALUE, val));
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
template<typename CommandOptions>
|
|
395
|
-
inline void
|
|
396
|
-
set_create_as_deleted(CommandOptions& opts, VALUE options)
|
|
397
|
-
{
|
|
398
|
-
static VALUE property_name = rb_id2sym(rb_intern("create_as_deleted"));
|
|
399
|
-
if (!NIL_P(options)) {
|
|
400
|
-
if (TYPE(options) != T_HASH) {
|
|
401
|
-
throw ruby_exception(rb_eArgError,
|
|
402
|
-
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
403
|
-
}
|
|
404
|
-
VALUE val = rb_hash_aref(options, property_name);
|
|
405
|
-
if (NIL_P(val)) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
switch (TYPE(val)) {
|
|
409
|
-
case T_TRUE:
|
|
410
|
-
opts.create_as_deleted(true);
|
|
411
|
-
break;
|
|
412
|
-
case T_FALSE:
|
|
413
|
-
opts.create_as_deleted(false);
|
|
414
|
-
break;
|
|
415
|
-
|
|
416
|
-
default:
|
|
417
|
-
throw ruby_exception(
|
|
418
|
-
rb_eArgError,
|
|
419
|
-
rb_sprintf("create_as_deleted must be an Boolean, but given %+" PRIsVALUE, val));
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
478
|
template<typename CommandOptions>
|
|
425
479
|
inline void
|
|
426
480
|
set_preserve_expiry(CommandOptions& opts, VALUE options)
|
|
@@ -450,88 +504,6 @@ set_preserve_expiry(CommandOptions& opts, VALUE options)
|
|
|
450
504
|
}
|
|
451
505
|
}
|
|
452
506
|
|
|
453
|
-
template<typename CommandOptions>
|
|
454
|
-
inline void
|
|
455
|
-
set_cas(CommandOptions& opts, VALUE options)
|
|
456
|
-
{
|
|
457
|
-
static VALUE property_name = rb_id2sym(rb_intern("cas"));
|
|
458
|
-
if (!NIL_P(options)) {
|
|
459
|
-
if (TYPE(options) != T_HASH) {
|
|
460
|
-
throw ruby_exception(rb_eArgError,
|
|
461
|
-
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
462
|
-
}
|
|
463
|
-
VALUE val = rb_hash_aref(options, property_name);
|
|
464
|
-
if (NIL_P(val)) {
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
switch (TYPE(val)) {
|
|
468
|
-
case T_FIXNUM:
|
|
469
|
-
case T_BIGNUM:
|
|
470
|
-
opts.cas(couchbase::cas{ static_cast<std::uint64_t>(NUM2ULL(val)) });
|
|
471
|
-
break;
|
|
472
|
-
|
|
473
|
-
default:
|
|
474
|
-
throw ruby_exception(rb_eArgError,
|
|
475
|
-
rb_sprintf("cas must be an Integer, but given %+" PRIsVALUE, val));
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
template<typename CommandOptions>
|
|
481
|
-
inline void
|
|
482
|
-
set_delta(CommandOptions& opts, VALUE options)
|
|
483
|
-
{
|
|
484
|
-
static VALUE property_name = rb_id2sym(rb_intern("delta"));
|
|
485
|
-
if (!NIL_P(options)) {
|
|
486
|
-
if (TYPE(options) != T_HASH) {
|
|
487
|
-
throw ruby_exception(rb_eArgError,
|
|
488
|
-
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
489
|
-
}
|
|
490
|
-
VALUE val = rb_hash_aref(options, property_name);
|
|
491
|
-
if (NIL_P(val)) {
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
switch (TYPE(val)) {
|
|
495
|
-
case T_FIXNUM:
|
|
496
|
-
case T_BIGNUM:
|
|
497
|
-
opts.delta(NUM2ULL(val));
|
|
498
|
-
break;
|
|
499
|
-
|
|
500
|
-
default:
|
|
501
|
-
throw ruby_exception(rb_eArgError,
|
|
502
|
-
rb_sprintf("delta must be an Integer, but given %+" PRIsVALUE, val));
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
template<typename CommandOptions>
|
|
508
|
-
inline void
|
|
509
|
-
set_initial_value(CommandOptions& opts, VALUE options)
|
|
510
|
-
{
|
|
511
|
-
static VALUE property_name = rb_id2sym(rb_intern("initial_value"));
|
|
512
|
-
if (!NIL_P(options)) {
|
|
513
|
-
if (TYPE(options) != T_HASH) {
|
|
514
|
-
throw ruby_exception(rb_eArgError,
|
|
515
|
-
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
516
|
-
}
|
|
517
|
-
VALUE val = rb_hash_aref(options, property_name);
|
|
518
|
-
if (NIL_P(val)) {
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
switch (TYPE(val)) {
|
|
522
|
-
case T_FIXNUM:
|
|
523
|
-
case T_BIGNUM:
|
|
524
|
-
opts.initial(NUM2ULL(val));
|
|
525
|
-
break;
|
|
526
|
-
|
|
527
|
-
default:
|
|
528
|
-
throw ruby_exception(
|
|
529
|
-
rb_eArgError,
|
|
530
|
-
rb_sprintf("initial_value must be an Integer, but given %+" PRIsVALUE, val));
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
507
|
std::optional<couchbase::durability_level>
|
|
536
508
|
extract_durability_level(VALUE options);
|
|
537
509
|
|
|
@@ -558,39 +530,40 @@ set_durability(CommandOptions& opts, VALUE options)
|
|
|
558
530
|
}
|
|
559
531
|
}
|
|
560
532
|
|
|
561
|
-
template<typename
|
|
533
|
+
template<typename Request>
|
|
562
534
|
inline void
|
|
563
|
-
|
|
535
|
+
cb_extract_store_semantics(Request& req, VALUE options)
|
|
564
536
|
{
|
|
565
537
|
static VALUE property_name = rb_id2sym(rb_intern("store_semantics"));
|
|
566
|
-
if (!NIL_P(options)) {
|
|
567
|
-
if (TYPE(options) != T_HASH) {
|
|
568
|
-
throw ruby_exception(rb_eArgError,
|
|
569
|
-
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
570
|
-
}
|
|
571
538
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
}
|
|
539
|
+
if (NIL_P(options)) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (TYPE(options) != T_HASH) {
|
|
543
|
+
throw ruby_exception(rb_eArgError,
|
|
544
|
+
rb_sprintf("expected options to be Hash, given %+" PRIsVALUE, options));
|
|
545
|
+
}
|
|
580
546
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
throw ruby_exception(rb_eArgError,
|
|
589
|
-
rb_sprintf("unexpected store_semantics, given %+" PRIsVALUE, val));
|
|
590
|
-
}
|
|
547
|
+
VALUE val = rb_hash_aref(options, property_name);
|
|
548
|
+
if (NIL_P(val)) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (TYPE(val) != T_SYMBOL) {
|
|
552
|
+
throw ruby_exception(
|
|
553
|
+
rb_eArgError, rb_sprintf("store_semantics must be a Symbol, but given %+" PRIsVALUE, val));
|
|
591
554
|
}
|
|
592
|
-
}
|
|
593
555
|
|
|
556
|
+
if (ID mode = rb_sym2id(val); mode == rb_intern("replace")) {
|
|
557
|
+
req.store_semantics = couchbase::store_semantics::replace;
|
|
558
|
+
} else if (mode == rb_intern("insert")) {
|
|
559
|
+
req.store_semantics = couchbase::store_semantics::insert;
|
|
560
|
+
} else if (mode == rb_intern("upsert")) {
|
|
561
|
+
req.store_semantics = couchbase::store_semantics::upsert;
|
|
562
|
+
} else {
|
|
563
|
+
throw ruby_exception(rb_eArgError,
|
|
564
|
+
rb_sprintf("unexpected store_semantics, given %+" PRIsVALUE, val));
|
|
565
|
+
}
|
|
566
|
+
}
|
|
594
567
|
} // namespace couchbase::ruby
|
|
595
568
|
|
|
596
569
|
#endif
|
data/ext/rcb_views.cxx
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#define COUCHBASE_CXX_CLIENT_IGNORE_CORE_DEPRECATIONS
|
|
18
19
|
#include <core/cluster.hxx>
|
|
19
20
|
#include <core/design_document_namespace_fmt.hxx>
|
|
20
21
|
#include <core/operations/document_view.hxx>
|
|
@@ -22,12 +23,14 @@
|
|
|
22
23
|
#include <core/operations/management/view_index_get.hxx>
|
|
23
24
|
#include <core/operations/management/view_index_get_all.hxx>
|
|
24
25
|
#include <core/operations/management/view_index_upsert.hxx>
|
|
26
|
+
#undef COUCHBASE_CXX_CLIENT_IGNORE_CORE_DEPRECATIONS
|
|
25
27
|
|
|
26
28
|
#include <future>
|
|
27
29
|
|
|
28
30
|
#include <ruby.h>
|
|
29
31
|
|
|
30
32
|
#include "rcb_backend.hxx"
|
|
33
|
+
#include "rcb_observability.hxx"
|
|
31
34
|
#include "rcb_utils.hxx"
|
|
32
35
|
|
|
33
36
|
namespace couchbase::ruby
|
|
@@ -35,7 +38,11 @@ namespace couchbase::ruby
|
|
|
35
38
|
namespace
|
|
36
39
|
{
|
|
37
40
|
VALUE
|
|
38
|
-
cb_Backend_view_index_get_all(VALUE self,
|
|
41
|
+
cb_Backend_view_index_get_all(VALUE self,
|
|
42
|
+
VALUE bucket_name,
|
|
43
|
+
VALUE name_space,
|
|
44
|
+
VALUE timeout,
|
|
45
|
+
VALUE observability_handler)
|
|
39
46
|
{
|
|
40
47
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
41
48
|
|
|
@@ -57,12 +64,14 @@ cb_Backend_view_index_get_all(VALUE self, VALUE bucket_name, VALUE name_space, V
|
|
|
57
64
|
req.bucket_name = cb_string_new(bucket_name);
|
|
58
65
|
req.ns = ns;
|
|
59
66
|
cb_extract_timeout(req, timeout);
|
|
67
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
60
68
|
std::promise<core::operations::management::view_index_get_all_response> promise;
|
|
61
69
|
auto f = promise.get_future();
|
|
62
70
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
63
71
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
64
72
|
});
|
|
65
73
|
auto resp = cb_wait_for_future(f);
|
|
74
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
66
75
|
if (resp.ctx.ec) {
|
|
67
76
|
cb_throw_error(resp.ctx, "unable to get list of the design documents");
|
|
68
77
|
}
|
|
@@ -110,7 +119,8 @@ cb_Backend_view_index_get(VALUE self,
|
|
|
110
119
|
VALUE bucket_name,
|
|
111
120
|
VALUE document_name,
|
|
112
121
|
VALUE name_space,
|
|
113
|
-
VALUE timeout
|
|
122
|
+
VALUE timeout,
|
|
123
|
+
VALUE observability_handler)
|
|
114
124
|
{
|
|
115
125
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
116
126
|
|
|
@@ -134,12 +144,14 @@ cb_Backend_view_index_get(VALUE self,
|
|
|
134
144
|
req.document_name = cb_string_new(document_name);
|
|
135
145
|
req.ns = ns;
|
|
136
146
|
cb_extract_timeout(req, timeout);
|
|
147
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
137
148
|
std::promise<core::operations::management::view_index_get_response> promise;
|
|
138
149
|
auto f = promise.get_future();
|
|
139
150
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
140
151
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
141
152
|
});
|
|
142
153
|
auto resp = cb_wait_for_future(f);
|
|
154
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
143
155
|
if (resp.ctx.ec) {
|
|
144
156
|
cb_throw_error(resp.ctx,
|
|
145
157
|
fmt::format(R"(unable to get design document "{}" ({}) on bucket "{}")",
|
|
@@ -187,7 +199,8 @@ cb_Backend_view_index_drop(VALUE self,
|
|
|
187
199
|
VALUE bucket_name,
|
|
188
200
|
VALUE document_name,
|
|
189
201
|
VALUE name_space,
|
|
190
|
-
VALUE timeout
|
|
202
|
+
VALUE timeout,
|
|
203
|
+
VALUE observability_handler)
|
|
191
204
|
{
|
|
192
205
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
193
206
|
|
|
@@ -211,13 +224,16 @@ cb_Backend_view_index_drop(VALUE self,
|
|
|
211
224
|
req.document_name = cb_string_new(document_name);
|
|
212
225
|
req.ns = ns;
|
|
213
226
|
cb_extract_timeout(req, timeout);
|
|
227
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
214
228
|
std::promise<core::operations::management::view_index_drop_response> promise;
|
|
215
229
|
auto f = promise.get_future();
|
|
216
230
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
217
231
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
218
232
|
});
|
|
219
233
|
|
|
220
|
-
|
|
234
|
+
auto resp = cb_wait_for_future(f);
|
|
235
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
236
|
+
if (resp.ctx.ec) {
|
|
221
237
|
cb_throw_error(resp.ctx,
|
|
222
238
|
fmt::format(R"(unable to drop design document "{}" ({}) on bucket "{}")",
|
|
223
239
|
req.document_name,
|
|
@@ -239,7 +255,8 @@ cb_Backend_view_index_upsert(VALUE self,
|
|
|
239
255
|
VALUE bucket_name,
|
|
240
256
|
VALUE document,
|
|
241
257
|
VALUE name_space,
|
|
242
|
-
VALUE timeout
|
|
258
|
+
VALUE timeout,
|
|
259
|
+
VALUE observability_handler)
|
|
243
260
|
{
|
|
244
261
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
245
262
|
|
|
@@ -287,13 +304,16 @@ cb_Backend_view_index_upsert(VALUE self,
|
|
|
287
304
|
}
|
|
288
305
|
|
|
289
306
|
cb_extract_timeout(req, timeout);
|
|
307
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
290
308
|
std::promise<core::operations::management::view_index_upsert_response> promise;
|
|
291
309
|
auto f = promise.get_future();
|
|
292
310
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
293
311
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
294
312
|
});
|
|
295
313
|
|
|
296
|
-
|
|
314
|
+
auto resp = cb_wait_for_future(f);
|
|
315
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
316
|
+
if (resp.ctx.ec) {
|
|
297
317
|
cb_throw_error(resp.ctx,
|
|
298
318
|
fmt::format(R"(unable to store design document "{}" ({}) on bucket "{}")",
|
|
299
319
|
req.document.name,
|
|
@@ -316,7 +336,8 @@ cb_Backend_document_view(VALUE self,
|
|
|
316
336
|
VALUE design_document_name,
|
|
317
337
|
VALUE view_name,
|
|
318
338
|
VALUE name_space,
|
|
319
|
-
VALUE options
|
|
339
|
+
VALUE options,
|
|
340
|
+
VALUE observability_handler)
|
|
320
341
|
{
|
|
321
342
|
auto cluster = cb_backend_to_core_api_cluster(self);
|
|
322
343
|
|
|
@@ -420,12 +441,15 @@ cb_Backend_document_view(VALUE self,
|
|
|
420
441
|
}
|
|
421
442
|
}
|
|
422
443
|
|
|
444
|
+
auto parent_span = cb_create_parent_span(req, self);
|
|
445
|
+
|
|
423
446
|
std::promise<core::operations::document_view_response> promise;
|
|
424
447
|
auto f = promise.get_future();
|
|
425
448
|
cluster.execute(req, [promise = std::move(promise)](auto&& resp) mutable {
|
|
426
449
|
promise.set_value(std::forward<decltype(resp)>(resp));
|
|
427
450
|
});
|
|
428
451
|
auto resp = cb_wait_for_future(f);
|
|
452
|
+
cb_add_core_spans(observability_handler, std::move(parent_span), resp.ctx.retry_attempts);
|
|
429
453
|
if (resp.ctx.ec) {
|
|
430
454
|
if (resp.error) {
|
|
431
455
|
cb_throw_error(resp.ctx,
|
|
@@ -475,11 +499,11 @@ cb_Backend_document_view(VALUE self,
|
|
|
475
499
|
void
|
|
476
500
|
init_views(VALUE cBackend)
|
|
477
501
|
{
|
|
478
|
-
rb_define_method(cBackend, "document_view", cb_Backend_document_view,
|
|
502
|
+
rb_define_method(cBackend, "document_view", cb_Backend_document_view, 6);
|
|
479
503
|
|
|
480
|
-
rb_define_method(cBackend, "view_index_get_all", cb_Backend_view_index_get_all,
|
|
481
|
-
rb_define_method(cBackend, "view_index_get", cb_Backend_view_index_get,
|
|
482
|
-
rb_define_method(cBackend, "view_index_drop", cb_Backend_view_index_drop,
|
|
483
|
-
rb_define_method(cBackend, "view_index_upsert", cb_Backend_view_index_upsert,
|
|
504
|
+
rb_define_method(cBackend, "view_index_get_all", cb_Backend_view_index_get_all, 4);
|
|
505
|
+
rb_define_method(cBackend, "view_index_get", cb_Backend_view_index_get, 5);
|
|
506
|
+
rb_define_method(cBackend, "view_index_drop", cb_Backend_view_index_drop, 5);
|
|
507
|
+
rb_define_method(cBackend, "view_index_upsert", cb_Backend_view_index_upsert, 5);
|
|
484
508
|
}
|
|
485
509
|
} // namespace couchbase::ruby
|
|
@@ -180,11 +180,11 @@ module ActiveSupport
|
|
|
180
180
|
end
|
|
181
181
|
end
|
|
182
182
|
|
|
183
|
-
def serialize_entry(entry, raw: false, **
|
|
183
|
+
def serialize_entry(entry, raw: false, **)
|
|
184
184
|
if raw
|
|
185
185
|
entry.value.to_s
|
|
186
186
|
else
|
|
187
|
-
super(entry, **
|
|
187
|
+
super(entry, **)
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
@@ -195,8 +195,8 @@ module ActiveSupport
|
|
|
195
195
|
end
|
|
196
196
|
|
|
197
197
|
# Reads an entry from the cache
|
|
198
|
-
def read_entry(key, **
|
|
199
|
-
deserialize_entry(read_serialized_entry(key, **
|
|
198
|
+
def read_entry(key, **)
|
|
199
|
+
deserialize_entry(read_serialized_entry(key, **), **)
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
def read_serialized_entry(key, **)
|
|
@@ -228,8 +228,8 @@ module ActiveSupport
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
# Writes an entry to the cache
|
|
231
|
-
def write_entry(key, entry, raw: false, **
|
|
232
|
-
write_serialized_entry(key, serialize_entry(entry, raw: raw, **
|
|
231
|
+
def write_entry(key, entry, raw: false, **)
|
|
232
|
+
write_serialized_entry(key, serialize_entry(entry, raw: raw, **), raw: raw, **)
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
def write_serialized_entry(key, payload, expires_in: nil, race_condition_ttl: nil, raw: false, **)
|
|
@@ -63,4 +63,18 @@ module Couchbase
|
|
|
63
63
|
@key_path = key_path
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
|
+
|
|
67
|
+
# Authenticator using a JSON Web Token (JWT)
|
|
68
|
+
#
|
|
69
|
+
# @!macro uncommitted
|
|
70
|
+
class JWTAuthenticator
|
|
71
|
+
attr_accessor :token
|
|
72
|
+
|
|
73
|
+
# Creates a new authenticator with a JSON Web Token (JWT)
|
|
74
|
+
#
|
|
75
|
+
# @param [String] token the JWT
|
|
76
|
+
def initialize(token)
|
|
77
|
+
@token = token
|
|
78
|
+
end
|
|
79
|
+
end
|
|
66
80
|
end
|