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
|
@@ -37,6 +37,7 @@ module Couchbase
|
|
|
37
37
|
@collection = collection
|
|
38
38
|
@options = options
|
|
39
39
|
@cas = 0
|
|
40
|
+
@observability = @collection.instance_variable_get(:@observability)
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
# Calls the given block once for each element in the set, passing that element as a parameter.
|
|
@@ -44,49 +45,58 @@ module Couchbase
|
|
|
44
45
|
# @yieldparam [Object] item
|
|
45
46
|
#
|
|
46
47
|
# @return [CouchbaseSet, Enumerable]
|
|
47
|
-
def each(&)
|
|
48
|
+
def each(parent_span: nil, &)
|
|
48
49
|
if block_given?
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
current =
|
|
51
|
+
@observability.record_operation(Observability::OP_SET_EACH, parent_span, self) do |obs_handler|
|
|
52
|
+
options = @options.get_options.clone
|
|
53
|
+
options.parent_span = obs_handler.op_span
|
|
54
|
+
result = @collection.get(@id, options)
|
|
55
|
+
@cas = result.cas
|
|
56
|
+
result.content
|
|
57
|
+
rescue Error::DocumentNotFound
|
|
58
|
+
@cas = 0
|
|
59
|
+
[]
|
|
60
|
+
end
|
|
57
61
|
current.each(&)
|
|
58
62
|
self
|
|
59
63
|
else
|
|
60
|
-
enum_for(:each)
|
|
64
|
+
enum_for(:each, parent_span: parent_span)
|
|
61
65
|
end
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
# @return [Integer] returns the number of elements in the set.
|
|
65
|
-
def length
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
def length(parent_span: nil)
|
|
70
|
+
@observability.record_operation(Observability::OP_SET_LENGTH, parent_span, self) do |obs_handler|
|
|
71
|
+
options = @options.lookup_in_options.clone
|
|
72
|
+
options.parent_span = obs_handler.op_span
|
|
73
|
+
result = @collection.lookup_in(@id, [
|
|
74
|
+
LookupInSpec.count(""),
|
|
75
|
+
], options)
|
|
76
|
+
result.content(0)
|
|
77
|
+
rescue Error::DocumentNotFound
|
|
78
|
+
0
|
|
79
|
+
end
|
|
72
80
|
end
|
|
73
81
|
|
|
74
82
|
alias size length
|
|
75
83
|
|
|
76
84
|
# @return [Boolean] returns true if set is empty
|
|
77
|
-
def empty?
|
|
78
|
-
size.zero?
|
|
85
|
+
def empty?(parent_span: nil)
|
|
86
|
+
size(parent_span: parent_span).zero?
|
|
79
87
|
end
|
|
80
88
|
|
|
81
89
|
# Adds the given value to the set
|
|
82
90
|
#
|
|
83
91
|
# @param [Object] obj
|
|
84
92
|
# @return [CouchbaseSet]
|
|
85
|
-
def add(obj)
|
|
86
|
-
|
|
93
|
+
def add(obj, parent_span: nil)
|
|
94
|
+
@observability.record_operation(Observability::OP_SET_ADD, parent_span, self) do |obs_handler|
|
|
95
|
+
options = @options.mutate_in_options.clone
|
|
96
|
+
options.parent_span = obs_handler.op_span
|
|
87
97
|
@collection.mutate_in(@id, [
|
|
88
98
|
MutateInSpec.array_add_unique("", obj),
|
|
89
|
-
],
|
|
99
|
+
], options)
|
|
90
100
|
rescue Error::PathExists
|
|
91
101
|
# ignore
|
|
92
102
|
end
|
|
@@ -94,31 +104,37 @@ module Couchbase
|
|
|
94
104
|
end
|
|
95
105
|
|
|
96
106
|
# Removes all elements from the set
|
|
97
|
-
def clear
|
|
98
|
-
@
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
def clear(parent_span: nil)
|
|
108
|
+
@observability.record_operation(Observability::OP_SET_CLEAR, parent_span, self) do |obs_handler|
|
|
109
|
+
options = @options.remove_options.clone
|
|
110
|
+
options.parent_span = obs_handler.op_span
|
|
111
|
+
@collection.remove(@id, options)
|
|
112
|
+
nil
|
|
113
|
+
rescue Error::DocumentNotFound
|
|
114
|
+
nil
|
|
115
|
+
end
|
|
102
116
|
end
|
|
103
117
|
|
|
104
118
|
# Deletes the given object from the set.
|
|
105
119
|
#
|
|
106
120
|
# @return [Boolean] true if the value has been removed
|
|
107
|
-
def delete(obj)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
121
|
+
def delete(obj, parent_span: nil)
|
|
122
|
+
@observability.record_operation(Observability::OP_SET_DELETE, parent_span, self) do |obs_handler|
|
|
123
|
+
result = @collection.get(@id, Options::Get.new(parent_span: obs_handler.op_span))
|
|
124
|
+
idx = result.content.index(obj)
|
|
125
|
+
return false unless idx
|
|
111
126
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
options = Options::MutateIn.new(parent_span: obs_handler.op_span)
|
|
128
|
+
options.cas = result.cas
|
|
129
|
+
@collection.mutate_in(@id, [
|
|
130
|
+
MutateInSpec.remove("[#{idx}]"),
|
|
131
|
+
], options)
|
|
132
|
+
true
|
|
133
|
+
rescue Error::CasMismatch
|
|
134
|
+
retry
|
|
135
|
+
rescue Error::DocumentNotFound
|
|
136
|
+
false
|
|
137
|
+
end
|
|
122
138
|
end
|
|
123
139
|
end
|
|
124
140
|
|
|
@@ -19,7 +19,7 @@ module Couchbase
|
|
|
19
19
|
def self.deprecate_constants(removed_in_version, parent, constants)
|
|
20
20
|
deprecator = Module.new do
|
|
21
21
|
define_method(:const_missing) do |old_name|
|
|
22
|
-
return super unless constants.key?(old_name)
|
|
22
|
+
return super(old_name) unless constants.key?(old_name)
|
|
23
23
|
|
|
24
24
|
new_name = constants[old_name]
|
|
25
25
|
|
|
@@ -47,7 +47,7 @@ module Couchbase
|
|
|
47
47
|
yield self if block_given?
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
def to_json(*
|
|
50
|
+
def to_json(*)
|
|
51
51
|
data = {
|
|
52
52
|
id: @id,
|
|
53
53
|
state: @state,
|
|
@@ -56,7 +56,7 @@ module Couchbase
|
|
|
56
56
|
}
|
|
57
57
|
data[:details] = @details if @details
|
|
58
58
|
data[:last_activity_us] = @last_activity_us if @last_activity_us
|
|
59
|
-
data.to_json(*
|
|
59
|
+
data.to_json(*)
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -88,13 +88,13 @@ module Couchbase
|
|
|
88
88
|
# @return [Integer] version
|
|
89
89
|
attr_accessor :version
|
|
90
90
|
|
|
91
|
-
def to_json(*
|
|
91
|
+
def to_json(*)
|
|
92
92
|
{
|
|
93
93
|
version: @version,
|
|
94
94
|
id: @id,
|
|
95
95
|
sdk: @sdk,
|
|
96
96
|
services: @services,
|
|
97
|
-
}.to_json(*
|
|
97
|
+
}.to_json(*)
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -130,7 +130,7 @@ module Couchbase
|
|
|
130
130
|
yield self if block_given?
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
def to_json(*
|
|
133
|
+
def to_json(*)
|
|
134
134
|
data = {
|
|
135
135
|
id: @id,
|
|
136
136
|
state: @state,
|
|
@@ -139,7 +139,7 @@ module Couchbase
|
|
|
139
139
|
latency: @latency,
|
|
140
140
|
}
|
|
141
141
|
data[:error] = @error if @error
|
|
142
|
-
data.to_json(*
|
|
142
|
+
data.to_json(*)
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
|
|
@@ -171,13 +171,13 @@ module Couchbase
|
|
|
171
171
|
# @return [Integer] version
|
|
172
172
|
attr_accessor :version
|
|
173
173
|
|
|
174
|
-
def to_json(*
|
|
174
|
+
def to_json(*)
|
|
175
175
|
{
|
|
176
176
|
version: @version,
|
|
177
177
|
id: @id,
|
|
178
178
|
sdk: @sdk,
|
|
179
179
|
services: @services,
|
|
180
|
-
}.to_json(*
|
|
180
|
+
}.to_json(*)
|
|
181
181
|
end
|
|
182
182
|
end
|
|
183
183
|
end
|
data/lib/couchbase/errors.rb
CHANGED
|
@@ -629,8 +629,9 @@ module Couchbase
|
|
|
629
629
|
alias inspect to_s
|
|
630
630
|
|
|
631
631
|
# @param [Couchbase::Backend] backend
|
|
632
|
-
def initialize(backend)
|
|
632
|
+
def initialize(backend, observability)
|
|
633
633
|
@backend = backend
|
|
634
|
+
@observability = observability
|
|
634
635
|
end
|
|
635
636
|
|
|
636
637
|
# Creates a new dataverse
|
|
@@ -643,7 +644,9 @@ module Couchbase
|
|
|
643
644
|
# @raise [ArgumentError]
|
|
644
645
|
# @raise [Error::DataverseExists]
|
|
645
646
|
def create_dataverse(dataverse_name, options = Options::Analytics::CreateDataverse.new)
|
|
646
|
-
@
|
|
647
|
+
@observability.record_operation(Observability::OP_AM_CREATE_DATAVERSE, options.parent_span, self, :analytics) do |obs_handler|
|
|
648
|
+
@backend.analytics_dataverse_create(dataverse_name, options.to_backend, obs_handler)
|
|
649
|
+
end
|
|
647
650
|
end
|
|
648
651
|
|
|
649
652
|
# Drops a dataverse
|
|
@@ -656,7 +659,9 @@ module Couchbase
|
|
|
656
659
|
# @raise [ArgumentError]
|
|
657
660
|
# @raise [Error::DataverseNotFound]
|
|
658
661
|
def drop_dataverse(dataverse_name, options = Options::Analytics::DropDataverse.new)
|
|
659
|
-
@
|
|
662
|
+
@observability.record_operation(Observability::OP_AM_DROP_DATAVERSE, options.parent_span, self, :analytics) do |obs_handler|
|
|
663
|
+
@backend.analytics_dataverse_drop(dataverse_name, options.to_backend, obs_handler)
|
|
664
|
+
end
|
|
660
665
|
end
|
|
661
666
|
|
|
662
667
|
# Creates a new dataset
|
|
@@ -671,7 +676,9 @@ module Couchbase
|
|
|
671
676
|
# @raise [Error::DatasetExists]
|
|
672
677
|
# @raise [Error::LinkNotFound]
|
|
673
678
|
def create_dataset(dataset_name, bucket_name, options = Options::Analytics::CreateDataset.new)
|
|
674
|
-
@
|
|
679
|
+
@observability.record_operation(Observability::OP_AM_CREATE_DATASET, options.parent_span, self, :analytics) do |_obs_handler|
|
|
680
|
+
@backend.analytics_dataset_create(dataset_name, bucket_name, options.to_backend)
|
|
681
|
+
end
|
|
675
682
|
end
|
|
676
683
|
|
|
677
684
|
# Drops a dataset
|
|
@@ -684,7 +691,9 @@ module Couchbase
|
|
|
684
691
|
# @raise [ArgumentError]
|
|
685
692
|
# @raise [Error::DatasetNotFound]
|
|
686
693
|
def drop_dataset(dataset_name, options = Options::Analytics::DropDataset.new)
|
|
687
|
-
@
|
|
694
|
+
@observability.record_operation(Observability::OP_AM_DROP_DATASET, options.parent_span, self, :analytics) do |obs_handler|
|
|
695
|
+
@backend.analytics_dataset_drop(dataset_name, options.to_backend, obs_handler)
|
|
696
|
+
end
|
|
688
697
|
end
|
|
689
698
|
|
|
690
699
|
# Gets all datasets
|
|
@@ -693,13 +702,15 @@ module Couchbase
|
|
|
693
702
|
#
|
|
694
703
|
# @return [Array<AnalyticsDataset>]
|
|
695
704
|
def get_all_datasets(options = Options::Analytics::GetAllDatasets.new)
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
705
|
+
@observability.record_operation(Observability::OP_AM_GET_ALL_DATASETS, options.parent_span, self, :analytics) do |obs_handler|
|
|
706
|
+
resp = @backend.analytics_dataset_get_all(options.to_backend, obs_handler)
|
|
707
|
+
resp.map do |entry|
|
|
708
|
+
AnalyticsDataset.new do |dataset|
|
|
709
|
+
dataset.name = entry[:name]
|
|
710
|
+
dataset.dataverse_name = entry[:dataverse_name]
|
|
711
|
+
dataset.link_name = entry[:link_name]
|
|
712
|
+
dataset.bucket_name = entry[:bucket_name]
|
|
713
|
+
end
|
|
703
714
|
end
|
|
704
715
|
end
|
|
705
716
|
end
|
|
@@ -716,7 +727,9 @@ module Couchbase
|
|
|
716
727
|
# @raise [ArgumentError]
|
|
717
728
|
# @raise [Error::IndexExists]
|
|
718
729
|
def create_index(index_name, dataset_name, fields, options = Options::Analytics::CreateIndex.new)
|
|
719
|
-
@
|
|
730
|
+
@observability.record_operation(Observability::OP_AM_CREATE_INDEX, options.parent_span, self, :analytics) do |obs_handler|
|
|
731
|
+
@backend.analytics_index_create(index_name, dataset_name, fields.entries, options.to_backend, obs_handler)
|
|
732
|
+
end
|
|
720
733
|
end
|
|
721
734
|
|
|
722
735
|
# Drops an index
|
|
@@ -730,7 +743,9 @@ module Couchbase
|
|
|
730
743
|
# @raise [ArgumentError]
|
|
731
744
|
# @raise [Error::IndexNotFound]
|
|
732
745
|
def drop_index(index_name, dataset_name, options = Options::Analytics::DropIndex.new)
|
|
733
|
-
@
|
|
746
|
+
@observability.record_operation(Observability::OP_AM_DROP_INDEX, options.parent_span, self, :analytics) do |obs_handler|
|
|
747
|
+
@backend.analytics_index_drop(index_name, dataset_name, options.to_backend, obs_handler)
|
|
748
|
+
end
|
|
734
749
|
end
|
|
735
750
|
|
|
736
751
|
# Gets all indexes
|
|
@@ -739,13 +754,15 @@ module Couchbase
|
|
|
739
754
|
#
|
|
740
755
|
# @return [Array<AnalyticsIndex>]
|
|
741
756
|
def get_all_indexes(options = Options::Analytics::GetAllIndexes.new)
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
757
|
+
@observability.record_operation(Observability::OP_AM_GET_ALL_INDEXES, options.parent_span, self, :analytics) do |obs_handler|
|
|
758
|
+
resp = @backend.analytics_index_get_all(options.to_backend, obs_handler)
|
|
759
|
+
resp.map do |entry|
|
|
760
|
+
AnalyticsIndex.new do |dataset|
|
|
761
|
+
dataset.name = entry[:name]
|
|
762
|
+
dataset.dataverse_name = entry[:dataverse_name]
|
|
763
|
+
dataset.dataset_name = entry[:dataset_name]
|
|
764
|
+
dataset.is_primary = entry[:is_primary]
|
|
765
|
+
end
|
|
749
766
|
end
|
|
750
767
|
end
|
|
751
768
|
end
|
|
@@ -759,7 +776,9 @@ module Couchbase
|
|
|
759
776
|
# @raise [ArgumentError]
|
|
760
777
|
# @raise [Error::LinkNotFound]
|
|
761
778
|
def connect_link(options = Options::Analytics::ConnectLink.new)
|
|
762
|
-
@
|
|
779
|
+
@observability.record_operation(Observability::OP_AM_CONNECT_LINK, options.parent_span, self, :analytics) do |obs_handler|
|
|
780
|
+
@backend.analytics_link_connect(options.to_backend, obs_handler)
|
|
781
|
+
end
|
|
763
782
|
end
|
|
764
783
|
|
|
765
784
|
# Disconnects a link,
|
|
@@ -771,7 +790,9 @@ module Couchbase
|
|
|
771
790
|
# @raise [ArgumentError]
|
|
772
791
|
# @raise [Error::LinkNotFound]
|
|
773
792
|
def disconnect_link(options = Options::Analytics::DisconnectLink.new)
|
|
774
|
-
@
|
|
793
|
+
@observability.record_operation(Observability::OP_AM_DISCONNECT_LINK, options.parent_span, self, :analytics) do |obs_handler|
|
|
794
|
+
@backend.analytics_link_disconnect(options.to_backend, obs_handler)
|
|
795
|
+
end
|
|
775
796
|
end
|
|
776
797
|
|
|
777
798
|
# Gets the pending mutations for all datasets.
|
|
@@ -784,7 +805,9 @@ module Couchbase
|
|
|
784
805
|
# @return [Hash<String => Integer>] dictionary, where keys are dataset coordinates encoded as +"dataverse.dataset"+
|
|
785
806
|
# and values are number of mutations for given dataset.
|
|
786
807
|
def get_pending_mutations(options = Options::Analytics::GetPendingMutations.new)
|
|
787
|
-
@
|
|
808
|
+
@observability.record_operation(Observability::OP_AM_GET_PENDING_MUTATIONS, options.parent_span, self, :analytics) do |obs_handler|
|
|
809
|
+
@backend.analytics_get_pending_mutations(options.to_backend, obs_handler)
|
|
810
|
+
end
|
|
788
811
|
end
|
|
789
812
|
|
|
790
813
|
# Creates a link
|
|
@@ -797,7 +820,9 @@ module Couchbase
|
|
|
797
820
|
# @raise [ArgumentError]
|
|
798
821
|
# @raise [Error::LinkExists]
|
|
799
822
|
def create_link(link, options = Options::Analytics::CreateLink.new)
|
|
800
|
-
@
|
|
823
|
+
@observability.record_operation(Observability::OP_AM_CREATE_LINK, options.parent_span, self, :analytics) do |obs_handler|
|
|
824
|
+
@backend.analytics_link_create(link.to_backend, options.to_backend, obs_handler)
|
|
825
|
+
end
|
|
801
826
|
end
|
|
802
827
|
|
|
803
828
|
# Replaces the link
|
|
@@ -810,7 +835,9 @@ module Couchbase
|
|
|
810
835
|
# @raise [ArgumentError]
|
|
811
836
|
# @raise [Error::LinkNotFound]
|
|
812
837
|
def replace_link(link, options = Options::Analytics::ReplaceLink.new)
|
|
813
|
-
@
|
|
838
|
+
@observability.record_operation(Observability::OP_AM_REPLACE_LINK, options.parent_span, self, :analytics) do |obs_handler|
|
|
839
|
+
@backend.analytics_link_replace(link.to_backend, options.to_backend, obs_handler)
|
|
840
|
+
end
|
|
814
841
|
end
|
|
815
842
|
|
|
816
843
|
# Drops the link
|
|
@@ -824,7 +851,9 @@ module Couchbase
|
|
|
824
851
|
# @raise [ArgumentError]
|
|
825
852
|
# @raise [Error::LinkNotFound]
|
|
826
853
|
def drop_link(link_name, dataverse_name, options = Options::Analytics::DropLink.new)
|
|
827
|
-
@
|
|
854
|
+
@observability.record_operation(Observability::OP_AM_DROP_LINK, options.parent_span, self, :analytics) do |obs_handler|
|
|
855
|
+
@backend.analytics_link_drop(link_name, dataverse_name, options.to_backend, obs_handler)
|
|
856
|
+
end
|
|
828
857
|
end
|
|
829
858
|
|
|
830
859
|
# Retrieves the links
|
|
@@ -836,38 +865,40 @@ module Couchbase
|
|
|
836
865
|
# @raise [ArgumentError]
|
|
837
866
|
# @raise [Error::LinkNotFound]
|
|
838
867
|
def get_links(options = Options::Analytics::GetLinks.new)
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
868
|
+
@observability.record_operation(Observability::OP_AM_GET_LINKS, options.parent_span, self, :analytics) do |obs_handler|
|
|
869
|
+
resp = @backend.analytics_link_get_all(options.to_backend, obs_handler)
|
|
870
|
+
resp.map do |entry|
|
|
871
|
+
case entry[:type]
|
|
872
|
+
when :s3
|
|
873
|
+
S3ExternalAnalyticsLink.new(
|
|
874
|
+
entry[:link_name],
|
|
875
|
+
entry[:dataverse],
|
|
876
|
+
entry[:access_key_id],
|
|
877
|
+
nil,
|
|
878
|
+
entry[:region],
|
|
879
|
+
service_endpoint: entry[:service_endpoint],
|
|
880
|
+
)
|
|
881
|
+
when :couchbase
|
|
882
|
+
CouchbaseRemoteAnalyticsLink.new(
|
|
883
|
+
entry[:link_name],
|
|
884
|
+
entry[:dataverse],
|
|
885
|
+
entry[:hostname],
|
|
886
|
+
username: entry[:username],
|
|
887
|
+
encryption: EncryptionSettings.new(
|
|
888
|
+
level: entry[:encryption_level],
|
|
889
|
+
certificate: entry[:certificate],
|
|
890
|
+
client_certificate: entry[:client_certificate],
|
|
891
|
+
),
|
|
892
|
+
)
|
|
893
|
+
when :azureblob
|
|
894
|
+
AzureBlobExternalAnalyticsLink.new(
|
|
895
|
+
entry[:link_name],
|
|
896
|
+
entry[:dataverse],
|
|
897
|
+
account_name: entry[:account_name],
|
|
898
|
+
blob_endpoint: entry[:blob_endpoint],
|
|
899
|
+
endpoint_suffix: entry[:endpoint_suffix],
|
|
900
|
+
)
|
|
901
|
+
end
|
|
871
902
|
end
|
|
872
903
|
end
|
|
873
904
|
end
|
|
@@ -190,8 +190,12 @@ module Couchbase
|
|
|
190
190
|
alias inspect to_s
|
|
191
191
|
|
|
192
192
|
# @param [Couchbase::Backend] backend
|
|
193
|
-
|
|
193
|
+
# @param [Couchbase::Observability::Wrapper] observability wrapper
|
|
194
|
+
#
|
|
195
|
+
# @api private
|
|
196
|
+
def initialize(backend, observability)
|
|
194
197
|
@backend = backend
|
|
198
|
+
@observability = observability
|
|
195
199
|
end
|
|
196
200
|
|
|
197
201
|
# Creates new bucket
|
|
@@ -204,26 +208,32 @@ module Couchbase
|
|
|
204
208
|
# @raise [ArgumentError]
|
|
205
209
|
# @raise [Error::BucketExists]
|
|
206
210
|
def create_bucket(settings, options = Options::Bucket::CreateBucket.new)
|
|
207
|
-
@
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
211
|
+
@observability.record_operation(Observability::OP_BM_CREATE_BUCKET, options.parent_span, self, :management) do |obs_handler|
|
|
212
|
+
obs_handler.add_bucket_name(settings.name)
|
|
213
|
+
|
|
214
|
+
@backend.bucket_create(
|
|
215
|
+
{
|
|
216
|
+
name: settings.name,
|
|
217
|
+
flush_enabled: settings.flush_enabled,
|
|
218
|
+
ram_quota_mb: settings.ram_quota_mb,
|
|
219
|
+
num_replicas: settings.num_replicas,
|
|
220
|
+
replica_indexes: settings.replica_indexes,
|
|
221
|
+
bucket_type: settings.bucket_type,
|
|
222
|
+
eviction_policy: settings.eviction_policy,
|
|
223
|
+
max_expiry: settings.max_expiry,
|
|
224
|
+
compression_mode: settings.compression_mode,
|
|
225
|
+
minimum_durability_level: settings.minimum_durability_level,
|
|
226
|
+
conflict_resolution_type: settings.conflict_resolution_type,
|
|
227
|
+
storage_backend: settings.storage_backend,
|
|
228
|
+
history_retention_collection_default: settings.history_retention_collection_default,
|
|
229
|
+
history_retention_duration: settings.history_retention_duration,
|
|
230
|
+
history_retention_bytes: settings.history_retention_bytes,
|
|
231
|
+
num_vbuckets: settings.num_vbuckets,
|
|
232
|
+
},
|
|
233
|
+
options.to_backend,
|
|
234
|
+
obs_handler,
|
|
235
|
+
)
|
|
236
|
+
end
|
|
227
237
|
end
|
|
228
238
|
|
|
229
239
|
# Updates the bucket settings
|
|
@@ -236,25 +246,31 @@ module Couchbase
|
|
|
236
246
|
# @raise [ArgumentError]
|
|
237
247
|
# @raise [Error::BucketNotFound]
|
|
238
248
|
def update_bucket(settings, options = Options::Bucket::UpdateBucket.new)
|
|
239
|
-
@
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
@observability.record_operation(Observability::OP_BM_UPDATE_BUCKET, options.parent_span, self, :management) do |obs_handler|
|
|
250
|
+
obs_handler.add_bucket_name(settings.name)
|
|
251
|
+
|
|
252
|
+
@backend.bucket_update(
|
|
253
|
+
{
|
|
254
|
+
name: settings.name,
|
|
255
|
+
flush_enabled: settings.flush_enabled,
|
|
256
|
+
ram_quota_mb: settings.ram_quota_mb,
|
|
257
|
+
num_replicas: settings.num_replicas,
|
|
258
|
+
replica_indexes: settings.replica_indexes,
|
|
259
|
+
bucket_type: settings.bucket_type,
|
|
260
|
+
eviction_policy: settings.eviction_policy,
|
|
261
|
+
max_expiry: settings.max_expiry,
|
|
262
|
+
compression_mode: settings.compression_mode,
|
|
263
|
+
minimum_durability_level: settings.minimum_durability_level,
|
|
264
|
+
storage_backend: settings.storage_backend,
|
|
265
|
+
history_retention_collection_default: settings.history_retention_collection_default,
|
|
266
|
+
history_retention_bytes: settings.history_retention_bytes,
|
|
267
|
+
history_retention_duration: settings.history_retention_duration,
|
|
268
|
+
num_vbuckets: settings.num_vbuckets,
|
|
269
|
+
},
|
|
270
|
+
options.to_backend,
|
|
271
|
+
obs_handler,
|
|
272
|
+
)
|
|
273
|
+
end
|
|
258
274
|
end
|
|
259
275
|
|
|
260
276
|
# Removes a bucket
|
|
@@ -267,7 +283,11 @@ module Couchbase
|
|
|
267
283
|
# @raise [ArgumentError]
|
|
268
284
|
# @raise [Error::BucketNotFound]
|
|
269
285
|
def drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new)
|
|
270
|
-
@
|
|
286
|
+
@observability.record_operation(Observability::OP_BM_DROP_BUCKET, options.parent_span, self, :management) do |obs_handler|
|
|
287
|
+
obs_handler.add_bucket_name(bucket_name)
|
|
288
|
+
|
|
289
|
+
@backend.bucket_drop(bucket_name, options.to_backend, obs_handler)
|
|
290
|
+
end
|
|
271
291
|
end
|
|
272
292
|
|
|
273
293
|
# Fetch settings of the bucket
|
|
@@ -280,7 +300,11 @@ module Couchbase
|
|
|
280
300
|
# @raise [ArgumentError]
|
|
281
301
|
# @raise [Error::BucketNotFound]
|
|
282
302
|
def get_bucket(bucket_name, options = Options::Bucket::GetBucket.new)
|
|
283
|
-
|
|
303
|
+
@observability.record_operation(Observability::OP_BM_GET_BUCKET, options.parent_span, self, :management) do |obs_handler|
|
|
304
|
+
obs_handler.add_bucket_name(bucket_name)
|
|
305
|
+
|
|
306
|
+
extract_bucket_settings(@backend.bucket_get(bucket_name, options.to_backend, obs_handler))
|
|
307
|
+
end
|
|
284
308
|
end
|
|
285
309
|
|
|
286
310
|
# Get settings for all buckets
|
|
@@ -288,8 +312,10 @@ module Couchbase
|
|
|
288
312
|
# @param [Options::Bucket::GetAllBuckets] options
|
|
289
313
|
# @return [Array<BucketSettings>]
|
|
290
314
|
def get_all_buckets(options = Options::Bucket::GetAllBuckets.new)
|
|
291
|
-
@
|
|
292
|
-
|
|
315
|
+
@observability.record_operation(Observability::OP_BM_GET_ALL_BUCKETS, options.parent_span, self, :management) do |obs_handler|
|
|
316
|
+
@backend.bucket_get_all(options.to_backend, obs_handler)
|
|
317
|
+
.map { |entry| extract_bucket_settings(entry) }
|
|
318
|
+
end
|
|
293
319
|
end
|
|
294
320
|
|
|
295
321
|
# @param [String] bucket_name name of the bucket
|
|
@@ -301,7 +327,9 @@ module Couchbase
|
|
|
301
327
|
# @raise [Error::BucketNotFound]
|
|
302
328
|
# @raise [Error::BucketNotFlushable]
|
|
303
329
|
def flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new)
|
|
304
|
-
@
|
|
330
|
+
@observability.record_operation(Observability::OP_BM_FLUSH_BUCKET, options.parent_span, self, :management) do |obs_handler|
|
|
331
|
+
@backend.bucket_flush(bucket_name, options.to_backend, obs_handler)
|
|
332
|
+
end
|
|
305
333
|
end
|
|
306
334
|
|
|
307
335
|
# @api private
|