riak-client 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +3 -0
- data/RELEASE_NOTES.md +21 -0
- data/lib/riak/client/beefcake/object_methods.rb +1 -1
- data/lib/riak/client/beefcake_protobuffs_backend.rb +17 -1
- data/lib/riak/client/http_backend.rb +10 -4
- data/lib/riak/locale/en.yml +1 -0
- data/lib/riak/version.rb +1 -1
- data/spec/riak/beefcake_protobuffs_backend_spec.rb +24 -3
- data/spec/riak/http_backend_spec.rb +13 -2
- data/spec/support/unified_backend_examples.rb +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead2288b6e4cf47a182c33bb8f7d9305b3f8bf81
|
4
|
+
data.tar.gz: 84f40a4b0c078fa3d8660d942c47987b9a79e1b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d60099de09cdd2b8dd511eaed9482cd4ab8e35088b5946343afab8871e7414c571090cde02075e62176a312421270539ba7df646c5d44f66803fac1d85daf756
|
7
|
+
data.tar.gz: 4e1513258ca94ac6032f0eda704df463104eb892a03c3d7fe0bd7288a157190a6a8ce4b867a863d28b194278ef3d84e81ad8f8a7f2385e74063a024dc6ebaae1
|
data/README.markdown
CHANGED
@@ -210,6 +210,9 @@ q2 = q.next_page
|
|
210
210
|
$ git checkout master
|
211
211
|
$ git pull --rebase basho master
|
212
212
|
```
|
213
|
+
|
214
|
+
* Copy spec/support/test_server.yml.example to spec/support/test_server.yml and change that file according to your local installation of riak.
|
215
|
+
|
213
216
|
* Create a topic branch. If you've already created a topic branch, rebase it on top of changes from the mainline "master" branch. Examples:
|
214
217
|
* New branch:
|
215
218
|
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Riak Ruby Client Release Notes
|
2
2
|
|
3
|
+
## 1.4.2 Bugfix Release - TBD
|
4
|
+
|
5
|
+
Release 1.4.2 fixes a couple bugs.
|
6
|
+
|
7
|
+
Issues:
|
8
|
+
|
9
|
+
* Secondary index queries against non-2i-enabled buckets/backends now raise a
|
10
|
+
useful exception.
|
11
|
+
|
12
|
+
Bugfixes:
|
13
|
+
|
14
|
+
* 2i Requests over PBC block forever when 0 results match in 1.4.x,
|
15
|
+
reported by Sean "graphex" McKibben in
|
16
|
+
https://github.com/basho/riak-ruby-client/pull/121 and
|
17
|
+
https://github.com/basho/riak-ruby-client/pull/122
|
18
|
+
* RObject#links is an Array when loaded from PBC, reported by Dan Pisarski in
|
19
|
+
https://github.com/basho/riak-ruby-client/pull/123
|
20
|
+
* Bucket listing doesn't work with HTTP backend,
|
21
|
+
reported and fixed by Wagner Camaro in
|
22
|
+
https://github.com/basho/riak-ruby-client/pull/124
|
23
|
+
|
3
24
|
## 1.4.1 Patch/Bugfix Release - 2013-09-06
|
4
25
|
|
5
26
|
Release 1.4.1 fixes a few minor bugs and issues.
|
@@ -47,7 +47,7 @@ module Riak
|
|
47
47
|
rcontent.raw_data = pbuf.value
|
48
48
|
rcontent.etag = pbuf.vtag if pbuf.vtag.present?
|
49
49
|
rcontent.content_type = pbuf.content_type if pbuf.content_type.present?
|
50
|
-
rcontent.links = pbuf.links.map(&method(:decode_link)) if pbuf.links.present?
|
50
|
+
rcontent.links = Set.new(pbuf.links.map(&method(:decode_link))) if pbuf.links.present?
|
51
51
|
pbuf.usermeta.each {|pair| decode_meta(pair, rcontent.meta) } if pbuf.usermeta.present?
|
52
52
|
if pbuf.indexes.present?
|
53
53
|
rcontent.indexes.clear
|
@@ -318,7 +318,23 @@ module Riak
|
|
318
318
|
raise SocketError, "Unexpected EOF on PBC socket" if header.nil?
|
319
319
|
msglen, msgcode = header.unpack("NC")
|
320
320
|
code = MESSAGE_CODES[msgcode]
|
321
|
-
|
321
|
+
if code == :ErrorResp
|
322
|
+
resp = RpbErrorResp.decode socket.read msglen - 1
|
323
|
+
message = resp.errmsg
|
324
|
+
if match = message.match(/indexes_not_supported,(\w+)/)
|
325
|
+
message = t('index.wrong_backend', backend: match[1])
|
326
|
+
end
|
327
|
+
raise ProtobuffsFailedRequest.new resp.errcode, message
|
328
|
+
elsif code != :IndexResp
|
329
|
+
teardown # close socket, we don't know what's going on anymore
|
330
|
+
inner = ProtobuffsFailedRequest.new code, t('protobuffs.unexpected_message')
|
331
|
+
raise Innertube::Pool::BadResource, inner
|
332
|
+
end
|
333
|
+
|
334
|
+
if msglen == 1
|
335
|
+
return if block_given?
|
336
|
+
return IndexCollection.new_from_protobuf(RpbIndexResp.decode(''))
|
337
|
+
end
|
322
338
|
|
323
339
|
message = RpbIndexResp.decode socket.read msglen - 1
|
324
340
|
|
@@ -204,9 +204,9 @@ module Riak
|
|
204
204
|
|
205
205
|
# Lists known buckets
|
206
206
|
# @return [Array<String>] the list of buckets
|
207
|
-
def list_buckets(&block)
|
207
|
+
def list_buckets(options = {}, &block)
|
208
208
|
if block_given?
|
209
|
-
get(200, bucket_list_path(stream: true), &BucketStreamer.new(block))
|
209
|
+
get(200, bucket_list_path(options.merge(stream: true)), &BucketStreamer.new(block))
|
210
210
|
return
|
211
211
|
end
|
212
212
|
|
@@ -294,8 +294,14 @@ module Riak
|
|
294
294
|
end
|
295
295
|
get(200, path, &parser)
|
296
296
|
else
|
297
|
-
|
298
|
-
|
297
|
+
begin
|
298
|
+
response = get(200, path)
|
299
|
+
Riak::IndexCollection.new_from_json response[:body]
|
300
|
+
rescue HTTPFailedRequest => e
|
301
|
+
if match = e.message.match(/indexes_not_supported,(\w+)/)
|
302
|
+
raise HTTPFailedRequest.new :get, 200, 500, e.headers, t('index.wrong_backend', backend: match[1])
|
303
|
+
end
|
304
|
+
end
|
299
305
|
end
|
300
306
|
end
|
301
307
|
|
data/lib/riak/locale/en.yml
CHANGED
@@ -28,6 +28,7 @@ en:
|
|
28
28
|
return_terms_not_available: "The Riak server does not support return_terms."
|
29
29
|
streaming_not_available: "The Riak server does not support streaming."
|
30
30
|
include_terms_is_wrong: "include_terms isn't a valid option; return_terms is."
|
31
|
+
wrong_backend: "Secondary indexes aren't supported on the %{backend} backend."
|
31
32
|
invalid_basic_auth: "basic auth must be set using 'user:pass'"
|
32
33
|
invalid_client_id: "Invalid client ID, must be a string or between 0 and %{max_id}"
|
33
34
|
invalid_io_object: "Invalid IO-like object assigned to RObject#data. It should be assigned to raw_data instead."
|
data/lib/riak/version.rb
CHANGED
@@ -42,6 +42,24 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
|
|
42
42
|
@socket = mock(:socket).as_null_object
|
43
43
|
TCPSocket.stub(:new => @socket)
|
44
44
|
end
|
45
|
+
|
46
|
+
it 'should raise an appropriate error when 2i is not available' do
|
47
|
+
backend.should_receive(:write_protobuff)
|
48
|
+
response_message = Riak::Client::BeefcakeProtobuffsBackend::
|
49
|
+
RpbErrorResp.
|
50
|
+
new(errmsg: '{error,{indexes_not_supported,riak_kv_bitcask_backend}}',
|
51
|
+
errcode: 0).
|
52
|
+
encode
|
53
|
+
|
54
|
+
response_header = [response_message.length + 1, 0].pack('NC')
|
55
|
+
|
56
|
+
@socket.should_receive(:read).with(5).and_return response_header
|
57
|
+
@socket.should_receive(:read).with(response_message.length).and_return response_message
|
58
|
+
|
59
|
+
expect{ backend.get_index 'bucket', 'words', 'asdf' }.to raise_error "Expected success from Riak but received 0. Secondary indexes aren't supported on the riak_kv_bitcask_backend backend."
|
60
|
+
# '
|
61
|
+
end
|
62
|
+
|
45
63
|
context 'when streaming' do
|
46
64
|
it "should stream when a block is given" do
|
47
65
|
backend.should_receive(:write_protobuff) do |msg, req|
|
@@ -99,7 +117,7 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
|
|
99
117
|
results.should == %w{asdf asdg asdh}
|
100
118
|
end
|
101
119
|
|
102
|
-
it "should not crash out when no keys or terms are
|
120
|
+
it "should not crash out when no keys or terms are returned" do
|
103
121
|
backend.should_receive(:write_protobuff) do |msg, req|
|
104
122
|
msg.should == :IndexReq
|
105
123
|
req[:stream].should_not be
|
@@ -107,9 +125,12 @@ describe Riak::Client::BeefcakeProtobuffsBackend do
|
|
107
125
|
|
108
126
|
response_message = Riak::Client::BeefcakeProtobuffsBackend::
|
109
127
|
RpbIndexResp.new().encode
|
110
|
-
|
128
|
+
|
111
129
|
header = [response_message.length + 1, 26].pack 'NC'
|
112
|
-
@socket.
|
130
|
+
@socket.
|
131
|
+
should_receive(:read).
|
132
|
+
with(5).
|
133
|
+
and_return(header)
|
113
134
|
|
114
135
|
results = nil
|
115
136
|
fetch = proc do
|
@@ -171,9 +171,20 @@ describe Riak::Client::HTTPBackend do
|
|
171
171
|
end
|
172
172
|
|
173
173
|
context "listing buckets" do
|
174
|
-
|
174
|
+
before(:each) do
|
175
175
|
@backend.should_receive(:get).with(200, @backend.bucket_list_path).and_return({:body => '{"buckets":["foo", "bar", "baz"]}'})
|
176
|
-
|
176
|
+
end
|
177
|
+
|
178
|
+
context "given no arguments" do
|
179
|
+
it "should GET the bucket list URL and parse the response as JSON" do
|
180
|
+
@backend.list_buckets.should == ["foo", "bar", "baz"]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context "given a hash of options" do
|
185
|
+
it "should GET the bucket list URL and parse the response as JSON" do
|
186
|
+
@backend.list_buckets({}).should == ["foo", "bar", "baz"]
|
187
|
+
end
|
177
188
|
end
|
178
189
|
end
|
179
190
|
|
@@ -11,6 +11,8 @@ shared_examples_for "Unified backend API" do
|
|
11
11
|
@robject.content_type = "application/json"
|
12
12
|
@robject.data = { "test" => "pass" }
|
13
13
|
@robject.indexes['test_bin'] << 'pass' if test_server.version >= "1.0.0"
|
14
|
+
@robject.links << Riak::Link.new('/riak/foo/bar', 'next')
|
15
|
+
@robject.links << Riak::Link.new('/riak/foo/baz', 'next')
|
14
16
|
@backend.store_object(@robject)
|
15
17
|
end
|
16
18
|
|
@@ -18,6 +20,7 @@ shared_examples_for "Unified backend API" do
|
|
18
20
|
robj = @backend.fetch_object("test", "fetch")
|
19
21
|
robj.should be_kind_of(Riak::RObject)
|
20
22
|
robj.data.should == { "test" => "pass" }
|
23
|
+
robj.links.should be_a Set
|
21
24
|
end
|
22
25
|
|
23
26
|
it "should raise an error when the object is not found" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riak-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Cribbs
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -332,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
version: '0'
|
333
333
|
requirements: []
|
334
334
|
rubyforge_project:
|
335
|
-
rubygems_version: 2.0
|
335
|
+
rubygems_version: 2.1.0
|
336
336
|
signing_key:
|
337
337
|
specification_version: 4
|
338
338
|
summary: riak-client is a rich client for Riak, the distributed database by Basho.
|