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
@@ -22,13 +22,23 @@ module Couchbase
|
|
22
22
|
attr_accessor :sequence_number
|
23
23
|
# @return [String] name of the bucket
|
24
24
|
attr_accessor :bucket_name
|
25
|
+
|
26
|
+
# @yieldparam [MutationToken] self
|
27
|
+
def initialize
|
28
|
+
yield self if block_given?
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
class MutationState
|
33
|
+
attr_accessor :tokens
|
34
|
+
|
28
35
|
# Create a mutation state from one or more MutationTokens
|
29
36
|
#
|
30
37
|
# @param [Array<MutationToken>] mutation_tokens the mutation tokens
|
31
|
-
def initialize(*mutation_tokens)
|
38
|
+
def initialize(*mutation_tokens)
|
39
|
+
@tokens = []
|
40
|
+
add(*mutation_tokens)
|
41
|
+
end
|
32
42
|
|
33
43
|
# Add one or more Mutation tokens to this state
|
34
44
|
#
|
data/lib/couchbase/scope.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require
|
15
|
+
require "couchbase/collection"
|
16
16
|
|
17
17
|
module Couchbase
|
18
18
|
class Scope
|
@@ -23,7 +23,7 @@ module Couchbase
|
|
23
23
|
|
24
24
|
# @param [Couchbase::Backend] backend
|
25
25
|
# @param [String] bucket_name name of the bucket
|
26
|
-
# @param [String, :
|
26
|
+
# @param [String, :_default] scope_name name of the scope
|
27
27
|
def initialize(backend, bucket_name, scope_name)
|
28
28
|
@backend = backend
|
29
29
|
@bucket_name = bucket_name
|
@@ -34,7 +34,7 @@ module Couchbase
|
|
34
34
|
#
|
35
35
|
# @return [Collection]
|
36
36
|
def default_collection
|
37
|
-
Collection.new(@backend, @bucket_name, @name, :
|
37
|
+
Collection.new(@backend, @bucket_name, @name, :_default)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Opens the default collection for this scope
|
@@ -46,4 +46,4 @@ module Couchbase
|
|
46
46
|
Collection.new(@backend, @bucket_name, @name, collection_name)
|
47
47
|
end
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
data/lib/couchbase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.2
|
5
5
|
platform: universal-darwin-19
|
6
6
|
authors:
|
7
7
|
- Sergey Avseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,22 +73,28 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/tests-6.0.3.yml"
|
77
|
+
- ".github/workflows/tests.yml"
|
76
78
|
- ".gitignore"
|
77
79
|
- ".gitmodules"
|
78
80
|
- ".idea/.gitignore"
|
79
81
|
- ".idea/dictionaries/gem_terms.xml"
|
80
82
|
- ".idea/inspectionProfiles/Project_Default.xml"
|
81
83
|
- ".idea/vcs.xml"
|
82
|
-
- ".travis.yml"
|
83
84
|
- Gemfile
|
84
85
|
- LICENSE.txt
|
85
86
|
- README.md
|
86
87
|
- Rakefile
|
87
88
|
- bin/console
|
89
|
+
- bin/init-cluster
|
88
90
|
- bin/setup
|
89
91
|
- couchbase.gemspec
|
90
92
|
- examples/crud.rb
|
93
|
+
- examples/managing_buckets.rb
|
94
|
+
- examples/managing_collections.rb
|
95
|
+
- examples/managing_query_indexes.rb
|
91
96
|
- examples/query.rb
|
97
|
+
- examples/query_with_consistency.rb
|
92
98
|
- examples/subdocument.rb
|
93
99
|
- ext/.clang-format
|
94
100
|
- ext/.clang-tidy
|
@@ -102,6 +108,7 @@ files:
|
|
102
108
|
- ext/.idea/vcs.xml
|
103
109
|
- ext/CMakeLists.txt
|
104
110
|
- ext/LICENSE.txt
|
111
|
+
- ext/build_version.hxx.in
|
105
112
|
- ext/couchbase/bucket.hxx
|
106
113
|
- ext/couchbase/cbcrypto/cbcrypto.cc
|
107
114
|
- ext/couchbase/cbcrypto/cbcrypto.h
|
@@ -123,25 +130,51 @@ files:
|
|
123
130
|
- ext/couchbase/configuration.hxx
|
124
131
|
- ext/couchbase/configuration_monitor.hxx
|
125
132
|
- ext/couchbase/couchbase.cxx
|
133
|
+
- ext/couchbase/document_id.hxx
|
126
134
|
- ext/couchbase/error_map.hxx
|
127
135
|
- ext/couchbase/errors.hxx
|
128
|
-
- ext/couchbase/io/binary_message.hxx
|
129
|
-
- ext/couchbase/io/binary_parser.hxx
|
130
136
|
- ext/couchbase/io/http_message.hxx
|
131
137
|
- ext/couchbase/io/http_parser.hxx
|
132
138
|
- ext/couchbase/io/http_session.hxx
|
133
|
-
- ext/couchbase/io/
|
139
|
+
- ext/couchbase/io/mcbp_message.hxx
|
140
|
+
- ext/couchbase/io/mcbp_parser.hxx
|
141
|
+
- ext/couchbase/io/mcbp_session.hxx
|
134
142
|
- ext/couchbase/io/session_manager.hxx
|
135
143
|
- ext/couchbase/mutation_token.hxx
|
136
144
|
- ext/couchbase/operations.hxx
|
145
|
+
- ext/couchbase/operations/bucket_create.hxx
|
146
|
+
- ext/couchbase/operations/bucket_drop.hxx
|
147
|
+
- ext/couchbase/operations/bucket_flush.hxx
|
148
|
+
- ext/couchbase/operations/bucket_get.hxx
|
149
|
+
- ext/couchbase/operations/bucket_get_all.hxx
|
150
|
+
- ext/couchbase/operations/bucket_settings.hxx
|
151
|
+
- ext/couchbase/operations/bucket_update.hxx
|
152
|
+
- ext/couchbase/operations/cluster_developer_preview_enable.hxx
|
153
|
+
- ext/couchbase/operations/collection_create.hxx
|
154
|
+
- ext/couchbase/operations/collection_drop.hxx
|
137
155
|
- ext/couchbase/operations/command.hxx
|
138
|
-
- ext/couchbase/operations/
|
139
|
-
- ext/couchbase/operations/
|
140
|
-
- ext/couchbase/operations/
|
141
|
-
- ext/couchbase/operations/
|
142
|
-
- ext/couchbase/operations/
|
143
|
-
- ext/couchbase/operations/
|
144
|
-
- ext/couchbase/operations/
|
156
|
+
- ext/couchbase/operations/document_decrement.hxx
|
157
|
+
- ext/couchbase/operations/document_exists.hxx
|
158
|
+
- ext/couchbase/operations/document_get.hxx
|
159
|
+
- ext/couchbase/operations/document_get_and_lock.hxx
|
160
|
+
- ext/couchbase/operations/document_get_and_touch.hxx
|
161
|
+
- ext/couchbase/operations/document_increment.hxx
|
162
|
+
- ext/couchbase/operations/document_insert.hxx
|
163
|
+
- ext/couchbase/operations/document_lookup_in.hxx
|
164
|
+
- ext/couchbase/operations/document_mutate_in.hxx
|
165
|
+
- ext/couchbase/operations/document_query.hxx
|
166
|
+
- ext/couchbase/operations/document_remove.hxx
|
167
|
+
- ext/couchbase/operations/document_replace.hxx
|
168
|
+
- ext/couchbase/operations/document_touch.hxx
|
169
|
+
- ext/couchbase/operations/document_unlock.hxx
|
170
|
+
- ext/couchbase/operations/document_upsert.hxx
|
171
|
+
- ext/couchbase/operations/query_index_build_deferred.hxx
|
172
|
+
- ext/couchbase/operations/query_index_create.hxx
|
173
|
+
- ext/couchbase/operations/query_index_drop.hxx
|
174
|
+
- ext/couchbase/operations/query_index_get_all.hxx
|
175
|
+
- ext/couchbase/operations/scope_create.hxx
|
176
|
+
- ext/couchbase/operations/scope_drop.hxx
|
177
|
+
- ext/couchbase/operations/scope_get_all.hxx
|
145
178
|
- ext/couchbase/platform/base64.cc
|
146
179
|
- ext/couchbase/platform/base64.h
|
147
180
|
- ext/couchbase/platform/random.cc
|
@@ -153,28 +186,43 @@ files:
|
|
153
186
|
- ext/couchbase/protocol/client_opcode.hxx
|
154
187
|
- ext/couchbase/protocol/client_request.hxx
|
155
188
|
- ext/couchbase/protocol/client_response.hxx
|
189
|
+
- ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx
|
190
|
+
- ext/couchbase/protocol/cmd_decrement.hxx
|
191
|
+
- ext/couchbase/protocol/cmd_exists.hxx
|
156
192
|
- ext/couchbase/protocol/cmd_get.hxx
|
193
|
+
- ext/couchbase/protocol/cmd_get_and_lock.hxx
|
194
|
+
- ext/couchbase/protocol/cmd_get_and_touch.hxx
|
157
195
|
- ext/couchbase/protocol/cmd_get_cluster_config.hxx
|
158
196
|
- ext/couchbase/protocol/cmd_get_collections_manifest.hxx
|
159
197
|
- ext/couchbase/protocol/cmd_get_error_map.hxx
|
160
198
|
- ext/couchbase/protocol/cmd_hello.hxx
|
199
|
+
- ext/couchbase/protocol/cmd_increment.hxx
|
161
200
|
- ext/couchbase/protocol/cmd_info.hxx
|
201
|
+
- ext/couchbase/protocol/cmd_insert.hxx
|
162
202
|
- ext/couchbase/protocol/cmd_lookup_in.hxx
|
163
203
|
- ext/couchbase/protocol/cmd_mutate_in.hxx
|
164
204
|
- ext/couchbase/protocol/cmd_remove.hxx
|
205
|
+
- ext/couchbase/protocol/cmd_replace.hxx
|
165
206
|
- ext/couchbase/protocol/cmd_sasl_auth.hxx
|
166
207
|
- ext/couchbase/protocol/cmd_sasl_list_mechs.hxx
|
167
208
|
- ext/couchbase/protocol/cmd_sasl_step.hxx
|
168
209
|
- ext/couchbase/protocol/cmd_select_bucket.hxx
|
210
|
+
- ext/couchbase/protocol/cmd_touch.hxx
|
211
|
+
- ext/couchbase/protocol/cmd_unlock.hxx
|
169
212
|
- ext/couchbase/protocol/cmd_upsert.hxx
|
170
213
|
- ext/couchbase/protocol/datatype.hxx
|
214
|
+
- ext/couchbase/protocol/durability_level.hxx
|
215
|
+
- ext/couchbase/protocol/frame_info_id.hxx
|
171
216
|
- ext/couchbase/protocol/hello_feature.hxx
|
172
217
|
- ext/couchbase/protocol/magic.hxx
|
218
|
+
- ext/couchbase/protocol/server_opcode.hxx
|
219
|
+
- ext/couchbase/protocol/server_request.hxx
|
173
220
|
- ext/couchbase/protocol/status.hxx
|
174
221
|
- ext/couchbase/protocol/unsigned_leb128.h
|
175
222
|
- ext/couchbase/service_type.hxx
|
176
223
|
- ext/couchbase/utils/byteswap.hxx
|
177
224
|
- ext/couchbase/utils/crc32.hxx
|
225
|
+
- ext/couchbase/utils/url_codec.hxx
|
178
226
|
- ext/couchbase/version.hxx
|
179
227
|
- ext/extconf.rb
|
180
228
|
- ext/test/main.cxx
|
@@ -1872,6 +1920,49 @@ files:
|
|
1872
1920
|
- ext/third_party/json/tests/taocpp/position.json
|
1873
1921
|
- ext/third_party/json/tests/taocpp/schema.json
|
1874
1922
|
- ext/third_party/json/tests/twitter.json
|
1923
|
+
- ext/third_party/snappy/.appveyor.yml
|
1924
|
+
- ext/third_party/snappy/.gitignore
|
1925
|
+
- ext/third_party/snappy/.travis.yml
|
1926
|
+
- ext/third_party/snappy/AUTHORS
|
1927
|
+
- ext/third_party/snappy/CMakeLists.txt
|
1928
|
+
- ext/third_party/snappy/CONTRIBUTING.md
|
1929
|
+
- ext/third_party/snappy/COPYING
|
1930
|
+
- ext/third_party/snappy/NEWS
|
1931
|
+
- ext/third_party/snappy/README.md
|
1932
|
+
- ext/third_party/snappy/cmake/SnappyConfig.cmake.in
|
1933
|
+
- ext/third_party/snappy/cmake/config.h.in
|
1934
|
+
- ext/third_party/snappy/docs/README.md
|
1935
|
+
- ext/third_party/snappy/format_description.txt
|
1936
|
+
- ext/third_party/snappy/framing_format.txt
|
1937
|
+
- ext/third_party/snappy/snappy-c.cc
|
1938
|
+
- ext/third_party/snappy/snappy-c.h
|
1939
|
+
- ext/third_party/snappy/snappy-internal.h
|
1940
|
+
- ext/third_party/snappy/snappy-sinksource.cc
|
1941
|
+
- ext/third_party/snappy/snappy-sinksource.h
|
1942
|
+
- ext/third_party/snappy/snappy-stubs-internal.cc
|
1943
|
+
- ext/third_party/snappy/snappy-stubs-internal.h
|
1944
|
+
- ext/third_party/snappy/snappy-stubs-public.h.in
|
1945
|
+
- ext/third_party/snappy/snappy-test.cc
|
1946
|
+
- ext/third_party/snappy/snappy-test.h
|
1947
|
+
- ext/third_party/snappy/snappy.cc
|
1948
|
+
- ext/third_party/snappy/snappy.h
|
1949
|
+
- ext/third_party/snappy/snappy_compress_fuzzer.cc
|
1950
|
+
- ext/third_party/snappy/snappy_uncompress_fuzzer.cc
|
1951
|
+
- ext/third_party/snappy/snappy_unittest.cc
|
1952
|
+
- ext/third_party/snappy/testdata/alice29.txt
|
1953
|
+
- ext/third_party/snappy/testdata/asyoulik.txt
|
1954
|
+
- ext/third_party/snappy/testdata/baddata1.snappy
|
1955
|
+
- ext/third_party/snappy/testdata/baddata2.snappy
|
1956
|
+
- ext/third_party/snappy/testdata/baddata3.snappy
|
1957
|
+
- ext/third_party/snappy/testdata/fireworks.jpeg
|
1958
|
+
- ext/third_party/snappy/testdata/geo.protodata
|
1959
|
+
- ext/third_party/snappy/testdata/html
|
1960
|
+
- ext/third_party/snappy/testdata/html_x_4
|
1961
|
+
- ext/third_party/snappy/testdata/kppkn.gtb
|
1962
|
+
- ext/third_party/snappy/testdata/lcet10.txt
|
1963
|
+
- ext/third_party/snappy/testdata/paper-100k.pdf
|
1964
|
+
- ext/third_party/snappy/testdata/plrabn12.txt
|
1965
|
+
- ext/third_party/snappy/testdata/urls.10K
|
1875
1966
|
- ext/third_party/spdlog/.clang-format
|
1876
1967
|
- ext/third_party/spdlog/.clang-tidy
|
1877
1968
|
- ext/third_party/spdlog/.gitattributes
|
@@ -2025,11 +2116,14 @@ files:
|
|
2025
2116
|
- lib/couchbase.rb
|
2026
2117
|
- lib/couchbase/authenticator.rb
|
2027
2118
|
- lib/couchbase/binary_collection.rb
|
2119
|
+
- lib/couchbase/binary_collection_options.rb
|
2028
2120
|
- lib/couchbase/bucket.rb
|
2029
2121
|
- lib/couchbase/cluster.rb
|
2030
2122
|
- lib/couchbase/collection.rb
|
2123
|
+
- lib/couchbase/collection_options.rb
|
2031
2124
|
- lib/couchbase/common_options.rb
|
2032
2125
|
- lib/couchbase/errors.rb
|
2126
|
+
- lib/couchbase/json_transcoder.rb
|
2033
2127
|
- lib/couchbase/libcouchbase.bundle
|
2034
2128
|
- lib/couchbase/management/analytics_index_manager.rb
|
2035
2129
|
- lib/couchbase/management/bucket_manager.rb
|
@@ -2039,20 +2133,21 @@ files:
|
|
2039
2133
|
- lib/couchbase/management/user_manager.rb
|
2040
2134
|
- lib/couchbase/management/view_index_manager.rb
|
2041
2135
|
- lib/couchbase/mutation_state.rb
|
2042
|
-
- lib/couchbase/results.rb
|
2043
2136
|
- lib/couchbase/scope.rb
|
2044
2137
|
- lib/couchbase/subdoc.rb
|
2045
2138
|
- lib/couchbase/version.rb
|
2046
2139
|
- rbi/couchbase.rbi
|
2047
|
-
homepage: https://
|
2140
|
+
homepage: https://www.couchbase.com
|
2048
2141
|
licenses:
|
2049
|
-
-
|
2142
|
+
- Apache-2.0
|
2050
2143
|
metadata:
|
2051
|
-
homepage_uri: https://
|
2144
|
+
homepage_uri: https://www.couchbase.com
|
2052
2145
|
source_code_uri: https://github.com/couchbase/couchbase-ruby-client
|
2053
2146
|
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases
|
2054
2147
|
post_install_message:
|
2055
|
-
rdoc_options:
|
2148
|
+
rdoc_options:
|
2149
|
+
- "--exclude"
|
2150
|
+
- ext/
|
2056
2151
|
require_paths:
|
2057
2152
|
- lib
|
2058
2153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/.travis.yml
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright 2020 Couchbase, Inc.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
|
18
|
-
#pragma once
|
19
|
-
|
20
|
-
#include <gsl/gsl_assert>
|
21
|
-
#include <protocol/magic.hxx>
|
22
|
-
|
23
|
-
namespace couchbase::io
|
24
|
-
{
|
25
|
-
struct binary_parser {
|
26
|
-
enum result { ok, need_data, failure };
|
27
|
-
|
28
|
-
template<typename Iterator>
|
29
|
-
void feed(Iterator begin, Iterator end)
|
30
|
-
{
|
31
|
-
buf.reserve(buf.size() + static_cast<size_t>(std::distance(begin, end)));
|
32
|
-
std::copy(begin, end, std::back_inserter(buf));
|
33
|
-
}
|
34
|
-
|
35
|
-
void reset()
|
36
|
-
{
|
37
|
-
buf.clear();
|
38
|
-
}
|
39
|
-
|
40
|
-
result next(binary_message& msg)
|
41
|
-
{
|
42
|
-
static const size_t header_size = 24;
|
43
|
-
if (buf.size() < header_size) {
|
44
|
-
return need_data;
|
45
|
-
}
|
46
|
-
std::memcpy(&msg.header, buf.data(), header_size);
|
47
|
-
uint32_t body_size = ntohl(msg.header.bodylen);
|
48
|
-
if (body_size > 0 && buf.size() - header_size < body_size) {
|
49
|
-
return need_data;
|
50
|
-
}
|
51
|
-
msg.body.clear();
|
52
|
-
msg.body.reserve(body_size);
|
53
|
-
std::copy(buf.begin() + header_size, buf.begin() + header_size + body_size, std::back_inserter(msg.body));
|
54
|
-
buf.erase(buf.begin(), buf.begin() + header_size + body_size);
|
55
|
-
if (!protocol::is_valid_magic(buf[0])) {
|
56
|
-
spdlog::warn("invalid magic of the next frame: {:x}, {} bytes to parse", buf[0], buf.size());
|
57
|
-
reset();
|
58
|
-
}
|
59
|
-
return ok;
|
60
|
-
}
|
61
|
-
|
62
|
-
std::vector<std::uint8_t> buf;
|
63
|
-
};
|
64
|
-
} // namespace couchbase::io
|
data/lib/couchbase/results.rb
DELETED
@@ -1,307 +0,0 @@
|
|
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 QueryResult
|
19
|
-
# @return [QueryMetaData] returns object representing additional metadata associated with this query
|
20
|
-
attr_accessor :meta_data
|
21
|
-
|
22
|
-
attr_accessor :transcoder
|
23
|
-
|
24
|
-
# Returns all rows converted using a transcoder
|
25
|
-
#
|
26
|
-
# @return [Array]
|
27
|
-
def rows(transcoder = self.transcoder)
|
28
|
-
@rows.lazy.map do |row|
|
29
|
-
if transcoder == :json
|
30
|
-
JSON.parse(row)
|
31
|
-
else
|
32
|
-
transcoder.call(row)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def initialize
|
38
|
-
yield self if block_given?
|
39
|
-
@transcoder = :json
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class QueryMetaData
|
44
|
-
# @return [String] returns the request identifier string of the query request
|
45
|
-
attr_accessor :request_id
|
46
|
-
|
47
|
-
# @return [String] returns the client context identifier string set of the query request
|
48
|
-
attr_accessor :client_context_id
|
49
|
-
|
50
|
-
# @return [Symbol] returns raw query execution status as returned by the query engine
|
51
|
-
attr_accessor :status
|
52
|
-
|
53
|
-
# @return [Hash] returns the signature as returned by the query engine which is then decoded as JSON object
|
54
|
-
attr_accessor :signature
|
55
|
-
|
56
|
-
# @return [Hash] returns the profiling information returned by the query engine which is then decoded as JSON object
|
57
|
-
attr_accessor :profile
|
58
|
-
|
59
|
-
# @return [QueryMetrics] metrics as returned by the query engine, if enabled
|
60
|
-
attr_accessor :metrics
|
61
|
-
|
62
|
-
# @return [List<QueryWarning>] list of warnings returned by the query engine
|
63
|
-
attr_accessor :warnings
|
64
|
-
|
65
|
-
def initialize
|
66
|
-
yield self if block_given?
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
class QueryMetrics
|
71
|
-
# @return [Integer] The total time taken for the request, that is the time from when the request was received until the results were returned
|
72
|
-
attr_accessor :elapsed_time
|
73
|
-
|
74
|
-
# @return [Integer] The time taken for the execution of the request, that is the time from when query execution started until the results were returned
|
75
|
-
attr_accessor :execution_time
|
76
|
-
|
77
|
-
# @return [Integer] the total number of results selected by the engine before restriction through LIMIT clause.
|
78
|
-
attr_accessor :sort_count
|
79
|
-
|
80
|
-
# @return [Integer] The total number of objects in the results.
|
81
|
-
attr_accessor :result_count
|
82
|
-
|
83
|
-
# @return [Integer] The total number of bytes in the results.
|
84
|
-
attr_accessor :result_size
|
85
|
-
|
86
|
-
# @return [Integer] The number of mutations that were made during the request.
|
87
|
-
attr_accessor :mutation_count
|
88
|
-
|
89
|
-
# @return [Integer] The number of errors that occurred during the request.
|
90
|
-
attr_accessor :error_count
|
91
|
-
|
92
|
-
# @return [Integer] The number of warnings that occurred during the request.
|
93
|
-
attr_accessor :warning_count
|
94
|
-
|
95
|
-
def initialize
|
96
|
-
yield self if block_given?
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# Represents a single warning returned from the query engine.
|
101
|
-
class QueryWarning
|
102
|
-
# @return [Integer]
|
103
|
-
attr_accessor :code
|
104
|
-
|
105
|
-
# @return [String]
|
106
|
-
attr_accessor :message
|
107
|
-
|
108
|
-
def initialize(code, message)
|
109
|
-
@code = code
|
110
|
-
@message = message
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
class GetResult
|
115
|
-
# @return [Integer] holds the CAS value of the fetched document
|
116
|
-
attr_accessor :cas
|
117
|
-
|
118
|
-
# @return [Integer] the expiration if fetched and present
|
119
|
-
attr_accessor :expiration
|
120
|
-
|
121
|
-
# @return [String] The encoded content when loading the document
|
122
|
-
attr_accessor :content
|
123
|
-
|
124
|
-
# Decodes the content of the document using given (or default transcoder)
|
125
|
-
#
|
126
|
-
# @param [Proc, :json] transcoder custom transcoder
|
127
|
-
#
|
128
|
-
# @return [Object]
|
129
|
-
def content_as(transcoder = self.transcoder)
|
130
|
-
if transcoder == :json
|
131
|
-
JSON.parse(@content)
|
132
|
-
else
|
133
|
-
transcoder.call(@content, @flags)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def initialize
|
138
|
-
yield self if block_given?
|
139
|
-
@transcoder = :json
|
140
|
-
end
|
141
|
-
|
142
|
-
protected
|
143
|
-
|
144
|
-
# @return [Integer] The flags from the operation
|
145
|
-
attr_accessor :flags
|
146
|
-
|
147
|
-
# @return [Proc] The default transcoder which should be used
|
148
|
-
attr_accessor :transcoder
|
149
|
-
end
|
150
|
-
|
151
|
-
class GetReplicaResult < GetResult
|
152
|
-
# @return [Boolean] true if this result came from a replica
|
153
|
-
attr_accessor :is_replica
|
154
|
-
alias_method :replica?, :is_replica
|
155
|
-
end
|
156
|
-
|
157
|
-
class ExistsResult
|
158
|
-
# @return [Integer] holds the CAS value of the fetched document
|
159
|
-
attr_accessor :cas
|
160
|
-
|
161
|
-
# @return [Boolean] Holds the boolean if the document actually exists
|
162
|
-
attr_accessor :exists
|
163
|
-
alias_method :exists?, :exists
|
164
|
-
end
|
165
|
-
|
166
|
-
class MutationResult
|
167
|
-
# @return [Integer] holds the CAS value of the document after the mutation
|
168
|
-
attr_accessor :cas
|
169
|
-
|
170
|
-
# @return [MutationToken] if returned, holds the mutation token of the document after the mutation
|
171
|
-
attr_accessor :mutation_token
|
172
|
-
|
173
|
-
def initialize
|
174
|
-
yield self if block_given?
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
class LookupInResult
|
179
|
-
# @return [Integer] holds the CAS value of the fetched document
|
180
|
-
attr_accessor :cas
|
181
|
-
|
182
|
-
# Decodes the content at the given index
|
183
|
-
#
|
184
|
-
# @param [Integer] index the index of the subdocument value to decode
|
185
|
-
#
|
186
|
-
# @return [Object] the decoded
|
187
|
-
def content(index, transcoder = self.transcoder)
|
188
|
-
if transcoder == :json
|
189
|
-
return if encoded[index].value&.empty?
|
190
|
-
JSON.parse(encoded[index].value)
|
191
|
-
else
|
192
|
-
transcoder.call(encoded[index].value)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
# Allows to check if a value at the given index exists
|
197
|
-
#
|
198
|
-
# @param [Integer] index the index of the subdocument value to check
|
199
|
-
#
|
200
|
-
# @return [Boolean] true if a value is present at the index, false otherwise
|
201
|
-
def exists?(index)
|
202
|
-
encoded[index].exists
|
203
|
-
end
|
204
|
-
|
205
|
-
# @return [Array<SubDocumentField>] holds the encoded subdocument responses
|
206
|
-
attr_accessor :encoded
|
207
|
-
|
208
|
-
def initialize
|
209
|
-
yield self if block_given?
|
210
|
-
@transcoder = :json
|
211
|
-
end
|
212
|
-
|
213
|
-
private
|
214
|
-
|
215
|
-
# @return [Proc] The default transcoder which should be used
|
216
|
-
attr_accessor :transcoder
|
217
|
-
end
|
218
|
-
|
219
|
-
class MutateInResult < MutationResult
|
220
|
-
# Decodes the content at the given index
|
221
|
-
#
|
222
|
-
# @param [Integer] index the index of the subdocument value to decode
|
223
|
-
#
|
224
|
-
# @return [Object] the decoded
|
225
|
-
def content(index, transcoder = self.transcoder)
|
226
|
-
if transcoder == :json
|
227
|
-
JSON.parse(encoded[index].value)
|
228
|
-
else
|
229
|
-
transcoder.call(encoded[index].value)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
def initialize
|
234
|
-
yield self if block_given?
|
235
|
-
@transcoder = :json
|
236
|
-
end
|
237
|
-
|
238
|
-
def success?
|
239
|
-
!!first_error_index
|
240
|
-
end
|
241
|
-
|
242
|
-
# @return [Array<SubDocumentField>] holds the encoded subdocument responses
|
243
|
-
attr_accessor :encoded
|
244
|
-
|
245
|
-
# @return [Integer, nil] index of first operation entry that generated an error
|
246
|
-
attr_accessor :first_error_index
|
247
|
-
|
248
|
-
private
|
249
|
-
|
250
|
-
# @return [Proc] The default transcoder which should be used
|
251
|
-
attr_accessor :transcoder
|
252
|
-
end
|
253
|
-
|
254
|
-
# @private
|
255
|
-
class SubDocumentField
|
256
|
-
attr_accessor :error
|
257
|
-
# @return [Boolean] true if the path exists in the document
|
258
|
-
attr_accessor :exists
|
259
|
-
# @return [String] value
|
260
|
-
attr_accessor :value
|
261
|
-
# @return [String] path
|
262
|
-
attr_accessor :path
|
263
|
-
|
264
|
-
# * +:set_doc+
|
265
|
-
# * +:counter+
|
266
|
-
# * +:replace+
|
267
|
-
# * +:dict_add+
|
268
|
-
# * +:dict_upsert+
|
269
|
-
# * +:array_push_first+
|
270
|
-
# * +:array_push_last+
|
271
|
-
# * +:array_add_unique+
|
272
|
-
# * +:array_insert+
|
273
|
-
# * +:delete+
|
274
|
-
# * +:get+
|
275
|
-
# * +:exists+
|
276
|
-
# * +:count+
|
277
|
-
# * +:get_doc+
|
278
|
-
#
|
279
|
-
# @return [Symbol] command type
|
280
|
-
attr_accessor :type
|
281
|
-
|
282
|
-
# * +:success+ Indicates a successful response in general.
|
283
|
-
# * +:path_not_found+ The provided path does not exist in the document
|
284
|
-
# * +:path_mismatch+ One of path components treats a non-dictionary as a dictionary, or a non-array as an array, or value the path points to is not a number
|
285
|
-
# * +:path_invalid+ The path's syntax was incorrect
|
286
|
-
# * +:path_too_big+ The path provided is too large: either the string is too long, or it contains too many components
|
287
|
-
# * +:value_cannot_insert+ The value provided will invalidate the JSON if inserted
|
288
|
-
# * +:doc_not_json+ The existing document is not valid JSON
|
289
|
-
# * +:num_range+ The existing number is out of the valid range for arithmetic operations
|
290
|
-
# * +:delta_invalid+ The operation would result in a number outside the valid range
|
291
|
-
# * +:path_exists+ The requested operation requires the path to not already exist, but it exists
|
292
|
-
# * +:value_too_deep+ Inserting the value would cause the document to be too deep
|
293
|
-
# * +:invalid_combo+ An invalid combination of commands was specified
|
294
|
-
# * +:xattr_invalid_flag_combo+ An invalid combination of operations, using macros when not using extended attributes
|
295
|
-
# * +:xattr_invalid_key_combo+ Only single xattr key may be accessed at the same time
|
296
|
-
# * +:xattr_unknown_macro+ The server has no knowledge of the requested macro
|
297
|
-
# * +:xattr_unknown_vattr+ Unknown virtual attribute.
|
298
|
-
# * +:xattr_cannot_modify_vattr+ Cannot modify this virtual attribute.
|
299
|
-
# * +:unknown+ Unknown error.
|
300
|
-
# @return [Symbol] status
|
301
|
-
attr_accessor :status
|
302
|
-
|
303
|
-
def initialize
|
304
|
-
yield self if block_given?
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|