couchbase 3.0.1 → 3.0.2
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 +73 -4
- data/ext/build_config.hxx.in +2 -0
- data/ext/build_version.hxx.in +11 -8
- data/ext/cmake/BuildTracing.cmake +1 -1
- data/ext/cmake/CompilerWarnings.cmake +5 -0
- data/ext/cmake/Testing.cmake +3 -6
- data/ext/couchbase/bucket.hxx +9 -1
- data/ext/couchbase/cbsasl/client.h +1 -1
- data/ext/couchbase/cluster.hxx +89 -6
- data/ext/couchbase/configuration.hxx +2 -0
- data/ext/couchbase/couchbase.cxx +1647 -507
- data/ext/couchbase/diagnostics.hxx +0 -3
- data/ext/couchbase/io/dns_client.hxx +2 -2
- data/ext/couchbase/io/http_command.hxx +6 -3
- data/ext/couchbase/io/http_session.hxx +14 -18
- data/ext/couchbase/io/http_session_manager.hxx +83 -2
- data/ext/couchbase/io/mcbp_command.hxx +4 -1
- data/ext/couchbase/io/mcbp_context.hxx +37 -0
- data/ext/couchbase/io/mcbp_session.hxx +91 -30
- data/ext/couchbase/operations.hxx +5 -0
- data/ext/couchbase/operations/analytics_dataset_create.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataset_drop.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataset_get_all.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataverse_create.hxx +3 -2
- data/ext/couchbase/operations/analytics_dataverse_drop.hxx +3 -2
- data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +3 -2
- data/ext/couchbase/operations/analytics_index_create.hxx +3 -2
- data/ext/couchbase/operations/analytics_index_drop.hxx +3 -2
- data/ext/couchbase/operations/analytics_index_get_all.hxx +5 -2
- data/ext/couchbase/operations/analytics_link_connect.hxx +3 -2
- data/ext/couchbase/operations/analytics_link_disconnect.hxx +3 -2
- data/ext/couchbase/operations/bucket_create.hxx +3 -2
- data/ext/couchbase/operations/bucket_drop.hxx +3 -2
- data/ext/couchbase/operations/bucket_flush.hxx +3 -2
- data/ext/couchbase/operations/bucket_get.hxx +3 -2
- data/ext/couchbase/operations/bucket_get_all.hxx +3 -2
- data/ext/couchbase/operations/bucket_update.hxx +3 -2
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +3 -2
- data/ext/couchbase/operations/collection_create.hxx +3 -2
- data/ext/couchbase/operations/collection_drop.hxx +3 -2
- data/ext/couchbase/operations/collections_manifest_get.hxx +3 -2
- data/ext/couchbase/operations/document_analytics.hxx +3 -2
- data/ext/couchbase/operations/document_append.hxx +77 -0
- data/ext/couchbase/operations/document_decrement.hxx +3 -2
- data/ext/couchbase/operations/document_exists.hxx +3 -2
- data/ext/couchbase/operations/document_get.hxx +3 -2
- data/ext/couchbase/operations/document_get_and_lock.hxx +3 -2
- data/ext/couchbase/operations/document_get_and_touch.hxx +3 -2
- data/ext/couchbase/operations/document_get_projected.hxx +3 -2
- data/ext/couchbase/operations/document_increment.hxx +3 -2
- data/ext/couchbase/operations/document_insert.hxx +3 -2
- data/ext/couchbase/operations/document_lookup_in.hxx +8 -2
- data/ext/couchbase/operations/document_mutate_in.hxx +13 -2
- data/ext/couchbase/operations/document_prepend.hxx +77 -0
- data/ext/couchbase/operations/document_query.hxx +3 -2
- data/ext/couchbase/operations/document_remove.hxx +5 -2
- data/ext/couchbase/operations/document_replace.hxx +3 -2
- data/ext/couchbase/operations/document_search.hxx +3 -2
- data/ext/couchbase/operations/document_touch.hxx +3 -2
- data/ext/couchbase/operations/document_unlock.hxx +3 -2
- data/ext/couchbase/operations/document_upsert.hxx +3 -2
- data/ext/couchbase/operations/document_view.hxx +3 -2
- data/ext/couchbase/operations/group_drop.hxx +3 -2
- data/ext/couchbase/operations/group_get.hxx +3 -2
- data/ext/couchbase/operations/group_get_all.hxx +3 -2
- data/ext/couchbase/operations/group_upsert.hxx +3 -2
- data/ext/couchbase/operations/http_noop.hxx +78 -0
- data/ext/couchbase/operations/mcbp_noop.hxx +61 -0
- data/ext/couchbase/operations/query_index_build_deferred.hxx +3 -2
- data/ext/couchbase/operations/query_index_create.hxx +3 -2
- data/ext/couchbase/operations/query_index_drop.hxx +3 -2
- data/ext/couchbase/operations/query_index_get_all.hxx +3 -2
- data/ext/couchbase/operations/role_get_all.hxx +3 -2
- data/ext/couchbase/operations/scope_create.hxx +3 -2
- data/ext/couchbase/operations/scope_drop.hxx +3 -2
- data/ext/couchbase/operations/scope_get_all.hxx +3 -2
- data/ext/couchbase/operations/search_get_stats.hxx +3 -2
- data/ext/couchbase/operations/search_index_analyze_document.hxx +3 -2
- data/ext/couchbase/operations/search_index_control_ingest.hxx +3 -2
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +3 -2
- data/ext/couchbase/operations/search_index_control_query.hxx +3 -2
- data/ext/couchbase/operations/search_index_drop.hxx +3 -2
- data/ext/couchbase/operations/search_index_get.hxx +3 -2
- data/ext/couchbase/operations/search_index_get_all.hxx +3 -2
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +3 -2
- data/ext/couchbase/operations/search_index_get_stats.hxx +3 -2
- data/ext/couchbase/operations/search_index_upsert.hxx +3 -2
- data/ext/couchbase/operations/user_drop.hxx +3 -2
- data/ext/couchbase/operations/user_get.hxx +3 -2
- data/ext/couchbase/operations/user_get_all.hxx +3 -2
- data/ext/couchbase/operations/user_upsert.hxx +3 -2
- data/ext/couchbase/operations/view_index_drop.hxx +3 -2
- data/ext/couchbase/operations/view_index_get.hxx +3 -2
- data/ext/couchbase/operations/view_index_get_all.hxx +3 -2
- data/ext/couchbase/operations/view_index_upsert.hxx +3 -2
- data/ext/couchbase/platform/terminate_handler.cc +5 -2
- data/ext/couchbase/protocol/client_opcode.hxx +368 -0
- data/ext/couchbase/protocol/cmd_append.hxx +145 -0
- data/ext/couchbase/protocol/cmd_hello.hxx +1 -0
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +11 -3
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +46 -4
- data/ext/couchbase/protocol/cmd_noop.hxx +82 -0
- data/ext/couchbase/protocol/cmd_prepend.hxx +145 -0
- data/ext/couchbase/protocol/durability_level.hxx +16 -0
- data/ext/couchbase/protocol/hello_feature.hxx +9 -0
- data/ext/couchbase/protocol/unsigned_leb128.h +2 -2
- data/ext/couchbase/service_type.hxx +1 -1
- data/ext/couchbase/version.hxx +18 -4
- data/ext/extconf.rb +9 -6
- data/ext/test/CMakeLists.txt +5 -0
- data/ext/test/test_helper.hxx +3 -3
- data/ext/test/test_helper_native.hxx +2 -5
- data/ext/test/test_native_binary_operations.cxx +186 -0
- data/ext/test/test_native_diagnostics.cxx +54 -3
- data/ext/test/test_ruby_trivial_crud.cxx +1 -1
- data/lib/couchbase.rb +1 -0
- data/lib/couchbase/analytics_options.rb +1 -71
- data/lib/couchbase/binary_collection.rb +60 -22
- data/lib/couchbase/binary_collection_options.rb +0 -76
- data/lib/couchbase/bucket.rb +40 -36
- data/lib/couchbase/cluster.rb +89 -156
- data/lib/couchbase/collection.rb +290 -72
- data/lib/couchbase/collection_options.rb +30 -243
- data/lib/couchbase/datastructures/couchbase_list.rb +5 -16
- data/lib/couchbase/datastructures/couchbase_map.rb +5 -16
- data/lib/couchbase/datastructures/couchbase_queue.rb +5 -16
- data/lib/couchbase/datastructures/couchbase_set.rb +5 -16
- data/lib/couchbase/diagnostics.rb +181 -0
- data/lib/couchbase/json_transcoder.rb +1 -1
- data/lib/couchbase/{common_options.rb → logger.rb} +24 -11
- data/lib/couchbase/management/query_index_manager.rb +1 -1
- data/lib/couchbase/management/user_manager.rb +3 -0
- data/lib/couchbase/options.rb +2094 -0
- data/lib/couchbase/query_options.rb +1 -144
- data/lib/couchbase/scope.rb +8 -25
- data/lib/couchbase/search_options.rb +0 -93
- data/lib/couchbase/version.rb +20 -1
- data/lib/couchbase/view_options.rb +1 -91
- metadata +19 -7
|
@@ -15,79 +15,11 @@
|
|
|
15
15
|
require "rubygems/deprecate"
|
|
16
16
|
|
|
17
17
|
require "couchbase/json_transcoder"
|
|
18
|
-
require "couchbase/common_options"
|
|
19
18
|
require "couchbase/subdoc"
|
|
20
19
|
require "couchbase/mutation_state"
|
|
21
20
|
|
|
22
21
|
module Couchbase
|
|
23
22
|
class Collection
|
|
24
|
-
class GetOptions < CommonOptions
|
|
25
|
-
# @return [Boolean] if the expiration should also fetched with get
|
|
26
|
-
attr_accessor :with_expiry
|
|
27
|
-
|
|
28
|
-
# @return [JsonTranscoder] transcoder used for decoding
|
|
29
|
-
attr_accessor :transcoder
|
|
30
|
-
|
|
31
|
-
# @yieldparam [GetOptions] self
|
|
32
|
-
def initialize
|
|
33
|
-
super
|
|
34
|
-
@transcoder = JsonTranscoder.new
|
|
35
|
-
@preserve_array_indexes = false
|
|
36
|
-
@with_expiry = nil
|
|
37
|
-
@projections = nil
|
|
38
|
-
yield self if block_given?
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# Allows to specify a custom list paths to fetch from the document instead of the whole.
|
|
42
|
-
#
|
|
43
|
-
# Note that a maximum of 16 individual paths can be projected at a time due to a server limitation. If you need
|
|
44
|
-
# more than that, think about fetching less-generic paths or the full document straight away.
|
|
45
|
-
#
|
|
46
|
-
# @param [String, Array<String>] paths a path that should be loaded if present.
|
|
47
|
-
def project(*paths)
|
|
48
|
-
@projections ||= []
|
|
49
|
-
@projections |= paths.flatten # union with current projections
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# @api private
|
|
53
|
-
# @return [Boolean] whether to use sparse arrays (default false)
|
|
54
|
-
attr_accessor :preserve_array_indexes
|
|
55
|
-
|
|
56
|
-
# @api private
|
|
57
|
-
# @return [Array<String>] list of paths to project
|
|
58
|
-
attr_accessor :projections
|
|
59
|
-
|
|
60
|
-
# @api private
|
|
61
|
-
# @return [Boolean]
|
|
62
|
-
def need_projected_get?
|
|
63
|
-
@with_expiry || !@projections.nil?
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
class GetAndLockOptions < CommonOptions
|
|
68
|
-
# @return [JsonTranscoder] transcoder used for decoding
|
|
69
|
-
attr_accessor :transcoder
|
|
70
|
-
|
|
71
|
-
# @yieldparam [GetAndLockOptions] self
|
|
72
|
-
def initialize
|
|
73
|
-
super
|
|
74
|
-
@transcoder = JsonTranscoder.new
|
|
75
|
-
yield self if block_given?
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
class GetAndTouchOptions < CommonOptions
|
|
80
|
-
# @return [JsonTranscoder] transcoder used for decoding
|
|
81
|
-
attr_accessor :transcoder
|
|
82
|
-
|
|
83
|
-
# @yieldparam [GetAndTouchOptions] self
|
|
84
|
-
def initialize
|
|
85
|
-
super
|
|
86
|
-
@transcoder = JsonTranscoder.new
|
|
87
|
-
yield self if block_given?
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
23
|
class GetResult
|
|
92
24
|
extend Gem::Deprecate
|
|
93
25
|
|
|
@@ -97,6 +29,9 @@ module Couchbase
|
|
|
97
29
|
# @return [Integer] the expiration if fetched and present
|
|
98
30
|
attr_writer :expiry
|
|
99
31
|
|
|
32
|
+
# @return [Error::CouchbaseError, nil] error associated with the result, or nil (used in {Collection#get_multi})
|
|
33
|
+
attr_accessor :error
|
|
34
|
+
|
|
100
35
|
# @return [String] The encoded content when loading the document
|
|
101
36
|
# @api private
|
|
102
37
|
attr_accessor :encoded
|
|
@@ -107,7 +42,7 @@ module Couchbase
|
|
|
107
42
|
#
|
|
108
43
|
# @return [Object]
|
|
109
44
|
def content(transcoder = self.transcoder)
|
|
110
|
-
transcoder.decode(@encoded, @flags)
|
|
45
|
+
transcoder ? transcoder.decode(@encoded, @flags) : @encoded
|
|
111
46
|
end
|
|
112
47
|
|
|
113
48
|
# @return [Time] time when the document will expire
|
|
@@ -118,6 +53,7 @@ module Couchbase
|
|
|
118
53
|
# @yieldparam [GetResult] self
|
|
119
54
|
def initialize
|
|
120
55
|
@expiry = nil
|
|
56
|
+
@error = nil
|
|
121
57
|
yield self if block_given?
|
|
122
58
|
end
|
|
123
59
|
|
|
@@ -130,48 +66,18 @@ module Couchbase
|
|
|
130
66
|
|
|
131
67
|
# @deprecated Use {#expiry_time}
|
|
132
68
|
# @return [Integer] the expiration if fetched and present
|
|
133
|
-
def expiry
|
|
69
|
+
def expiry # rubocop:disable Style/TrivialAccessors will be removed in next major release
|
|
134
70
|
@expiry
|
|
135
71
|
end
|
|
136
72
|
deprecate :expiry, :expiry_time, 2021, 1
|
|
137
73
|
end
|
|
138
74
|
|
|
139
|
-
class GetAllReplicasOptions < CommonOptions
|
|
140
|
-
# @return [JsonTranscoder] transcoder used for decoding
|
|
141
|
-
attr_accessor :transcoder
|
|
142
|
-
|
|
143
|
-
# @yieldparam [GetAllReplicasOptions] self
|
|
144
|
-
def initialize
|
|
145
|
-
super
|
|
146
|
-
yield self if block_given?
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
class GetAnyReplicaOptions < CommonOptions
|
|
151
|
-
# @return [JsonTranscoder] transcoder used for decoding
|
|
152
|
-
attr_accessor :transcoder
|
|
153
|
-
|
|
154
|
-
# @yieldparam [GetAnyReplicaOptions] self
|
|
155
|
-
def initialize
|
|
156
|
-
super
|
|
157
|
-
yield self if block_given?
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
|
|
161
75
|
class GetReplicaResult < GetResult
|
|
162
76
|
# @return [Boolean] true if this result came from a replica
|
|
163
77
|
attr_accessor :is_replica
|
|
164
78
|
alias replica? is_replica
|
|
165
79
|
end
|
|
166
80
|
|
|
167
|
-
class ExistsOptions < CommonOptions
|
|
168
|
-
# @yieldparam [ExistsOptions] self
|
|
169
|
-
def initialize
|
|
170
|
-
super
|
|
171
|
-
yield self if block_given?
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
81
|
class ExistsResult
|
|
176
82
|
# @return [Integer] holds the CAS value of the fetched document
|
|
177
83
|
attr_accessor :cas
|
|
@@ -195,81 +101,6 @@ module Couchbase
|
|
|
195
101
|
attr_accessor :partition_id
|
|
196
102
|
end
|
|
197
103
|
|
|
198
|
-
class RemoveOptions < CommonOptions
|
|
199
|
-
# @return [Integer] Specifies a CAS value that will be taken into account on the server side for optimistic concurrency
|
|
200
|
-
attr_accessor :cas
|
|
201
|
-
|
|
202
|
-
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
|
203
|
-
attr_accessor :durability_level
|
|
204
|
-
|
|
205
|
-
# @yieldparam [RemoveOptions]
|
|
206
|
-
def initialize
|
|
207
|
-
super
|
|
208
|
-
@durability_level = :none
|
|
209
|
-
yield self if block_given?
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
class InsertOptions < CommonOptions
|
|
214
|
-
# @return [Integer] expiration time to associate with the document
|
|
215
|
-
attr_accessor :expiry
|
|
216
|
-
|
|
217
|
-
# @return [Proc] transcoder used for encoding
|
|
218
|
-
attr_accessor :transcoder
|
|
219
|
-
|
|
220
|
-
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
|
221
|
-
attr_accessor :durability_level
|
|
222
|
-
|
|
223
|
-
# @yieldparam [InsertOptions]
|
|
224
|
-
def initialize
|
|
225
|
-
super
|
|
226
|
-
@transcoder = JsonTranscoder.new
|
|
227
|
-
@durability_level = :none
|
|
228
|
-
yield self if block_given?
|
|
229
|
-
end
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
class UpsertOptions < CommonOptions
|
|
233
|
-
# @return [Integer] expiration time to associate with the document
|
|
234
|
-
attr_accessor :expiry
|
|
235
|
-
|
|
236
|
-
# @return [JsonTranscoder] transcoder used for encoding
|
|
237
|
-
attr_accessor :transcoder
|
|
238
|
-
|
|
239
|
-
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
|
240
|
-
attr_accessor :durability_level
|
|
241
|
-
|
|
242
|
-
# @yieldparam [UpsertOptions]
|
|
243
|
-
def initialize
|
|
244
|
-
super
|
|
245
|
-
@transcoder = JsonTranscoder.new
|
|
246
|
-
@durability_level = :none
|
|
247
|
-
yield self if block_given?
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
class ReplaceOptions < CommonOptions
|
|
252
|
-
# @return [Integer] expiration time to associate with the document
|
|
253
|
-
attr_accessor :expiry
|
|
254
|
-
|
|
255
|
-
# @return [JsonTranscoder] transcoder used for encoding
|
|
256
|
-
attr_accessor :transcoder
|
|
257
|
-
|
|
258
|
-
# @return [Integer] Specifies a CAS value that will be taken into account on the server side for optimistic concurrency
|
|
259
|
-
attr_accessor :cas
|
|
260
|
-
|
|
261
|
-
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
|
262
|
-
attr_accessor :durability_level
|
|
263
|
-
|
|
264
|
-
# @yieldparam [ReplaceOptions]
|
|
265
|
-
def initialize
|
|
266
|
-
super
|
|
267
|
-
@transcoder = JsonTranscoder.new
|
|
268
|
-
@durability_level = :none
|
|
269
|
-
yield self if block_given?
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
|
|
273
104
|
class MutationResult
|
|
274
105
|
# @return [Integer] holds the CAS value of the document after the mutation
|
|
275
106
|
attr_accessor :cas
|
|
@@ -277,39 +108,13 @@ module Couchbase
|
|
|
277
108
|
# @return [MutationToken] if returned, holds the mutation token of the document after the mutation
|
|
278
109
|
attr_accessor :mutation_token
|
|
279
110
|
|
|
280
|
-
# @
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
end
|
|
284
|
-
end
|
|
285
|
-
|
|
286
|
-
class TouchOptions < CommonOptions
|
|
287
|
-
# @yieldparam [TouchOptions] self
|
|
288
|
-
def initialize
|
|
289
|
-
super
|
|
290
|
-
yield self if block_given?
|
|
291
|
-
end
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
class UnlockOptions < CommonOptions
|
|
295
|
-
# @yieldparam [UnlockOptions] self
|
|
296
|
-
def initialize
|
|
297
|
-
super
|
|
298
|
-
yield self if block_given?
|
|
299
|
-
end
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
class LookupInOptions < CommonOptions
|
|
303
|
-
# @return [Boolean] For internal use only: allows access to deleted documents that are in 'tombstone' form
|
|
304
|
-
attr_accessor :access_deleted
|
|
305
|
-
|
|
306
|
-
# @return [JsonTranscoder] transcoder used for decoding
|
|
307
|
-
attr_accessor :transcoder
|
|
111
|
+
# @return [Error::CouchbaseError, nil] error or nil (used in multi-operations like {Collection#upsert_multi},
|
|
112
|
+
# {Collection#remove_multi})
|
|
113
|
+
attr_accessor :error
|
|
308
114
|
|
|
309
|
-
# @yieldparam [
|
|
115
|
+
# @yieldparam [MutationResult] self
|
|
310
116
|
def initialize
|
|
311
|
-
|
|
312
|
-
@transcoder = JsonTranscoder.new
|
|
117
|
+
@error = nil
|
|
313
118
|
yield self if block_given?
|
|
314
119
|
end
|
|
315
120
|
end
|
|
@@ -336,11 +141,21 @@ module Couchbase
|
|
|
336
141
|
!encoded[index].nil? && encoded[index].exists
|
|
337
142
|
end
|
|
338
143
|
|
|
144
|
+
# @see MutateInOptions#create_as_deleted
|
|
145
|
+
#
|
|
146
|
+
# @return [Boolean] true if the document is a tombstone (created in deleted state)
|
|
147
|
+
def deleted?
|
|
148
|
+
@deleted
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
attr_accessor :deleted
|
|
152
|
+
|
|
339
153
|
# @return [Array<SubDocumentField>] holds the encoded subdocument responses
|
|
340
154
|
attr_accessor :encoded
|
|
341
155
|
|
|
342
156
|
# @yieldparam [LookupInResult] self
|
|
343
157
|
def initialize
|
|
158
|
+
@deleted = false
|
|
344
159
|
yield self if block_given?
|
|
345
160
|
end
|
|
346
161
|
|
|
@@ -359,43 +174,6 @@ module Couchbase
|
|
|
359
174
|
end
|
|
360
175
|
end
|
|
361
176
|
|
|
362
|
-
class MutateInOptions < CommonOptions
|
|
363
|
-
# @return [Integer] expiration time to associate with the document
|
|
364
|
-
attr_accessor :expiry
|
|
365
|
-
|
|
366
|
-
# Describes how the outer document store semantics on subdoc should act
|
|
367
|
-
#
|
|
368
|
-
# * +:replace+: replace the document, fail if it does not exist. This is the default
|
|
369
|
-
# * +:upsert+: replace the document or create if it does not exist
|
|
370
|
-
# * +:insert+: create the document, fail if it exists
|
|
371
|
-
#
|
|
372
|
-
# @return [:replace, :upsert, :insert]
|
|
373
|
-
attr_accessor :store_semantics
|
|
374
|
-
|
|
375
|
-
# @return [Integer] Specifies a CAS value that will be taken into account on the server side for optimistic concurrency
|
|
376
|
-
attr_accessor :cas
|
|
377
|
-
|
|
378
|
-
# @return [Boolean] For internal use only: allows access to deleted documents that are in 'tombstone' form
|
|
379
|
-
attr_accessor :access_deleted
|
|
380
|
-
|
|
381
|
-
# @return [Boolean] For internal use only: allows creating documents in 'tombstone' form
|
|
382
|
-
attr_accessor :create_as_deleted
|
|
383
|
-
|
|
384
|
-
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
|
385
|
-
attr_accessor :durability_level
|
|
386
|
-
|
|
387
|
-
# @yieldparam [MutateInOptions]
|
|
388
|
-
def initialize
|
|
389
|
-
super
|
|
390
|
-
@durability_level = :none
|
|
391
|
-
@store_semantics = :replace
|
|
392
|
-
@transcoder = JsonTranscoder.new
|
|
393
|
-
yield self if block_given?
|
|
394
|
-
end
|
|
395
|
-
|
|
396
|
-
attr_accessor :transcoder
|
|
397
|
-
end
|
|
398
|
-
|
|
399
177
|
class MutateInResult < MutationResult
|
|
400
178
|
# Decodes the content at the given index
|
|
401
179
|
#
|
|
@@ -411,6 +189,15 @@ module Couchbase
|
|
|
411
189
|
end
|
|
412
190
|
end
|
|
413
191
|
|
|
192
|
+
# @see MutateInOptions#create_as_deleted
|
|
193
|
+
#
|
|
194
|
+
# @return [Boolean] true if the document is a tombstone (created in deleted state)
|
|
195
|
+
def deleted?
|
|
196
|
+
@deleted
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
attr_accessor :deleted
|
|
200
|
+
|
|
414
201
|
# @yieldparam [MutateInResult] self
|
|
415
202
|
def initialize
|
|
416
203
|
super
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
require "couchbase/collection"
|
|
16
16
|
require "couchbase/errors"
|
|
17
|
+
require "couchbase/options"
|
|
17
18
|
|
|
18
19
|
module Couchbase
|
|
19
20
|
module Datastructures
|
|
@@ -28,8 +29,8 @@ module Couchbase
|
|
|
28
29
|
#
|
|
29
30
|
# @param [String] id the id of the document to back the list.
|
|
30
31
|
# @param [Collection] collection the Couchbase collection through which to interact with the document.
|
|
31
|
-
# @param [
|
|
32
|
-
def initialize(id, collection, options =
|
|
32
|
+
# @param [Options::CouchbaseList] options customization of the datastructure
|
|
33
|
+
def initialize(id, collection, options = Options::CouchbaseList.new)
|
|
33
34
|
@id = id
|
|
34
35
|
@collection = collection
|
|
35
36
|
@options = options
|
|
@@ -153,19 +154,7 @@ module Couchbase
|
|
|
153
154
|
end
|
|
154
155
|
end
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
attr_accessor :lookup_in_options
|
|
159
|
-
attr_accessor :mutate_in_options
|
|
160
|
-
attr_accessor :remove_options
|
|
161
|
-
|
|
162
|
-
def initialize
|
|
163
|
-
@get_options = Collection::GetOptions.new
|
|
164
|
-
@remove_options = Collection::RemoveOptions.new
|
|
165
|
-
@lookup_in_options = Collection::LookupInOptions.new
|
|
166
|
-
@mutate_in_options = Collection::MutateInOptions.new
|
|
167
|
-
@mutate_in_options.store_semantics = :upsert
|
|
168
|
-
end
|
|
169
|
-
end
|
|
157
|
+
# @api private
|
|
158
|
+
CouchbaseListOptions = ::Couchbase::Options::CouchbaseList
|
|
170
159
|
end
|
|
171
160
|
end
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
require "couchbase/collection"
|
|
16
|
+
require "couchbase/options"
|
|
16
17
|
require "couchbase/errors"
|
|
17
18
|
|
|
18
19
|
module Couchbase
|
|
@@ -28,8 +29,8 @@ module Couchbase
|
|
|
28
29
|
#
|
|
29
30
|
# @param [String] id the id of the document to back the map.
|
|
30
31
|
# @param [Collection] collection the Couchbase collection through which to interact with the document.
|
|
31
|
-
# @param [
|
|
32
|
-
def initialize(id, collection, options =
|
|
32
|
+
# @param [Options::CouchbaseMap] options customization of the datastructure
|
|
33
|
+
def initialize(id, collection, options = Options::CouchbaseMap.new)
|
|
33
34
|
@id = id
|
|
34
35
|
@collection = collection
|
|
35
36
|
@options = options
|
|
@@ -187,19 +188,7 @@ module Couchbase
|
|
|
187
188
|
end
|
|
188
189
|
end
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
attr_accessor :lookup_in_options
|
|
193
|
-
attr_accessor :mutate_in_options
|
|
194
|
-
attr_accessor :remove_options
|
|
195
|
-
|
|
196
|
-
def initialize
|
|
197
|
-
@get_options = Collection::GetOptions.new
|
|
198
|
-
@remove_options = Collection::RemoveOptions.new
|
|
199
|
-
@lookup_in_options = Collection::LookupInOptions.new
|
|
200
|
-
@mutate_in_options = Collection::MutateInOptions.new
|
|
201
|
-
@mutate_in_options.store_semantics = :upsert
|
|
202
|
-
end
|
|
203
|
-
end
|
|
191
|
+
# @api private
|
|
192
|
+
CouchbaseMapOptions = ::Couchbase::Options::CouchbaseMap
|
|
204
193
|
end
|
|
205
194
|
end
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
require "couchbase/collection"
|
|
16
|
+
require "couchbase/options"
|
|
16
17
|
require "couchbase/errors"
|
|
17
18
|
|
|
18
19
|
module Couchbase
|
|
@@ -28,8 +29,8 @@ module Couchbase
|
|
|
28
29
|
#
|
|
29
30
|
# @param [String] id the id of the document to back the queue.
|
|
30
31
|
# @param [Collection] collection the collection through which to interact with the document.
|
|
31
|
-
# @param [
|
|
32
|
-
def initialize(id, collection, options =
|
|
32
|
+
# @param [Options::CouchbaseList] options customization of the datastructure
|
|
33
|
+
def initialize(id, collection, options = Options::CouchbaseQueue.new)
|
|
33
34
|
@id = id
|
|
34
35
|
@collection = collection
|
|
35
36
|
@options = options
|
|
@@ -127,19 +128,7 @@ module Couchbase
|
|
|
127
128
|
alias shift pop
|
|
128
129
|
end
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
attr_accessor :lookup_in_options
|
|
133
|
-
attr_accessor :mutate_in_options
|
|
134
|
-
attr_accessor :remove_options
|
|
135
|
-
|
|
136
|
-
def initialize
|
|
137
|
-
@get_options = Collection::GetOptions.new
|
|
138
|
-
@remove_options = Collection::RemoveOptions.new
|
|
139
|
-
@lookup_in_options = Collection::LookupInOptions.new
|
|
140
|
-
@mutate_in_options = Collection::MutateInOptions.new
|
|
141
|
-
@mutate_in_options.store_semantics = :upsert
|
|
142
|
-
end
|
|
143
|
-
end
|
|
131
|
+
# @api private
|
|
132
|
+
CouchbaseQueueOptions = ::Couchbase::Options::CouchbaseQueue
|
|
144
133
|
end
|
|
145
134
|
end
|