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/member_discovered.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, MemberDiscovered, 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::MemberDiscovered ].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.
53 54 55 56 57 |
# File 'lib/mongo/server/description/inspector.rb', line 53 def initialize(listeners) @inspectors = INSPECTORS.map do |inspector| inspector.new(listeners) end end |
Instance Attribute Details
#inspectors ⇒ Array (readonly)
Returns inspectors The description inspectors.
43 44 45 |
# File 'lib/mongo/server/description/inspector.rb', line 43 def inspectors @inspectors end |
Instance Method Details
#run(description, ismaster, average_round_trip_time) ⇒ Description
Run the server description inspector.
71 72 73 74 75 76 77 |
# File 'lib/mongo/server/description/inspector.rb', line 71 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 |