module Bones::RPC::ReadPreference
Provides behaviour around getting various read preference implementations.
@since 0.0.1
Constants
- PREFERENCES
Hash lookup for the read preference classes based off the symbols provided in configuration.
@since 0.0.1
Public Instance Methods
get(name, tags = nil)
click to toggle source
Get a read preference for the provided name. Valid names are:
- :nearest - :primary - :primary_preferred - :secondary - :secondary_preferred
@example Get the primary read preference.
Bones::RPC::ReadPreference.get(:primary)
@param [ Symbol ] name The name of the preference. @param [ Array<Hash> ] tags The tag sets to match the node on.
@return [ Object ] The appropriate read preference.
@since 0.0.1
# File lib/bones/rpc/read_preference.rb, line 38 def get(name, tags = nil) PREFERENCES.fetch(name.to_sym).new(tags) end