Class: Moped::ReadPreference::Primary
- Inherits:
-
Object
- Object
- Moped::ReadPreference::Primary
- Includes:
- Selectable
- Defined in:
- lib/moped/read_preference/primary.rb
Overview
Encapsulates behaviour around a primary read preference.
Instance Attribute Summary
Attributes included from Selectable
Instance Method Summary collapse
-
#name ⇒ Symbol
Get the name for the read preference on the server side.
-
#query_options(options) ⇒ Hash
Get the provided options as query options for this read preference.
-
#with_node(cluster, &block) ⇒ Object
Select a primary node from the cluster.
Methods included from Selectable
Instance Method Details
#name ⇒ Symbol
Get the name for the read preference on the server side.
19 20 21 |
# File 'lib/moped/read_preference/primary.rb', line 19 def name :primary end |
#query_options(options) ⇒ Hash
Get the provided options as query options for this read preference.
33 34 35 |
# File 'lib/moped/read_preference/primary.rb', line 33 def () end |
#with_node(cluster, &block) ⇒ Object
Select a primary node from the cluster. If no primary node is available then an exception will be raised.
53 54 55 56 57 |
# File 'lib/moped/read_preference/primary.rb', line 53 def with_node(cluster, &block) with_retry(cluster) do cluster.with_primary(&block) end end |