Class: Mongo::Server::Description::Inspector::PrimaryElected
- Inherits:
-
Object
- Object
- Mongo::Server::Description::Inspector::PrimaryElected
- Includes:
- Event::Publisher
- Defined in:
- lib/mongo/server/description/inspector/primary_elected.rb
Overview
Handles inspecting the result of an ismaster command to check if this server was elected primary.
Instance Attribute Summary
Attributes included from Event::Publisher
Instance Method Summary collapse
-
#initialize(event_listeners) ⇒ PrimaryElected
constructor
Instantiate the primary elected inspection.
-
#run(description, updated) ⇒ Object
Run the primary elected inspection.
Methods included from Event::Publisher
Constructor Details
#initialize(event_listeners) ⇒ PrimaryElected
Instantiate the primary elected inspection.
35 36 37 |
# File 'lib/mongo/server/description/inspector/primary_elected.rb', line 35 def initialize(event_listeners) @event_listeners = event_listeners end |
Instance Method Details
#run(description, updated) ⇒ Object
Run the primary elected inspection.
48 49 50 51 52 53 |
# File 'lib/mongo/server/description/inspector/primary_elected.rb', line 48 def run(description, updated) if (!description.primary? && updated.primary?) || (!description.mongos? && updated.mongos?) publish(Event::PRIMARY_ELECTED, updated) end end |