Class: Mongo::Event::DescriptionChanged

Inherits:
Base
  • Object
show all
Defined in:
lib/mongo/event/description_changed.rb

Overview

This handles a change in description.

Since:

  • 2.0.6

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#summary

Constructor Details

#initialize(cluster) ⇒ DescriptionChanged

Initialize the new host added event handler.

Examples:

Create the new handler.

ServerAdded.new(cluster)

Parameters:

Since:

  • 2.0.0



34
35
36
# File 'lib/mongo/event/description_changed.rb', line 34

def initialize(cluster)
  @cluster = cluster
end

Instance Attribute Details

#clusterMongo::Cluster (readonly)

Returns cluster The cluster.

Returns:

Since:

  • 2.0.6



24
25
26
# File 'lib/mongo/event/description_changed.rb', line 24

def cluster
  @cluster
end

Instance Method Details

#handle(previous_desc, updated_desc) ⇒ Object

This event publishes an event to add the cluster and logs the configuration change.

Parameters:

Since:

  • 2.0.0



45
46
47
48
49
# File 'lib/mongo/event/description_changed.rb', line 45

def handle(previous_desc, updated_desc)
  cluster.sdam_flow_lock.synchronize do
    Mongo::Cluster::SdamFlow.new(cluster, previous_desc, updated_desc).server_description_changed
  end
end