couchbase 3.0.0.alpha.1-universal-darwin-19 → 3.0.0.alpha.2-universal-darwin-19

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.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests-6.0.3.yml +49 -0
  3. data/.github/workflows/tests.yml +47 -0
  4. data/.gitmodules +3 -0
  5. data/.idea/dictionaries/gem_terms.xml +5 -0
  6. data/.idea/inspectionProfiles/Project_Default.xml +1 -0
  7. data/.idea/vcs.xml +1 -0
  8. data/Gemfile +1 -0
  9. data/README.md +55 -2
  10. data/Rakefile +18 -0
  11. data/bin/init-cluster +62 -0
  12. data/bin/setup +1 -0
  13. data/couchbase.gemspec +3 -2
  14. data/examples/crud.rb +1 -2
  15. data/examples/managing_buckets.rb +47 -0
  16. data/examples/managing_collections.rb +58 -0
  17. data/examples/managing_query_indexes.rb +63 -0
  18. data/examples/query.rb +3 -2
  19. data/examples/query_with_consistency.rb +76 -0
  20. data/examples/subdocument.rb +23 -1
  21. data/ext/.clang-format +1 -1
  22. data/ext/.idea/dictionaries/couchbase_terms.xml +2 -0
  23. data/ext/.idea/vcs.xml +1 -0
  24. data/ext/CMakeLists.txt +30 -12
  25. data/ext/build_version.hxx.in +26 -0
  26. data/ext/couchbase/bucket.hxx +69 -8
  27. data/ext/couchbase/cluster.hxx +70 -54
  28. data/ext/couchbase/collections_manifest.hxx +3 -3
  29. data/ext/couchbase/configuration.hxx +14 -0
  30. data/ext/couchbase/couchbase.cxx +2044 -383
  31. data/ext/couchbase/{operations/document_id.hxx → document_id.hxx} +5 -4
  32. data/ext/couchbase/io/http_message.hxx +5 -1
  33. data/ext/couchbase/io/http_parser.hxx +2 -1
  34. data/ext/couchbase/io/http_session.hxx +6 -3
  35. data/ext/couchbase/io/{binary_message.hxx → mcbp_message.hxx} +15 -12
  36. data/ext/couchbase/io/mcbp_parser.hxx +99 -0
  37. data/ext/couchbase/io/{key_value_session.hxx → mcbp_session.hxx} +200 -95
  38. data/ext/couchbase/io/session_manager.hxx +37 -22
  39. data/ext/couchbase/mutation_token.hxx +2 -1
  40. data/ext/couchbase/operations.hxx +38 -8
  41. data/ext/couchbase/operations/bucket_create.hxx +138 -0
  42. data/ext/couchbase/operations/bucket_drop.hxx +65 -0
  43. data/ext/couchbase/operations/bucket_flush.hxx +65 -0
  44. data/ext/couchbase/operations/bucket_get.hxx +69 -0
  45. data/ext/couchbase/operations/bucket_get_all.hxx +62 -0
  46. data/ext/couchbase/operations/bucket_settings.hxx +111 -0
  47. data/ext/couchbase/operations/bucket_update.hxx +115 -0
  48. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +60 -0
  49. data/ext/couchbase/operations/collection_create.hxx +86 -0
  50. data/ext/couchbase/operations/collection_drop.hxx +82 -0
  51. data/ext/couchbase/operations/command.hxx +10 -10
  52. data/ext/couchbase/operations/document_decrement.hxx +80 -0
  53. data/ext/couchbase/operations/document_exists.hxx +80 -0
  54. data/ext/couchbase/operations/{get.hxx → document_get.hxx} +4 -2
  55. data/ext/couchbase/operations/document_get_and_lock.hxx +64 -0
  56. data/ext/couchbase/operations/document_get_and_touch.hxx +64 -0
  57. data/ext/couchbase/operations/document_increment.hxx +80 -0
  58. data/ext/couchbase/operations/document_insert.hxx +74 -0
  59. data/ext/couchbase/operations/{lookup_in.hxx → document_lookup_in.hxx} +2 -2
  60. data/ext/couchbase/operations/{mutate_in.hxx → document_mutate_in.hxx} +11 -2
  61. data/ext/couchbase/operations/{query.hxx → document_query.hxx} +101 -6
  62. data/ext/couchbase/operations/document_remove.hxx +67 -0
  63. data/ext/couchbase/operations/document_replace.hxx +76 -0
  64. data/ext/couchbase/operations/{upsert.hxx → document_touch.hxx} +14 -14
  65. data/ext/couchbase/operations/{remove.hxx → document_unlock.hxx} +12 -10
  66. data/ext/couchbase/operations/document_upsert.hxx +74 -0
  67. data/ext/couchbase/operations/query_index_build_deferred.hxx +85 -0
  68. data/ext/couchbase/operations/query_index_create.hxx +134 -0
  69. data/ext/couchbase/operations/query_index_drop.hxx +108 -0
  70. data/ext/couchbase/operations/query_index_get_all.hxx +106 -0
  71. data/ext/couchbase/operations/scope_create.hxx +81 -0
  72. data/ext/couchbase/operations/scope_drop.hxx +79 -0
  73. data/ext/couchbase/operations/scope_get_all.hxx +72 -0
  74. data/ext/couchbase/protocol/client_opcode.hxx +35 -0
  75. data/ext/couchbase/protocol/client_request.hxx +56 -9
  76. data/ext/couchbase/protocol/client_response.hxx +52 -15
  77. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +81 -0
  78. data/ext/couchbase/protocol/cmd_decrement.hxx +187 -0
  79. data/ext/couchbase/protocol/cmd_exists.hxx +171 -0
  80. data/ext/couchbase/protocol/cmd_get.hxx +31 -8
  81. data/ext/couchbase/protocol/cmd_get_and_lock.hxx +142 -0
  82. data/ext/couchbase/protocol/cmd_get_and_touch.hxx +142 -0
  83. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +16 -3
  84. data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +16 -3
  85. data/ext/couchbase/protocol/cmd_get_error_map.hxx +16 -3
  86. data/ext/couchbase/protocol/cmd_hello.hxx +24 -8
  87. data/ext/couchbase/protocol/cmd_increment.hxx +187 -0
  88. data/ext/couchbase/protocol/cmd_info.hxx +1 -0
  89. data/ext/couchbase/protocol/cmd_insert.hxx +172 -0
  90. data/ext/couchbase/protocol/cmd_lookup_in.hxx +28 -13
  91. data/ext/couchbase/protocol/cmd_mutate_in.hxx +65 -13
  92. data/ext/couchbase/protocol/cmd_remove.hxx +59 -4
  93. data/ext/couchbase/protocol/cmd_replace.hxx +172 -0
  94. data/ext/couchbase/protocol/cmd_sasl_auth.hxx +15 -3
  95. data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +15 -3
  96. data/ext/couchbase/protocol/cmd_sasl_step.hxx +15 -3
  97. data/ext/couchbase/protocol/cmd_select_bucket.hxx +14 -2
  98. data/ext/couchbase/protocol/cmd_touch.hxx +102 -0
  99. data/ext/couchbase/protocol/cmd_unlock.hxx +95 -0
  100. data/ext/couchbase/protocol/cmd_upsert.hxx +50 -14
  101. data/ext/couchbase/protocol/durability_level.hxx +67 -0
  102. data/ext/couchbase/protocol/frame_info_id.hxx +187 -0
  103. data/ext/couchbase/protocol/hello_feature.hxx +137 -0
  104. data/ext/couchbase/protocol/server_opcode.hxx +57 -0
  105. data/ext/couchbase/protocol/server_request.hxx +122 -0
  106. data/ext/couchbase/protocol/unsigned_leb128.h +15 -15
  107. data/ext/couchbase/utils/byteswap.hxx +1 -2
  108. data/ext/couchbase/utils/url_codec.hxx +225 -0
  109. data/ext/couchbase/version.hxx +3 -1
  110. data/ext/extconf.rb +4 -1
  111. data/ext/test/main.cxx +37 -113
  112. data/ext/third_party/snappy/.appveyor.yml +36 -0
  113. data/ext/third_party/snappy/.gitignore +8 -0
  114. data/ext/third_party/snappy/.travis.yml +98 -0
  115. data/ext/third_party/snappy/AUTHORS +1 -0
  116. data/ext/third_party/snappy/CMakeLists.txt +345 -0
  117. data/ext/third_party/snappy/CONTRIBUTING.md +26 -0
  118. data/ext/third_party/snappy/COPYING +54 -0
  119. data/ext/third_party/snappy/NEWS +188 -0
  120. data/ext/third_party/snappy/README.md +148 -0
  121. data/ext/third_party/snappy/cmake/SnappyConfig.cmake.in +33 -0
  122. data/ext/third_party/snappy/cmake/config.h.in +59 -0
  123. data/ext/third_party/snappy/docs/README.md +72 -0
  124. data/ext/third_party/snappy/format_description.txt +110 -0
  125. data/ext/third_party/snappy/framing_format.txt +135 -0
  126. data/ext/third_party/snappy/snappy-c.cc +90 -0
  127. data/ext/third_party/snappy/snappy-c.h +138 -0
  128. data/ext/third_party/snappy/snappy-internal.h +315 -0
  129. data/ext/third_party/snappy/snappy-sinksource.cc +121 -0
  130. data/ext/third_party/snappy/snappy-sinksource.h +182 -0
  131. data/ext/third_party/snappy/snappy-stubs-internal.cc +42 -0
  132. data/ext/third_party/snappy/snappy-stubs-internal.h +493 -0
  133. data/ext/third_party/snappy/snappy-stubs-public.h.in +63 -0
  134. data/ext/third_party/snappy/snappy-test.cc +613 -0
  135. data/ext/third_party/snappy/snappy-test.h +526 -0
  136. data/ext/third_party/snappy/snappy.cc +1770 -0
  137. data/ext/third_party/snappy/snappy.h +209 -0
  138. data/ext/third_party/snappy/snappy_compress_fuzzer.cc +60 -0
  139. data/ext/third_party/snappy/snappy_uncompress_fuzzer.cc +58 -0
  140. data/ext/third_party/snappy/snappy_unittest.cc +1512 -0
  141. data/ext/third_party/snappy/testdata/alice29.txt +3609 -0
  142. data/ext/third_party/snappy/testdata/asyoulik.txt +4122 -0
  143. data/ext/third_party/snappy/testdata/baddata1.snappy +0 -0
  144. data/ext/third_party/snappy/testdata/baddata2.snappy +0 -0
  145. data/ext/third_party/snappy/testdata/baddata3.snappy +0 -0
  146. data/ext/third_party/snappy/testdata/fireworks.jpeg +0 -0
  147. data/ext/third_party/snappy/testdata/geo.protodata +0 -0
  148. data/ext/third_party/snappy/testdata/html +1 -0
  149. data/ext/third_party/snappy/testdata/html_x_4 +1 -0
  150. data/ext/third_party/snappy/testdata/kppkn.gtb +0 -0
  151. data/ext/third_party/snappy/testdata/lcet10.txt +7519 -0
  152. data/ext/third_party/snappy/testdata/paper-100k.pdf +600 -2
  153. data/ext/third_party/snappy/testdata/plrabn12.txt +10699 -0
  154. data/ext/third_party/snappy/testdata/urls.10K +10000 -0
  155. data/lib/couchbase/binary_collection.rb +33 -76
  156. data/lib/couchbase/binary_collection_options.rb +94 -0
  157. data/lib/couchbase/bucket.rb +9 -3
  158. data/lib/couchbase/cluster.rb +161 -23
  159. data/lib/couchbase/collection.rb +108 -191
  160. data/lib/couchbase/collection_options.rb +430 -0
  161. data/lib/couchbase/errors.rb +136 -134
  162. data/lib/couchbase/json_transcoder.rb +32 -0
  163. data/lib/couchbase/management/analytics_index_manager.rb +185 -9
  164. data/lib/couchbase/management/bucket_manager.rb +84 -33
  165. data/lib/couchbase/management/collection_manager.rb +166 -1
  166. data/lib/couchbase/management/query_index_manager.rb +261 -0
  167. data/lib/couchbase/management/search_index_manager.rb +291 -0
  168. data/lib/couchbase/management/user_manager.rb +12 -10
  169. data/lib/couchbase/management/view_index_manager.rb +151 -1
  170. data/lib/couchbase/mutation_state.rb +11 -1
  171. data/lib/couchbase/scope.rb +4 -4
  172. data/lib/couchbase/version.rb +1 -1
  173. metadata +113 -18
  174. data/.travis.yml +0 -7
  175. data/ext/couchbase/io/binary_parser.hxx +0 -64
  176. data/lib/couchbase/results.rb +0 -307
@@ -13,210 +13,212 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module Couchbase
16
- # Common exceptions
16
+ module Error
17
+ # Common exceptions
17
18
 
18
- class RequestCanceled < StandardError
19
- end
19
+ class RequestCanceled < StandardError
20
+ end
20
21
 
21
- class InvalidArgument < StandardError
22
- end
22
+ class InvalidArgument < StandardError
23
+ end
23
24
 
24
- class ServiceNotAvailable < StandardError
25
- end
25
+ class ServiceNotAvailable < StandardError
26
+ end
26
27
 
27
- class InternalServerFailure < StandardError
28
- end
28
+ class InternalServerFailure < StandardError
29
+ end
29
30
 
30
- class AuthenticationFailure < StandardError
31
- end
31
+ class AuthenticationFailure < StandardError
32
+ end
32
33
 
33
- class TemporaryFailure < StandardError
34
- end
34
+ class TemporaryFailure < StandardError
35
+ end
35
36
 
36
- class ParsingFailure < StandardError
37
- end
37
+ class ParsingFailure < StandardError
38
+ end
38
39
 
39
- class CasMismatch < StandardError
40
- end
40
+ class CasMismatch < StandardError
41
+ end
41
42
 
42
- class BucketNotFound < StandardError
43
- end
43
+ class BucketNotFound < StandardError
44
+ end
44
45
 
45
- class CollectionNotFound < StandardError
46
- end
46
+ class CollectionNotFound < StandardError
47
+ end
47
48
 
48
- class ScopeNotFound < StandardError
49
- end
49
+ class ScopeNotFound < StandardError
50
+ end
50
51
 
51
- class IndexNotFound < StandardError
52
- end
52
+ class IndexNotFound < StandardError
53
+ end
53
54
 
54
- class IndexExists < StandardError
55
- end
55
+ class IndexExists < StandardError
56
+ end
56
57
 
57
- class EncodingFailure < StandardError
58
- end
58
+ class EncodingFailure < StandardError
59
+ end
59
60
 
60
- class DecodingFailure < StandardError
61
- end
61
+ class DecodingFailure < StandardError
62
+ end
62
63
 
63
- class UnsupportedOperation < StandardError
64
- end
64
+ class UnsupportedOperation < StandardError
65
+ end
65
66
 
66
- class AmbiguousTimeout < StandardError
67
- end
67
+ class AmbiguousTimeout < StandardError
68
+ end
68
69
 
69
- class UnambiguousTimeout < StandardError
70
- end
70
+ class UnambiguousTimeout < StandardError
71
+ end
71
72
 
72
- class FeatureNotAvailable < StandardError
73
- end
73
+ class FeatureNotAvailable < StandardError
74
+ end
74
75
 
75
- # KeyValue exceptions
76
+ # KeyValue exceptions
76
77
 
77
- class DocumentNotFound < StandardError
78
- end
78
+ class DocumentNotFound < StandardError
79
+ end
79
80
 
80
- class DocumentIrretrievable < StandardError
81
- end
81
+ class DocumentIrretrievable < StandardError
82
+ end
82
83
 
83
- class DocumentLocked < StandardError
84
- end
84
+ class DocumentLocked < StandardError
85
+ end
85
86
 
86
- class ValueTooLarge < StandardError
87
- end
87
+ class ValueTooLarge < StandardError
88
+ end
88
89
 
89
- class DocumentExists < StandardError
90
- end
90
+ class DocumentExists < StandardError
91
+ end
91
92
 
92
- class DurabilityLevelNotAvailable < StandardError
93
- end
93
+ class DurabilityLevelNotAvailable < StandardError
94
+ end
94
95
 
95
- class DurabilityImpossible < StandardError
96
- end
96
+ class DurabilityImpossible < StandardError
97
+ end
97
98
 
98
- class DurabilityAmbiguous < StandardError
99
- end
99
+ class DurabilityAmbiguous < StandardError
100
+ end
100
101
 
101
- class DurableWriteInProgress < StandardError
102
- end
102
+ class DurableWriteInProgress < StandardError
103
+ end
103
104
 
104
- class DurableWriteReCommitInProgress < StandardError
105
- end
105
+ class DurableWriteReCommitInProgress < StandardError
106
+ end
106
107
 
107
- class PathNotFound < StandardError
108
- end
108
+ class PathNotFound < StandardError
109
+ end
109
110
 
110
- class PathMismatch < StandardError
111
- end
111
+ class PathMismatch < StandardError
112
+ end
112
113
 
113
- class PathInvalid < StandardError
114
- end
114
+ class PathInvalid < StandardError
115
+ end
115
116
 
116
- class PathTooDeep < StandardError
117
- end
117
+ class PathTooDeep < StandardError
118
+ end
118
119
 
119
- class PathTooBig < StandardError
120
- end
120
+ class PathTooBig < StandardError
121
+ end
121
122
 
122
- class ValueTooDeep < StandardError
123
- end
123
+ class ValueTooDeep < StandardError
124
+ end
124
125
 
125
- class ValueInvalid < StandardError
126
- end
126
+ class ValueInvalid < StandardError
127
+ end
127
128
 
128
- class DocumentNotJson < StandardError
129
- end
129
+ class DocumentNotJson < StandardError
130
+ end
130
131
 
131
- class NumberTooBig < StandardError
132
- end
132
+ class NumberTooBig < StandardError
133
+ end
133
134
 
134
- class DeltaInvalid < StandardError
135
- end
135
+ class DeltaInvalid < StandardError
136
+ end
136
137
 
137
- class PathExists < StandardError
138
- end
138
+ class PathExists < StandardError
139
+ end
139
140
 
140
- class XattrUnknownMacro < StandardError
141
- end
141
+ class XattrUnknownMacro < StandardError
142
+ end
142
143
 
143
- class XattrInvalidKeyCombo < StandardError
144
- end
144
+ class XattrInvalidKeyCombo < StandardError
145
+ end
145
146
 
146
- class XattrUnknownVirtualAttribute < StandardError
147
- end
147
+ class XattrUnknownVirtualAttribute < StandardError
148
+ end
148
149
 
149
- class XattrCannotModifyVirtualAttribute < StandardError
150
- end
150
+ class XattrCannotModifyVirtualAttribute < StandardError
151
+ end
151
152
 
152
- # Query exceptions
153
+ # Query exceptions
153
154
 
154
- class PlanningFailure < StandardError
155
- end
155
+ class PlanningFailure < StandardError
156
+ end
156
157
 
157
- class IndexFailure < StandardError
158
- end
158
+ class IndexFailure < StandardError
159
+ end
159
160
 
160
- class PreparedStatementFailure < StandardError
161
- end
161
+ class PreparedStatementFailure < StandardError
162
+ end
162
163
 
163
164
 
164
- # Analytics exceptions
165
+ # Analytics exceptions
165
166
 
166
- class CompilationFailure < StandardError
167
- end
167
+ class CompilationFailure < StandardError
168
+ end
168
169
 
169
- class JobQueueFull < StandardError
170
- end
170
+ class JobQueueFull < StandardError
171
+ end
171
172
 
172
- class DatasetNotFound < StandardError
173
- end
173
+ class DatasetNotFound < StandardError
174
+ end
174
175
 
175
- class DatasetExists < StandardError
176
- end
176
+ class DatasetExists < StandardError
177
+ end
177
178
 
178
- class DataverseExists < StandardError
179
- end
179
+ class DataverseExists < StandardError
180
+ end
180
181
 
181
- class DataverseNotFound < StandardError
182
- end
182
+ class DataverseNotFound < StandardError
183
+ end
183
184
 
184
- class LinkNotFound < StandardError
185
- end
185
+ class LinkNotFound < StandardError
186
+ end
186
187
 
187
- # View exceptions
188
+ # View exceptions
188
189
 
189
- class DesignDocumentNotFound < StandardError
190
- end
190
+ class DesignDocumentNotFound < StandardError
191
+ end
191
192
 
192
- class ViewNotFound < StandardError
193
- end
193
+ class ViewNotFound < StandardError
194
+ end
194
195
 
195
- # Management exceptions
196
+ # Management exceptions
196
197
 
197
- class CollectionExists < StandardError
198
- end
198
+ class CollectionExists < StandardError
199
+ end
199
200
 
200
- class ScopeExists < StandardError
201
- end
201
+ class ScopeExists < StandardError
202
+ end
202
203
 
203
- class UserExists < StandardError
204
- end
204
+ class UserExists < StandardError
205
+ end
205
206
 
206
- class BucketExists < StandardError
207
- end
207
+ class BucketExists < StandardError
208
+ end
208
209
 
209
- class BucketNotFlushable < StandardError
210
- end
210
+ class BucketNotFlushable < StandardError
211
+ end
211
212
 
212
- class GroupNotFound < StandardError
213
- end
213
+ class GroupNotFound < StandardError
214
+ end
214
215
 
215
- class UserNotFound < StandardError
216
- end
216
+ class UserNotFound < StandardError
217
+ end
217
218
 
218
- # Library-specific exceptions
219
+ # Library-specific exceptions
219
220
 
220
- class BackendError < StandardError
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 DataverseExists
31
- # @raise ArgumentError
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 DataverseNotFound
40
- # @raise ArgumentError
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 DatasetAlreadyExistsError
49
- # @raise ArgumentError
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
- def get_all_datasets(options = GetAllDatasetOptions.new) end
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
- def get_all_indexes(options = GetAllIndexesOptions.new) end
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
- def get_pending_mutations(options = GetPendingMutations.new) end
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