Module: Moped::ReadPreference
- Extended by:
- ReadPreference
- Included in:
- ReadPreference
- Defined in:
- lib/moped/read_preference.rb,
lib/moped/read_preference/nearest.rb,
lib/moped/read_preference/primary.rb,
lib/moped/read_preference/secondary.rb,
lib/moped/read_preference/selectable.rb,
lib/moped/read_preference/primary_preferred.rb,
lib/moped/read_preference/secondary_preferred.rb
Overview
Provides behaviour around getting various read preference implementations.
Defined Under Namespace
Modules: Selectable Classes: Nearest, Primary, PrimaryPreferred, Secondary, SecondaryPreferred
Constant Summary collapse
- PREFERENCES =
Hash lookup for the read preference classes based off the symbols provided in configuration.
{ nearest: Nearest, primary: Primary, primary_preferred: PrimaryPreferred, secondary: Secondary, secondary_preferred: SecondaryPreferred }.freeze
Instance Method Summary collapse
-
#get(name, tags = nil) ⇒ Object
Get a read preference for the provided name.
Instance Method Details
#get(name, tags = nil) ⇒ Object
Get a read preference for the provided name. Valid names are:
- :nearest
- :primary
- :primary_preferred
- :secondary
- :secondary_preferred
45 46 47 |
# File 'lib/moped/read_preference.rb', line 45 def get(name, = nil) PREFERENCES.fetch(name.to_sym).new() end |