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
@@ -12,12 +12,178 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require "couchbase/errors"
|
16
|
-
|
17
15
|
require "rubygems/deprecate"
|
18
16
|
|
17
|
+
require "couchbase/errors"
|
18
|
+
require "couchbase/options"
|
19
|
+
|
19
20
|
module Couchbase
|
20
21
|
module Management
|
22
|
+
module Options
|
23
|
+
module Bucket
|
24
|
+
# Options for {BucketManager#create_bucket}
|
25
|
+
class CreateBucket < ::Couchbase::Options::Base
|
26
|
+
# Creates an instance of options for {BucketManager#create_bucket}
|
27
|
+
#
|
28
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
29
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
30
|
+
# @param [Hash, nil] client_context the client context data, if set
|
31
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
32
|
+
#
|
33
|
+
# @yieldparam [CreateBucket] self
|
34
|
+
def initialize(timeout: nil,
|
35
|
+
retry_strategy: nil,
|
36
|
+
client_context: nil,
|
37
|
+
parent_span: nil)
|
38
|
+
super
|
39
|
+
yield self if block_given?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Options for {BucketManager#update_bucket}
|
44
|
+
class UpdateBucket < ::Couchbase::Options::Base
|
45
|
+
# Creates an instance of options for {BucketManager#update_bucket}
|
46
|
+
#
|
47
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
48
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
49
|
+
# @param [Hash, nil] client_context the client context data, if set
|
50
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
51
|
+
#
|
52
|
+
# @yieldparam [UpdateBucket] self
|
53
|
+
def initialize(timeout: nil,
|
54
|
+
retry_strategy: nil,
|
55
|
+
client_context: nil,
|
56
|
+
parent_span: nil)
|
57
|
+
super
|
58
|
+
yield self if block_given?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Options for {BucketManager#drop_bucket}
|
63
|
+
class DropBucket < ::Couchbase::Options::Base
|
64
|
+
# Creates an instance of options for {BucketManager#drop_bucket}
|
65
|
+
#
|
66
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
67
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
68
|
+
# @param [Hash, nil] client_context the client context data, if set
|
69
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
70
|
+
#
|
71
|
+
# @yieldparam [DropBucket] self
|
72
|
+
def initialize(timeout: nil,
|
73
|
+
retry_strategy: nil,
|
74
|
+
client_context: nil,
|
75
|
+
parent_span: nil)
|
76
|
+
super
|
77
|
+
yield self if block_given?
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Options for {BucketManager#get_bucket}
|
82
|
+
class GetBucket < ::Couchbase::Options::Base
|
83
|
+
# Creates an instance of options for {BucketManager#get_bucket}
|
84
|
+
#
|
85
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
86
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
87
|
+
# @param [Hash, nil] client_context the client context data, if set
|
88
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
89
|
+
#
|
90
|
+
# @yieldparam [GetBucket] self
|
91
|
+
def initialize(timeout: nil,
|
92
|
+
retry_strategy: nil,
|
93
|
+
client_context: nil,
|
94
|
+
parent_span: nil)
|
95
|
+
super
|
96
|
+
yield self if block_given?
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Options for {BucketManager#get_all_buckets}
|
101
|
+
class GetAllBuckets < ::Couchbase::Options::Base
|
102
|
+
# Creates an instance of options for {BucketManager#get_all_buckets}
|
103
|
+
#
|
104
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
105
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
106
|
+
# @param [Hash, nil] client_context the client context data, if set
|
107
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
108
|
+
#
|
109
|
+
# @yieldparam [GetAllBuckets] self
|
110
|
+
def initialize(timeout: nil,
|
111
|
+
retry_strategy: nil,
|
112
|
+
client_context: nil,
|
113
|
+
parent_span: nil)
|
114
|
+
super
|
115
|
+
yield self if block_given?
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Options for {BucketManager#flush_bucket}
|
120
|
+
class FlushBucket < ::Couchbase::Options::Base
|
121
|
+
# Creates an instance of options for {BucketManager#flush_bucket}
|
122
|
+
#
|
123
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
124
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
125
|
+
# @param [Hash, nil] client_context the client context data, if set
|
126
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
127
|
+
#
|
128
|
+
# @yieldparam [FlushBucket] self
|
129
|
+
def initialize(timeout: nil,
|
130
|
+
retry_strategy: nil,
|
131
|
+
client_context: nil,
|
132
|
+
parent_span: nil)
|
133
|
+
super
|
134
|
+
yield self if block_given?
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# rubocop:disable Naming/MethodName constructor shortcuts
|
139
|
+
module_function
|
140
|
+
|
141
|
+
# Construct {CreateBucket} options for {BucketManager#create_bucket}
|
142
|
+
#
|
143
|
+
# @return [CreateBucket]
|
144
|
+
def CreateBucket(**args)
|
145
|
+
CreateBucket.new(**args)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Construct {UpdateBucket} options for {BucketManager#update_bucket}
|
149
|
+
#
|
150
|
+
# @return [UpdateBucket]
|
151
|
+
def UpdateBucket(**args)
|
152
|
+
UpdateBucket.new(**args)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Construct {DropBucket} options for {BucketManager#drop_bucket}
|
156
|
+
#
|
157
|
+
# @return [DropBucket]
|
158
|
+
def DropBucket(**args)
|
159
|
+
DropBucket.new(**args)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Construct {GetBucket} options for {BucketManager#get_bucket}
|
163
|
+
#
|
164
|
+
# @return [GetBucket]
|
165
|
+
def GetBucket(**args)
|
166
|
+
GetBucket.new(**args)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Construct {GetAllBuckets} options for {BucketManager#get_all_buckets}
|
170
|
+
#
|
171
|
+
# @return [GetAllBuckets]
|
172
|
+
def GetAllBuckets(**args)
|
173
|
+
GetAllBuckets.new(**args)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Construct {FlushBucket} options for {BucketManager#flush_bucket}
|
177
|
+
#
|
178
|
+
# @return [FlushBucket]
|
179
|
+
def FlushBucket(**args)
|
180
|
+
FlushBucket.new(**args)
|
181
|
+
end
|
182
|
+
|
183
|
+
# rubocop:enable Naming/MethodName
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
21
187
|
class BucketManager
|
22
188
|
alias inspect to_s
|
23
189
|
|
@@ -29,13 +195,13 @@ module Couchbase
|
|
29
195
|
# Creates new bucket
|
30
196
|
#
|
31
197
|
# @param [BucketSettings] settings bucket settings
|
32
|
-
# @param [
|
198
|
+
# @param [Options::Bucket::CreateBucket] options
|
33
199
|
#
|
34
200
|
# @return void
|
35
201
|
#
|
36
202
|
# @raise [ArgumentError]
|
37
203
|
# @raise [Error::BucketExists]
|
38
|
-
def create_bucket(settings, options =
|
204
|
+
def create_bucket(settings, options = Options::Bucket::CreateBucket.new)
|
39
205
|
@backend.bucket_create(
|
40
206
|
{
|
41
207
|
|
@@ -50,20 +216,20 @@ module Couchbase
|
|
50
216
|
compression_mode: settings.compression_mode,
|
51
217
|
minimum_durability_level: settings.minimum_durability_level,
|
52
218
|
conflict_resolution_type: settings.conflict_resolution_type,
|
53
|
-
}, options.
|
219
|
+
}, options.to_backend
|
54
220
|
)
|
55
221
|
end
|
56
222
|
|
57
223
|
# Updates the bucket settings
|
58
224
|
#
|
59
225
|
# @param [BucketSettings] settings bucket settings
|
60
|
-
# @param [
|
226
|
+
# @param [Options::Bucket::UpdateBucket] options
|
61
227
|
#
|
62
228
|
# @return void
|
63
229
|
#
|
64
230
|
# @raise [ArgumentError]
|
65
231
|
# @raise [Error::BucketNotFound]
|
66
|
-
def update_bucket(settings, options =
|
232
|
+
def update_bucket(settings, options = Options::Bucket::UpdateBucket.new)
|
67
233
|
@backend.bucket_update(
|
68
234
|
{
|
69
235
|
name: settings.name,
|
@@ -76,110 +242,80 @@ module Couchbase
|
|
76
242
|
max_expiry: settings.max_expiry,
|
77
243
|
compression_mode: settings.compression_mode,
|
78
244
|
minimum_durability_level: settings.minimum_durability_level,
|
79
|
-
}, options.
|
245
|
+
}, options.to_backend
|
80
246
|
)
|
81
247
|
end
|
82
248
|
|
83
249
|
# Removes a bucket
|
84
250
|
#
|
85
251
|
# @param [String] bucket_name name of the bucket
|
86
|
-
# @param [
|
252
|
+
# @param [Options::Bucket::DropBucket] options
|
87
253
|
#
|
88
254
|
# @return void
|
89
255
|
#
|
90
256
|
# @raise [ArgumentError]
|
91
257
|
# @raise [Error::BucketNotFound]
|
92
|
-
def drop_bucket(bucket_name, options =
|
93
|
-
@backend.bucket_drop(bucket_name, options.
|
258
|
+
def drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new)
|
259
|
+
@backend.bucket_drop(bucket_name, options.to_backend)
|
94
260
|
end
|
95
261
|
|
96
262
|
# Fetch settings of the bucket
|
97
263
|
#
|
98
264
|
# @param [String] bucket_name name of the bucket
|
99
|
-
# @param [
|
265
|
+
# @param [Options::Bucket::GetBucket] options
|
100
266
|
#
|
101
267
|
# @return [BucketSettings]
|
102
268
|
#
|
103
269
|
# @raise [ArgumentError]
|
104
270
|
# @raise [Error::BucketNotFound]
|
105
|
-
def get_bucket(bucket_name, options =
|
106
|
-
|
107
|
-
extract_bucket_settings(res)
|
271
|
+
def get_bucket(bucket_name, options = Options::Bucket::GetBucket.new)
|
272
|
+
extract_bucket_settings(@backend.bucket_get(bucket_name, options.to_backend))
|
108
273
|
end
|
109
274
|
|
110
275
|
# Get settings for all buckets
|
111
276
|
#
|
112
|
-
# @param [
|
277
|
+
# @param [Options::Bucket::GetAllBuckets] options
|
113
278
|
# @return [Array<BucketSettings>]
|
114
|
-
def get_all_buckets(options =
|
115
|
-
|
116
|
-
|
279
|
+
def get_all_buckets(options = Options::Bucket::GetAllBuckets.new)
|
280
|
+
@backend.bucket_get_all(options.to_backend)
|
281
|
+
.map { |entry| extract_bucket_settings(entry) }
|
117
282
|
end
|
118
283
|
|
119
284
|
# @param [String] bucket_name name of the bucket
|
285
|
+
# @param [Options::Bucket::FlushBucket] options
|
120
286
|
#
|
121
287
|
# @return void
|
122
288
|
#
|
123
289
|
# @raise [ArgumentError]
|
124
290
|
# @raise [Error::BucketNotFound]
|
125
291
|
# @raise [Error::BucketNotFlushable]
|
126
|
-
def flush_bucket(bucket_name, options =
|
127
|
-
@backend.bucket_flush(bucket_name, options.
|
128
|
-
end
|
129
|
-
|
130
|
-
class CreateBucketOptions
|
131
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
132
|
-
attr_accessor :timeout
|
133
|
-
|
134
|
-
def initialize
|
135
|
-
yield self if block_given?
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
class UpdateBucketOptions
|
140
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
141
|
-
attr_accessor :timeout
|
142
|
-
|
143
|
-
def initialize
|
144
|
-
yield self if block_given?
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
class DropBucketOptions
|
149
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
150
|
-
attr_accessor :timeout
|
151
|
-
|
152
|
-
def initialize
|
153
|
-
yield self if block_given?
|
154
|
-
end
|
292
|
+
def flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new)
|
293
|
+
@backend.bucket_flush(bucket_name, options.to_backend)
|
155
294
|
end
|
156
295
|
|
157
|
-
|
158
|
-
|
159
|
-
|
296
|
+
# @api private
|
297
|
+
# TODO: deprecate after 3.2
|
298
|
+
CreateBucketOptions = ::Couchbase::Management::Options::Bucket::CreateBucket
|
160
299
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
end
|
300
|
+
# @api private
|
301
|
+
# TODO: deprecate after 3.2
|
302
|
+
UpdateBucketOptions = ::Couchbase::Management::Options::Bucket::UpdateBucket
|
165
303
|
|
166
|
-
|
167
|
-
|
168
|
-
|
304
|
+
# @api private
|
305
|
+
# TODO: deprecate after 3.2
|
306
|
+
DropBucketOptions = ::Couchbase::Management::Options::Bucket::DropBucket
|
169
307
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
end
|
308
|
+
# @api private
|
309
|
+
# TODO: deprecate after 3.2
|
310
|
+
GetBucketOptions = ::Couchbase::Management::Options::Bucket::GetBucket
|
174
311
|
|
175
|
-
|
176
|
-
|
177
|
-
|
312
|
+
# @api private
|
313
|
+
# TODO: deprecate after 3.2
|
314
|
+
GetAllBucketsOptions = ::Couchbase::Management::Options::Bucket::GetAllBuckets
|
178
315
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
316
|
+
# @api private
|
317
|
+
# TODO: deprecate after 3.2
|
318
|
+
FlushBucketOptions = ::Couchbase::Management::Options::Bucket::FlushBucket
|
183
319
|
|
184
320
|
private
|
185
321
|
|
@@ -263,12 +399,14 @@ module Couchbase
|
|
263
399
|
def ejection_policy
|
264
400
|
@eviction_policy
|
265
401
|
end
|
402
|
+
|
266
403
|
deprecate :ejection_policy, :eviction_policy, 2021, 1
|
267
404
|
|
268
405
|
# @deprecated Use {#eviction_policy=} instead
|
269
406
|
def ejection_policy=(val)
|
270
407
|
@eviction_policy = val
|
271
408
|
end
|
409
|
+
|
272
410
|
deprecate :ejection_policy=, :eviction_policy=, 2021, 1
|
273
411
|
|
274
412
|
# @yieldparam [BucketSettings] self
|
@@ -15,9 +15,149 @@
|
|
15
15
|
require "rubygems/deprecate"
|
16
16
|
|
17
17
|
require "couchbase/errors"
|
18
|
+
require "couchbase/options"
|
18
19
|
|
19
20
|
module Couchbase
|
20
21
|
module Management
|
22
|
+
module Options
|
23
|
+
module Collection
|
24
|
+
# Options for {CollectionManager#get_all_scopes}
|
25
|
+
class GetAllScopes < ::Couchbase::Options::Base
|
26
|
+
# Creates an instance of options for {CollectionManager#get_all_scopes}
|
27
|
+
#
|
28
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
29
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
30
|
+
# @param [Hash, nil] client_context the client context data, if set
|
31
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
32
|
+
#
|
33
|
+
# @yieldparam [GetAllScopes] self
|
34
|
+
def initialize(timeout: nil,
|
35
|
+
retry_strategy: nil,
|
36
|
+
client_context: nil,
|
37
|
+
parent_span: nil)
|
38
|
+
super
|
39
|
+
yield self if block_given?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Options for {CollectionManager#create_scope}
|
44
|
+
class CreateScope < ::Couchbase::Options::Base
|
45
|
+
# Creates an instance of options for {CollectionManager#create_scope}
|
46
|
+
#
|
47
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
48
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
49
|
+
# @param [Hash, nil] client_context the client context data, if set
|
50
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
51
|
+
#
|
52
|
+
# @yieldparam [CreateScope] self
|
53
|
+
def initialize(timeout: nil,
|
54
|
+
retry_strategy: nil,
|
55
|
+
client_context: nil,
|
56
|
+
parent_span: nil)
|
57
|
+
super
|
58
|
+
yield self if block_given?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Options for {CollectionManager#drop_scope}
|
63
|
+
class DropScope < ::Couchbase::Options::Base
|
64
|
+
# Creates an instance of options for {CollectionManager#drop_scope}
|
65
|
+
#
|
66
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
67
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
68
|
+
# @param [Hash, nil] client_context the client context data, if set
|
69
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
70
|
+
#
|
71
|
+
# @yieldparam [DropScope] self
|
72
|
+
def initialize(timeout: nil,
|
73
|
+
retry_strategy: nil,
|
74
|
+
client_context: nil,
|
75
|
+
parent_span: nil)
|
76
|
+
super
|
77
|
+
yield self if block_given?
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Options for {CollectionManager#create_collection}
|
82
|
+
class CreateCollection < ::Couchbase::Options::Base
|
83
|
+
# Creates an instance of options for {CollectionManager#create_collection}
|
84
|
+
#
|
85
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
86
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
87
|
+
# @param [Hash, nil] client_context the client context data, if set
|
88
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
89
|
+
#
|
90
|
+
# @yieldparam [CreateCollection] self
|
91
|
+
def initialize(timeout: nil,
|
92
|
+
retry_strategy: nil,
|
93
|
+
client_context: nil,
|
94
|
+
parent_span: nil)
|
95
|
+
super
|
96
|
+
yield self if block_given?
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Options for {CollectionManager#drop_collection}
|
101
|
+
class DropCollection < ::Couchbase::Options::Base
|
102
|
+
# Creates an instance of options for {CollectionManager#drop_collection}
|
103
|
+
#
|
104
|
+
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
105
|
+
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
106
|
+
# @param [Hash, nil] client_context the client context data, if set
|
107
|
+
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
108
|
+
#
|
109
|
+
# @yieldparam [DropCollection] self
|
110
|
+
def initialize(timeout: nil,
|
111
|
+
retry_strategy: nil,
|
112
|
+
client_context: nil,
|
113
|
+
parent_span: nil)
|
114
|
+
super
|
115
|
+
yield self if block_given?
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# rubocop:disable Naming/MethodName constructor shortcuts
|
120
|
+
module_function
|
121
|
+
|
122
|
+
# Construct {GetAllScopes} options for {CollectionManager#get_all_scopes}
|
123
|
+
#
|
124
|
+
# @return [GetAllScopes]
|
125
|
+
def GetAllScopes(**args)
|
126
|
+
GetAllScopes.new(**args)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Construct {CreateScope} options for {CollectionManager#create_scope}
|
130
|
+
#
|
131
|
+
# @return [CreateScope]
|
132
|
+
def CreateScope(**args)
|
133
|
+
CreateScope.new(**args)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Construct {DropScope} options for {CollectionManager#drop_scope}
|
137
|
+
#
|
138
|
+
# @return [DropScope]
|
139
|
+
def DropScope(**args)
|
140
|
+
DropScope.new(**args)
|
141
|
+
end
|
142
|
+
|
143
|
+
# Construct {CreateCollection} options for {CollectionManager#create_collection}
|
144
|
+
#
|
145
|
+
# @return [CreateCollection]
|
146
|
+
def CreateCollection(**args)
|
147
|
+
CreateCollection.new(**args)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Construct {DropCollection} options for {CollectionManager#drop_collection}
|
151
|
+
#
|
152
|
+
# @return [DropCollection]
|
153
|
+
def DropCollection(**args)
|
154
|
+
DropCollection.new(**args)
|
155
|
+
end
|
156
|
+
|
157
|
+
# rubocop:enable Naming/MethodName
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
21
161
|
class CollectionManager
|
22
162
|
extend Gem::Deprecate
|
23
163
|
|
@@ -32,11 +172,11 @@ module Couchbase
|
|
32
172
|
|
33
173
|
# Get all scopes
|
34
174
|
#
|
35
|
-
# @param [
|
175
|
+
# @param [Options::Collection::GetAllScopes] options
|
36
176
|
#
|
37
177
|
# @return [Array<ScopeSpec>]
|
38
|
-
def get_all_scopes(options =
|
39
|
-
res = @backend.scope_get_all(@bucket_name, options.
|
178
|
+
def get_all_scopes(options = Options::Collection::GetAllScopes.new)
|
179
|
+
res = @backend.scope_get_all(@bucket_name, options.to_backend)
|
40
180
|
res[:scopes].map do |s|
|
41
181
|
ScopeSpec.new do |scope|
|
42
182
|
scope.name = s[:name]
|
@@ -61,61 +201,63 @@ module Couchbase
|
|
61
201
|
#
|
62
202
|
# @raise [Error::ScopeNotFound]
|
63
203
|
def get_scope(scope_name, options = GetScopeOptions.new)
|
64
|
-
get_all_scopes(
|
204
|
+
get_all_scopes(Options::Collection::GetAllScopes(timeout: options.timeout))
|
65
205
|
.find { |scope| scope.name == scope_name } or raise Error::ScopeNotFound, "unable to find scope #{scope_name}"
|
66
206
|
end
|
207
|
+
|
67
208
|
deprecate :get_scope, :get_all_scopes, 2021, 6
|
68
209
|
|
69
210
|
# Creates a new scope
|
70
211
|
#
|
71
212
|
# @param [String] scope_name name of the scope
|
72
|
-
# @param [
|
213
|
+
# @param [Options::Collection::CreateScope] options
|
73
214
|
#
|
74
215
|
# @return void
|
75
216
|
#
|
76
217
|
# @raise [ArgumentError]
|
77
|
-
def create_scope(scope_name, options =
|
78
|
-
@backend.scope_create(@bucket_name, scope_name, options.
|
218
|
+
def create_scope(scope_name, options = Options::Collection::CreateScope.new)
|
219
|
+
@backend.scope_create(@bucket_name, scope_name, options.to_backend)
|
79
220
|
end
|
80
221
|
|
81
222
|
# Removes a scope
|
82
223
|
#
|
83
224
|
# @param [String] scope_name name of the scope
|
84
|
-
# @param [
|
225
|
+
# @param [Options::Collection::DropScope] options
|
85
226
|
#
|
86
227
|
# @return void
|
87
228
|
#
|
88
229
|
# @raise [Error::ScopeNotFound]
|
89
|
-
def drop_scope(scope_name, options =
|
90
|
-
@backend.scope_drop(@bucket_name, scope_name, options.
|
230
|
+
def drop_scope(scope_name, options = Options::Collection::DropScope.new)
|
231
|
+
@backend.scope_drop(@bucket_name, scope_name, options.to_backend)
|
91
232
|
end
|
92
233
|
|
93
234
|
# Creates a new collection
|
94
235
|
#
|
95
236
|
# @param [CollectionSpec] collection specification of the collection
|
96
|
-
# @param [
|
237
|
+
# @param [Options::Collection::CreateCollection] options
|
97
238
|
#
|
98
239
|
# @return void
|
99
240
|
#
|
100
241
|
# @raise [ArgumentError]
|
101
242
|
# @raise [Error::CollectionExist]
|
102
243
|
# @raise [Error::ScopeNotFound]
|
103
|
-
def create_collection(collection, options =
|
104
|
-
@backend.collection_create(@bucket_name, collection.scope_name, collection.name, collection.max_expiry, options.
|
244
|
+
def create_collection(collection, options = Options::Collection::CreateCollection.new)
|
245
|
+
@backend.collection_create(@bucket_name, collection.scope_name, collection.name, collection.max_expiry, options.to_backend)
|
105
246
|
end
|
106
247
|
|
107
248
|
# Removes a collection
|
108
249
|
#
|
109
250
|
# @param [CollectionSpec] collection specification of the collection
|
110
|
-
# @param [
|
251
|
+
# @param [Options::Collection::DropCollection] options
|
111
252
|
#
|
112
253
|
# @return void
|
113
254
|
#
|
114
255
|
# @raise [Error::CollectionNotFound]
|
115
|
-
def drop_collection(collection, options =
|
116
|
-
@backend.collection_drop(@bucket_name, collection.scope_name, collection.name, options.
|
256
|
+
def drop_collection(collection, options = Options::Collection::DropCollection.new)
|
257
|
+
@backend.collection_drop(@bucket_name, collection.scope_name, collection.name, options.to_backend)
|
117
258
|
end
|
118
259
|
|
260
|
+
# @deprecated use {CollectionManager#get_all_scopes} instead
|
119
261
|
class GetScopeOptions
|
120
262
|
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
121
263
|
attr_accessor :timeout
|
@@ -126,55 +268,25 @@ module Couchbase
|
|
126
268
|
end
|
127
269
|
end
|
128
270
|
|
129
|
-
|
130
|
-
|
131
|
-
|
271
|
+
# @api private
|
272
|
+
# TODO: deprecate after 3.2
|
273
|
+
GetAllScopesOptions = ::Couchbase::Management::Options::Collection::GetAllScopes
|
132
274
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
class CreateScopeOptions
|
140
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
141
|
-
attr_accessor :timeout
|
142
|
-
|
143
|
-
# @yieldparam [CreateScopeOptions] self
|
144
|
-
def initialize
|
145
|
-
yield self if block_given?
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
class DropScopeOptions
|
150
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
151
|
-
attr_accessor :timeout
|
152
|
-
|
153
|
-
# @yieldparam [DropScopeOptions] self
|
154
|
-
def initialize
|
155
|
-
yield self if block_given?
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
class CreateCollectionOptions
|
160
|
-
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
161
|
-
attr_accessor :timeout
|
275
|
+
# @api private
|
276
|
+
# TODO: deprecate after 3.2
|
277
|
+
CreateScopeOptions = ::Couchbase::Management::Options::Collection::CreateScope
|
162
278
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
end
|
167
|
-
end
|
279
|
+
# @api private
|
280
|
+
# TODO: deprecate after 3.2
|
281
|
+
DropScopeOptions = ::Couchbase::Management::Options::Collection::DropScope
|
168
282
|
|
169
|
-
|
170
|
-
|
171
|
-
|
283
|
+
# @api private
|
284
|
+
# TODO: deprecate after 3.2
|
285
|
+
CreateCollectionOptions = ::Couchbase::Management::Options::Collection::CreateCollection
|
172
286
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
end
|
177
|
-
end
|
287
|
+
# @api private
|
288
|
+
# TODO: deprecate after 3.2
|
289
|
+
DropCollectionOptions = ::Couchbase::Management::Options::Collection::DropCollection
|
178
290
|
end
|
179
291
|
|
180
292
|
class ScopeSpec
|