couchbase 3.0.0.alpha.1-universal-darwin-19 → 3.0.0.alpha.2-universal-darwin-19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests-6.0.3.yml +49 -0
- data/.github/workflows/tests.yml +47 -0
- data/.gitmodules +3 -0
- data/.idea/dictionaries/gem_terms.xml +5 -0
- data/.idea/inspectionProfiles/Project_Default.xml +1 -0
- data/.idea/vcs.xml +1 -0
- data/Gemfile +1 -0
- data/README.md +55 -2
- data/Rakefile +18 -0
- data/bin/init-cluster +62 -0
- data/bin/setup +1 -0
- data/couchbase.gemspec +3 -2
- data/examples/crud.rb +1 -2
- data/examples/managing_buckets.rb +47 -0
- data/examples/managing_collections.rb +58 -0
- data/examples/managing_query_indexes.rb +63 -0
- data/examples/query.rb +3 -2
- data/examples/query_with_consistency.rb +76 -0
- data/examples/subdocument.rb +23 -1
- data/ext/.clang-format +1 -1
- data/ext/.idea/dictionaries/couchbase_terms.xml +2 -0
- data/ext/.idea/vcs.xml +1 -0
- data/ext/CMakeLists.txt +30 -12
- data/ext/build_version.hxx.in +26 -0
- data/ext/couchbase/bucket.hxx +69 -8
- data/ext/couchbase/cluster.hxx +70 -54
- data/ext/couchbase/collections_manifest.hxx +3 -3
- data/ext/couchbase/configuration.hxx +14 -0
- data/ext/couchbase/couchbase.cxx +2044 -383
- data/ext/couchbase/{operations/document_id.hxx → document_id.hxx} +5 -4
- data/ext/couchbase/io/http_message.hxx +5 -1
- data/ext/couchbase/io/http_parser.hxx +2 -1
- data/ext/couchbase/io/http_session.hxx +6 -3
- data/ext/couchbase/io/{binary_message.hxx → mcbp_message.hxx} +15 -12
- data/ext/couchbase/io/mcbp_parser.hxx +99 -0
- data/ext/couchbase/io/{key_value_session.hxx → mcbp_session.hxx} +200 -95
- data/ext/couchbase/io/session_manager.hxx +37 -22
- data/ext/couchbase/mutation_token.hxx +2 -1
- data/ext/couchbase/operations.hxx +38 -8
- data/ext/couchbase/operations/bucket_create.hxx +138 -0
- data/ext/couchbase/operations/bucket_drop.hxx +65 -0
- data/ext/couchbase/operations/bucket_flush.hxx +65 -0
- data/ext/couchbase/operations/bucket_get.hxx +69 -0
- data/ext/couchbase/operations/bucket_get_all.hxx +62 -0
- data/ext/couchbase/operations/bucket_settings.hxx +111 -0
- data/ext/couchbase/operations/bucket_update.hxx +115 -0
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +60 -0
- data/ext/couchbase/operations/collection_create.hxx +86 -0
- data/ext/couchbase/operations/collection_drop.hxx +82 -0
- data/ext/couchbase/operations/command.hxx +10 -10
- data/ext/couchbase/operations/document_decrement.hxx +80 -0
- data/ext/couchbase/operations/document_exists.hxx +80 -0
- data/ext/couchbase/operations/{get.hxx → document_get.hxx} +4 -2
- data/ext/couchbase/operations/document_get_and_lock.hxx +64 -0
- data/ext/couchbase/operations/document_get_and_touch.hxx +64 -0
- data/ext/couchbase/operations/document_increment.hxx +80 -0
- data/ext/couchbase/operations/document_insert.hxx +74 -0
- data/ext/couchbase/operations/{lookup_in.hxx → document_lookup_in.hxx} +2 -2
- data/ext/couchbase/operations/{mutate_in.hxx → document_mutate_in.hxx} +11 -2
- data/ext/couchbase/operations/{query.hxx → document_query.hxx} +101 -6
- data/ext/couchbase/operations/document_remove.hxx +67 -0
- data/ext/couchbase/operations/document_replace.hxx +76 -0
- data/ext/couchbase/operations/{upsert.hxx → document_touch.hxx} +14 -14
- data/ext/couchbase/operations/{remove.hxx → document_unlock.hxx} +12 -10
- data/ext/couchbase/operations/document_upsert.hxx +74 -0
- data/ext/couchbase/operations/query_index_build_deferred.hxx +85 -0
- data/ext/couchbase/operations/query_index_create.hxx +134 -0
- data/ext/couchbase/operations/query_index_drop.hxx +108 -0
- data/ext/couchbase/operations/query_index_get_all.hxx +106 -0
- data/ext/couchbase/operations/scope_create.hxx +81 -0
- data/ext/couchbase/operations/scope_drop.hxx +79 -0
- data/ext/couchbase/operations/scope_get_all.hxx +72 -0
- data/ext/couchbase/protocol/client_opcode.hxx +35 -0
- data/ext/couchbase/protocol/client_request.hxx +56 -9
- data/ext/couchbase/protocol/client_response.hxx +52 -15
- data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +81 -0
- data/ext/couchbase/protocol/cmd_decrement.hxx +187 -0
- data/ext/couchbase/protocol/cmd_exists.hxx +171 -0
- data/ext/couchbase/protocol/cmd_get.hxx +31 -8
- data/ext/couchbase/protocol/cmd_get_and_lock.hxx +142 -0
- data/ext/couchbase/protocol/cmd_get_and_touch.hxx +142 -0
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +16 -3
- data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +16 -3
- data/ext/couchbase/protocol/cmd_get_error_map.hxx +16 -3
- data/ext/couchbase/protocol/cmd_hello.hxx +24 -8
- data/ext/couchbase/protocol/cmd_increment.hxx +187 -0
- data/ext/couchbase/protocol/cmd_info.hxx +1 -0
- data/ext/couchbase/protocol/cmd_insert.hxx +172 -0
- data/ext/couchbase/protocol/cmd_lookup_in.hxx +28 -13
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +65 -13
- data/ext/couchbase/protocol/cmd_remove.hxx +59 -4
- data/ext/couchbase/protocol/cmd_replace.hxx +172 -0
- data/ext/couchbase/protocol/cmd_sasl_auth.hxx +15 -3
- data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +15 -3
- data/ext/couchbase/protocol/cmd_sasl_step.hxx +15 -3
- data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -2
- data/ext/couchbase/protocol/cmd_touch.hxx +102 -0
- data/ext/couchbase/protocol/cmd_unlock.hxx +95 -0
- data/ext/couchbase/protocol/cmd_upsert.hxx +50 -14
- data/ext/couchbase/protocol/durability_level.hxx +67 -0
- data/ext/couchbase/protocol/frame_info_id.hxx +187 -0
- data/ext/couchbase/protocol/hello_feature.hxx +137 -0
- data/ext/couchbase/protocol/server_opcode.hxx +57 -0
- data/ext/couchbase/protocol/server_request.hxx +122 -0
- data/ext/couchbase/protocol/unsigned_leb128.h +15 -15
- data/ext/couchbase/utils/byteswap.hxx +1 -2
- data/ext/couchbase/utils/url_codec.hxx +225 -0
- data/ext/couchbase/version.hxx +3 -1
- data/ext/extconf.rb +4 -1
- data/ext/test/main.cxx +37 -113
- data/ext/third_party/snappy/.appveyor.yml +36 -0
- data/ext/third_party/snappy/.gitignore +8 -0
- data/ext/third_party/snappy/.travis.yml +98 -0
- data/ext/third_party/snappy/AUTHORS +1 -0
- data/ext/third_party/snappy/CMakeLists.txt +345 -0
- data/ext/third_party/snappy/CONTRIBUTING.md +26 -0
- data/ext/third_party/snappy/COPYING +54 -0
- data/ext/third_party/snappy/NEWS +188 -0
- data/ext/third_party/snappy/README.md +148 -0
- data/ext/third_party/snappy/cmake/SnappyConfig.cmake.in +33 -0
- data/ext/third_party/snappy/cmake/config.h.in +59 -0
- data/ext/third_party/snappy/docs/README.md +72 -0
- data/ext/third_party/snappy/format_description.txt +110 -0
- data/ext/third_party/snappy/framing_format.txt +135 -0
- data/ext/third_party/snappy/snappy-c.cc +90 -0
- data/ext/third_party/snappy/snappy-c.h +138 -0
- data/ext/third_party/snappy/snappy-internal.h +315 -0
- data/ext/third_party/snappy/snappy-sinksource.cc +121 -0
- data/ext/third_party/snappy/snappy-sinksource.h +182 -0
- data/ext/third_party/snappy/snappy-stubs-internal.cc +42 -0
- data/ext/third_party/snappy/snappy-stubs-internal.h +493 -0
- data/ext/third_party/snappy/snappy-stubs-public.h.in +63 -0
- data/ext/third_party/snappy/snappy-test.cc +613 -0
- data/ext/third_party/snappy/snappy-test.h +526 -0
- data/ext/third_party/snappy/snappy.cc +1770 -0
- data/ext/third_party/snappy/snappy.h +209 -0
- data/ext/third_party/snappy/snappy_compress_fuzzer.cc +60 -0
- data/ext/third_party/snappy/snappy_uncompress_fuzzer.cc +58 -0
- data/ext/third_party/snappy/snappy_unittest.cc +1512 -0
- data/ext/third_party/snappy/testdata/alice29.txt +3609 -0
- data/ext/third_party/snappy/testdata/asyoulik.txt +4122 -0
- data/ext/third_party/snappy/testdata/baddata1.snappy +0 -0
- data/ext/third_party/snappy/testdata/baddata2.snappy +0 -0
- data/ext/third_party/snappy/testdata/baddata3.snappy +0 -0
- data/ext/third_party/snappy/testdata/fireworks.jpeg +0 -0
- data/ext/third_party/snappy/testdata/geo.protodata +0 -0
- data/ext/third_party/snappy/testdata/html +1 -0
- data/ext/third_party/snappy/testdata/html_x_4 +1 -0
- data/ext/third_party/snappy/testdata/kppkn.gtb +0 -0
- data/ext/third_party/snappy/testdata/lcet10.txt +7519 -0
- data/ext/third_party/snappy/testdata/paper-100k.pdf +600 -2
- data/ext/third_party/snappy/testdata/plrabn12.txt +10699 -0
- data/ext/third_party/snappy/testdata/urls.10K +10000 -0
- data/lib/couchbase/binary_collection.rb +33 -76
- data/lib/couchbase/binary_collection_options.rb +94 -0
- data/lib/couchbase/bucket.rb +9 -3
- data/lib/couchbase/cluster.rb +161 -23
- data/lib/couchbase/collection.rb +108 -191
- data/lib/couchbase/collection_options.rb +430 -0
- data/lib/couchbase/errors.rb +136 -134
- data/lib/couchbase/json_transcoder.rb +32 -0
- data/lib/couchbase/management/analytics_index_manager.rb +185 -9
- data/lib/couchbase/management/bucket_manager.rb +84 -33
- data/lib/couchbase/management/collection_manager.rb +166 -1
- data/lib/couchbase/management/query_index_manager.rb +261 -0
- data/lib/couchbase/management/search_index_manager.rb +291 -0
- data/lib/couchbase/management/user_manager.rb +12 -10
- data/lib/couchbase/management/view_index_manager.rb +151 -1
- data/lib/couchbase/mutation_state.rb +11 -1
- data/lib/couchbase/scope.rb +4 -4
- data/lib/couchbase/version.rb +1 -1
- metadata +113 -18
- data/.travis.yml +0 -7
- data/ext/couchbase/io/binary_parser.hxx +0 -64
- data/lib/couchbase/results.rb +0 -307
data/lib/couchbase/errors.rb
CHANGED
@@ -13,210 +13,212 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
module Couchbase
|
16
|
-
|
16
|
+
module Error
|
17
|
+
# Common exceptions
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
class RequestCanceled < StandardError
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
class InvalidArgument < StandardError
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
class ServiceNotAvailable < StandardError
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
class InternalServerFailure < StandardError
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
class AuthenticationFailure < StandardError
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
class TemporaryFailure < StandardError
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
class ParsingFailure < StandardError
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
class CasMismatch < StandardError
|
41
|
+
end
|
41
42
|
|
42
|
-
|
43
|
-
|
43
|
+
class BucketNotFound < StandardError
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
-
|
46
|
+
class CollectionNotFound < StandardError
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
49
|
+
class ScopeNotFound < StandardError
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
52
|
+
class IndexNotFound < StandardError
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
55
|
+
class IndexExists < StandardError
|
56
|
+
end
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
class EncodingFailure < StandardError
|
59
|
+
end
|
59
60
|
|
60
|
-
|
61
|
-
|
61
|
+
class DecodingFailure < StandardError
|
62
|
+
end
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
class UnsupportedOperation < StandardError
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
67
|
+
class AmbiguousTimeout < StandardError
|
68
|
+
end
|
68
69
|
|
69
|
-
|
70
|
-
|
70
|
+
class UnambiguousTimeout < StandardError
|
71
|
+
end
|
71
72
|
|
72
|
-
|
73
|
-
|
73
|
+
class FeatureNotAvailable < StandardError
|
74
|
+
end
|
74
75
|
|
75
|
-
|
76
|
+
# KeyValue exceptions
|
76
77
|
|
77
|
-
|
78
|
-
|
78
|
+
class DocumentNotFound < StandardError
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
-
|
81
|
+
class DocumentIrretrievable < StandardError
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
84
|
+
class DocumentLocked < StandardError
|
85
|
+
end
|
85
86
|
|
86
|
-
|
87
|
-
|
87
|
+
class ValueTooLarge < StandardError
|
88
|
+
end
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
class DocumentExists < StandardError
|
91
|
+
end
|
91
92
|
|
92
|
-
|
93
|
-
|
93
|
+
class DurabilityLevelNotAvailable < StandardError
|
94
|
+
end
|
94
95
|
|
95
|
-
|
96
|
-
|
96
|
+
class DurabilityImpossible < StandardError
|
97
|
+
end
|
97
98
|
|
98
|
-
|
99
|
-
|
99
|
+
class DurabilityAmbiguous < StandardError
|
100
|
+
end
|
100
101
|
|
101
|
-
|
102
|
-
|
102
|
+
class DurableWriteInProgress < StandardError
|
103
|
+
end
|
103
104
|
|
104
|
-
|
105
|
-
|
105
|
+
class DurableWriteReCommitInProgress < StandardError
|
106
|
+
end
|
106
107
|
|
107
|
-
|
108
|
-
|
108
|
+
class PathNotFound < StandardError
|
109
|
+
end
|
109
110
|
|
110
|
-
|
111
|
-
|
111
|
+
class PathMismatch < StandardError
|
112
|
+
end
|
112
113
|
|
113
|
-
|
114
|
-
|
114
|
+
class PathInvalid < StandardError
|
115
|
+
end
|
115
116
|
|
116
|
-
|
117
|
-
|
117
|
+
class PathTooDeep < StandardError
|
118
|
+
end
|
118
119
|
|
119
|
-
|
120
|
-
|
120
|
+
class PathTooBig < StandardError
|
121
|
+
end
|
121
122
|
|
122
|
-
|
123
|
-
|
123
|
+
class ValueTooDeep < StandardError
|
124
|
+
end
|
124
125
|
|
125
|
-
|
126
|
-
|
126
|
+
class ValueInvalid < StandardError
|
127
|
+
end
|
127
128
|
|
128
|
-
|
129
|
-
|
129
|
+
class DocumentNotJson < StandardError
|
130
|
+
end
|
130
131
|
|
131
|
-
|
132
|
-
|
132
|
+
class NumberTooBig < StandardError
|
133
|
+
end
|
133
134
|
|
134
|
-
|
135
|
-
|
135
|
+
class DeltaInvalid < StandardError
|
136
|
+
end
|
136
137
|
|
137
|
-
|
138
|
-
|
138
|
+
class PathExists < StandardError
|
139
|
+
end
|
139
140
|
|
140
|
-
|
141
|
-
|
141
|
+
class XattrUnknownMacro < StandardError
|
142
|
+
end
|
142
143
|
|
143
|
-
|
144
|
-
|
144
|
+
class XattrInvalidKeyCombo < StandardError
|
145
|
+
end
|
145
146
|
|
146
|
-
|
147
|
-
|
147
|
+
class XattrUnknownVirtualAttribute < StandardError
|
148
|
+
end
|
148
149
|
|
149
|
-
|
150
|
-
|
150
|
+
class XattrCannotModifyVirtualAttribute < StandardError
|
151
|
+
end
|
151
152
|
|
152
|
-
|
153
|
+
# Query exceptions
|
153
154
|
|
154
|
-
|
155
|
-
|
155
|
+
class PlanningFailure < StandardError
|
156
|
+
end
|
156
157
|
|
157
|
-
|
158
|
-
|
158
|
+
class IndexFailure < StandardError
|
159
|
+
end
|
159
160
|
|
160
|
-
|
161
|
-
|
161
|
+
class PreparedStatementFailure < StandardError
|
162
|
+
end
|
162
163
|
|
163
164
|
|
164
|
-
|
165
|
+
# Analytics exceptions
|
165
166
|
|
166
|
-
|
167
|
-
|
167
|
+
class CompilationFailure < StandardError
|
168
|
+
end
|
168
169
|
|
169
|
-
|
170
|
-
|
170
|
+
class JobQueueFull < StandardError
|
171
|
+
end
|
171
172
|
|
172
|
-
|
173
|
-
|
173
|
+
class DatasetNotFound < StandardError
|
174
|
+
end
|
174
175
|
|
175
|
-
|
176
|
-
|
176
|
+
class DatasetExists < StandardError
|
177
|
+
end
|
177
178
|
|
178
|
-
|
179
|
-
|
179
|
+
class DataverseExists < StandardError
|
180
|
+
end
|
180
181
|
|
181
|
-
|
182
|
-
|
182
|
+
class DataverseNotFound < StandardError
|
183
|
+
end
|
183
184
|
|
184
|
-
|
185
|
-
|
185
|
+
class LinkNotFound < StandardError
|
186
|
+
end
|
186
187
|
|
187
|
-
|
188
|
+
# View exceptions
|
188
189
|
|
189
|
-
|
190
|
-
|
190
|
+
class DesignDocumentNotFound < StandardError
|
191
|
+
end
|
191
192
|
|
192
|
-
|
193
|
-
|
193
|
+
class ViewNotFound < StandardError
|
194
|
+
end
|
194
195
|
|
195
|
-
|
196
|
+
# Management exceptions
|
196
197
|
|
197
|
-
|
198
|
-
|
198
|
+
class CollectionExists < StandardError
|
199
|
+
end
|
199
200
|
|
200
|
-
|
201
|
-
|
201
|
+
class ScopeExists < StandardError
|
202
|
+
end
|
202
203
|
|
203
|
-
|
204
|
-
|
204
|
+
class UserExists < StandardError
|
205
|
+
end
|
205
206
|
|
206
|
-
|
207
|
-
|
207
|
+
class BucketExists < StandardError
|
208
|
+
end
|
208
209
|
|
209
|
-
|
210
|
-
|
210
|
+
class BucketNotFlushable < StandardError
|
211
|
+
end
|
211
212
|
|
212
|
-
|
213
|
-
|
213
|
+
class GroupNotFound < StandardError
|
214
|
+
end
|
214
215
|
|
215
|
-
|
216
|
-
|
216
|
+
class UserNotFound < StandardError
|
217
|
+
end
|
217
218
|
|
218
|
-
|
219
|
+
# Library-specific exceptions
|
219
220
|
|
220
|
-
|
221
|
+
class BackendError < StandardError
|
222
|
+
end
|
221
223
|
end
|
222
224
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright 2020 Couchbase, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "json"
|
16
|
+
|
17
|
+
module Couchbase
|
18
|
+
class JsonTranscoder
|
19
|
+
# @param [Object] document
|
20
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
21
|
+
def encode(document)
|
22
|
+
[JSON.generate(document), (0x02 << 24) | 0x06]
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
26
|
+
# @param [Integer, :json] flags bit field, describing how the data encoded
|
27
|
+
# @return Object decoded document
|
28
|
+
def decode(blob, flags)
|
29
|
+
JSON.parse(blob)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -12,6 +12,8 @@
|
|
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
|
+
|
15
17
|
module Couchbase
|
16
18
|
module Management
|
17
19
|
class AnalyticsIndexManager
|
@@ -27,8 +29,8 @@ module Couchbase
|
|
27
29
|
# @param [String] dataverse_name
|
28
30
|
# @param [CreateDataverseOptions] options
|
29
31
|
#
|
30
|
-
# @raise
|
31
|
-
# @raise
|
32
|
+
# @raise [ArgumentError]
|
33
|
+
# @raise [Error::DataverseExists]
|
32
34
|
def create_dataverse(dataverse_name, options = CreateDataverseOptions.new) end
|
33
35
|
|
34
36
|
# Drops a dataverse
|
@@ -36,34 +38,96 @@ module Couchbase
|
|
36
38
|
# @param [String] dataverse_name name of the dataverse
|
37
39
|
# @param [DropDataverseOptions] options
|
38
40
|
#
|
39
|
-
# @raise
|
40
|
-
# @raise
|
41
|
+
# @raise [ArgumentError]
|
42
|
+
# @raise [Error::DataverseNotFound]
|
41
43
|
def drop_dataverse(dataverse_name, options = DropDataverseOptions.new) end
|
42
44
|
|
43
45
|
# Creates a new dataset
|
44
46
|
#
|
45
47
|
# @param [String] dataset_name name of dataset
|
46
48
|
# @param [String] bucket_name name of the bucket
|
49
|
+
# @param [CreateDatasetOptions] options
|
47
50
|
#
|
48
|
-
# @raise
|
49
|
-
# @raise
|
51
|
+
# @raise [ArgumentError]
|
52
|
+
# @raise [Error::DatasetExists]
|
50
53
|
def create_dataset(dataset_name, bucket_name, options = CreateDatasetOptions.new) end
|
51
54
|
|
55
|
+
# Drops a dataset
|
56
|
+
#
|
57
|
+
# @param [String] dataset_name name of the dataset
|
58
|
+
# @param [DropDataverseOptions] options
|
59
|
+
#
|
60
|
+
# @raise [ArgumentError]
|
61
|
+
# @raise [Error::DatasetNotFound]
|
52
62
|
def drop_dataset(dataset_name, options = DropDatasetOptions.new) end
|
53
63
|
|
54
|
-
|
64
|
+
# Gets all datasets
|
65
|
+
#
|
66
|
+
# @param [GetAllDatasetsOptions] options
|
67
|
+
#
|
68
|
+
# @return [Array<AnalyticsDataset>]
|
69
|
+
def get_all_datasets(options = GetAllDatasetsOptions.new)
|
70
|
+
# SELECT d.* FROM Metadata.`Dataset` d WHERE d.DataverseName <> "Metadata"
|
71
|
+
end
|
55
72
|
|
73
|
+
# Creates a new index
|
74
|
+
#
|
75
|
+
# @param [String] index_name name of the index
|
76
|
+
# @param [String] dataset_name name of the dataset
|
77
|
+
# @param [Hash<String, String>] fields mapping of the field name to field type
|
78
|
+
# @param [CreateIndexOptions] options
|
79
|
+
#
|
80
|
+
# @raise [ArgumentError]
|
81
|
+
# @raise [Error::IndexExists]
|
56
82
|
def create_index(index_name, dataset_name, fields, options = CreateIndexOptions.new) end
|
57
83
|
|
84
|
+
# Drops an index
|
85
|
+
#
|
86
|
+
# @param [String] index_name name of the index
|
87
|
+
# @param [String] dataset_name name of the dataset
|
88
|
+
# @param [DropIndexOptions] options
|
89
|
+
#
|
90
|
+
# @raise [ArgumentError]
|
91
|
+
# @raise [Error::IndexNotFound]
|
58
92
|
def drop_index(index_name, dataset_name, options = DropIndexOptions.new) end
|
59
93
|
|
60
|
-
|
94
|
+
# Gets all indexes
|
95
|
+
#
|
96
|
+
# @param [GetAllIndexesOptions] options
|
97
|
+
#
|
98
|
+
# @return [Array<AnalyticsIndex>]
|
99
|
+
def get_all_indexes(options = GetAllIndexesOptions.new)
|
100
|
+
# SELECT d.* FROM Metadata.`Index` d WHERE d.DataverseName <> "Metadata"
|
101
|
+
end
|
61
102
|
|
103
|
+
# Connects a link
|
104
|
+
#
|
105
|
+
# @param [ConnectLinkOptions] options
|
106
|
+
#
|
107
|
+
# @raise [ArgumentError]
|
108
|
+
# @raise [Error::LinkNotFound]
|
62
109
|
def connect_link(options = ConnectLinkOptions.new) end
|
63
110
|
|
111
|
+
# Disconnects a link,
|
112
|
+
#
|
113
|
+
# @param [DisconnectLinkOptions] options
|
114
|
+
#
|
115
|
+
# @raise [ArgumentError]
|
116
|
+
# @raise [Error::LinkNotFound]
|
64
117
|
def disconnect_link(options = DisconnectLinkOptions.new) end
|
65
118
|
|
66
|
-
|
119
|
+
# Gets the pending mutations for all datasets.
|
120
|
+
#
|
121
|
+
# @note If a link is disconnected then it will return no results. If all links are disconnected, then
|
122
|
+
# an empty object is returned.
|
123
|
+
#
|
124
|
+
# @param [GetPendingMutationsOptions] options
|
125
|
+
#
|
126
|
+
# @return [Hash<String, Integer>] dictionary, where keys are dataset coordinates encoded as +"dataverse.dataset"+
|
127
|
+
# and values are number of mutations for given dataset.
|
128
|
+
def get_pending_mutations(options = GetPendingMutationsOptions.new)
|
129
|
+
# GET http://localhost:8095/analytics/node/agg/stats/remaining
|
130
|
+
end
|
67
131
|
|
68
132
|
class CreateDataverseOptions
|
69
133
|
# @return [Boolean] ignore if the dataverse already exists
|
@@ -110,6 +174,118 @@ module Couchbase
|
|
110
174
|
end
|
111
175
|
end
|
112
176
|
|
177
|
+
class DropDatasetOptions
|
178
|
+
# @return [Boolean] ignore if the dataset does not exists
|
179
|
+
attr_accessor :ignore_if_not_exists
|
180
|
+
|
181
|
+
# @return [String] The name of the dataverse to use (defaults to +nil+)
|
182
|
+
attr_accessor :dataverse_name
|
183
|
+
|
184
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
185
|
+
attr_accessor :timeout
|
186
|
+
|
187
|
+
def initialize
|
188
|
+
@ignore_if_not_exists = false
|
189
|
+
yield self if block_given?
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
class GetAllDatasetsOptions
|
194
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
195
|
+
attr_accessor :timeout
|
196
|
+
|
197
|
+
def initialize
|
198
|
+
@ignore_if_not_exists = false
|
199
|
+
yield self if block_given?
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
class CreateIndexOptions
|
204
|
+
# @return [Boolean] ignore if the index already exists
|
205
|
+
attr_accessor :ignore_if_exists
|
206
|
+
|
207
|
+
# @return [String] The name of the dataverse to use (defaults to +nil+)
|
208
|
+
attr_accessor :dataverse_name
|
209
|
+
|
210
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
211
|
+
attr_accessor :timeout
|
212
|
+
|
213
|
+
def initialize
|
214
|
+
@ignore_if_exists = false
|
215
|
+
yield self if block_given?
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
class DropIndexOptions
|
220
|
+
# @return [Boolean] ignore if the index does not exists
|
221
|
+
attr_accessor :ignore_if_not_exists
|
222
|
+
|
223
|
+
# @return [String] The name of the dataverse to use (defaults to +nil+)
|
224
|
+
attr_accessor :dataverse_name
|
225
|
+
|
226
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
227
|
+
attr_accessor :timeout
|
228
|
+
|
229
|
+
def initialize
|
230
|
+
@ignore_if_not_exists = false
|
231
|
+
yield self if block_given?
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class GetAllIndexesOptions
|
236
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
237
|
+
attr_accessor :timeout
|
238
|
+
|
239
|
+
def initialize
|
240
|
+
yield self if block_given?
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
class ConnectLinkOptions
|
245
|
+
# @return [String] The name of the link (defaults to +"Local"+)
|
246
|
+
attr_accessor :link_name
|
247
|
+
|
248
|
+
# @return [Boolean] Whether to force link creation even if the bucket UUID changed, for example due to the
|
249
|
+
# bucket being deleted and recreated (defaults to +false+)
|
250
|
+
attr_accessor :force
|
251
|
+
|
252
|
+
# @return [String] The name of the dataverse to use (defaults to +nil+)
|
253
|
+
attr_accessor :dataverse_name
|
254
|
+
|
255
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
256
|
+
attr_accessor :timeout
|
257
|
+
|
258
|
+
def initialize
|
259
|
+
@link_name = "Local"
|
260
|
+
@force = false
|
261
|
+
yield self if block_given?
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
class DisconnectLinkOptions
|
266
|
+
# @return [String] The name of the link (defaults to +"Local"+)
|
267
|
+
attr_accessor :link_name
|
268
|
+
|
269
|
+
# @return [String] The name of the dataverse to use (defaults to +nil+)
|
270
|
+
attr_accessor :dataverse_name
|
271
|
+
|
272
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
273
|
+
attr_accessor :timeout
|
274
|
+
|
275
|
+
def initialize
|
276
|
+
@link_name = "Local"
|
277
|
+
yield self if block_given?
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
class GetPendingMutationsOptions
|
282
|
+
# @return [Integer] the time in milliseconds allowed for the operation to complete
|
283
|
+
attr_accessor :timeout
|
284
|
+
|
285
|
+
def initialize
|
286
|
+
yield self if block_given?
|
287
|
+
end
|
288
|
+
end
|
113
289
|
end
|
114
290
|
|
115
291
|
class AnalyticsDataset
|