Class: Mongo::Server::Description::Inspector
- Inherits:
-
Object
- Object
- Mongo::Server::Description::Inspector
- Defined in:
- lib/mongo/server/description/inspector.rb,
lib/mongo/server/description/inspector/primary_elected.rb,
lib/mongo/server/description/inspector/description_changed.rb,
lib/mongo/server/description/inspector/standalone_discovered.rb
Overview
Handles inspection of an updated server description to determine if events should be fired.
Defined Under Namespace
Classes: DescriptionChanged, PrimaryElected, StandaloneDiscovered
Constant Summary collapse
- INSPECTORS =
Static list of inspections that are performed on the result of an ismaster command in order to generate the appropriate events for the changes.
[ Inspector::StandaloneDiscovered, Inspector::DescriptionChanged, Inspector::PrimaryElected ].freeze
Instance Attribute Summary collapse
-
#inspectors ⇒ Array
readonly
Inspectors The description inspectors.
Instance Method Summary collapse
-
#initialize(listeners) ⇒ Inspector
constructor
Create the new inspector.
-
#run(description, ismaster, average_round_trip_time) ⇒ Description
Run the server description inspector.
Constructor Details
#initialize(listeners) ⇒ Inspector
Create the new inspector.
51 52 53 54 55 |
# File 'lib/mongo/server/description/inspector.rb', line 51 def initialize(listeners) @inspectors = INSPECTORS.map do |inspector| inspector.new(listeners) end end |
Instance Attribute Details
#inspectors ⇒ Array (readonly)
Returns inspectors The description inspectors.
41 42 43 |
# File 'lib/mongo/server/description/inspector.rb', line 41 def inspectors @inspectors end |
Instance Method Details
#run(description, ismaster, average_round_trip_time) ⇒ Description
Run the server description inspector.
69 70 71 72 73 74 75 |
# File 'lib/mongo/server/description/inspector.rb', line 69 def run(description, ismaster, average_round_trip_time) new_description = Description.new(description.address, ismaster, average_round_trip_time) inspectors.each do |inspector| inspector.run(description, new_description) end new_description end |