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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
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