couchbase 3.1.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/CMakeLists.txt +3 -1
- data/ext/build_version.hxx.in +1 -1
- data/ext/cmake/Testing.cmake +1 -0
- data/ext/cmake/ThirdPartyDependencies.cmake +6 -0
- data/ext/cmake/VersionInfo.cmake +3 -0
- data/ext/couchbase/bucket.hxx +47 -28
- data/ext/couchbase/cbsasl/client.h +1 -1
- data/ext/couchbase/cbsasl/context.cc +1 -1
- data/ext/couchbase/cbsasl/context.h +3 -3
- data/ext/couchbase/cbsasl/mechanism.cc +5 -8
- data/ext/couchbase/cbsasl/mechanism.h +1 -4
- data/ext/couchbase/cbsasl/plain/plain.cc +1 -1
- data/ext/couchbase/cbsasl/scram-sha/scram-sha.cc +30 -36
- data/ext/couchbase/cluster.hxx +40 -22
- data/ext/couchbase/cluster_options.hxx +7 -1
- data/ext/couchbase/configuration.hxx +37 -16
- data/ext/couchbase/couchbase.cxx +1145 -291
- data/ext/couchbase/error_map.hxx +1 -1
- data/ext/couchbase/errors.hxx +25 -17
- data/ext/couchbase/io/dns_client.hxx +3 -3
- data/ext/couchbase/io/dns_codec.hxx +4 -5
- data/ext/couchbase/io/dns_config.hxx +5 -6
- data/ext/couchbase/io/dns_message.hxx +3 -3
- data/ext/couchbase/io/http_command.hxx +70 -35
- data/ext/couchbase/io/http_session.hxx +4 -3
- data/ext/couchbase/io/http_session_manager.hxx +28 -19
- data/ext/couchbase/io/mcbp_command.hxx +51 -19
- data/ext/couchbase/io/mcbp_context.hxx +1 -1
- data/ext/couchbase/io/mcbp_parser.hxx +4 -4
- data/ext/couchbase/io/mcbp_session.hxx +91 -101
- data/ext/couchbase/io/query_cache.hxx +2 -2
- data/ext/couchbase/io/retry_orchestrator.hxx +2 -4
- data/ext/couchbase/io/retry_reason.hxx +2 -2
- data/ext/couchbase/io/retry_strategy.hxx +1 -6
- data/ext/couchbase/io/streams.hxx +7 -7
- data/ext/couchbase/metrics/logging_meter.hxx +228 -0
- data/ext/couchbase/metrics/logging_meter_options.hxx +28 -0
- data/ext/couchbase/metrics/meter.hxx +49 -0
- data/ext/couchbase/metrics/noop_meter.hxx +43 -0
- data/ext/couchbase/operations/analytics_dataset_create.hxx +16 -12
- data/ext/couchbase/operations/analytics_dataset_drop.hxx +11 -11
- data/ext/couchbase/operations/analytics_dataset_get_all.hxx +6 -6
- data/ext/couchbase/operations/analytics_dataverse_create.hxx +10 -11
- data/ext/couchbase/operations/analytics_dataverse_drop.hxx +10 -11
- data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +9 -11
- data/ext/couchbase/operations/analytics_index_create.hxx +14 -13
- data/ext/couchbase/operations/analytics_index_drop.hxx +18 -12
- data/ext/couchbase/operations/analytics_index_get_all.hxx +8 -6
- data/ext/couchbase/operations/analytics_link.hxx +39 -0
- data/ext/couchbase/operations/analytics_link_azure_blob_external.hxx +145 -0
- data/ext/couchbase/operations/analytics_link_connect.hxx +14 -12
- data/ext/couchbase/operations/analytics_link_couchbase_remote.hxx +220 -0
- data/ext/couchbase/operations/analytics_link_create.hxx +128 -0
- data/ext/couchbase/operations/analytics_link_disconnect.hxx +11 -12
- data/ext/couchbase/operations/analytics_link_drop.hxx +130 -0
- data/ext/couchbase/operations/analytics_link_get_all.hxx +160 -0
- data/ext/couchbase/operations/analytics_link_replace.hxx +128 -0
- data/ext/couchbase/operations/analytics_link_s3_external.hxx +122 -0
- data/ext/couchbase/operations/bucket_create.hxx +8 -8
- data/ext/couchbase/operations/bucket_drop.hxx +5 -5
- data/ext/couchbase/operations/bucket_flush.hxx +5 -5
- data/ext/couchbase/operations/bucket_get.hxx +7 -7
- data/ext/couchbase/operations/bucket_get_all.hxx +7 -5
- data/ext/couchbase/operations/bucket_settings.hxx +40 -49
- data/ext/couchbase/operations/bucket_update.hxx +8 -8
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +7 -7
- data/ext/couchbase/operations/collection_create.hxx +11 -11
- data/ext/couchbase/operations/collection_drop.hxx +12 -10
- data/ext/couchbase/operations/collections_manifest_get.hxx +3 -3
- data/ext/couchbase/operations/design_document.hxx +2 -2
- data/ext/couchbase/operations/document_analytics.hxx +29 -36
- data/ext/couchbase/operations/document_append.hxx +3 -3
- data/ext/couchbase/operations/document_decrement.hxx +3 -3
- data/ext/couchbase/operations/document_exists.hxx +2 -2
- data/ext/couchbase/operations/document_get.hxx +3 -3
- data/ext/couchbase/operations/document_get_and_lock.hxx +5 -3
- data/ext/couchbase/operations/document_get_and_touch.hxx +5 -3
- data/ext/couchbase/operations/document_get_projected.hxx +10 -11
- data/ext/couchbase/operations/document_increment.hxx +3 -3
- data/ext/couchbase/operations/document_insert.hxx +3 -3
- data/ext/couchbase/operations/document_lookup_in.hxx +12 -18
- data/ext/couchbase/operations/document_mutate_in.hxx +13 -18
- data/ext/couchbase/operations/document_prepend.hxx +3 -3
- data/ext/couchbase/operations/document_query.hxx +39 -41
- data/ext/couchbase/operations/document_remove.hxx +3 -3
- data/ext/couchbase/operations/document_replace.hxx +3 -3
- data/ext/couchbase/operations/document_search.hxx +56 -61
- data/ext/couchbase/operations/document_touch.hxx +3 -3
- data/ext/couchbase/operations/document_unlock.hxx +3 -3
- data/ext/couchbase/operations/document_upsert.hxx +3 -3
- data/ext/couchbase/operations/document_view.hxx +23 -23
- data/ext/couchbase/operations/group_drop.hxx +5 -5
- data/ext/couchbase/operations/group_get.hxx +7 -7
- data/ext/couchbase/operations/group_get_all.hxx +6 -6
- data/ext/couchbase/operations/group_upsert.hxx +11 -11
- data/ext/couchbase/operations/http_noop.hxx +6 -6
- data/ext/couchbase/operations/mcbp_noop.hxx +3 -3
- data/ext/couchbase/operations/query_index_build_deferred.hxx +6 -6
- data/ext/couchbase/operations/query_index_create.hxx +10 -8
- data/ext/couchbase/operations/query_index_drop.hxx +8 -8
- data/ext/couchbase/operations/query_index_get_all.hxx +43 -39
- data/ext/couchbase/operations/rbac.hxx +40 -63
- data/ext/couchbase/operations/role_get_all.hxx +6 -6
- data/ext/couchbase/operations/scope_create.hxx +10 -10
- data/ext/couchbase/operations/scope_drop.hxx +9 -9
- data/ext/couchbase/operations/scope_get_all.hxx +8 -8
- data/ext/couchbase/operations/search_get_stats.hxx +5 -3
- data/ext/couchbase/operations/search_index.hxx +6 -15
- data/ext/couchbase/operations/search_index_analyze_document.hxx +11 -11
- data/ext/couchbase/operations/search_index_control_ingest.hxx +9 -9
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +9 -9
- data/ext/couchbase/operations/search_index_control_query.hxx +9 -9
- data/ext/couchbase/operations/search_index_drop.hxx +11 -9
- data/ext/couchbase/operations/search_index_get.hxx +11 -9
- data/ext/couchbase/operations/search_index_get_all.hxx +11 -11
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +10 -10
- data/ext/couchbase/operations/search_index_get_stats.hxx +10 -8
- data/ext/couchbase/operations/search_index_upsert.hxx +12 -10
- data/ext/couchbase/operations/user_drop.hxx +5 -5
- data/ext/couchbase/operations/user_get.hxx +7 -7
- data/ext/couchbase/operations/user_get_all.hxx +6 -6
- data/ext/couchbase/operations/user_upsert.hxx +9 -9
- data/ext/couchbase/operations/view_index_drop.hxx +10 -10
- data/ext/couchbase/operations/view_index_get.hxx +13 -15
- data/ext/couchbase/operations/view_index_get_all.hxx +17 -20
- data/ext/couchbase/operations/view_index_upsert.hxx +9 -7
- data/ext/couchbase/operations.hxx +4 -0
- data/ext/couchbase/origin.hxx +14 -10
- data/ext/couchbase/platform/backtrace.c +1 -1
- data/ext/couchbase/platform/base64.cc +5 -5
- data/ext/couchbase/platform/base64.h +2 -5
- data/ext/couchbase/protocol/client_opcode.hxx +7 -4
- data/ext/couchbase/protocol/client_request.hxx +2 -2
- data/ext/couchbase/protocol/client_response.hxx +41 -16
- data/ext/couchbase/protocol/cmd_append.hxx +17 -16
- data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +4 -4
- data/ext/couchbase/protocol/cmd_decrement.hxx +10 -11
- data/ext/couchbase/protocol/cmd_exists.hxx +12 -15
- data/ext/couchbase/protocol/cmd_get.hxx +11 -14
- data/ext/couchbase/protocol/cmd_get_and_lock.hxx +10 -12
- data/ext/couchbase/protocol/cmd_get_and_touch.hxx +10 -12
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +13 -18
- data/ext/couchbase/protocol/cmd_get_collection_id.hxx +12 -15
- data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +12 -16
- data/ext/couchbase/protocol/cmd_get_error_map.hxx +14 -17
- data/ext/couchbase/protocol/cmd_hello.hxx +8 -10
- data/ext/couchbase/protocol/cmd_increment.hxx +9 -10
- data/ext/couchbase/protocol/cmd_insert.hxx +9 -9
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +12 -13
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +11 -11
- data/ext/couchbase/protocol/cmd_noop.hxx +16 -20
- data/ext/couchbase/protocol/cmd_prepend.hxx +9 -10
- data/ext/couchbase/protocol/cmd_remove.hxx +10 -13
- data/ext/couchbase/protocol/cmd_replace.hxx +7 -7
- data/ext/couchbase/protocol/cmd_sasl_auth.hxx +8 -10
- data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +10 -15
- data/ext/couchbase/protocol/cmd_sasl_step.hxx +10 -12
- data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -18
- data/ext/couchbase/protocol/cmd_touch.hxx +8 -11
- data/ext/couchbase/protocol/cmd_unlock.hxx +10 -14
- data/ext/couchbase/protocol/cmd_upsert.hxx +8 -8
- data/ext/couchbase/protocol/datatype.hxx +3 -3
- data/ext/couchbase/protocol/durability_level.hxx +2 -2
- data/ext/couchbase/protocol/frame_info_id.hxx +4 -4
- data/ext/couchbase/protocol/hello_feature.hxx +2 -2
- data/ext/couchbase/protocol/magic.hxx +2 -2
- data/ext/couchbase/protocol/server_opcode.hxx +2 -2
- data/ext/couchbase/protocol/server_request.hxx +1 -1
- data/ext/couchbase/protocol/status.hxx +4 -7
- data/ext/couchbase/protocol/unsigned_leb128.h +5 -20
- data/ext/couchbase/service_type.hxx +4 -4
- data/ext/couchbase/tracing/constants.hxx +261 -0
- data/ext/couchbase/tracing/noop_tracer.hxx +50 -0
- data/ext/couchbase/tracing/request_tracer.hxx +77 -0
- data/ext/couchbase/tracing/threshold_logging_options.hxx +64 -0
- data/ext/couchbase/tracing/threshold_logging_tracer.hxx +366 -0
- data/ext/couchbase/utils/byteswap.hxx +1 -1
- data/ext/couchbase/utils/connection_string.hxx +21 -1
- data/ext/couchbase/utils/name_codec.hxx +41 -0
- data/ext/couchbase/utils/url_codec.hxx +236 -0
- data/ext/couchbase/version.hxx +1 -1
- data/ext/test/CMakeLists.txt +1 -0
- data/ext/test/test_native_trivial_query.cxx +60 -0
- data/ext/third_party/hdr_histogram_c/CMakeLists.txt +84 -0
- data/ext/third_party/hdr_histogram_c/COPYING.txt +121 -0
- data/ext/third_party/hdr_histogram_c/LICENSE.txt +41 -0
- data/ext/third_party/hdr_histogram_c/config.cmake.in +6 -0
- data/ext/third_party/hdr_histogram_c/src/CMakeLists.txt +83 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_atomic.h +146 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_encoding.c +322 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_encoding.h +79 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_endian.h +116 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram.c +1196 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram.h +516 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.c +1290 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log.h +236 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_histogram_log_no_op.c +171 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.c +227 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.h +109 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_malloc.h +19 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_tests.h +22 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_thread.c +108 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_thread.h +55 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_time.c +98 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_time.h +49 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.c +143 -0
- data/ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.h +51 -0
- data/lib/couchbase/cluster.rb +1 -0
- data/lib/couchbase/errors.rb +3 -0
- data/lib/couchbase/management/analytics_index_manager.rb +920 -226
- data/lib/couchbase/management/bucket_manager.rb +207 -69
- data/lib/couchbase/management/collection_manager.rb +173 -61
- data/lib/couchbase/management/query_index_manager.rb +357 -169
- data/lib/couchbase/options.rb +75 -3
- data/lib/couchbase/scope.rb +102 -0
- data/lib/couchbase/utils/time.rb +4 -0
- data/lib/couchbase/version.rb +6 -6
- metadata +50 -7
data/lib/couchbase/options.rb
CHANGED
@@ -40,6 +40,13 @@ module Couchbase
|
|
40
40
|
@parent_span = parent_span
|
41
41
|
yield self if block_given?
|
42
42
|
end
|
43
|
+
|
44
|
+
# @api private
|
45
|
+
def to_backend
|
46
|
+
{
|
47
|
+
timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
|
48
|
+
}
|
49
|
+
end
|
43
50
|
end
|
44
51
|
|
45
52
|
# Options for {Collection#get}
|
@@ -128,7 +135,7 @@ module Couchbase
|
|
128
135
|
# @param [Hash, nil] client_context the client context data, if set
|
129
136
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
130
137
|
#
|
131
|
-
# @yieldparam [
|
138
|
+
# @yieldparam [GetMulti] self
|
132
139
|
def initialize(transcoder: JsonTranscoder.new,
|
133
140
|
timeout: nil,
|
134
141
|
retry_strategy: nil,
|
@@ -1142,13 +1149,53 @@ module Couchbase
|
|
1142
1149
|
class Cluster
|
1143
1150
|
attr_accessor :authenticator # @return [PasswordAuthenticator, CertificateAuthenticator]
|
1144
1151
|
|
1152
|
+
attr_accessor :enable_metrics # @return [Boolean]
|
1153
|
+
attr_accessor :metrics_emit_interval # @return [nil, Integer, #in_milliseconds]
|
1154
|
+
attr_accessor :enable_tracing # @return [Boolean]
|
1155
|
+
attr_accessor :orphaned_emit_interval # @return [nil, Integer, #in_milliseconds]
|
1156
|
+
attr_accessor :orphaned_sample_size # @return [nil, Integer]
|
1157
|
+
attr_accessor :threshold_emit_interval # @return [nil, Integer, #in_milliseconds]
|
1158
|
+
attr_accessor :threshold_sample_size # @return [nil, Integer]
|
1159
|
+
attr_accessor :key_value_threshold # @return [nil, Integer, #in_milliseconds]
|
1160
|
+
attr_accessor :query_threshold # @return [nil, Integer, #in_milliseconds]
|
1161
|
+
attr_accessor :view_threshold # @return [nil, Integer, #in_milliseconds]
|
1162
|
+
attr_accessor :search_threshold # @return [nil, Integer, #in_milliseconds]
|
1163
|
+
attr_accessor :analytics_threshold # @return [nil, Integer, #in_milliseconds]
|
1164
|
+
attr_accessor :management_threshold # @return [nil, Integer, #in_milliseconds]
|
1165
|
+
|
1145
1166
|
# Creates an instance of options for {Couchbase::Cluster.connect}
|
1146
1167
|
#
|
1147
1168
|
# @param [PasswordAuthenticator, CertificateAuthenticator] authenticator
|
1148
1169
|
#
|
1149
1170
|
# @yieldparam [Cluster] self
|
1150
|
-
def initialize(authenticator: nil
|
1171
|
+
def initialize(authenticator: nil,
|
1172
|
+
enable_metrics: nil,
|
1173
|
+
metrics_emit_interval: nil,
|
1174
|
+
enable_tracing: nil,
|
1175
|
+
orphaned_emit_interval: nil,
|
1176
|
+
orphaned_sample_size: nil,
|
1177
|
+
threshold_emit_interval: nil,
|
1178
|
+
threshold_sample_size: nil,
|
1179
|
+
key_value_threshold: nil,
|
1180
|
+
query_threshold: nil,
|
1181
|
+
view_threshold: nil,
|
1182
|
+
search_threshold: nil,
|
1183
|
+
analytics_threshold: nil,
|
1184
|
+
management_threshold: nil)
|
1151
1185
|
@authenticator = authenticator
|
1186
|
+
@enable_metrics = enable_metrics
|
1187
|
+
@metrics_emit_interval = metrics_emit_interval
|
1188
|
+
@enable_tracing = enable_tracing
|
1189
|
+
@orphaned_emit_interval = orphaned_emit_interval
|
1190
|
+
@orphaned_sample_size = orphaned_sample_size
|
1191
|
+
@threshold_emit_interval = threshold_emit_interval
|
1192
|
+
@threshold_sample_size = threshold_sample_size
|
1193
|
+
@key_value_threshold = key_value_threshold
|
1194
|
+
@query_threshold = query_threshold
|
1195
|
+
@view_threshold = view_threshold
|
1196
|
+
@search_threshold = search_threshold
|
1197
|
+
@analytics_threshold = analytics_threshold
|
1198
|
+
@management_threshold = management_threshold
|
1152
1199
|
yield self if block_given?
|
1153
1200
|
end
|
1154
1201
|
|
@@ -1157,6 +1204,25 @@ module Couchbase
|
|
1157
1204
|
def authenticate(username, password)
|
1158
1205
|
@authenticator = PasswordAuthenticator.new(username, password)
|
1159
1206
|
end
|
1207
|
+
|
1208
|
+
# @api private
|
1209
|
+
def to_backend
|
1210
|
+
{
|
1211
|
+
enable_metrics: @enable_metrics,
|
1212
|
+
metrics_emit_interval: Utils::Time.extract_duration(@metrics_emit_interval),
|
1213
|
+
enable_tracing: @enable_tracing,
|
1214
|
+
orphaned_emit_interval: Utils::Time.extract_duration(@orphaned_emit_interval),
|
1215
|
+
orphaned_sample_size: @orphaned_sample_size,
|
1216
|
+
threshold_emit_interval: Utils::Time.extract_duration(@threshold_emit_interval),
|
1217
|
+
threshold_sample_size: @threshold_sample_size,
|
1218
|
+
key_value_threshold: Utils::Time.extract_duration(@key_value_threshold),
|
1219
|
+
query_threshold: Utils::Time.extract_duration(@query_threshold),
|
1220
|
+
view_threshold: Utils::Time.extract_duration(@view_threshold),
|
1221
|
+
search_threshold: Utils::Time.extract_duration(@search_threshold),
|
1222
|
+
analytics_threshold: Utils::Time.extract_duration(@analytics_threshold),
|
1223
|
+
management_threshold: Utils::Time.extract_duration(@management_threshold),
|
1224
|
+
}
|
1225
|
+
end
|
1160
1226
|
end
|
1161
1227
|
|
1162
1228
|
# Options for {Couchbase::Cluster#diagnostics}
|
@@ -1563,6 +1629,7 @@ module Couchbase
|
|
1563
1629
|
attr_accessor :highlight_fields # @return [Array<String>]
|
1564
1630
|
attr_accessor :fields # @return [Array<String>]
|
1565
1631
|
attr_accessor :disable_scoring # @return [Boolean]
|
1632
|
+
attr_accessor :collections # @return [Array<String>, nil]
|
1566
1633
|
attr_accessor :sort # @return [Array<String, Cluster::SearchSort>]
|
1567
1634
|
attr_accessor :facets # @return [Hash<String => Cluster::SearchFacet>]
|
1568
1635
|
attr_accessor :transcoder # @return [JsonTranscoder, #decode(String)]
|
@@ -1578,6 +1645,7 @@ module Couchbase
|
|
1578
1645
|
# were stored while indexing
|
1579
1646
|
# @param [MutationState] mutation_state the mutation tokens this query should be consistent with
|
1580
1647
|
# @param [Boolean] disable_scoring If set to true, the server will not perform any scoring on the hits
|
1648
|
+
# @param [Array<String>, nil] collections list of collections by which to filter the results
|
1581
1649
|
# @param [Array<String, Cluster::SearchSort>] sort Ordering rules to apply to the results. The list might contain
|
1582
1650
|
# either strings or special objects, that derive from {Cluster::SearchSort}. In case of String, the value
|
1583
1651
|
# represents the name of the field with optional +-+ in front of the name, which will turn on descending mode
|
@@ -1601,6 +1669,7 @@ module Couchbase
|
|
1601
1669
|
fields: nil,
|
1602
1670
|
mutation_state: nil,
|
1603
1671
|
disable_scoring: false,
|
1672
|
+
collections: nil,
|
1604
1673
|
sort: nil,
|
1605
1674
|
facets: nil,
|
1606
1675
|
transcoder: JsonTranscoder.new,
|
@@ -1616,6 +1685,7 @@ module Couchbase
|
|
1616
1685
|
@highlight_fields = highlight_fields
|
1617
1686
|
@fields = fields
|
1618
1687
|
@disable_scoring = disable_scoring
|
1688
|
+
@collections = collections
|
1619
1689
|
@sort = sort
|
1620
1690
|
@facets = facets
|
1621
1691
|
@transcoder = transcoder
|
@@ -1658,13 +1728,15 @@ module Couchbase
|
|
1658
1728
|
attr_reader :scan_consistency
|
1659
1729
|
|
1660
1730
|
# @api private
|
1661
|
-
def to_backend
|
1731
|
+
def to_backend(scope_name: nil)
|
1662
1732
|
{
|
1663
1733
|
timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
|
1664
1734
|
limit: @limit,
|
1665
1735
|
skip: @skip,
|
1666
1736
|
explain: @explain,
|
1667
1737
|
disable_scoring: @disable_scoring,
|
1738
|
+
scope: scope_name,
|
1739
|
+
collections: scope_name ? @collections : nil,
|
1668
1740
|
highlight_style: @highlight_style,
|
1669
1741
|
highlight_fields: @highlight_fields,
|
1670
1742
|
fields: @fields,
|
data/lib/couchbase/scope.rb
CHANGED
@@ -124,5 +124,107 @@ module Couchbase
|
|
124
124
|
res.instance_variable_set("@rows", resp[:rows])
|
125
125
|
end
|
126
126
|
end
|
127
|
+
|
128
|
+
# Performs a Full Text Search (FTS) query
|
129
|
+
#
|
130
|
+
# @param [String] index_name the name of the search index
|
131
|
+
# @param [SearchQuery] query the query tree
|
132
|
+
# @param [Options::Search] options the query tree
|
133
|
+
#
|
134
|
+
# @example Return first 10 results of "hop beer" query and request highlighting
|
135
|
+
# cluster.search_query("travel_index", Cluster::SearchQuery.match_phrase("green"),
|
136
|
+
# Options::Search(
|
137
|
+
# limit: 10,
|
138
|
+
# collections: ["landmark", "hotel"]
|
139
|
+
# fields: %w[name],
|
140
|
+
# highlight_style: :html,
|
141
|
+
# highlight_fields: %w[name description]
|
142
|
+
# ))
|
143
|
+
#
|
144
|
+
# @return [SearchResult]
|
145
|
+
def search_query(index_name, query, options = Options::Search.new)
|
146
|
+
resp = @backend.document_search(index_name, JSON.generate(query), options.to_backend(scope_name: @name))
|
147
|
+
|
148
|
+
SearchResult.new do |res|
|
149
|
+
res.meta_data = SearchMetaData.new do |meta|
|
150
|
+
meta.metrics.max_score = resp[:meta_data][:metrics][:max_score]
|
151
|
+
meta.metrics.error_partition_count = resp[:meta_data][:metrics][:error_partition_count]
|
152
|
+
meta.metrics.success_partition_count = resp[:meta_data][:metrics][:success_partition_count]
|
153
|
+
meta.metrics.took = resp[:meta_data][:metrics][:took]
|
154
|
+
meta.metrics.total_rows = resp[:meta_data][:metrics][:total_rows]
|
155
|
+
meta.errors = resp[:meta_data][:errors]
|
156
|
+
end
|
157
|
+
res.rows = resp[:rows].map do |r|
|
158
|
+
SearchRow.new do |row|
|
159
|
+
row.transcoder = options.transcoder
|
160
|
+
row.index = r[:index]
|
161
|
+
row.id = r[:id]
|
162
|
+
row.score = r[:score]
|
163
|
+
row.fragments = r[:fragments]
|
164
|
+
row.locations = SearchRowLocations.new(
|
165
|
+
r[:locations].map do |loc|
|
166
|
+
SearchRowLocation.new do |location|
|
167
|
+
location.field = loc[:field]
|
168
|
+
location.term = loc[:term]
|
169
|
+
location.position = loc[:position]
|
170
|
+
location.start_offset = loc[:start_offset]
|
171
|
+
location.end_offset = loc[:end_offset]
|
172
|
+
location.array_positions = loc[:array_positions]
|
173
|
+
end
|
174
|
+
end
|
175
|
+
)
|
176
|
+
row.instance_variable_set("@fields", r[:fields])
|
177
|
+
row.explanation = JSON.parse(r[:explanation]) if r[:explanation]
|
178
|
+
end
|
179
|
+
end
|
180
|
+
if resp[:facets]
|
181
|
+
res.facets = resp[:facets].each_with_object({}) do |(k, v), o|
|
182
|
+
facet = case options.facets[k]
|
183
|
+
when SearchFacet::SearchFacetTerm
|
184
|
+
SearchFacetResult::TermFacetResult.new do |f|
|
185
|
+
f.terms =
|
186
|
+
if v[:terms]
|
187
|
+
v[:terms].map do |t|
|
188
|
+
SearchFacetResult::TermFacetResult::TermFacet.new(t[:term], t[:count])
|
189
|
+
end
|
190
|
+
else
|
191
|
+
[]
|
192
|
+
end
|
193
|
+
end
|
194
|
+
when SearchFacet::SearchFacetDateRange
|
195
|
+
SearchFacetResult::DateRangeFacetResult.new do |f|
|
196
|
+
f.date_ranges =
|
197
|
+
if v[:date_ranges]
|
198
|
+
v[:date_ranges].map do |r|
|
199
|
+
SearchFacetResult::DateRangeFacetResult::DateRangeFacet.new(r[:name], r[:count], r[:start_time], r[:end_time])
|
200
|
+
end
|
201
|
+
else
|
202
|
+
[]
|
203
|
+
end
|
204
|
+
end
|
205
|
+
when SearchFacet::SearchFacetNumericRange
|
206
|
+
SearchFacetResult::NumericRangeFacetResult.new do |f|
|
207
|
+
f.numeric_ranges =
|
208
|
+
if v[:numeric_ranges]
|
209
|
+
v[:numeric_ranges].map do |r|
|
210
|
+
SearchFacetResult::NumericRangeFacetResult::NumericRangeFacet.new(r[:name], r[:count], r[:min], r[:max])
|
211
|
+
end
|
212
|
+
else
|
213
|
+
[]
|
214
|
+
end
|
215
|
+
end
|
216
|
+
else
|
217
|
+
next # ignore unknown facet result
|
218
|
+
end
|
219
|
+
facet.name = v[:name]
|
220
|
+
facet.field = v[:field]
|
221
|
+
facet.total = v[:total]
|
222
|
+
facet.missing = v[:missing]
|
223
|
+
facet.other = v[:other]
|
224
|
+
o[k] = facet
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
127
229
|
end
|
128
230
|
end
|
data/lib/couchbase/utils/time.rb
CHANGED
data/lib/couchbase/version.rb
CHANGED
@@ -17,15 +17,15 @@ module Couchbase
|
|
17
17
|
#
|
18
18
|
# @example Display version and all dependencies in command line
|
19
19
|
# # ruby -rcouchbase -e 'pp Couchbase::VERSION'
|
20
|
-
# {:sdk=>"3.1.
|
21
|
-
# :backend=>"1.
|
22
|
-
# :build_timestamp=>"2021-
|
23
|
-
# :revision=>"
|
20
|
+
# {:sdk=>"3.1.1",
|
21
|
+
# :backend=>"1.5.0",
|
22
|
+
# :build_timestamp=>"2021-04-08 16:29:43",
|
23
|
+
# :revision=>"a79d098eb238b3883e49e1738c35167642e8834f",
|
24
24
|
# :platform=>"Linux-4.15.0-66-generic",
|
25
25
|
# :cpu=>"x86_64",
|
26
26
|
# :cc=>"GNU 9.3.1",
|
27
27
|
# :cxx=>"GNU 9.3.1",
|
28
|
-
# :ruby=>"
|
28
|
+
# :ruby=>"2.7.0",
|
29
29
|
# :spdlog=>"1.8.1",
|
30
30
|
# :asio=>"1.18.0",
|
31
31
|
# :snappy=>"1.1.8",
|
@@ -33,5 +33,5 @@ module Couchbase
|
|
33
33
|
# :openssl_headers=>"OpenSSL 1.1.1g FIPS 21 Apr 2020",
|
34
34
|
# :openssl_runtime=>"OpenSSL 1.1.1g FIPS 21 Apr 2020"}
|
35
35
|
VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
|
36
|
-
VERSION.update(:sdk => "3.
|
36
|
+
VERSION.update(:sdk => "3.2.0".freeze)
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Avseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Modern SDK for Couchbase Server
|
14
14
|
email:
|
@@ -89,6 +89,10 @@ files:
|
|
89
89
|
- ext/couchbase/io/retry_reason.hxx
|
90
90
|
- ext/couchbase/io/retry_strategy.hxx
|
91
91
|
- ext/couchbase/io/streams.hxx
|
92
|
+
- ext/couchbase/metrics/logging_meter.hxx
|
93
|
+
- ext/couchbase/metrics/logging_meter_options.hxx
|
94
|
+
- ext/couchbase/metrics/meter.hxx
|
95
|
+
- ext/couchbase/metrics/noop_meter.hxx
|
92
96
|
- ext/couchbase/mutation_token.hxx
|
93
97
|
- ext/couchbase/operations.hxx
|
94
98
|
- ext/couchbase/operations/analytics_dataset_create.hxx
|
@@ -100,8 +104,16 @@ files:
|
|
100
104
|
- ext/couchbase/operations/analytics_index_create.hxx
|
101
105
|
- ext/couchbase/operations/analytics_index_drop.hxx
|
102
106
|
- ext/couchbase/operations/analytics_index_get_all.hxx
|
107
|
+
- ext/couchbase/operations/analytics_link.hxx
|
108
|
+
- ext/couchbase/operations/analytics_link_azure_blob_external.hxx
|
103
109
|
- ext/couchbase/operations/analytics_link_connect.hxx
|
110
|
+
- ext/couchbase/operations/analytics_link_couchbase_remote.hxx
|
111
|
+
- ext/couchbase/operations/analytics_link_create.hxx
|
104
112
|
- ext/couchbase/operations/analytics_link_disconnect.hxx
|
113
|
+
- ext/couchbase/operations/analytics_link_drop.hxx
|
114
|
+
- ext/couchbase/operations/analytics_link_get_all.hxx
|
115
|
+
- ext/couchbase/operations/analytics_link_replace.hxx
|
116
|
+
- ext/couchbase/operations/analytics_link_s3_external.hxx
|
105
117
|
- ext/couchbase/operations/bucket_create.hxx
|
106
118
|
- ext/couchbase/operations/bucket_drop.hxx
|
107
119
|
- ext/couchbase/operations/bucket_flush.hxx
|
@@ -226,9 +238,15 @@ files:
|
|
226
238
|
- ext/couchbase/protocol/unsigned_leb128.h
|
227
239
|
- ext/couchbase/service_type.hxx
|
228
240
|
- ext/couchbase/timeout_defaults.hxx
|
241
|
+
- ext/couchbase/tracing/constants.hxx
|
242
|
+
- ext/couchbase/tracing/noop_tracer.hxx
|
243
|
+
- ext/couchbase/tracing/request_tracer.hxx
|
244
|
+
- ext/couchbase/tracing/threshold_logging_options.hxx
|
245
|
+
- ext/couchbase/tracing/threshold_logging_tracer.hxx
|
229
246
|
- ext/couchbase/utils/byteswap.hxx
|
230
247
|
- ext/couchbase/utils/connection_string.hxx
|
231
248
|
- ext/couchbase/utils/crc32.hxx
|
249
|
+
- ext/couchbase/utils/name_codec.hxx
|
232
250
|
- ext/couchbase/utils/url_codec.hxx
|
233
251
|
- ext/couchbase/version.hxx
|
234
252
|
- ext/extconf.rb
|
@@ -239,6 +257,7 @@ files:
|
|
239
257
|
- ext/test/test_native_binary_operations.cxx
|
240
258
|
- ext/test/test_native_diagnostics.cxx
|
241
259
|
- ext/test/test_native_trivial_crud.cxx
|
260
|
+
- ext/test/test_native_trivial_query.cxx
|
242
261
|
- ext/test/test_ruby_trivial_crud.cxx
|
243
262
|
- ext/test/test_ruby_trivial_query.cxx
|
244
263
|
- ext/third_party/asio/asio/include/asio.hpp
|
@@ -813,6 +832,30 @@ files:
|
|
813
832
|
- ext/third_party/gsl/include/gsl/span
|
814
833
|
- ext/third_party/gsl/include/gsl/span_ext
|
815
834
|
- ext/third_party/gsl/include/gsl/string_span
|
835
|
+
- ext/third_party/hdr_histogram_c/CMakeLists.txt
|
836
|
+
- ext/third_party/hdr_histogram_c/COPYING.txt
|
837
|
+
- ext/third_party/hdr_histogram_c/LICENSE.txt
|
838
|
+
- ext/third_party/hdr_histogram_c/config.cmake.in
|
839
|
+
- ext/third_party/hdr_histogram_c/src/CMakeLists.txt
|
840
|
+
- ext/third_party/hdr_histogram_c/src/hdr_atomic.h
|
841
|
+
- ext/third_party/hdr_histogram_c/src/hdr_encoding.c
|
842
|
+
- ext/third_party/hdr_histogram_c/src/hdr_encoding.h
|
843
|
+
- ext/third_party/hdr_histogram_c/src/hdr_endian.h
|
844
|
+
- ext/third_party/hdr_histogram_c/src/hdr_histogram.c
|
845
|
+
- ext/third_party/hdr_histogram_c/src/hdr_histogram.h
|
846
|
+
- ext/third_party/hdr_histogram_c/src/hdr_histogram_log.c
|
847
|
+
- ext/third_party/hdr_histogram_c/src/hdr_histogram_log.h
|
848
|
+
- ext/third_party/hdr_histogram_c/src/hdr_histogram_log_no_op.c
|
849
|
+
- ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.c
|
850
|
+
- ext/third_party/hdr_histogram_c/src/hdr_interval_recorder.h
|
851
|
+
- ext/third_party/hdr_histogram_c/src/hdr_malloc.h
|
852
|
+
- ext/third_party/hdr_histogram_c/src/hdr_tests.h
|
853
|
+
- ext/third_party/hdr_histogram_c/src/hdr_thread.c
|
854
|
+
- ext/third_party/hdr_histogram_c/src/hdr_thread.h
|
855
|
+
- ext/third_party/hdr_histogram_c/src/hdr_time.c
|
856
|
+
- ext/third_party/hdr_histogram_c/src/hdr_time.h
|
857
|
+
- ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.c
|
858
|
+
- ext/third_party/hdr_histogram_c/src/hdr_writer_reader_phaser.h
|
816
859
|
- ext/third_party/http_parser/LICENSE-MIT
|
817
860
|
- ext/third_party/http_parser/http_parser.c
|
818
861
|
- ext/third_party/http_parser/http_parser.h
|
@@ -1375,9 +1418,9 @@ metadata:
|
|
1375
1418
|
homepage_uri: https://docs.couchbase.com/ruby-sdk/3.0/hello-world/start-using-sdk.html
|
1376
1419
|
bug_tracker_uri: https://couchbase.com/issues/browse/RCBC
|
1377
1420
|
mailing_list_uri: https://forums.couchbase.com/c/ruby-sdk
|
1378
|
-
source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.
|
1379
|
-
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.
|
1380
|
-
documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.
|
1421
|
+
source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.2.0
|
1422
|
+
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.2.0
|
1423
|
+
documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.2.0/index.html
|
1381
1424
|
github_repo: ssh://github.com/couchbase/couchbase-ruby-client
|
1382
1425
|
post_install_message:
|
1383
1426
|
rdoc_options:
|
@@ -1389,14 +1432,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1389
1432
|
requirements:
|
1390
1433
|
- - ">"
|
1391
1434
|
- !ruby/object:Gem::Version
|
1392
|
-
version: '2.
|
1435
|
+
version: '2.6'
|
1393
1436
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1394
1437
|
requirements:
|
1395
1438
|
- - ">="
|
1396
1439
|
- !ruby/object:Gem::Version
|
1397
1440
|
version: '0'
|
1398
1441
|
requirements: []
|
1399
|
-
rubygems_version: 3.1.
|
1442
|
+
rubygems_version: 3.1.6
|
1400
1443
|
signing_key:
|
1401
1444
|
specification_version: 4
|
1402
1445
|
summary: SDK for Couchbase Server
|