class Mongo::Server::Description::Features
Defines behaviour around what features a specific server supports.
@since 2.0.0
Constants
- DRIVER_TOO_OLD
Error message if the driver is too old for the version of the server.
@since 2.5.0
- DRIVER_WIRE_VERSIONS
The wire protocol versions that this version of the driver supports.
@since 2.0.0
- MAPPINGS
List of features and the wire protocol version they appear in.
@since 2.0.0
- SERVER_TOO_OLD
Error message if the server is too old for this version of the driver.
@since 2.5.0
Attributes
@return [ Range ] #server_wire_versions The server's supported wire
versions.
Public Class Methods
Initialize the features.
@example Initialize the features.
Features.new(0..3)
@param [ Range ] #server_wire_versions The server supported wire
versions.
@since 2.0.0
# File lib/mongo/server/description/features.rb, line 89 def initialize(server_wire_versions, address = nil) @server_wire_versions = server_wire_versions @address = address end
Public Instance Methods
Check that there is an overlap between the driver supported wire version range
and the server wire version range.
@example Verify the wire version overlap.
features.check_driver_support!
@raise [ Error::UnsupportedFeatures ] If the wire version range is not covered
by the driver.
@since 2.5.1
# File lib/mongo/server/description/features.rb, line 104 def check_driver_support! if DRIVER_WIRE_VERSIONS.min > @server_wire_versions.max raise Error::UnsupportedFeatures.new(SERVER_TOO_OLD % [@address, @server_wire_versions.max, DRIVER_WIRE_VERSIONS.min]) elsif DRIVER_WIRE_VERSIONS.max < @server_wire_versions.min raise Error::UnsupportedFeatures.new(DRIVER_TOO_OLD % [@address, @server_wire_versions.min, DRIVER_WIRE_VERSIONS.max]) end end