riak-client 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.document +5 -5
  3. data/Gemfile +17 -17
  4. data/Guardfile +20 -20
  5. data/LICENSE.md +16 -16
  6. data/README.markdown +1 -1
  7. data/RELEASE_NOTES.md +9 -0
  8. data/lib/riak/client/beefcake/crdt/counter_loader.rb +18 -18
  9. data/lib/riak/client/beefcake/crdt/map_loader.rb +64 -64
  10. data/lib/riak/client/beefcake/footer +4 -4
  11. data/lib/riak/client/beefcake/header +6 -6
  12. data/lib/riak/client/beefcake/messages.rb +0 -16
  13. data/lib/riak/client/decaying.rb +36 -36
  14. data/lib/riak/client/feature_detection.rb +120 -120
  15. data/lib/riak/client/instrumentation.rb +19 -19
  16. data/lib/riak/client/node.rb +49 -49
  17. data/lib/riak/client/search.rb +27 -27
  18. data/lib/riak/conflict.rb +13 -13
  19. data/lib/riak/core_ext.rb +7 -7
  20. data/lib/riak/core_ext/blank.rb +53 -53
  21. data/lib/riak/core_ext/extract_options.rb +7 -7
  22. data/lib/riak/core_ext/json.rb +15 -15
  23. data/lib/riak/core_ext/slice.rb +18 -18
  24. data/lib/riak/core_ext/stringify_keys.rb +10 -10
  25. data/lib/riak/core_ext/symbolize_keys.rb +10 -10
  26. data/lib/riak/core_ext/to_param.rb +31 -31
  27. data/lib/riak/crdt.rb +21 -21
  28. data/lib/riak/crdt/operation.rb +19 -19
  29. data/lib/riak/encoding.rb +6 -6
  30. data/lib/riak/errors/backend_creation.rb +9 -9
  31. data/lib/riak/errors/connection_error.rb +50 -50
  32. data/lib/riak/errors/protobuffs_error.rb +11 -11
  33. data/lib/riak/i18n.rb +7 -7
  34. data/lib/riak/instrumentation.rb +6 -6
  35. data/lib/riak/json.rb +52 -52
  36. data/lib/riak/list_buckets.rb +28 -28
  37. data/lib/riak/locale/fr.yml +51 -51
  38. data/lib/riak/map_reduce/results.rb +49 -49
  39. data/lib/riak/map_reduce_error.rb +7 -7
  40. data/lib/riak/multiget.rb +122 -122
  41. data/lib/riak/stamp.rb +77 -77
  42. data/lib/riak/util/tcp_socket_extensions.rb +58 -58
  43. data/lib/riak/version.rb +1 -1
  44. data/spec/failover/failover.rb +59 -59
  45. data/spec/fixtures/bitcask.txt +25 -25
  46. data/spec/fixtures/multipart-basic-conflict.txt +15 -15
  47. data/spec/fixtures/multipart-blank.txt +7 -7
  48. data/spec/fixtures/multipart-mapreduce.txt +10 -10
  49. data/spec/fixtures/multipart-with-body.txt +16 -16
  50. data/spec/fixtures/multipart-with-marked-tombstones.txt +17 -17
  51. data/spec/fixtures/multipart-with-unmarked-tombstone.txt +16 -16
  52. data/spec/fixtures/server.cert.crt +15 -15
  53. data/spec/fixtures/server.cert.key +15 -15
  54. data/spec/fixtures/test.pem +1 -1
  55. data/spec/integration/riak/threading_spec.rb +150 -150
  56. data/spec/integration/yokozuna/index_spec.rb +61 -61
  57. data/spec/integration/yokozuna/schema_spec.rb +49 -49
  58. data/spec/riak/core_ext/to_param_spec.rb +15 -15
  59. data/spec/riak/crdt/inner_counter_spec.rb +21 -21
  60. data/spec/riak/crdt/inner_set_spec.rb +33 -33
  61. data/spec/riak/crdt/set_spec.rb +61 -61
  62. data/spec/riak/escape_spec.rb +72 -72
  63. data/spec/riak/feature_detection_spec.rb +77 -77
  64. data/spec/riak/index_collection_spec.rb +53 -53
  65. data/spec/riak/instrumentation_spec.rb +124 -124
  66. data/spec/riak/link_spec.rb +85 -85
  67. data/spec/riak/list_buckets_spec.rb +41 -41
  68. data/spec/riak/node_spec.rb +26 -26
  69. data/spec/riak/stamp_spec.rb +54 -54
  70. data/spec/support/certs/README.md +12 -12
  71. data/spec/support/certs/ca.crt +21 -21
  72. data/spec/support/certs/client.crl +13 -13
  73. data/spec/support/certs/client.crt +94 -94
  74. data/spec/support/certs/client.csr +18 -18
  75. data/spec/support/certs/client.key +27 -27
  76. data/spec/support/certs/empty_ca.crt +21 -21
  77. data/spec/support/certs/server.crl +13 -13
  78. data/spec/support/certs/server.crt +94 -94
  79. data/spec/support/certs/server.key +27 -27
  80. data/spec/support/integration_setup.rb +10 -10
  81. data/spec/support/test_client.yml.example +9 -9
  82. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8eb1ae6b34bdb0bc9e7ace398e001f570dfe0782
4
- data.tar.gz: f4b53df09ae0c37710f74bc6fa4bb2bc2e47e82e
3
+ metadata.gz: 1b5ed7456c2e32f4778aaae11cfef9d56563f726
4
+ data.tar.gz: ce022ab4fee296be7eeb2b88b551a74592bda77d
5
5
  SHA512:
6
- metadata.gz: 9bb8412b0efd79d81d486a87302c0985e59420d7d1a2d1cd9119f60afef9dbffbed2fc19a003c4e31917080c14816830545d3bcebab200d23b0f6ab0e8c3374f
7
- data.tar.gz: 3ffebec87cfddc2ddd8422785f49e9814452ed94720c27d8666ff815e224f072c046302741c34d2b77aa4026f872a1e928cd25f7a4b93a901367518ad83a3b13
6
+ metadata.gz: 5e9a483f5cf12ddd801d0f2f6973fb9b9299e2e96c22e011e74783e57976716f61b31d4d4f929f812124d6e0589cb2bddf806fceb218ae0bbec84a174115f832
7
+ data.tar.gz: a1eff3a59c308f4026dc41c8e01f5583b865b1fd9cfaa73ad224b63d5107db65a8cfa43408cd32f41847b38377fca4e65e1a0a97b7e2e807c86cbe84efb6a0fa
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/Gemfile CHANGED
@@ -1,17 +1,17 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :guard do
6
- gem 'guard-rspec'
7
- gem 'rb-fsevent'
8
- gem 'terminal-notifier-guard'
9
- end
10
-
11
- platforms :mri do
12
- gem 'yajl-ruby'
13
- end
14
-
15
- platforms :jruby, :rbx do
16
- gem 'json'
17
- end
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :guard do
6
+ gem 'guard-rspec'
7
+ gem 'rb-fsevent'
8
+ gem 'terminal-notifier-guard'
9
+ end
10
+
11
+ platforms :mri do
12
+ gem 'yajl-ruby'
13
+ end
14
+
15
+ platforms :jruby, :rbx do
16
+ gem 'json'
17
+ end
data/Guardfile CHANGED
@@ -1,20 +1,20 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- # Note: The cmd option is now required due to the increasing number of ways
5
- # rspec may be run, below are examples of the most common uses.
6
- # * bundler: 'bundle exec rspec'
7
- # * bundler binstubs: 'bin/rspec'
8
- # * spring: 'bin/rsspec' (This will use spring if running and you have
9
- # installed the spring binstubs per the docs)
10
- # * zeus: 'zeus rspec' (requires the server to be started separetly)
11
- # * 'just' rspec: 'rspec'
12
- guard :rspec, cmd: 'bundle exec rspec', all_after_pass: true, all_on_start: true do
13
- watch(%r{^spec/.+_spec\.rb$})
14
- watch(%r{^lib/riak/(.+)\.rb$}) { |m| "spec/riak/#{m[1]}_spec.rb" }
15
- watch(%r{^lib/riak/client/}) { 'spec/riak/beefcake_protobuffs_backend' }
16
- watch('spec/spec_helper.rb') { "spec" }
17
-
18
- watch(/^spec\/integration/) { 'spec:integration' }
19
- end
20
-
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ # Note: The cmd option is now required due to the increasing number of ways
5
+ # rspec may be run, below are examples of the most common uses.
6
+ # * bundler: 'bundle exec rspec'
7
+ # * bundler binstubs: 'bin/rspec'
8
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
9
+ # installed the spring binstubs per the docs)
10
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
11
+ # * 'just' rspec: 'rspec'
12
+ guard :rspec, cmd: 'bundle exec rspec', all_after_pass: true, all_on_start: true do
13
+ watch(%r{^spec/.+_spec\.rb$})
14
+ watch(%r{^lib/riak/(.+)\.rb$}) { |m| "spec/riak/#{m[1]}_spec.rb" }
15
+ watch(%r{^lib/riak/client/}) { 'spec/riak/beefcake_protobuffs_backend' }
16
+ watch('spec/spec_helper.rb') { "spec" }
17
+
18
+ watch(/^spec\/integration/) { 'spec:integration' }
19
+ end
20
+
data/LICENSE.md CHANGED
@@ -1,16 +1,16 @@
1
- Copyright 2010-2011 Sean Cribbs and Basho Technologies, 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
- All of the files in this project are under the project-wide license
16
- unless they are otherwise marked.
1
+ Copyright 2010-2016 Sean Cribbs and Basho Technologies, 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
+ All of the files in this project are under the project-wide license
16
+ unless they are otherwise marked.
data/README.markdown CHANGED
@@ -626,7 +626,7 @@ search.admin,search.query,riak_kv.mapreduce on any to user
626
626
 
627
627
  ## License & Copyright
628
628
 
629
- Copyright ©2010-2015 Sean Cribbs and Basho Technologies, Inc.
629
+ Copyright ©2010-2016 Sean Cribbs and Basho Technologies, Inc.
630
630
 
631
631
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
632
632
 
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Riak Ruby Client Release Notes
2
2
 
3
+ ## 2.3.1 Release - 2016-01-12
4
+
5
+ Version 2.3.1 is a bugfix release with a small fix in support of the Riak TS
6
+ time series database.
7
+
8
+ * Queries that return no data will return an empty collection.
9
+
10
+ New features:
11
+
3
12
  ## 2.3.0 Release - 2015-12-15
4
13
 
5
14
  Version 2.3.0 is a feature release, introducing support for the Riak TS time
@@ -1,18 +1,18 @@
1
- class Riak::Client::BeefcakeProtobuffsBackend
2
- class CrdtLoader
3
- class CounterLoader
4
- def self.for_value(resp)
5
- return nil unless resp.counter_value
6
- new resp.counter_value
7
- end
8
-
9
- def initialize(counter_value)
10
- @value = counter_value
11
- end
12
-
13
- def rubyfy
14
- @value
15
- end
16
- end
17
- end
18
- end
1
+ class Riak::Client::BeefcakeProtobuffsBackend
2
+ class CrdtLoader
3
+ class CounterLoader
4
+ def self.for_value(resp)
5
+ return nil unless resp.counter_value
6
+ new resp.counter_value
7
+ end
8
+
9
+ def initialize(counter_value)
10
+ @value = counter_value
11
+ end
12
+
13
+ def rubyfy
14
+ @value
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,64 +1,64 @@
1
- class Riak::Client::BeefcakeProtobuffsBackend
2
- class CrdtLoader
3
- class MapLoader
4
- def self.for_value(resp)
5
- return nil unless resp.map_value
6
- new resp.map_value
7
- end
8
-
9
- def initialize(map_value)
10
- @value = map_value
11
- end
12
-
13
- def rubyfy
14
- accum = {
15
- counters: {},
16
- flags: {},
17
- maps: {},
18
- registers: {},
19
- sets: {}
20
- }
21
-
22
- contents_loop @value, accum
23
- end
24
-
25
- private
26
-
27
- def rubyfy_inner(accum, map_value)
28
- destination = accum[:maps][map_value.field.name]
29
- if destination.nil?
30
- destination = accum[:maps][map_value.field.name] = {
31
- counters: {},
32
- flags: {},
33
- maps: {},
34
- registers: {},
35
- sets: {}
36
- }
37
- end
38
-
39
- contents_loop map_value.map_value, destination
40
- end
41
-
42
- def contents_loop(rolling_value, destination)
43
- return destination if rolling_value.nil?
44
-
45
- rolling_value.each do |inner|
46
- case inner.field.type
47
- when MapField::MapFieldType::COUNTER
48
- destination[:counters][inner.field.name] = inner.counter_value
49
- when MapField::MapFieldType::FLAG
50
- destination[:flags][inner.field.name] = inner.flag_value
51
- when MapField::MapFieldType::MAP
52
- rubyfy_inner destination, inner
53
- when MapField::MapFieldType::REGISTER
54
- destination[:registers][inner.field.name] = inner.register_value
55
- when MapField::MapFieldType::SET
56
- destination[:sets][inner.field.name] = ::Set.new inner.set_value
57
- end
58
- end
59
-
60
- return destination
61
- end
62
- end
63
- end
64
- end
1
+ class Riak::Client::BeefcakeProtobuffsBackend
2
+ class CrdtLoader
3
+ class MapLoader
4
+ def self.for_value(resp)
5
+ return nil unless resp.map_value
6
+ new resp.map_value
7
+ end
8
+
9
+ def initialize(map_value)
10
+ @value = map_value
11
+ end
12
+
13
+ def rubyfy
14
+ accum = {
15
+ counters: {},
16
+ flags: {},
17
+ maps: {},
18
+ registers: {},
19
+ sets: {}
20
+ }
21
+
22
+ contents_loop @value, accum
23
+ end
24
+
25
+ private
26
+
27
+ def rubyfy_inner(accum, map_value)
28
+ destination = accum[:maps][map_value.field.name]
29
+ if destination.nil?
30
+ destination = accum[:maps][map_value.field.name] = {
31
+ counters: {},
32
+ flags: {},
33
+ maps: {},
34
+ registers: {},
35
+ sets: {}
36
+ }
37
+ end
38
+
39
+ contents_loop map_value.map_value, destination
40
+ end
41
+
42
+ def contents_loop(rolling_value, destination)
43
+ return destination if rolling_value.nil?
44
+
45
+ rolling_value.each do |inner|
46
+ case inner.field.type
47
+ when MapField::MapFieldType::COUNTER
48
+ destination[:counters][inner.field.name] = inner.counter_value
49
+ when MapField::MapFieldType::FLAG
50
+ destination[:flags][inner.field.name] = inner.flag_value
51
+ when MapField::MapFieldType::MAP
52
+ rubyfy_inner destination, inner
53
+ when MapField::MapFieldType::REGISTER
54
+ destination[:registers][inner.field.name] = inner.register_value
55
+ when MapField::MapFieldType::SET
56
+ destination[:sets][inner.field.name] = ::Set.new inner.set_value
57
+ end
58
+ end
59
+
60
+ return destination
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,4 +1,4 @@
1
-
2
- end
3
- end
4
- end
1
+
2
+ end
3
+ end
4
+ end
@@ -1,6 +1,6 @@
1
- require 'beefcake'
2
-
3
- module Riak
4
- class Client
5
- # @private
6
- class BeefcakeProtobuffsBackend
1
+ require 'beefcake'
2
+
3
+ module Riak
4
+ class Client
5
+ # @private
6
+ class BeefcakeProtobuffsBackend
@@ -67,14 +67,6 @@ class RpbAuthReq
67
67
  include Beefcake::Message
68
68
  end
69
69
 
70
- class RpbToggleEncodingReq
71
- include Beefcake::Message
72
- end
73
-
74
- class RpbToggleEncodingResp
75
- include Beefcake::Message
76
- end
77
-
78
70
  class RpbErrorResp
79
71
  required :errmsg, :bytes, 1
80
72
  required :errcode, :uint32, 2
@@ -164,14 +156,6 @@ class RpbAuthReq
164
156
  required :user, :bytes, 1
165
157
  required :password, :bytes, 2
166
158
  end
167
-
168
- class RpbToggleEncodingReq
169
- required :use_native, :bool, 1
170
- end
171
-
172
- class RpbToggleEncodingResp
173
- required :use_native, :bool, 1
174
- end
175
159
  ## Generated from riak_kv.proto
176
160
  require "beefcake"
177
161
 
@@ -1,36 +1,36 @@
1
- module Riak
2
- class Client
3
- # A float value which decays exponentially toward 0 over time.
4
- # @private
5
- class Decaying
6
- attr_accessor :e
7
- attr_accessor :p
8
-
9
- # @param [Hash] opts options
10
- # @option options [Float] :p (0.0) The initial value
11
- # @option options [Float] :e (Math::E) Exponent base
12
- # @option options [Float] :r (Math.log(0.5) / 10) Timescale
13
- # factor - defaulting to decay 50% every 10 seconds
14
- def initialize(opts = {})
15
- @p = opts[:p] || 0.0
16
- @e = opts[:e] || Math::E
17
- @r = opts[:r] || Math.log(0.5) / 10
18
- @t0 = Time.now
19
- end
20
-
21
- # Add to current value.
22
- # @param [Float] d the value to add
23
- def <<(d)
24
- @p = value + d
25
- end
26
-
27
- # @return [Float] the current value (adjusted for the time decay)
28
- def value
29
- now = Time.now
30
- dt = now - @t0
31
- @t0 = now
32
- @p = @p * (@e ** (@r * dt))
33
- end
34
- end
35
- end
36
- end
1
+ module Riak
2
+ class Client
3
+ # A float value which decays exponentially toward 0 over time.
4
+ # @private
5
+ class Decaying
6
+ attr_accessor :e
7
+ attr_accessor :p
8
+
9
+ # @param [Hash] opts options
10
+ # @option options [Float] :p (0.0) The initial value
11
+ # @option options [Float] :e (Math::E) Exponent base
12
+ # @option options [Float] :r (Math.log(0.5) / 10) Timescale
13
+ # factor - defaulting to decay 50% every 10 seconds
14
+ def initialize(opts = {})
15
+ @p = opts[:p] || 0.0
16
+ @e = opts[:e] || Math::E
17
+ @r = opts[:r] || Math.log(0.5) / 10
18
+ @t0 = Time.now
19
+ end
20
+
21
+ # Add to current value.
22
+ # @param [Float] d the value to add
23
+ def <<(d)
24
+ @p = value + d
25
+ end
26
+
27
+ # @return [Float] the current value (adjusted for the time decay)
28
+ def value
29
+ now = Time.now
30
+ dt = now - @t0
31
+ @t0 = now
32
+ @p = @p * (@e ** (@r * dt))
33
+ end
34
+ end
35
+ end
36
+ end