riak-client 2.3.2 → 2.4.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/{README.markdown → README.md} +72 -0
  3. data/Rakefile +9 -10
  4. data/lib/riak/bucket.rb +2 -2
  5. data/lib/riak/client.rb +51 -19
  6. data/lib/riak/client/beefcake/messages.rb +10 -10
  7. data/lib/riak/client/beefcake/object_methods.rb +5 -3
  8. data/lib/riak/client/beefcake/protocol.rb +30 -3
  9. data/lib/riak/client/beefcake/socket.rb +10 -13
  10. data/lib/riak/client/beefcake/time_series_get_operator.rb +8 -3
  11. data/lib/riak/client/beefcake/time_series_list_operator.rb +8 -3
  12. data/lib/riak/client/beefcake/time_series_query_operator.rb +8 -3
  13. data/lib/riak/client/beefcake/ts_cell_codec.rb +11 -1
  14. data/lib/riak/client/beefcake_protobuffs_backend.rb +23 -14
  15. data/lib/riak/client/protobuffs_backend.rb +1 -0
  16. data/lib/riak/counter.rb +2 -2
  17. data/lib/riak/rcontent.rb +30 -7
  18. data/lib/riak/robject.rb +9 -3
  19. data/lib/riak/time_series/list.rb +2 -3
  20. data/lib/riak/time_series/query.rb +2 -1
  21. data/lib/riak/time_series/read.rb +2 -1
  22. data/lib/riak/util/gzip.rb +44 -0
  23. data/lib/riak/version.rb +1 -1
  24. data/riak-client.gemspec +11 -11
  25. data/spec/integration/riak/encodings/kv_spec.rb +6 -0
  26. data/spec/integration/riak/protobuffs/timeouts_spec.rb +174 -0
  27. data/spec/integration/riak/time_series_spec.rb +8 -6
  28. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +1 -0
  29. data/spec/riak/beefcake_protobuffs_backend/ts_cell_codec_spec.rb +9 -1
  30. data/spec/riak/client_spec.rb +49 -2
  31. data/spec/riak/robject_spec.rb +2 -1
  32. data/spec/riak/stamp_spec.rb +54 -54
  33. data/spec/riak/time_series/listing_spec.rb +1 -0
  34. data/spec/riak/util/gzip_spec.rb +37 -0
  35. data/spec/support/unified_backend_examples.rb +22 -0
  36. metadata +28 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 801f389ebb664f16d07a1f8ece1f0f43c630764f
4
- data.tar.gz: 607a42223cd90d60b5d45bb99e82e443b612975a
3
+ metadata.gz: 091da90ba79f138406f4c579e5e2ace6b7e64c9f
4
+ data.tar.gz: f9358609ddee45c9bd31c0ecd08041e8fc7af0dd
5
5
  SHA512:
6
- metadata.gz: 6295481b6c846aa7836e73589bf3ce75d4afbfe517594c67bcaa93d99e03eb189a833f0b234242a380b4e6ee945ca1520fa117270f8ffb7d56d2ac180e8f05bd
7
- data.tar.gz: 9d021d51f71193b367dee6b9951107238db9b616eec9b25119b8f59ba072eb00b5452c9b17335f0c8d43714f5efeb2e272ccc4f3ace231f77c79112fd54cba16
6
+ metadata.gz: 1d3ce61ec6c57a6d263536b2d0936f01310f98899a4324c1da020bf1a4985bc00a729bde3410ee5f0de1e20b6d6f017a288a2817b3cdf9cb0e87709993f01e42
7
+ data.tar.gz: 06d6d70268bcbeee49508348393a978a476b85f924b8ee8662bea3b4cd78478ca8269638e88d8e8627b2688cce0a73216eec1cf1815adebcde2299d108b5d73a
@@ -638,3 +638,75 @@ Unless required by applicable law or agreed to in writing, software distributed
638
638
 
639
639
  The included photo (spec/fixtures/cat.jpg) is Copyright ©2009 [Sean Cribbs](http://seancribbs.com/), and is licensed under the [Creative Commons Attribution Non-Commercial 3.0](http://creativecommons.org/licenses/by-nc/3.0) license.
640
640
  !["Creative Commons"](http://i.creativecommons.org/l/by-nc/3.0/88x31.png)
641
+
642
+ `gzip` encoding support is copied from the [ActiveSupport project](https://github.com/rails/rails/blob/master/activesupport/lib/active_support/gzip.rb).
643
+
644
+ ## Contributors
645
+
646
+ Thank you to all of our contributors!
647
+
648
+ * [Adam Hunter](https://github.com/adamhunter)
649
+ * [akm](https://github.com/akm)
650
+ * [Alexander Lang](https://github.com/langalex)
651
+ * [Alex Moore](https://github.com/alexmoore)
652
+ * [André Silva](https://github.com/andrelrs)
653
+ * [Ashley Woodard](https://github.com/ashley-woodard)
654
+ * [batasrki](https://github.com/batasrki)
655
+ * [benmills](https://github.com/benmills)
656
+ * [Brian Kaney](https://github.com/bkaney)
657
+ * [Bryce Kerley](https://github.com/bkerley)
658
+ * [Carl Hall](https://github.com/thecarlhall)
659
+ * [Charl Matthee](https://github.com/charl)
660
+ * [dan](https://github.com/dan)
661
+ * [Daniel Reverri](https://github.com/dreverri)
662
+ * [Dave Perrett](https://github.com/recurser)
663
+ * [David Czarnecki](https://github.com/czarneckid)
664
+ * [dn](https://github.com/dndn)
665
+ * Duff OMelia
666
+ * [Elias Levy](https://github.com/eliaslevy)
667
+ * [Eric Cestari](https://github.com/cstar)
668
+ * [Eric Redmond](https://github.com/coderoshi)
669
+ * [Hidekazu Tanaka](https://github.com/holidayworking)
670
+ * [Hiroyasu Ohyama](https://github.com/userlocalhost2000)
671
+ * [Jace](https://github.com/jace)
672
+ * [Jack Dempsey](https://github.com/jackdempsey)
673
+ * Jay Adkisson
674
+ * [Jeff Pollard](https://github.com/Fluxx)
675
+ * [Joe DeVivo](https://github.com/joedevivo)
676
+ * [John Axel Eriksson](https://github.com/johnae)
677
+ * [John Leach](https://github.com/johnl)
678
+ * [John Lynch](https://github.com/johnthethird)
679
+ * Jordan Goldstein
680
+ * [Josh Nichols](https://github.com/technicalpickles)
681
+ * [Justin Pease](https://github.com/jpease)
682
+ * [Kazuhiro Suzuki](https://github.com/ksauzz)
683
+ * [Kyle Kingsbury](https://github.com/aphyr)
684
+ * [Lee Jensen](https://github.com/outerim)
685
+ * [Luke Bakken](https://github.com/lukebakken)
686
+ * [Marco Campana](https://github.com/marcocampana)
687
+ * [Mat Brown](https://github.com/outoftime)
688
+ * [Mathias Meyer](https://github.com/roidrage)
689
+ * [Michael Sullivan](https://github.com/msullivan)
690
+ * [Misha Gorodnitzky](https://github.com/misaka)
691
+ * [Myron Marston](https://github.com/myronmarston)
692
+ * [Nathaniel Talbott](https://github.com/ntalbott)
693
+ * [Nicholas Rowe](https://github.com/NicholasRowe)
694
+ * [Nicolas Fouché](https://github.com/nfo)
695
+ * [oleg dashevskii](https://github.com/be9)
696
+ * [PatrickMa](https://github.com/patrickmaciel)
697
+ * [Peter Garbers](https://github.com/petergarbers)
698
+ * [Randy Secrist](https://github.com/randysecrist)
699
+ * [Rusty Klophaus](https://github.com/rustyio)
700
+ * [Ryan Daigle](https://github.com/rwdaigle)
701
+ * [Sam Aarons](https://github.com/saarons)
702
+ * [Sean Cribbs](https://github.com/seancribbs)
703
+ * Sebastian Röbke
704
+ * [Shay Frendt](https://github.com/shayfrendt)
705
+ * [Srdjan Pejic](https://github.com/batasrki)
706
+ * [StabbyCutyou](https://github.com/StabbyCutyou)
707
+ * [Stefan Sprenger](https://github.com/flippingbits)
708
+ * Technorama, Ltd
709
+ * [Tyler Hunt](https://github.com/tylerhunt)
710
+ * [Wagner Camarao](https://github.com/wcamarao)
711
+ * [Woody Peterson](https://github.com/woahdae)
712
+ * [Zshawn Syed](https://github.com/zsyed91)
data/Rakefile CHANGED
@@ -31,11 +31,6 @@ task :gemspec do
31
31
  gemspec.validate
32
32
  end
33
33
 
34
- desc %{Release the gem to RubyGems.org}
35
- task :release => :gem do
36
- system "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
37
- end
38
-
39
34
  desc "Cleans up white space in source files"
40
35
  task :clean_whitespace do
41
36
  no_file_cleaned = true
@@ -63,7 +58,7 @@ end
63
58
  namespace :spec do
64
59
  desc "Run Integration Specs Only (without explicitly slow specs)"
65
60
  RSpec::Core::RakeTask.new(:integration) do |spec|
66
- spec.rspec_opts = %w[--profile --tag '~slow' --tag integration]
61
+ spec.rspec_opts = %w[--profile --tag '~slow' --tag '~time_series' --tag integration]
67
62
  end
68
63
 
69
64
  desc "Run All Specs (without explicitly slow specs)"
@@ -75,11 +70,16 @@ namespace :spec do
75
70
  RSpec::Core::RakeTask.new(:slow) do |spec|
76
71
  spec.rspec_opts = %w[--profile --tag slow]
77
72
  end
73
+
74
+ desc "Run Time Series Specs Only"
75
+ RSpec::Core::RakeTask.new(:time_series) do |spec|
76
+ spec.rspec_opts = %w[--profile --tag time_series]
77
+ end
78
78
  end
79
79
 
80
- desc "Run All Specs (including slow specs)"
80
+ desc "Run Unit Test Specs (excluding slow, integration and time_series)"
81
81
  RSpec::Core::RakeTask.new(:ci) do |spec|
82
- spec.rspec_opts = %w[--profile]
82
+ spec.rspec_opts = %w[--profile --tag '~slow' --tag '~integration' --tag '~time_series']
83
83
  end
84
84
  task :default => :ci
85
85
 
@@ -113,8 +113,7 @@ namespace :beefcake do
113
113
 
114
114
  directory 'tmp/riak_pb' => 'tmp' do
115
115
  cd 'tmp' do
116
- # NB: change this once TS is published
117
- sh "git clone -b end-to-end/timeseries https://github.com/basho/riak_pb.git"
116
+ sh "git clone -b 2.1.3.0 https://github.com/basho/riak_pb.git"
118
117
  end
119
118
  end
120
119
  end
@@ -23,8 +23,8 @@ module Riak
23
23
  # @param [Client] client the {Riak::Client} for this bucket
24
24
  # @param [String] name the name of the bucket
25
25
  def initialize(client, name)
26
- raise ArgumentError, t("client_type", :client => client.inspect) unless Client === client
27
- raise ArgumentError, t("string_type", :string => name.inspect) unless String === name
26
+ raise ArgumentError, t('client_type', :client => client.inspect) unless Client === client
27
+ raise ArgumentError, t('string_type', :string => name.inspect) unless String === name
28
28
  raise ArgumentError, t('zero_length_bucket') if name == ''
29
29
  @client, @name = client, name
30
30
  end
@@ -37,7 +37,7 @@ module Riak
37
37
  HOST_REGEX = /^(?:(?:(?:[a-zA-Z\d](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\])$/n
38
38
 
39
39
  # Valid constructor options.
40
- VALID_OPTIONS = [:nodes, :client_id, :protobuffs_backend, :authentication] | Node::VALID_OPTIONS
40
+ VALID_OPTIONS = [:nodes, :client_id, :protobuffs_backend, :authentication, :max_retries, :connect_timeout, :read_timeout, :write_timeout, :convert_timestamp] | Node::VALID_OPTIONS
41
41
 
42
42
  # Network errors.
43
43
  NETWORK_ERRORS = [
@@ -48,6 +48,7 @@ module Riak
48
48
  Errno::ENETDOWN,
49
49
  Errno::ENETRESET,
50
50
  Errno::ENETUNREACH,
51
+ Errno::ETIMEDOUT,
51
52
  SocketError,
52
53
  SystemCallError,
53
54
  Riak::ProtobuffsFailedHeader,
@@ -73,6 +74,21 @@ module Riak
73
74
  # @return [Hash] The authentication information this client will use.
74
75
  attr_reader :authentication
75
76
 
77
+ # @return [Integer] The maximum number of retries in case of NETWORK_ERRORS
78
+ attr_accessor :max_retries
79
+
80
+ # @return [Numeric] The connect timeout, in seconds
81
+ attr_reader :connect_timeout
82
+
83
+ # @return [Numeric] The read timeout, in seconds
84
+ attr_reader :read_timeout
85
+
86
+ # @return [Numeric] The write timeout, in seconds
87
+ attr_reader :write_timeout
88
+
89
+ # @return [Boolean] Convert timestamps from Riak TS to Time objects
90
+ attr_reader :convert_timestamp
91
+
76
92
  # Creates a client connection to Riak
77
93
  # @param [Hash] options configuration options for the client
78
94
  # @option options [Array] :nodes A list of nodes this client connects to.
@@ -84,6 +100,10 @@ module Riak
84
100
  # @option options [Fixnum] :pb_port (8087) The port of the Riak Protocol Buffers endpoint
85
101
  # @option options [Fixnum, String] :client_id (rand(MAX_CLIENT_ID)) The internal client ID used by Riak to route responses
86
102
  # @option options [String, Symbol] :protobuffs_backend (:Beefcake) which Protocol Buffers backend to use
103
+ # @option options [Fixnum] :max_retries (2) The maximum number of retries in case of NETWORK_ERRORS
104
+ # @option options [Numeric] :connect_timeout (nil) The connect timeout, in seconds
105
+ # @option options [Numeric] :read_timeout (nil) The read timeout, in seconds
106
+ # @option options [Numeric] :write_timeout (nil) The write timeout, in seconds
87
107
  # @raise [ArgumentError] raised if any invalid options are given
88
108
  def initialize(options = {})
89
109
  if options.include? :port
@@ -94,23 +114,22 @@ module Riak
94
114
  raise ArgumentError, "#{evil.inspect} are not valid options for Client.new"
95
115
  end
96
116
 
97
- @nodes = (options[:nodes] || []).map do |n|
98
- Client::Node.new self, n
99
- end
100
- if @nodes.empty? or options[:host] or options[:pb_port]
101
- @nodes |= [Client::Node.new(self, options)]
102
- end
117
+ @nodes = build_nodes(options)
103
118
 
104
119
  @protobuffs_pool = Pool.new(
105
120
  method(:new_protobuffs_backend),
106
121
  lambda { |b| b.teardown }
107
122
  )
108
123
 
109
-
110
124
  self.protobuffs_backend = options[:protobuffs_backend] || :Beefcake
111
125
  self.client_id = options[:client_id] if options[:client_id]
112
126
  self.multiget_threads = options[:multiget_threads]
113
127
  @authentication = options[:authentication] && options[:authentication].symbolize_keys
128
+ self.max_retries = options[:max_retries] || 2
129
+ @connect_timeout = options[:connect_timeout]
130
+ @read_timeout = options[:read_timeout]
131
+ @write_timeout = options[:write_timeout]
132
+ @convert_timestamp = options[:convert_timestamp] || false
114
133
  end
115
134
 
116
135
  # Is security enabled?
@@ -261,7 +280,8 @@ module Riak
261
280
 
262
281
  # Get an object. See Bucket#get
263
282
  def get_object(bucket, key, options = {})
264
- raise ArgumentError, t("zero_length_key") if key == ''
283
+ raise ArgumentError, t('zero_length_key') if key == ''
284
+ raise ArgumentError, t('string_type', :string => key) unless key.is_a? String
265
285
  backend do |b|
266
286
  b.fetch_object(bucket, key, options)
267
287
  end
@@ -297,17 +317,16 @@ module Riak
297
317
  # a given node.
298
318
  def new_protobuffs_backend
299
319
  klass = self.class.const_get("#{@protobuffs_backend}ProtobuffsBackend")
300
- if klass.configured?
301
- node = choose_node(
302
- @nodes.select do |n|
303
- n.protobuffs?
304
- end
305
- )
306
-
307
- klass.new(self, node)
308
- else
320
+ unless klass.configured?
309
321
  raise BackendCreationError.new @protobuffs_backend
310
322
  end
323
+ node = choose_node(
324
+ @nodes.select do |n|
325
+ n.protobuffs?
326
+ end
327
+ )
328
+
329
+ klass.new(self, node)
311
330
  end
312
331
 
313
332
  # @return [Node] An arbitrary Node.
@@ -342,7 +361,7 @@ module Riak
342
361
  def recover_from(pool)
343
362
  skip_nodes = []
344
363
  take_opts = {}
345
- tries = 3
364
+ tries = 1 + max_retries
346
365
 
347
366
  begin
348
367
  # Only select nodes which we haven't used before.
@@ -432,5 +451,18 @@ module Riak
432
451
  n.ssl_disable
433
452
  end
434
453
  end
454
+
455
+ def build_nodes(options)
456
+ if options.key?(:nodes) and !options[:nodes].empty?
457
+ options[:nodes].map do |n|
458
+ if !n.key?(:pb_port) and options.key?(:pb_port)
459
+ n[:pb_port] = options[:pb_port]
460
+ end
461
+ Client::Node.new self, n
462
+ end
463
+ else
464
+ [Client::Node.new(self, options)]
465
+ end
466
+ end
435
467
  end
436
468
  end
@@ -1,9 +1,9 @@
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
7
7
  ## Generated from riak.proto
8
8
  require "beefcake"
9
9
 
@@ -950,7 +950,7 @@ class TsListKeysResp
950
950
  repeated :keys, TsRow, 1
951
951
  optional :done, :bool, 2
952
952
  end
953
-
954
- end
955
- end
956
- end
953
+
954
+ end
955
+ end
956
+ end
@@ -42,6 +42,7 @@ module Riak
42
42
  rcontent.raw_data = pbuf.value
43
43
  rcontent.etag = pbuf.vtag if pbuf.vtag.present?
44
44
  rcontent.content_type = pbuf.content_type if pbuf.content_type.present?
45
+ rcontent.content_encoding = pbuf.content_encoding if pbuf.content_encoding.present?
45
46
  rcontent.links = Set.new(pbuf.links.map(&method(:decode_link))) if pbuf.links.present?
46
47
  pbuf.usermeta.each {|pair| decode_meta(pair, rcontent.meta) } if pbuf.usermeta.present?
47
48
  if pbuf.indexes.present?
@@ -60,11 +61,12 @@ module Riak
60
61
  :links => robject.links.map {|l| encode_link(l) }.compact,
61
62
  :indexes => robject.indexes.map {|k, s| encode_index(k, s) }.flatten)
62
63
 
64
+ pbuf.content.content_encoding = robject.content_encoding if robject.content_encoding.present?
63
65
  pbuf.content.usermeta = robject.meta.map {|k, v| encode_meta(k, v)} if robject.meta.any?
64
66
  pbuf.content.vtag = maybe_encode(robject.etag) if robject.etag.present?
65
- if ENCODING # 1.9 support
66
- pbuf.content.charset = maybe_encode(robject.raw_data.encoding.name)
67
- end
67
+
68
+ return unless ENCODING # 1.9 support
69
+ pbuf.content.charset = maybe_encode(robject.raw_data.encoding.name)
68
70
  end
69
71
 
70
72
  def decode_link(pbuf)
@@ -8,10 +8,16 @@ module Riak
8
8
  class BeefcakeProtobuffsBackend < ProtobuffsBackend
9
9
  class Protocol
10
10
  include Riak::Util::Translation
11
- attr_reader :socket
11
+ attr_reader :socket, :read_timeout, :write_timeout
12
12
 
13
- def initialize(socket)
13
+ # @param [Socket]
14
+ # @param [Hash] options
15
+ # @option options [Numeric] :read_timeout (nil) The read timeout, in seconds
16
+ # @option options [Numeric] :write_timeout (nil) The write timeout, in seconds
17
+ def initialize(socket, options = {})
14
18
  @socket = socket
19
+ @read_timeout = options[:read_timeout]
20
+ @write_timeout = options[:write_timeout]
15
21
  end
16
22
 
17
23
  # Encodes and writes a Riak-formatted message, including protocol buffer
@@ -32,7 +38,25 @@ module Riak
32
38
 
33
39
  payload = header + serialized
34
40
 
35
- socket.write payload
41
+ if write_timeout
42
+ begin
43
+ loop do
44
+ bytes_written = socket.write_nonblock(payload)
45
+ # write_nonblock doesn't guarantee to write all data at once,
46
+ # so check if there are bytes left to be written
47
+ break if bytes_written >= payload.bytesize
48
+ payload.slice!(0, bytes_written)
49
+ end
50
+ rescue IO::WaitWritable, Errno::EINTR
51
+ # wait with the retry until socket is writable again
52
+ unless IO.select(nil, [socket], nil, write_timeout)
53
+ raise Errno::ETIMEDOUT, 'write timeout'
54
+ end
55
+ retry
56
+ end
57
+ else
58
+ socket.write(payload)
59
+ end
36
60
  socket.flush
37
61
  end
38
62
 
@@ -41,6 +65,9 @@ module Riak
41
65
  #
42
66
  # @return [Array<Symbol, String>]
43
67
  def receive
68
+ if read_timeout && !IO.select([socket], nil, nil, read_timeout)
69
+ raise Errno::ETIMEDOUT, 'read timeout'
70
+ end
44
71
  header = socket.read 5
45
72
 
46
73
  raise ProtobuffsFailedHeader.new if header.nil?
@@ -1,3 +1,4 @@
1
+ require 'socket'
1
2
  require 'openssl'
2
3
  require 'cert_validator'
3
4
  require 'riak/client/beefcake/messages'
@@ -13,21 +14,22 @@ module Riak
13
14
  # Only create class methods, don't initialize
14
15
  class << self
15
16
  def new(host, port, options = {})
16
- return start_tcp_socket(host, port) if options[:authentication].blank?
17
- return start_tls_socket(host, port, options[:authentication])
17
+ return start_tcp_socket(host, port, options) if options[:authentication].blank?
18
+ return start_tls_socket(host, port, options)
18
19
  end
19
20
 
20
21
  private
21
- def start_tcp_socket(host, port)
22
- TCPSocket.new(host, port).tap do |sock|
22
+ def start_tcp_socket(host, port, options = {})
23
+ Socket.tcp(host, port, connect_timeout: options[:connect_timeout]).tap do |sock|
23
24
  sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
24
25
  end
25
26
  end
26
27
 
27
- def start_tls_socket(host, port, authentication)
28
+ def start_tls_socket(host, port, options)
29
+ authentication = options[:authentication]
28
30
  raise Riak::UserConfigurationError.new if authentication[:username]
29
31
 
30
- tcp = start_tcp_socket(host, port)
32
+ tcp = start_tcp_socket(host, port, options)
31
33
  TlsInitiator.new(tcp, host, authentication).tls_socket
32
34
  end
33
35
 
@@ -178,13 +180,8 @@ module Riak
178
180
 
179
181
  validator.crl = try_load @auth[:crl_file] if @auth[:crl_file]
180
182
 
181
- if @auth[:crl]
182
- raise TlsError::CertRevokedError.new unless validator.crl_valid?
183
- end
184
-
185
- if @auth[:ocsp]
186
- raise TlsError::CertRevokedError.new unless validator.ocsp_valid?
187
- end
183
+ raise TlsError::CertRevokedError.new if @auth[:crl] and !validator.crl_valid?
184
+ raise TlsError::CertRevokedError.new if @auth[:ocsp] and !validator.ocsp_valid?
188
185
  end
189
186
 
190
187
  def validator_options
@@ -2,13 +2,18 @@ require_relative './ts_cell_codec'
2
2
  require_relative './operator'
3
3
 
4
4
  class Riak::Client::BeefcakeProtobuffsBackend
5
- def time_series_get_operator
6
- TimeSeriesGetOperator.new(self)
5
+ def time_series_get_operator(convert_timestamp)
6
+ TimeSeriesGetOperator.new(self, convert_timestamp)
7
7
  end
8
8
 
9
9
  class TimeSeriesGetOperator < Operator
10
+ def initialize(backend, convert_timestamp)
11
+ super(backend)
12
+ @convert_timestamp = convert_timestamp
13
+ end
14
+
10
15
  def get(table_name, key_components, options = {})
11
- codec = TsCellCodec.new
16
+ codec = TsCellCodec.new(@convert_timestamp)
12
17
 
13
18
  request_options = options.merge(table: table_name,
14
19
  key: codec.cells_for(key_components))