riak-client 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE_NOTES.md +23 -0
- data/lib/riak/bucket.rb +9 -1
- data/lib/riak/bucket_type.rb +1 -1
- data/lib/riak/bucket_typed/bucket.rb +11 -0
- data/lib/riak/map_reduce.rb +13 -7
- data/lib/riak/rcontent.rb +2 -2
- data/lib/riak/version.rb +1 -1
- data/spec/integration/riak/encodings/crdt_spec.rb +76 -0
- data/spec/integration/riak/encodings/kv_spec.rb +81 -0
- data/spec/integration/riak/encodings/yz_spec.rb +141 -0
- data/spec/riak/bucket_typed/bucket_spec.rb +16 -0
- data/spec/riak/map_reduce_spec.rb +7 -0
- data/spec/riak/search_spec.rb +6 -6
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e4c5dd56ba3d2a7ea13534ba0d15f0bd7b2119
|
4
|
+
data.tar.gz: e1c2afdbb12543c942f7d58bf15d9f5c07f40f03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab4b31f98818b08370d58a6379ce9a607ab9aabdbc09efddf1cc40a2f45af7d45252add5dbdfb4f562c5ad9d21bf40ad4a1f3506c4ba5ba4ed2eaa98a244c356
|
7
|
+
data.tar.gz: f6241dbd209b254d53024eca1db750789aaa6ec031ea53483b34dbb315317d0bf94d80570edd6cf92dba841092c9d6a90ffc3a3f12b3cfeeb3e8c1ae64e9e44e
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Riak Ruby Client Release Notes
|
2
2
|
|
3
|
+
## 2.2.1 Release - 2015-06-19
|
4
|
+
|
5
|
+
Version 2.2.1 is a bugfix release, and includes additional testing of character
|
6
|
+
encodings.
|
7
|
+
|
8
|
+
Bug fixes:
|
9
|
+
|
10
|
+
* Support bucket-typed buckets when creating secondary-index input phases
|
11
|
+
for map-reduce, thanks to Takeshi Akima.
|
12
|
+
* Support Riak Search 2 / Yokozuna results as input phases for map-reduce,
|
13
|
+
thanks again to Takeshi Akima.
|
14
|
+
* `BucketTyped::Bucket#get_index` now includes the bucket type name in the
|
15
|
+
2i request.
|
16
|
+
* `Bucket#==` now performs an encoding-independent comparison on bucket names.
|
17
|
+
* `BucketType#==` also does an encoding-independent comparison on type names.
|
18
|
+
|
19
|
+
Testing enhancements:
|
20
|
+
|
21
|
+
* Non-ASCII UTF-8 strings, and binary strings containing byte 255 are tested
|
22
|
+
with key-value, secondary index, CRDT, and Riak Search interfaces. These
|
23
|
+
findings are available on our documentation site:
|
24
|
+
http://basho.github.io/riak-ruby-client/encoding.html
|
25
|
+
|
3
26
|
## 2.2.0 Release - 2015-05-27
|
4
27
|
|
5
28
|
Version 2.2.0 is a feature release.
|
data/lib/riak/bucket.rb
CHANGED
@@ -33,6 +33,10 @@ module Riak
|
|
33
33
|
# If a block is given, keys will be streamed through
|
34
34
|
# the block (useful for large buckets). When streaming,
|
35
35
|
# results of the operation will not be returned to the caller.
|
36
|
+
#
|
37
|
+
# Returned keys will be in binary encoding regardless of the key's original
|
38
|
+
# encoding.
|
39
|
+
#
|
36
40
|
# @yield [Array<String>] a list of keys from the current chunk
|
37
41
|
# @return [Array<String>] Keys in this bucket
|
38
42
|
# @note This operation has serious performance implications and
|
@@ -290,7 +294,11 @@ module Riak
|
|
290
294
|
def ==(other)
|
291
295
|
return false unless self.class == other.class
|
292
296
|
return false unless self.client == other.client
|
293
|
-
return
|
297
|
+
return true if self.name.nil? && other.name.nil?
|
298
|
+
unless self.name.respond_to?(:bytes) && other.name.respond_to?(:bytes)
|
299
|
+
return false
|
300
|
+
end
|
301
|
+
return false unless self.name.bytes == other.name.bytes
|
294
302
|
true
|
295
303
|
end
|
296
304
|
end
|
data/lib/riak/bucket_type.rb
CHANGED
@@ -98,6 +98,17 @@ module Riak
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
# Queries a secondary index on the bucket-typed bucket.
|
102
|
+
# @note This will only work if your Riak installation supports 2I.
|
103
|
+
# @param [String] index the name of the index
|
104
|
+
# @param [String,Integer,Range] query the value of the index, or a
|
105
|
+
# Range of values to query
|
106
|
+
# @return [Array<String>] a list of keys that match the index
|
107
|
+
# query
|
108
|
+
def get_index(index, query, options = { })
|
109
|
+
super index, query, o(options)
|
110
|
+
end
|
111
|
+
|
101
112
|
# Does this {BucketTyped::Bucket} have a non-default bucket type?
|
102
113
|
# @return [Boolean] true if this bucket has a non-default type.
|
103
114
|
def needs_type?
|
data/lib/riak/map_reduce.rb
CHANGED
@@ -110,12 +110,13 @@ module Riak
|
|
110
110
|
end
|
111
111
|
|
112
112
|
# (Riak Search) Use a search query to start a map/reduce job.
|
113
|
-
# @param [String,
|
113
|
+
# @param [String,Riak::Search::Index] index the index to query, either a
|
114
|
+
# {Riak::Search::Index} instance or a {String}
|
114
115
|
# @param [String] query the query to run
|
115
116
|
# @return [MapReduce] self
|
116
|
-
def search(
|
117
|
-
|
118
|
-
@inputs = {:module => "
|
117
|
+
def search(index, query)
|
118
|
+
index = index.name if index.respond_to?(:name)
|
119
|
+
@inputs = {:module => "yokozuna", :function => "mapred_search", :arg => [index, query]}
|
119
120
|
self
|
120
121
|
end
|
121
122
|
|
@@ -127,13 +128,18 @@ module Riak
|
|
127
128
|
# a range of values (of Strings or Integers)
|
128
129
|
# @return [MapReduce] self
|
129
130
|
def index(bucket, index, query)
|
130
|
-
|
131
|
+
if bucket.is_a? Bucket
|
132
|
+
bucket = bucket.needs_type? ? [maybe_escape(bucket.type.name), maybe_escape(bucket.name)] : maybe_escape(bucket.name)
|
133
|
+
else
|
134
|
+
bucket = maybe_escape(bucket)
|
135
|
+
end
|
136
|
+
|
131
137
|
case query
|
132
138
|
when String, Fixnum
|
133
|
-
@inputs = {:bucket =>
|
139
|
+
@inputs = {:bucket => bucket, :index => index, :key => query}
|
134
140
|
when Range
|
135
141
|
raise ArgumentError, t('invalid_index_query', :value => query.inspect) unless String === query.begin || Integer === query.begin
|
136
|
-
@inputs = {:bucket =>
|
142
|
+
@inputs = {:bucket => bucket, :index => index, :start => query.begin, :end => query.end}
|
137
143
|
else
|
138
144
|
raise ArgumentError, t('invalid_index_query', :value => query.inspect)
|
139
145
|
end
|
data/lib/riak/rcontent.rb
CHANGED
@@ -58,7 +58,8 @@ module Riak
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
# @return [Object] the unmarshaled form of {#raw_data} stored in riak at
|
61
|
+
# @return [Object] the unmarshaled form of {#raw_data} stored in riak at
|
62
|
+
# this object's key
|
62
63
|
def data
|
63
64
|
if @raw_data && !@data
|
64
65
|
raw = @raw_data.respond_to?(:read) ? @raw_data.read : @raw_data
|
@@ -82,7 +83,6 @@ module Riak
|
|
82
83
|
@data = new_data
|
83
84
|
end
|
84
85
|
|
85
|
-
|
86
86
|
# @return [String] raw data stored in riak for this object's key
|
87
87
|
def raw_data
|
88
88
|
if @data && !@raw_data
|
data/lib/riak/version.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'riak'
|
4
|
+
|
5
|
+
describe 'Encoding and CRDTs', integration: true, search_config: true do
|
6
|
+
shared_examples 'CRDTs with weird names' do
|
7
|
+
let(:counter_bucket) do
|
8
|
+
test_client.bucket_type('counters').bucket(random_string)
|
9
|
+
end
|
10
|
+
let(:map_bucket) do
|
11
|
+
test_client.bucket_type('maps').bucket(random_string)
|
12
|
+
end
|
13
|
+
let(:set_bucket) do
|
14
|
+
test_client.bucket_type('sets').bucket(random_string)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'creates counters' do
|
18
|
+
counter = nil
|
19
|
+
expect{ counter = Riak::Crdt::Counter.new counter_bucket, random_string }.
|
20
|
+
to_not raise_error
|
21
|
+
|
22
|
+
expect(counter).to be_a Riak::Crdt::Counter
|
23
|
+
|
24
|
+
expect(value = counter.value).to be_a Numeric
|
25
|
+
|
26
|
+
expect{ counter.increment }.to_not raise_error
|
27
|
+
expect(counter.value).to eq value + 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'updates registers in maps' do
|
31
|
+
map = nil
|
32
|
+
expect{ map = Riak::Crdt::Map.new map_bucket, random_string }.
|
33
|
+
to_not raise_error
|
34
|
+
|
35
|
+
expect(map).to be_a Riak::Crdt::Map
|
36
|
+
|
37
|
+
expect(map.registers[random_string]).to be_nil
|
38
|
+
expect{ map.registers[random_string] = random_string }.
|
39
|
+
to_not raise_error
|
40
|
+
|
41
|
+
expect(map.registers[random_string]).to eq random_string
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'updates sets' do
|
45
|
+
set = nil
|
46
|
+
expect{ set = Riak::Crdt::Set.new set_bucket, random_string }.
|
47
|
+
to_not raise_error
|
48
|
+
|
49
|
+
expect(set).to be_a Riak::Crdt::Set
|
50
|
+
|
51
|
+
expect(set.members).to_not include random_string
|
52
|
+
|
53
|
+
set.add random_string
|
54
|
+
|
55
|
+
expect(set.members).to include random_string
|
56
|
+
|
57
|
+
set.remove random_string
|
58
|
+
|
59
|
+
expect(set.members).to_not include random_string
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'with utf-8 strings' do
|
64
|
+
let(:string){ "\xF0\x9F\x9A\xB4こんにちはสวัสดี" }
|
65
|
+
let(:random_string){ string + random_key }
|
66
|
+
|
67
|
+
include_examples 'CRDTs with weird names'
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'with binary strings' do
|
71
|
+
let(:string){ "\xff\xff".force_encoding('binary') }
|
72
|
+
let(:random_string){ string + random_key }
|
73
|
+
|
74
|
+
include_examples 'CRDTs with weird names'
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'riak'
|
4
|
+
|
5
|
+
describe 'Encoding and Riak KV', integration: true, test_client: true do
|
6
|
+
let(:bucket_type){ test_client.bucket_type 'yokozuna' }
|
7
|
+
|
8
|
+
let(:utf8_encoding){ Encoding.find 'utf-8' }
|
9
|
+
let(:utf8_string){ "\xF0\x9F\x9A\xB4こんにちはสวัสดี" }
|
10
|
+
let(:random_utf8_string){ utf8_string + random_key }
|
11
|
+
let(:utf8_bucket){ bucket_type.bucket random_utf8_string }
|
12
|
+
|
13
|
+
let(:binary_encoding){ Encoding.find 'binary' }
|
14
|
+
let(:binary_string){ "\xff\xff".force_encoding('binary') }
|
15
|
+
let(:random_binary_string){ binary_string + random_key }
|
16
|
+
let(:binary_bucket){ bucket_type.bucket random_binary_string }
|
17
|
+
|
18
|
+
it 'encodes the test strings correctly' do
|
19
|
+
expect(utf8_string.encoding).to eq utf8_encoding
|
20
|
+
expect(random_utf8_string.encoding).to eq utf8_encoding
|
21
|
+
expect(binary_string.encoding).to eq binary_encoding
|
22
|
+
expect(random_binary_string.encoding).to eq binary_encoding
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'key-value operations' do
|
26
|
+
it 'allows utf-8 strings in bucket and key names, values, and 2i' do
|
27
|
+
expect(utf8_bucket).to be_a Riak::Bucket
|
28
|
+
expect(robj = utf8_bucket.new(random_utf8_string)).to be_a Riak::RObject
|
29
|
+
robj.content_type = 'text/plain'
|
30
|
+
robj.data = random_utf8_string
|
31
|
+
robj.indexes['cat_bin'] = [random_utf8_string, 'asdf']
|
32
|
+
expect{ robj.store }.to_not raise_error
|
33
|
+
|
34
|
+
expect(robj2 = utf8_bucket.get(random_utf8_string)).to be_a Riak::RObject
|
35
|
+
expect(robj2.data).to eq random_utf8_string
|
36
|
+
|
37
|
+
robj.raw_data = random_utf8_string
|
38
|
+
robj.store
|
39
|
+
robj2.reload
|
40
|
+
expect(robj2.raw_data).to eq random_utf8_string
|
41
|
+
expect(robj2.indexes['cat_bin']).to include 'asdf'
|
42
|
+
expect(robj2.indexes['cat_bin']).
|
43
|
+
to include random_utf8_string.force_encoding('binary')
|
44
|
+
|
45
|
+
expect(utf8_bucket.get_index 'cat_bin', 'asdf').
|
46
|
+
to include random_utf8_string.force_encoding('binary')
|
47
|
+
expect(utf8_bucket.get_index 'cat_bin', random_utf8_string).
|
48
|
+
to include random_utf8_string.force_encoding('binary')
|
49
|
+
|
50
|
+
# riak gives us binary-encoding back, which is working as intended
|
51
|
+
expect(utf8_bucket.keys).
|
52
|
+
to include random_utf8_string.force_encoding('binary')
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'allows binary strings in bucket and key names and values' do
|
56
|
+
expect(binary_bucket).to be_a Riak::Bucket
|
57
|
+
expect(robj = binary_bucket.new(random_binary_string)).
|
58
|
+
to be_a Riak::RObject
|
59
|
+
robj.content_type = 'text/plain'
|
60
|
+
robj.data = random_binary_string
|
61
|
+
robj.indexes['cat_bin'] = [random_binary_string, 'asdf']
|
62
|
+
expect{ robj.store }.to_not raise_error
|
63
|
+
|
64
|
+
expect(robj2 = binary_bucket.get(random_binary_string)).
|
65
|
+
to be_a Riak::RObject
|
66
|
+
expect(robj2.data).to eq random_binary_string
|
67
|
+
|
68
|
+
robj.raw_data = random_binary_string
|
69
|
+
robj.store
|
70
|
+
robj2.reload
|
71
|
+
expect(robj2.raw_data).to eq random_binary_string
|
72
|
+
|
73
|
+
expect(binary_bucket.get_index 'cat_bin', 'asdf').
|
74
|
+
to include random_binary_string
|
75
|
+
expect(binary_bucket.get_index 'cat_bin', random_binary_string).
|
76
|
+
to include random_binary_string
|
77
|
+
|
78
|
+
expect(binary_bucket.keys).to include random_binary_string
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'riak'
|
4
|
+
|
5
|
+
describe 'Encoding and Riak Search', integration: true, search_config: true do
|
6
|
+
let(:bucket_type){ test_client.bucket_type 'yokozuna' }
|
7
|
+
|
8
|
+
let(:utf8_encoding){ Encoding.find 'utf-8' }
|
9
|
+
let(:utf8_string){ "\xF0\x9F\x9A\xB4こんにちはสวัสดี" }
|
10
|
+
let(:random_utf8_string){ utf8_string + random_key }
|
11
|
+
let(:utf8_bucket){ bucket_type.bucket random_utf8_string }
|
12
|
+
|
13
|
+
let(:binary_encoding){ Encoding.find 'binary' }
|
14
|
+
let(:binary_string){ "\xff\xff".force_encoding('binary') }
|
15
|
+
let(:random_binary_string){ binary_string + random_key }
|
16
|
+
let(:binary_bucket){ bucket_type.bucket random_binary_string }
|
17
|
+
|
18
|
+
describe 'with utf-8 strings' do
|
19
|
+
it 'creates schemas' do
|
20
|
+
schema = nil
|
21
|
+
expect do
|
22
|
+
schema = Riak::Search::Schema.new test_client, random_utf8_string
|
23
|
+
end.to_not raise_error
|
24
|
+
|
25
|
+
expect(schema).to be_a Riak::Search::Schema
|
26
|
+
|
27
|
+
expect{ schema.create! schema_xml random_utf8_string }.to_not raise_error
|
28
|
+
|
29
|
+
schema2 = Riak::Search::Schema.new test_client, random_utf8_string
|
30
|
+
expect(schema2).to be_exists
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'refuses to create indexes' do
|
34
|
+
index = nil
|
35
|
+
expect do
|
36
|
+
index = Riak::Search::Index.new test_client, random_utf8_string
|
37
|
+
end.to_not raise_error
|
38
|
+
|
39
|
+
expect(index).to be_a Riak::Search::Index
|
40
|
+
|
41
|
+
expect{ index.create! }.to raise_error /Invalid character/
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'queries non-weird indexes' do
|
45
|
+
create_index
|
46
|
+
|
47
|
+
props = Riak::BucketProperties.new utf8_bucket
|
48
|
+
props['search_index'] = index_name
|
49
|
+
props.store
|
50
|
+
|
51
|
+
wait_until do
|
52
|
+
props.reload
|
53
|
+
props['search_index'] == index_name
|
54
|
+
end
|
55
|
+
|
56
|
+
robj = utf8_bucket.new random_utf8_string
|
57
|
+
robj.content_type = 'text/plain'
|
58
|
+
robj.raw_data = <<EOD
|
59
|
+
This is due to the write-once, append-only nature of the Bitcask database files.
|
60
|
+
High throughput, especially when writing an incoming stream of random items
|
61
|
+
Because the data being written doesn't need to be ordered on disk and because
|
62
|
+
the log structured design allows for minimal disk head movement during writes
|
63
|
+
these operations generally saturate the I/O and disk bandwidth.
|
64
|
+
EOD
|
65
|
+
robj.store
|
66
|
+
|
67
|
+
results = nil
|
68
|
+
wait_until do
|
69
|
+
results = index.query('bitcask').results
|
70
|
+
!results.empty?
|
71
|
+
end
|
72
|
+
expect(results).to_not be_empty
|
73
|
+
expect(results.docs.first.bucket_type).to eq robj.bucket.type
|
74
|
+
expect(results.docs.first.bucket).to eq robj.bucket
|
75
|
+
expect(results.docs.first.key.bytes).to eq robj.key.bytes
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe 'with binary strings' do
|
80
|
+
it 'refuses to create schemas' do
|
81
|
+
schema = nil
|
82
|
+
expect do
|
83
|
+
schema = Riak::Search::Schema.new test_client, random_binary_string
|
84
|
+
end.to_not raise_error
|
85
|
+
|
86
|
+
expect(schema).to be_a Riak::Search::Schema
|
87
|
+
|
88
|
+
# yz will refuse to create files with names that aren't valid utf-8
|
89
|
+
expect{ schema.create! schema_xml random_binary_string }.
|
90
|
+
to raise_error /bad_character/
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
it 'refuses to create indexes' do
|
95
|
+
index = nil
|
96
|
+
expect do
|
97
|
+
index = Riak::Search::Index.new test_client, random_binary_string
|
98
|
+
end.to_not raise_error
|
99
|
+
|
100
|
+
expect(index).to be_a Riak::Search::Index
|
101
|
+
|
102
|
+
expect{ index.create! }.to raise_error /Invalid character/
|
103
|
+
end
|
104
|
+
|
105
|
+
# left here for reference: yz can't index documents with \xff\xff in the
|
106
|
+
# key, or presumably bucket name either
|
107
|
+
# it 'queries non-weird indexes' do
|
108
|
+
# create_index
|
109
|
+
|
110
|
+
# props = Riak::BucketProperties.new binary_bucket
|
111
|
+
# props['search_index'] = index_name
|
112
|
+
# props.store
|
113
|
+
|
114
|
+
# wait_until do
|
115
|
+
# props.reload
|
116
|
+
# props['search_index'] == index_name
|
117
|
+
# end
|
118
|
+
|
119
|
+
# robj = binary_bucket.new random_binary_string
|
120
|
+
# robj.content_type = 'text/plain'
|
121
|
+
# robj.raw_data = <<EOD
|
122
|
+
# This is due to the write-once, append-only nature of the Bitcask database files.
|
123
|
+
# High throughput, especially when writing an incoming stream of random items
|
124
|
+
# Because the data being written doesn't need to be ordered on disk and because
|
125
|
+
# the log structured design allows for minimal disk head movement during writes
|
126
|
+
# these operations generally saturate the I/O and disk bandwidth.
|
127
|
+
# EOD
|
128
|
+
# robj.store
|
129
|
+
|
130
|
+
# results = nil
|
131
|
+
# wait_until do
|
132
|
+
# results = index.query('bitcask').results
|
133
|
+
# !results.empty?
|
134
|
+
# end
|
135
|
+
# expect(results).to_not be_empty
|
136
|
+
# expect(results.docs.first.bucket_type).to eq robj.bucket.type
|
137
|
+
# expect(results.docs.first.bucket).to eq robj.bucket
|
138
|
+
# expect(results.docs.first.key.bytes).to eq robj.key.bytes
|
139
|
+
# end
|
140
|
+
end
|
141
|
+
end
|
@@ -59,4 +59,20 @@ describe Riak::BucketTyped::Bucket do
|
|
59
59
|
expect{ subject.props = { 'allow_mult' => true } }.to_not raise_error
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
describe "querying an index" do
|
64
|
+
it "attaches the bucket type" do
|
65
|
+
expect(client).
|
66
|
+
to receive(:get_index).
|
67
|
+
with(subject, 'test_bin', 'testing', { type: 'type' }).
|
68
|
+
and_return(
|
69
|
+
Riak::IndexCollection.new_from_json({
|
70
|
+
keys: ['asdf']
|
71
|
+
}.to_json))
|
72
|
+
|
73
|
+
result = subject.get_index('test_bin', 'testing')
|
74
|
+
expect(result).to be_a Riak::IndexCollection
|
75
|
+
expect(result.to_a).to eq %w{asdf}
|
76
|
+
end
|
77
|
+
end
|
62
78
|
end
|
@@ -129,6 +129,13 @@ describe Riak::MapReduce do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
context "using secondary indexes as inputs" do
|
132
|
+
it "set the inputs for a bucket-typed bucket" do
|
133
|
+
expect(mr.index(typed_bucket, "email_bin", "sean@basho.com")).to eq(mr)
|
134
|
+
expect(mr.inputs).to eq(bucket: [typed_bucket.type.name, typed_bucket.name],
|
135
|
+
index: "email_bin",
|
136
|
+
key: "sean@basho.com")
|
137
|
+
end
|
138
|
+
|
132
139
|
it "sets the inputs for equality" do
|
133
140
|
expect(mr.index("foo", "email_bin", "sean@basho.com")).to eq(mr)
|
134
141
|
expect(mr.inputs).to eq(bucket: "foo",
|
data/spec/riak/search_spec.rb
CHANGED
@@ -85,20 +85,20 @@ describe "Search features" do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
describe "using a search query as inputs" do
|
88
|
-
it "accepts a
|
88
|
+
it "accepts a index name and query" do
|
89
89
|
@mr.search("foo", "bar OR baz")
|
90
|
-
expect(@mr.inputs).to eq({:module => "
|
90
|
+
expect(@mr.inputs).to eq({:module => "yokozuna", :function => "mapred_search", :arg => ["foo", "bar OR baz"]})
|
91
91
|
end
|
92
92
|
|
93
|
-
it "accepts a Riak::
|
94
|
-
@mr.search(Riak::
|
95
|
-
expect(@mr.inputs).to eq({:module => "
|
93
|
+
it "accepts a Riak::Search::Index and query" do
|
94
|
+
@mr.search(Riak::Search::Index.new(@client, "foo"), "bar OR baz")
|
95
|
+
expect(@mr.inputs).to eq({:module => "yokozuna", :function => "mapred_search", :arg => ["foo", "bar OR baz"]})
|
96
96
|
end
|
97
97
|
|
98
98
|
it "emits the Erlang function and arguments" do
|
99
99
|
@mr.search("foo", "bar OR baz")
|
100
100
|
expect(@mr.to_json).to include('"inputs":{')
|
101
|
-
expect(@mr.to_json).to include('"module":"
|
101
|
+
expect(@mr.to_json).to include('"module":"yokozuna"')
|
102
102
|
expect(@mr.to_json).to include('"function":"mapred_search"')
|
103
103
|
expect(@mr.to_json).to include('"arg":["foo","bar OR baz"]')
|
104
104
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riak-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Kerley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -310,6 +310,9 @@ files:
|
|
310
310
|
- spec/integration/riak/crdt_spec.rb
|
311
311
|
- spec/integration/riak/crdt_validation/map_spec.rb
|
312
312
|
- spec/integration/riak/crdt_validation/set_spec.rb
|
313
|
+
- spec/integration/riak/encodings/crdt_spec.rb
|
314
|
+
- spec/integration/riak/encodings/kv_spec.rb
|
315
|
+
- spec/integration/riak/encodings/yz_spec.rb
|
313
316
|
- spec/integration/riak/preflist_spec.rb
|
314
317
|
- spec/integration/riak/properties_spec.rb
|
315
318
|
- spec/integration/riak/protobuffs/interrupted_request_spec.rb
|
@@ -407,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
407
410
|
version: '0'
|
408
411
|
requirements: []
|
409
412
|
rubyforge_project:
|
410
|
-
rubygems_version: 2.4.
|
413
|
+
rubygems_version: 2.4.5
|
411
414
|
signing_key:
|
412
415
|
specification_version: 4
|
413
416
|
summary: riak-client is a rich client for Riak, the distributed database by Basho.
|
@@ -433,6 +436,9 @@ test_files:
|
|
433
436
|
- spec/integration/riak/crdt_spec.rb
|
434
437
|
- spec/integration/riak/crdt_validation/map_spec.rb
|
435
438
|
- spec/integration/riak/crdt_validation/set_spec.rb
|
439
|
+
- spec/integration/riak/encodings/crdt_spec.rb
|
440
|
+
- spec/integration/riak/encodings/kv_spec.rb
|
441
|
+
- spec/integration/riak/encodings/yz_spec.rb
|
436
442
|
- spec/integration/riak/preflist_spec.rb
|
437
443
|
- spec/integration/riak/properties_spec.rb
|
438
444
|
- spec/integration/riak/protobuffs/interrupted_request_spec.rb
|