module Riak::Client::FeatureDetection

Methods that can be used to determine whether certain features are supported by the Riak node to which the client backend is connected.

Backends must implement the “get_server_version” method, returning a string representing the Riak node’s version. This is implemented on HTTP using the stats resource, and on Protocol Buffers using the RpbGetServerInfoReq message.

Constants

VERSION

Constants representing Riak versions

Public Instance Methods

get_server_version() click to toggle source

@return [String] the version of the Riak node @abstract

# File lib/riak/client/feature_detection.rb, line 23
def get_server_version
  raise NotImplementedError
end
http_props_clearable?() click to toggle source

@return [true,false] whether bucket properties can be cleared

(reset to defaults) over HTTP
# File lib/riak/client/feature_detection.rb, line 78
def http_props_clearable?
  at_least? VERSION[1.3]
end
index_pagination?() click to toggle source

@return [true,false] whether secondary indexes support

pagination
# File lib/riak/client/feature_detection.rb, line 84
def index_pagination?
  at_least? VERSION[1.4]
end
index_return_terms?() click to toggle source

@return [true,false] whether secondary indexes support

return_terms
# File lib/riak/client/feature_detection.rb, line 90
def index_return_terms?
  at_least? VERSION[1.4]
end
index_streaming?() click to toggle source

@return [true,false] whether secondary indexes support

streaming
# File lib/riak/client/feature_detection.rb, line 96
def index_streaming?
  at_least? VERSION[1.4]
end
key_object_bucket_timeouts?() click to toggle source

@return [true,false] whether timeouts are accepted for

object CRUD, key listing, and bucket listing
# File lib/riak/client/feature_detection.rb, line 102
def key_object_bucket_timeouts?
  at_least? VERSION[1.4]
end
mapred_phaseless?() click to toggle source

@return [true,false] whether MapReduce requests can be submitted without

phases.
# File lib/riak/client/feature_detection.rb, line 35
def mapred_phaseless?
  at_least? VERSION[1.1]
end
pb_conditionals?() click to toggle source

@return [true,false] whether conditional fetch/store semantics

are supported over Protocol Buffers
# File lib/riak/client/feature_detection.rb, line 53
def pb_conditionals?
  at_least? VERSION[1]
end
pb_head?() click to toggle source

@return [true,false] whether partial-fetches (vclock and

metadata only) are supported over Protocol Buffers
# File lib/riak/client/feature_detection.rb, line 72
def pb_head?
  at_least? VERSION[1]
end
pb_indexes?() click to toggle source

@return [true,false] whether secondary index queries are

supported over Protocol Buffers
# File lib/riak/client/feature_detection.rb, line 41
def pb_indexes?
  at_least? VERSION[1.2]
end
pb_search?() click to toggle source

@return [true,false] whether search queries are supported over

Protocol Buffers
# File lib/riak/client/feature_detection.rb, line 47
def pb_search?
  at_least? VERSION[1.2]
end
quorum_controls?() click to toggle source

@return [true,false] whether additional quorums and FSM

controls are available, e.g. primary quorums, basic_quorum,
notfound_ok
# File lib/riak/client/feature_detection.rb, line 60
def quorum_controls?
  at_least? VERSION[1]
end
server_version() click to toggle source

@return [Gem::Version] the version of the Riak node to which

this backend is connected
# File lib/riak/client/feature_detection.rb, line 29
def server_version
  @server_version ||= Gem::Version.new(get_server_version.split("-").first)
end
tombstone_vclocks?() click to toggle source

@return [true,false] whether “not found” responses might

include vclocks
# File lib/riak/client/feature_detection.rb, line 66
def tombstone_vclocks?
  at_least? VERSION[1]
end

Protected Instance Methods

at_least?(version) click to toggle source

@return [true,false] whether the server version is the same or

newer than the requested version
# File lib/riak/client/feature_detection.rb, line 109
def at_least?(version)
  server_version >= version
end
reset_server_version() click to toggle source

Backends should call this when their connection is interrupted or reset so as to facilitate rolling upgrades

# File lib/riak/client/feature_detection.rb, line 115
def reset_server_version
  @server_version = nil
end