Module: Riak::Client::FeatureDetection

Included in:
ProtobuffsBackend, SecondaryIndex
Defined in:
lib/riak/client/feature_detection.rb

Overview

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.

Constant Summary collapse

VERSION =

Constants representing Riak versions

{
  1 => Gem::Version.new("1.0.0"),
  1.1 => Gem::Version.new("1.1.0"),
  1.2 => Gem::Version.new("1.2.0"),
  1.3 => Gem::Version.new("1.3.0"),
  1.4 => Gem::Version.new("1.4.0")
}.freeze

Instance Method Summary collapse

Instance Method Details

#get_server_versionString

This method is abstract.

Returns the version of the Riak node

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/riak/client/feature_detection.rb', line 23

def get_server_version
  raise NotImplementedError
end

#http_props_clearable?true, false



78
79
80
# File 'lib/riak/client/feature_detection.rb', line 78

def http_props_clearable?
  at_least? VERSION[1.3]
end

#index_pagination?true, false



84
85
86
# File 'lib/riak/client/feature_detection.rb', line 84

def index_pagination?
  at_least? VERSION[1.4]
end

#index_return_terms?true, false



90
91
92
# File 'lib/riak/client/feature_detection.rb', line 90

def index_return_terms?
  at_least? VERSION[1.4]
end

#index_streaming?true, false



96
97
98
# File 'lib/riak/client/feature_detection.rb', line 96

def index_streaming?
  at_least? VERSION[1.4]
end

#key_object_bucket_timeouts?true, false



102
103
104
# File 'lib/riak/client/feature_detection.rb', line 102

def key_object_bucket_timeouts?
  at_least? VERSION[1.4]
end

#mapred_phaseless?true, false



35
36
37
# File 'lib/riak/client/feature_detection.rb', line 35

def mapred_phaseless?
  at_least? VERSION[1.1]
end

#pb_conditionals?true, false



53
54
55
# File 'lib/riak/client/feature_detection.rb', line 53

def pb_conditionals?
  at_least? VERSION[1]
end

#pb_head?true, false



72
73
74
# File 'lib/riak/client/feature_detection.rb', line 72

def pb_head?
  at_least? VERSION[1]
end

#pb_indexes?true, false



41
42
43
# File 'lib/riak/client/feature_detection.rb', line 41

def pb_indexes?
  at_least? VERSION[1.2]
end

#pb_search?true, false



47
48
49
# File 'lib/riak/client/feature_detection.rb', line 47

def pb_search?
  at_least? VERSION[1.2]
end

#quorum_controls?true, false



60
61
62
# File 'lib/riak/client/feature_detection.rb', line 60

def quorum_controls?
  at_least? VERSION[1]
end

#server_versionGem::Version



29
30
31
# 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?true, false



66
67
68
# File 'lib/riak/client/feature_detection.rb', line 66

def tombstone_vclocks?
  at_least? VERSION[1]
end