Class: Mongo::Event::DescriptionChanged
- Inherits:
-
Object
- Object
- Mongo::Event::DescriptionChanged
- Includes:
- Monitoring::Publishable
- Defined in:
- lib/mongo/event/description_changed.rb
Overview
This handles a change in description.
Instance Attribute Summary collapse
-
#cluster ⇒ Mongo::Cluster
readonly
Cluster The cluster.
-
#monitoring ⇒ Monitoring
readonly
Monitoring The monitoring.
-
#options ⇒ Hash
readonly
Options The options.
Instance Method Summary collapse
-
#handle(previous, updated) ⇒ Object
This event publishes an event to add the cluster and logs the configuration change.
-
#initialize(cluster) ⇒ DescriptionChanged
constructor
Initialize the new host added event handler.
Methods included from Monitoring::Publishable
#publish_command, #publish_event, #publish_sdam_event
Constructor Details
#initialize(cluster) ⇒ DescriptionChanged
Initialize the new host added event handler.
42 43 44 45 46 |
# File 'lib/mongo/event/description_changed.rb', line 42 def initialize(cluster) @cluster = cluster = cluster. @monitoring = cluster.monitoring end |
Instance Attribute Details
#cluster ⇒ Mongo::Cluster (readonly)
Returns cluster The cluster.
26 27 28 |
# File 'lib/mongo/event/description_changed.rb', line 26 def cluster @cluster end |
#monitoring ⇒ Monitoring (readonly)
Returns monitoring The monitoring.
32 33 34 |
# File 'lib/mongo/event/description_changed.rb', line 32 def monitoring @monitoring end |
#options ⇒ Hash (readonly)
Returns options The options.
29 30 31 |
# File 'lib/mongo/event/description_changed.rb', line 29 def end |
Instance Method Details
#handle(previous, updated) ⇒ Object
This event publishes an event to add the cluster and logs the configuration change.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mongo/event/description_changed.rb', line 57 def handle(previous, updated) publish_sdam_event( Monitoring::SERVER_DESCRIPTION_CHANGED, Monitoring::Event::ServerDescriptionChanged.new( updated.address, cluster.topology, previous, updated ) ) cluster.add_hosts(updated) cluster.remove_hosts(updated) end |