riak-client 2.3.0 → 2.3.1

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 (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
data/lib/riak/core_ext.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'riak/core_ext/blank'
2
- require 'riak/core_ext/extract_options'
3
- require 'riak/core_ext/slice'
4
- require 'riak/core_ext/stringify_keys'
5
- require 'riak/core_ext/symbolize_keys'
6
- require 'riak/core_ext/to_param'
7
- require 'riak/core_ext/deep_dup'
1
+ require 'riak/core_ext/blank'
2
+ require 'riak/core_ext/extract_options'
3
+ require 'riak/core_ext/slice'
4
+ require 'riak/core_ext/stringify_keys'
5
+ require 'riak/core_ext/symbolize_keys'
6
+ require 'riak/core_ext/to_param'
7
+ require 'riak/core_ext/deep_dup'
@@ -1,53 +1,53 @@
1
- require 'set'
2
-
3
- unless Object.new.respond_to? :blank?
4
- class Object
5
- def blank?
6
- false
7
- end
8
- end
9
-
10
- class NilClass
11
- def blank?
12
- true
13
- end
14
- end
15
-
16
- class FalseClass
17
- def blank?
18
- true
19
- end
20
- end
21
-
22
- class TrueClass
23
- def blank?
24
- false
25
- end
26
- end
27
-
28
- class Set
29
- alias :blank? :empty?
30
- end
31
-
32
- class String
33
- def blank?
34
- self !~ /[^\s]/
35
- end
36
- end
37
-
38
- class Array
39
- alias :blank? :empty?
40
- end
41
-
42
- class Hash
43
- alias :blank? :empty?
44
- end
45
- end
46
-
47
- unless Object.new.respond_to? :present?
48
- class Object
49
- def present?
50
- !blank?
51
- end
52
- end
53
- end
1
+ require 'set'
2
+
3
+ unless Object.new.respond_to? :blank?
4
+ class Object
5
+ def blank?
6
+ false
7
+ end
8
+ end
9
+
10
+ class NilClass
11
+ def blank?
12
+ true
13
+ end
14
+ end
15
+
16
+ class FalseClass
17
+ def blank?
18
+ true
19
+ end
20
+ end
21
+
22
+ class TrueClass
23
+ def blank?
24
+ false
25
+ end
26
+ end
27
+
28
+ class Set
29
+ alias :blank? :empty?
30
+ end
31
+
32
+ class String
33
+ def blank?
34
+ self !~ /[^\s]/
35
+ end
36
+ end
37
+
38
+ class Array
39
+ alias :blank? :empty?
40
+ end
41
+
42
+ class Hash
43
+ alias :blank? :empty?
44
+ end
45
+ end
46
+
47
+ unless Object.new.respond_to? :present?
48
+ class Object
49
+ def present?
50
+ !blank?
51
+ end
52
+ end
53
+ end
@@ -1,7 +1,7 @@
1
- unless Array.new.respond_to? :extract_options!
2
- class Array
3
- def extract_options!
4
- last.is_a?(::Hash) ? pop : {}
5
- end
6
- end
7
- end
1
+ unless Array.new.respond_to? :extract_options!
2
+ class Array
3
+ def extract_options!
4
+ last.is_a?(::Hash) ? pop : {}
5
+ end
6
+ end
7
+ end
@@ -1,15 +1,15 @@
1
- unless Object.new.respond_to?(:to_json)
2
- # @private
3
- class Object
4
- def to_json(*args)
5
- Riak::JSON.encode(self)
6
- end
7
- end
8
-
9
- # @private
10
- class Symbol
11
- def to_json(*args)
12
- to_s.to_json(*args)
13
- end
14
- end
15
- end
1
+ unless Object.new.respond_to?(:to_json)
2
+ # @private
3
+ class Object
4
+ def to_json(*args)
5
+ Riak::JSON.encode(self)
6
+ end
7
+ end
8
+
9
+ # @private
10
+ class Symbol
11
+ def to_json(*args)
12
+ to_s.to_json(*args)
13
+ end
14
+ end
15
+ end
@@ -1,18 +1,18 @@
1
- unless {}.respond_to? :slice
2
- class Hash
3
- def slice(*keys)
4
- allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
5
- hash = {}
6
- allowed.each { |k| hash[k] = self[k] if has_key?(k) }
7
- hash
8
- end
9
-
10
- def slice!(*keys)
11
- keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
12
- omit = slice(*self.keys - keys)
13
- hash = slice(*keys)
14
- replace(hash)
15
- omit
16
- end
17
- end
18
- end
1
+ unless {}.respond_to? :slice
2
+ class Hash
3
+ def slice(*keys)
4
+ allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
5
+ hash = {}
6
+ allowed.each { |k| hash[k] = self[k] if has_key?(k) }
7
+ hash
8
+ end
9
+
10
+ def slice!(*keys)
11
+ keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
12
+ omit = slice(*self.keys - keys)
13
+ hash = slice(*keys)
14
+ replace(hash)
15
+ omit
16
+ end
17
+ end
18
+ end
@@ -1,10 +1,10 @@
1
- unless {}.respond_to? :stringify_keys
2
- class Hash
3
- def stringify_keys
4
- inject({}) do |hash, pair|
5
- hash[pair[0].to_s] = pair[1]
6
- hash
7
- end
8
- end
9
- end
10
- end
1
+ unless {}.respond_to? :stringify_keys
2
+ class Hash
3
+ def stringify_keys
4
+ inject({}) do |hash, pair|
5
+ hash[pair[0].to_s] = pair[1]
6
+ hash
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- unless {}.respond_to? :symbolize_keys
2
- class Hash
3
- def symbolize_keys
4
- inject({}) do |hash, pair|
5
- hash[pair[0].to_sym] = pair[1]
6
- hash
7
- end
8
- end
9
- end
10
- end
1
+ unless {}.respond_to? :symbolize_keys
2
+ class Hash
3
+ def symbolize_keys
4
+ inject({}) do |hash, pair|
5
+ hash[pair[0].to_sym] = pair[1]
6
+ hash
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,31 +1,31 @@
1
- unless Object.new.respond_to? :to_query and Object.new.respond_to? :to_param
2
- class Object
3
- def to_param
4
- to_s
5
- end
6
-
7
- def to_query(key)
8
- require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
9
- "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
10
- end
11
- end
12
-
13
- class Array
14
- def to_param
15
- map(&:to_param).join('/')
16
- end
17
-
18
- def to_query(key)
19
- prefix = "#{key}[]"
20
- collect { |value| value.to_query(prefix) }.join '&'
21
- end
22
- end
23
-
24
- class Hash
25
- def to_param(namespace = nil)
26
- collect do |key, value|
27
- value.to_query(namespace ? "#{namespace}[#{key}]" : key)
28
- end.sort * '&'
29
- end
30
- end
31
- end
1
+ unless Object.new.respond_to? :to_query and Object.new.respond_to? :to_param
2
+ class Object
3
+ def to_param
4
+ to_s
5
+ end
6
+
7
+ def to_query(key)
8
+ require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
9
+ "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
10
+ end
11
+ end
12
+
13
+ class Array
14
+ def to_param
15
+ map(&:to_param).join('/')
16
+ end
17
+
18
+ def to_query(key)
19
+ prefix = "#{key}[]"
20
+ collect { |value| value.to_query(prefix) }.join '&'
21
+ end
22
+ end
23
+
24
+ class Hash
25
+ def to_param(namespace = nil)
26
+ collect do |key, value|
27
+ value.to_query(namespace ? "#{namespace}[#{key}]" : key)
28
+ end.sort * '&'
29
+ end
30
+ end
31
+ end
data/lib/riak/crdt.rb CHANGED
@@ -1,21 +1,21 @@
1
- require 'riak/errors/crdt_error'
2
-
3
- %w{ operation base inner_register inner_flag counter inner_counter batch_counter map inner_map batch_map set inner_set typed_collection }.each do |f|
4
- require "riak/crdt/#{f}"
5
- end
6
-
7
- module Riak
8
- # Container module for Convergent Replicated Data Type
9
- # features.
10
- module Crdt
11
-
12
- # These are the default bucket types for the three top-level data types.
13
- # Broadly, CRDTs require allow_mult to be enabled, and the `datatype`
14
- # property to be set to the appropriate atom (`counter`, `map`, or `set`).
15
- DEFAULT_BUCKET_TYPES = {
16
- counter: 'counters',
17
- map: 'maps',
18
- set: 'sets',
19
- }
20
- end
21
- end
1
+ require 'riak/errors/crdt_error'
2
+
3
+ %w{ operation base inner_register inner_flag counter inner_counter batch_counter map inner_map batch_map set inner_set typed_collection }.each do |f|
4
+ require "riak/crdt/#{f}"
5
+ end
6
+
7
+ module Riak
8
+ # Container module for Convergent Replicated Data Type
9
+ # features.
10
+ module Crdt
11
+
12
+ # These are the default bucket types for the three top-level data types.
13
+ # Broadly, CRDTs require allow_mult to be enabled, and the `datatype`
14
+ # property to be set to the appropriate atom (`counter`, `map`, or `set`).
15
+ DEFAULT_BUCKET_TYPES = {
16
+ counter: 'counters',
17
+ map: 'maps',
18
+ set: 'sets',
19
+ }
20
+ end
21
+ end
@@ -1,19 +1,19 @@
1
- module Riak
2
- module Crdt
3
- # @api private
4
- module Operation
5
- class Update
6
- attr_accessor :parent
7
- attr_accessor :name
8
- attr_accessor :type
9
- attr_accessor :value
10
- end
11
-
12
- class Delete
13
- attr_accessor :parent
14
- attr_accessor :name
15
- attr_accessor :type
16
- end
17
- end
18
- end
19
- end
1
+ module Riak
2
+ module Crdt
3
+ # @api private
4
+ module Operation
5
+ class Update
6
+ attr_accessor :parent
7
+ attr_accessor :name
8
+ attr_accessor :type
9
+ attr_accessor :value
10
+ end
11
+
12
+ class Delete
13
+ attr_accessor :parent
14
+ attr_accessor :name
15
+ attr_accessor :type
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/riak/encoding.rb CHANGED
@@ -1,6 +1,6 @@
1
- if defined? Encoding
2
- Encoding.default_internal = "UTF-8" if Encoding.default_internal.nil? ||
3
- !Encoding.default_internal.ascii_compatible?
4
- else
5
- $KCODE = "U"
6
- end
1
+ if defined? Encoding
2
+ Encoding.default_internal = "UTF-8" if Encoding.default_internal.nil? ||
3
+ !Encoding.default_internal.ascii_compatible?
4
+ else
5
+ $KCODE = "U"
6
+ end
@@ -1,9 +1,9 @@
1
- require 'riak/errors/base'
2
-
3
- module Riak
4
- class BackendCreationError < Error
5
- def initialize(backend)
6
- super t('protobuffs_configuration', backend: backend)
7
- end
8
- end
9
- end
1
+ require 'riak/errors/base'
2
+
3
+ module Riak
4
+ class BackendCreationError < Error
5
+ def initialize(backend)
6
+ super t('protobuffs_configuration', backend: backend)
7
+ end
8
+ end
9
+ end
@@ -1,50 +1,50 @@
1
- require 'riak/errors/base'
2
-
3
- module Riak
4
- class ConnectionError < Error
5
- end
6
-
7
- class TlsError < ConnectionError
8
- class SslVersionConfigurationError < TlsError
9
- def initialize
10
- super t('ssl.version_configuration_error')
11
- end
12
- end
13
-
14
- class CertHostMismatchError < TlsError
15
- def initialize
16
- super t('ssl.cert_host_mismatch')
17
- end
18
- end
19
-
20
- class CertNotValidError < TlsError
21
- def initialize
22
- super t('ssl.cert_not_valid')
23
- end
24
- end
25
-
26
- class CertRevokedError < TlsError
27
- def initialize
28
- super t('ssl.cert_revoked')
29
- end
30
- end
31
-
32
- class ReadDataError < TlsError
33
- def initialize(actual, candidate)
34
- super t('ssl.read_data_error', actual: actual, candidate: candidate)
35
- end
36
- end
37
-
38
- class UnknownKeyTypeError < TlsError
39
- def initialize
40
- super t('ssl.unknown_key_type')
41
- end
42
- end
43
- end
44
-
45
- class UserConfigurationError < ConnectionError
46
- def initialize
47
- super t('pbc.user_not_username')
48
- end
49
- end
50
- end
1
+ require 'riak/errors/base'
2
+
3
+ module Riak
4
+ class ConnectionError < Error
5
+ end
6
+
7
+ class TlsError < ConnectionError
8
+ class SslVersionConfigurationError < TlsError
9
+ def initialize
10
+ super t('ssl.version_configuration_error')
11
+ end
12
+ end
13
+
14
+ class CertHostMismatchError < TlsError
15
+ def initialize
16
+ super t('ssl.cert_host_mismatch')
17
+ end
18
+ end
19
+
20
+ class CertNotValidError < TlsError
21
+ def initialize
22
+ super t('ssl.cert_not_valid')
23
+ end
24
+ end
25
+
26
+ class CertRevokedError < TlsError
27
+ def initialize
28
+ super t('ssl.cert_revoked')
29
+ end
30
+ end
31
+
32
+ class ReadDataError < TlsError
33
+ def initialize(actual, candidate)
34
+ super t('ssl.read_data_error', actual: actual, candidate: candidate)
35
+ end
36
+ end
37
+
38
+ class UnknownKeyTypeError < TlsError
39
+ def initialize
40
+ super t('ssl.unknown_key_type')
41
+ end
42
+ end
43
+ end
44
+
45
+ class UserConfigurationError < ConnectionError
46
+ def initialize
47
+ super t('pbc.user_not_username')
48
+ end
49
+ end
50
+ end