Class: Mongo::Event::PrimaryElected
- Inherits:
-
Object
- Object
- Mongo::Event::PrimaryElected
- Defined in:
- lib/mongo/event/primary_elected.rb
Overview
This handles primary elected events for server descriptions.
Instance Attribute Summary collapse
-
#cluster ⇒ Mongo::Cluster
readonly
Cluster The cluster.
Instance Method Summary collapse
-
#handle(description) ⇒ Object
This event tells the cluster to take all previous primaries to an unknown state.
-
#initialize(cluster) ⇒ PrimaryElected
constructor
Initialize the new primary elected event handler.
Constructor Details
#initialize(cluster) ⇒ PrimaryElected
Initialize the new primary elected event handler.
36 37 38 |
# File 'lib/mongo/event/primary_elected.rb', line 36 def initialize(cluster) @cluster = cluster end |
Instance Attribute Details
#cluster ⇒ Mongo::Cluster (readonly)
Returns cluster The cluster.
26 27 28 |
# File 'lib/mongo/event/primary_elected.rb', line 26 def cluster @cluster end |
Instance Method Details
#handle(description) ⇒ Object
This event tells the cluster to take all previous primaries to an unknown state.
50 51 52 |
# File 'lib/mongo/event/primary_elected.rb', line 50 def handle(description) cluster.elect_primary!(description) end |