couchbase 3.1.1-universal-darwin-20 → 3.2.0-universal-darwin-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/CMakeLists.txt +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.hxx +4 -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/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/libcouchbase.bundle +0 -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 +48 -5
@@ -13,9 +13,318 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
require "couchbase/errors"
|
16
|
+
require "couchbase/options"
|
16
17
|
|
17
18
|
module Couchbase
|
18
19
|
module Management
|
20
|
+
module Options
|
21
|
+
module Query
|
22
|
+
# Options for {QueryIndexManager#get_all_indexes}
|
23
|
+
class GetAllIndexes < ::Couchbase::Options::Base
|
24
|
+
# Creates an instance of options for {QueryIndexManager#get_all_indexes}
|
25
|
+
#
|
26
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
27
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
28
|
+
# @param [Hash, nil] client_context the client context data, if set
|
29
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
30
|
+
#
|
31
|
+
# @yieldparam [GetAllScopes] self
|
32
|
+
def initialize(timeout: nil,
|
33
|
+
retry_strategy: nil,
|
34
|
+
client_context: nil,
|
35
|
+
parent_span: nil)
|
36
|
+
super
|
37
|
+
yield self if block_given?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Options for {QueryIndexManager#create_index}
|
42
|
+
class CreateIndex < ::Couchbase::Options::Base
|
43
|
+
attr_accessor :ignore_if_exists # @return [Boolean]
|
44
|
+
attr_accessor :num_replicas # @return [Integer, nil]
|
45
|
+
attr_accessor :deferred # @return [Boolean]
|
46
|
+
attr_accessor :condition # @return [String, nil]
|
47
|
+
attr_accessor :scope_name # @return [String, nil]
|
48
|
+
attr_accessor :collection_name # @return [String, nil]
|
49
|
+
|
50
|
+
# Creates an instance of options for {QueryIndexManager#create_index}
|
51
|
+
#
|
52
|
+
# @param [Boolean] ignore_if_exists do not raise error if the index already exist
|
53
|
+
# @param [Integer] num_replicas the number of replicas that this index should have
|
54
|
+
# @param [Boolean] deferred whether the index should be created as a deferred index.
|
55
|
+
# @param [String, nil] condition to apply to the index
|
56
|
+
# @param [String, nil] scope_name the name of the scope
|
57
|
+
# @param [String, nil] collection_name the name of the collection
|
58
|
+
#
|
59
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
60
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
61
|
+
# @param [Hash, nil] client_context the client context data, if set
|
62
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
63
|
+
#
|
64
|
+
# @yieldparam [CreateIndex] self
|
65
|
+
def initialize(ignore_if_exists: false,
|
66
|
+
num_replicas: nil,
|
67
|
+
deferred: false,
|
68
|
+
condition: nil,
|
69
|
+
scope_name: nil,
|
70
|
+
collection_name: nil,
|
71
|
+
timeout: nil,
|
72
|
+
retry_strategy: nil,
|
73
|
+
client_context: nil,
|
74
|
+
parent_span: nil)
|
75
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
76
|
+
@ignore_if_exists = ignore_if_exists
|
77
|
+
@num_replicas = num_replicas
|
78
|
+
@deferred = deferred
|
79
|
+
@condition = condition
|
80
|
+
@scope_name = scope_name
|
81
|
+
@collection_name = collection_name
|
82
|
+
yield self if block_given?
|
83
|
+
end
|
84
|
+
|
85
|
+
# @api private
|
86
|
+
def to_backend
|
87
|
+
{
|
88
|
+
timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
|
89
|
+
ignore_if_exists: @ignore_if_exists,
|
90
|
+
condition: @condition,
|
91
|
+
deferred: @deferred,
|
92
|
+
num_replicas: @num_replicas,
|
93
|
+
scope_name: @scope_name,
|
94
|
+
collection_name: @collection_name,
|
95
|
+
}
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Options for {QueryIndexManager#create_primary_index}
|
100
|
+
class CreatePrimaryIndex < ::Couchbase::Options::Base
|
101
|
+
attr_accessor :ignore_if_exists # @return [Boolean]
|
102
|
+
attr_accessor :num_replicas # @return [Integer, nil]
|
103
|
+
attr_accessor :deferred # @return [Boolean]
|
104
|
+
attr_accessor :scope_name # @return [String, nil]
|
105
|
+
attr_accessor :collection_name # @return [String, nil]
|
106
|
+
|
107
|
+
# Creates an instance of options for {QueryIndexManager#create_primary_index}
|
108
|
+
#
|
109
|
+
# @param [Boolean] ignore_if_exists do not raise error if the index already exist
|
110
|
+
# @param [Integer] num_replicas the number of replicas that this index should have
|
111
|
+
# @param [Boolean] deferred whether the index should be created as a deferred index.
|
112
|
+
# @param [String, nil] scope_name the name of the scope
|
113
|
+
# @param [String, nil] collection_name the name of the collection
|
114
|
+
#
|
115
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
116
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
117
|
+
# @param [Hash, nil] client_context the client context data, if set
|
118
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
119
|
+
#
|
120
|
+
# @yieldparam [CreatePrimaryIndex] self
|
121
|
+
def initialize(ignore_if_exists: false,
|
122
|
+
num_replicas: nil,
|
123
|
+
deferred: false,
|
124
|
+
scope_name: nil,
|
125
|
+
collection_name: nil,
|
126
|
+
timeout: nil,
|
127
|
+
retry_strategy: nil,
|
128
|
+
client_context: nil,
|
129
|
+
parent_span: nil)
|
130
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
131
|
+
@ignore_if_exists = ignore_if_exists
|
132
|
+
@num_replicas = num_replicas
|
133
|
+
@deferred = deferred
|
134
|
+
@scope_name = scope_name
|
135
|
+
@collection_name = collection_name
|
136
|
+
yield self if block_given?
|
137
|
+
end
|
138
|
+
|
139
|
+
# @api private
|
140
|
+
def to_backend
|
141
|
+
{
|
142
|
+
timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
|
143
|
+
ignore_if_exists: @ignore_if_exists,
|
144
|
+
deferred: @deferred,
|
145
|
+
num_replicas: @num_replicas,
|
146
|
+
scope_name: @scope_name,
|
147
|
+
collection_name: @collection_name,
|
148
|
+
}
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Options for {QueryIndexManager#drop_index}
|
153
|
+
class DropIndex < ::Couchbase::Options::Base
|
154
|
+
attr_accessor :ignore_if_does_not_exist # @return [Boolean]
|
155
|
+
attr_accessor :scope_name # @return [String, nil]
|
156
|
+
attr_accessor :collection_name # @return [String, nil]
|
157
|
+
|
158
|
+
# Creates an instance of options for {QueryIndexManager#drop_index}
|
159
|
+
#
|
160
|
+
# @param [Boolean] ignore_if_does_not_exist do not raise error if the index does not exist
|
161
|
+
# @param [String, nil] scope_name the name of the scope
|
162
|
+
# @param [String, nil] collection_name the name of the collection
|
163
|
+
#
|
164
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
165
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
166
|
+
# @param [Hash, nil] client_context the client context data, if set
|
167
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
168
|
+
#
|
169
|
+
# @yieldparam [DropIndex] self
|
170
|
+
def initialize(ignore_if_does_not_exist: false,
|
171
|
+
scope_name: nil,
|
172
|
+
collection_name: nil,
|
173
|
+
timeout: nil,
|
174
|
+
retry_strategy: nil,
|
175
|
+
client_context: nil,
|
176
|
+
parent_span: nil)
|
177
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
178
|
+
@ignore_if_does_not_exist = ignore_if_does_not_exist
|
179
|
+
@scope_name = scope_name
|
180
|
+
@collection_name = collection_name
|
181
|
+
yield self if block_given?
|
182
|
+
end
|
183
|
+
|
184
|
+
# @api private
|
185
|
+
def to_backend
|
186
|
+
{
|
187
|
+
timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
|
188
|
+
ignore_if_does_not_exist: @ignore_if_does_not_exist,
|
189
|
+
scope_name: @scope_name,
|
190
|
+
collection_name: @collection_name,
|
191
|
+
}
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
# Options for {QueryIndexManager#drop_primary_index}
|
196
|
+
class DropPrimaryIndex < ::Couchbase::Options::Base
|
197
|
+
attr_accessor :ignore_if_does_not_exist # @return [Boolean]
|
198
|
+
attr_accessor :scope_name # @return [String, nil]
|
199
|
+
attr_accessor :collection_name # @return [String, nil]
|
200
|
+
|
201
|
+
# Creates an instance of options for {QueryIndexManager#drop_primary_index}
|
202
|
+
#
|
203
|
+
# @param [Boolean] ignore_if_does_not_exist do not raise error if the index does not exist
|
204
|
+
# @param [String, nil] scope_name the name of the scope
|
205
|
+
# @param [String, nil] collection_name the name of the collection
|
206
|
+
#
|
207
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
208
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
209
|
+
# @param [Hash, nil] client_context the client context data, if set
|
210
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
211
|
+
#
|
212
|
+
# @yieldparam [DropPrimaryIndex] self
|
213
|
+
def initialize(ignore_if_does_not_exist: false,
|
214
|
+
scope_name: nil,
|
215
|
+
collection_name: nil,
|
216
|
+
timeout: nil,
|
217
|
+
retry_strategy: nil,
|
218
|
+
client_context: nil,
|
219
|
+
parent_span: nil)
|
220
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
221
|
+
@ignore_if_does_not_exist = ignore_if_does_not_exist
|
222
|
+
@scope_name = scope_name
|
223
|
+
@collection_name = collection_name
|
224
|
+
yield self if block_given?
|
225
|
+
end
|
226
|
+
|
227
|
+
# @api private
|
228
|
+
def to_backend
|
229
|
+
{
|
230
|
+
timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
|
231
|
+
ignore_if_does_not_exist: @ignore_if_does_not_exist,
|
232
|
+
scope_name: @scope_name,
|
233
|
+
collection_name: @collection_name,
|
234
|
+
}
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# Options for {QueryIndexManager#build_deferred_indexes}
|
239
|
+
class BuildDeferredIndexes < ::Couchbase::Options::Base
|
240
|
+
# Creates an instance of options for {QueryIndexManager#build_deferred_indexes}
|
241
|
+
#
|
242
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
243
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
244
|
+
# @param [Hash, nil] client_context the client context data, if set
|
245
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
246
|
+
#
|
247
|
+
# @yieldparam [GetAllScopes] self
|
248
|
+
def initialize(timeout: nil,
|
249
|
+
retry_strategy: nil,
|
250
|
+
client_context: nil,
|
251
|
+
parent_span: nil)
|
252
|
+
super
|
253
|
+
yield self if block_given?
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# Options for {QueryIndexManager#watch_indexes}
|
258
|
+
class WatchIndexes < ::Couchbase::Options::Base
|
259
|
+
attr_accessor :watch_primary # @return [Boolean]
|
260
|
+
|
261
|
+
# Creates an instance of options for {QueryIndexManager#watch_indexes}
|
262
|
+
#
|
263
|
+
# @param [Boolean] watch_primary whether or not to watch the primary index
|
264
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
265
|
+
# @param [Hash, nil] client_context the client context data, if set
|
266
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
267
|
+
#
|
268
|
+
# @yieldparam [GetAllScopes] self
|
269
|
+
def initialize(watch_primary: false,
|
270
|
+
retry_strategy: nil,
|
271
|
+
client_context: nil,
|
272
|
+
parent_span: nil)
|
273
|
+
super(timeout: nil, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
274
|
+
@watch_primary = watch_primary
|
275
|
+
yield self if block_given?
|
276
|
+
end
|
277
|
+
|
278
|
+
# @api private
|
279
|
+
def to_backend
|
280
|
+
{
|
281
|
+
watch_primary: @watch_primary,
|
282
|
+
}
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# rubocop:disable Naming/MethodName constructor shortcuts
|
287
|
+
module_function
|
288
|
+
|
289
|
+
# Construct {GetAllIndexes} options for {QueryIndexManager#get_all_indexes}
|
290
|
+
#
|
291
|
+
# @return [GetAllIndexes]
|
292
|
+
def GetAllIndexes(**args)
|
293
|
+
GetAllIndexes.new(**args)
|
294
|
+
end
|
295
|
+
|
296
|
+
# Construct {CreateIndex} options for {QueryIndexManager#create_index}
|
297
|
+
#
|
298
|
+
# @return [CreateIndex]
|
299
|
+
def CreateIndex(**args)
|
300
|
+
CreateIndex.new(**args)
|
301
|
+
end
|
302
|
+
|
303
|
+
# Construct {CreatePrimaryIndex} options for {QueryIndexManager#create_index}
|
304
|
+
#
|
305
|
+
# @return [CreatePrimaryIndex]
|
306
|
+
def CreatePrimaryIndex(**args)
|
307
|
+
CreatePrimaryIndex.new(**args)
|
308
|
+
end
|
309
|
+
|
310
|
+
# Construct {DropIndex} options for {QueryIndexManager#drop_index}
|
311
|
+
#
|
312
|
+
# @return [DropIndex]
|
313
|
+
def DropIndex(**args)
|
314
|
+
DropIndex.new(**args)
|
315
|
+
end
|
316
|
+
|
317
|
+
# Construct {DropPrimaryIndex} options for {QueryIndexManager#drop_primary_index}
|
318
|
+
#
|
319
|
+
# @return [DropPrimaryIndex]
|
320
|
+
def DropPrimaryIndex(**args)
|
321
|
+
DropPrimaryIndex.new(**args)
|
322
|
+
end
|
323
|
+
|
324
|
+
# rubocop:enable Naming/MethodName
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
19
328
|
class QueryIndexManager
|
20
329
|
alias inspect to_s
|
21
330
|
|
@@ -27,13 +336,13 @@ module Couchbase
|
|
27
336
|
# Fetches all indexes from the server
|
28
337
|
#
|
29
338
|
# @param [String] bucket_name name of the bucket
|
30
|
-
# @param [
|
339
|
+
# @param [Options::Query::GetAllIndexes] options
|
31
340
|
#
|
32
341
|
# @return [Array<QueryIndex>]
|
33
342
|
#
|
34
343
|
# @raise [ArgumentError]
|
35
344
|
def get_all_indexes(bucket_name, options = GetAllIndexOptions.new)
|
36
|
-
res = @backend.query_index_get_all(bucket_name, options.
|
345
|
+
res = @backend.query_index_get_all(bucket_name, options.to_backend)
|
37
346
|
res[:indexes].map do |idx|
|
38
347
|
QueryIndex.new do |index|
|
39
348
|
index.name = idx[:name]
|
@@ -47,6 +356,7 @@ module Couchbase
|
|
47
356
|
index.name_space = idx[:namespace_id]
|
48
357
|
index.index_key = idx[:index_key]
|
49
358
|
index.condition = idx[:condition]
|
359
|
+
index.partition = idx[:partition]
|
50
360
|
end
|
51
361
|
end
|
52
362
|
end
|
@@ -56,237 +366,112 @@ module Couchbase
|
|
56
366
|
# @param [String] bucket_name name of the bucket
|
57
367
|
# @param [String] index_name name of the index
|
58
368
|
# @param [Array<String>] fields the lists of fields to create th index over
|
59
|
-
# @param [
|
369
|
+
# @param [Options::Query::CreateIndex] options
|
60
370
|
#
|
61
371
|
# @return void
|
62
372
|
#
|
63
373
|
# @raise [ArgumentError]
|
64
374
|
# @raise [Error::IndexExists]
|
65
|
-
def create_index(bucket_name, index_name, fields, options =
|
66
|
-
@backend.query_index_create(bucket_name, index_name, fields,
|
67
|
-
ignore_if_exists: options.ignore_if_exists,
|
68
|
-
condition: options.condition,
|
69
|
-
deferred: options.deferred,
|
70
|
-
num_replicas: options.num_replicas,
|
71
|
-
scope_name: options.scope_name,
|
72
|
-
collection_name: options.collection_name,
|
73
|
-
}, options.timeout)
|
375
|
+
def create_index(bucket_name, index_name, fields, options = Options::Query::CreateIndex.new)
|
376
|
+
@backend.query_index_create(bucket_name, index_name, fields, options.to_backend)
|
74
377
|
end
|
75
378
|
|
76
379
|
# Creates new primary index
|
77
380
|
#
|
78
381
|
# @param [String] bucket_name name of the bucket
|
79
|
-
# @param [
|
382
|
+
# @param [Options::Query::CreatePrimaryIndex] options
|
80
383
|
#
|
81
384
|
# @return void
|
82
385
|
#
|
83
386
|
# @raise [ArgumentError]
|
84
387
|
# @raise [Error::IndexExists]
|
85
|
-
def create_primary_index(bucket_name, options =
|
86
|
-
@backend.query_index_create_primary(bucket_name,
|
87
|
-
ignore_if_exists: options.ignore_if_exists,
|
88
|
-
deferred: options.deferred,
|
89
|
-
num_replicas: options.num_replicas,
|
90
|
-
scope_name: options.scope_name,
|
91
|
-
collection_name: options.collection_name,
|
92
|
-
}, options.timeout)
|
388
|
+
def create_primary_index(bucket_name, options = Options::Query::CreatePrimaryIndex.new)
|
389
|
+
@backend.query_index_create_primary(bucket_name, options.to_backend)
|
93
390
|
end
|
94
391
|
|
95
392
|
# Drops the index
|
96
393
|
#
|
97
394
|
# @param [String] bucket_name name of the bucket
|
98
395
|
# @param [String] index_name name of the index
|
99
|
-
# @param [
|
396
|
+
# @param [Options::Query::DropIndex] options
|
100
397
|
#
|
101
398
|
# @return void
|
102
399
|
#
|
103
400
|
# @raise [ArgumentError]
|
104
401
|
# @raise [Error::IndexNotFound]
|
105
|
-
def drop_index(bucket_name, index_name, options =
|
106
|
-
@backend.query_index_drop(bucket_name, index_name,
|
107
|
-
ignore_if_does_not_exist: options.ignore_if_does_not_exist,
|
108
|
-
scope_name: options.scope_name,
|
109
|
-
collection_name: options.collection_name,
|
110
|
-
}, options.timeout)
|
402
|
+
def drop_index(bucket_name, index_name, options = Options::Query::DropIndex.new)
|
403
|
+
@backend.query_index_drop(bucket_name, index_name, options.to_backend)
|
111
404
|
true
|
112
405
|
end
|
113
406
|
|
114
407
|
# Drops the primary index
|
115
408
|
#
|
116
409
|
# @param [String] bucket_name name of the bucket
|
117
|
-
# @param [
|
410
|
+
# @param [Options::Query::DropPrimaryIndex] options
|
118
411
|
#
|
119
412
|
# @return void
|
120
413
|
#
|
121
414
|
# @raise [ArgumentError]
|
122
415
|
# @raise [Error::IndexNotFound]
|
123
|
-
def drop_primary_index(bucket_name, options =
|
124
|
-
@backend.query_index_drop_primary(bucket_name,
|
125
|
-
ignore_if_does_not_exist: options.ignore_if_does_not_exist,
|
126
|
-
index_name: options.index_name,
|
127
|
-
scope_name: options.scope_name,
|
128
|
-
collection_name: options.collection_name,
|
129
|
-
}, options.timeout)
|
416
|
+
def drop_primary_index(bucket_name, options = Options::Query::DropPrimaryIndex.new)
|
417
|
+
@backend.query_index_drop_primary(bucket_name, options.to_backend)
|
130
418
|
true
|
131
419
|
end
|
132
420
|
|
133
421
|
# Build all indexes which are currently in deferred state
|
134
422
|
#
|
135
423
|
# @param [String] bucket_name name of the bucket
|
136
|
-
# @param [
|
424
|
+
# @param [Options::Query::BuildDeferredIndexes] options
|
137
425
|
#
|
138
426
|
# @return void
|
139
427
|
#
|
140
428
|
# @raise [ArgumentError]
|
141
|
-
def build_deferred_indexes(bucket_name, options =
|
142
|
-
@backend.query_index_build_deferred(bucket_name, options.
|
429
|
+
def build_deferred_indexes(bucket_name, options = Options::Query::BuildDeferredIndexes.new)
|
430
|
+
@backend.query_index_build_deferred(bucket_name, options.to_backend)
|
143
431
|
end
|
144
432
|
|
145
433
|
# Polls indexes until they are online
|
146
434
|
#
|
147
435
|
# @param [String] bucket_name name of the bucket
|
148
436
|
# @param [Array<String>] index_names names of the indexes to watch
|
149
|
-
# @param [Integer, #in_milliseconds] timeout
|
150
|
-
# @param [
|
437
|
+
# @param [Integer, #in_milliseconds] timeout the time in milliseconds allowed for the operation to complete
|
438
|
+
# @param [Options::Query::WatchIndexes] options
|
151
439
|
#
|
152
440
|
# @raise [ArgumentError]
|
153
441
|
# @raise [Error::IndexNotFound]
|
154
|
-
def watch_indexes(bucket_name, index_names, timeout, options =
|
155
|
-
@backend.query_index_watch(bucket_name, index_names,
|
156
|
-
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
class GetAllIndexOptions
|
161
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
162
|
-
attr_accessor :timeout
|
163
|
-
|
164
|
-
# @yieldparam [GetAllIndexOptions] self
|
165
|
-
def initialize
|
166
|
-
yield self if block_given?
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
class CreateIndexOptions
|
171
|
-
# @return [Boolean] do not raise error if the index already exist
|
172
|
-
attr_accessor :ignore_if_exists
|
173
|
-
|
174
|
-
# @return [Integer] the number of replicas that this index should have
|
175
|
-
attr_accessor :num_replicas
|
176
|
-
|
177
|
-
# @return [Boolean] whether the index should be created as a deferred index.
|
178
|
-
attr_accessor :deferred
|
179
|
-
|
180
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
181
|
-
attr_accessor :timeout
|
182
|
-
|
183
|
-
# @return [String] condition to apply to the index
|
184
|
-
attr_accessor :condition
|
185
|
-
|
186
|
-
# @return [String] the name of the scope
|
187
|
-
attr_accessor :scope_name
|
188
|
-
|
189
|
-
# @return [String] the name of the collection
|
190
|
-
attr_accessor :collection_name
|
191
|
-
|
192
|
-
# @yieldparam [CreateIndexOptions] self
|
193
|
-
def initialize
|
194
|
-
@ignore_if_exists = false
|
195
|
-
yield self if block_given?
|
196
|
-
end
|
442
|
+
def watch_indexes(bucket_name, index_names, timeout, options = Options::Query::WatchIndexes.new)
|
443
|
+
@backend.query_index_watch(bucket_name, index_names,
|
444
|
+
timeout.respond_to?(:in_milliseconds) ? timeout.public_send(:in_milliseconds) : timeout,
|
445
|
+
options.to_backend)
|
197
446
|
end
|
198
447
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
# @return [Boolean] do not raise error if the index already exist
|
204
|
-
attr_accessor :ignore_if_exists
|
448
|
+
# @api private
|
449
|
+
# TODO: deprecate after 3.2
|
450
|
+
GetAllIndexOptions = ::Couchbase::Management::Options::Query::GetAllIndexes
|
205
451
|
|
206
|
-
|
207
|
-
|
452
|
+
# @api private
|
453
|
+
# TODO: deprecate after 3.2
|
454
|
+
CreateIndexOptions = ::Couchbase::Management::Options::Query::CreateIndex
|
208
455
|
|
209
|
-
|
210
|
-
|
456
|
+
# @api private
|
457
|
+
# TODO: deprecate after 3.2
|
458
|
+
CreatePrimaryIndexOptions = ::Couchbase::Management::Options::Query::CreatePrimaryIndex
|
211
459
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
# @return [String] the name of the scope
|
216
|
-
attr_accessor :scope_name
|
217
|
-
|
218
|
-
# @return [String] the name of the collection
|
219
|
-
attr_accessor :collection_name
|
220
|
-
|
221
|
-
# @yieldparam [CreatePrimaryIndexOptions] self
|
222
|
-
def initialize
|
223
|
-
@ignore_if_exists = false
|
224
|
-
yield self if block_given?
|
225
|
-
end
|
226
|
-
end
|
460
|
+
# @api private
|
461
|
+
# TODO: deprecate after 3.2
|
462
|
+
DropIndexOptions = ::Couchbase::Management::Options::Query::DropIndex
|
227
463
|
|
228
|
-
|
229
|
-
|
230
|
-
|
464
|
+
# @api private
|
465
|
+
# TODO: deprecate after 3.2
|
466
|
+
DropPrimaryIndexOptions = ::Couchbase::Management::Options::Query::DropPrimaryIndex
|
231
467
|
|
232
|
-
|
233
|
-
|
468
|
+
# @api private
|
469
|
+
# TODO: deprecate after 3.2
|
470
|
+
BuildDeferredIndexOptions = ::Couchbase::Management::Options::Query::BuildDeferredIndexes
|
234
471
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
# @return [String] the name of the collection
|
239
|
-
attr_accessor :collection_name
|
240
|
-
|
241
|
-
# @yieldparam [DropIndexOptions] self
|
242
|
-
def initialize
|
243
|
-
@ignore_if_does_not_exist = false
|
244
|
-
yield self if block_given?
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
class DropPrimaryIndexOptions
|
249
|
-
# @return [String] name of the index
|
250
|
-
attr_accessor :index_name
|
251
|
-
|
252
|
-
# @return [Boolean] do not raise error if the index does not exist
|
253
|
-
attr_accessor :ignore_if_does_not_exist
|
254
|
-
|
255
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
256
|
-
attr_accessor :timeout
|
257
|
-
|
258
|
-
# @return [String] the name of the scope
|
259
|
-
attr_accessor :scope_name
|
260
|
-
|
261
|
-
# @return [String] the name of the collection
|
262
|
-
attr_accessor :collection_name
|
263
|
-
|
264
|
-
# @yieldparam [DropPrimaryIndexOptions] self
|
265
|
-
def initialize
|
266
|
-
@ignore_if_does_not_exist = false
|
267
|
-
yield self if block_given?
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
class WatchIndexesOptions
|
272
|
-
# @return [Boolean] whether or not to watch the primary index
|
273
|
-
attr_accessor :watch_primary
|
274
|
-
|
275
|
-
# @yieldparam [WatchIndexesOptions] self
|
276
|
-
def initialize
|
277
|
-
yield self if block_given?
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
class BuildDeferredIndexOptions
|
282
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
283
|
-
attr_accessor :timeout
|
284
|
-
|
285
|
-
# @yieldparam [BuildDeferredIndexOptions] self
|
286
|
-
def initialize
|
287
|
-
yield self if block_given?
|
288
|
-
end
|
289
|
-
end
|
472
|
+
# @api private
|
473
|
+
# TODO: deprecate after 3.2
|
474
|
+
WatchIndexesOptions = ::Couchbase::Management::Options::Query::WatchIndexes
|
290
475
|
end
|
291
476
|
|
292
477
|
class QueryIndex
|
@@ -333,6 +518,9 @@ module Couchbase
|
|
333
518
|
# (surrounded by backticks).
|
334
519
|
attr_accessor :condition
|
335
520
|
|
521
|
+
# @return [String] the string representation of the index's partition
|
522
|
+
attr_accessor :partition
|
523
|
+
|
336
524
|
# @yieldparam [QueryIndex] self
|
337
525
|
def initialize
|
338
526
|
yield self if block_given?
|