class Mongo::Event::DescriptionChanged

This handles a change in description.

@since 2.0.6

Attributes

cluster[R]

@return [ Mongo::Cluster ] cluster The cluster.

Public Class Methods

new(cluster) click to toggle source

Initialize the new host added event handler.

@example Create the new handler.

ServerAdded.new(cluster)

@param [ Mongo::Cluster ] cluster The cluster to publish from.

@since 2.0.0

# File lib/mongo/event/description_changed.rb, line 34
def initialize(cluster)
  @cluster = cluster
end

Public Instance Methods

handle(previous_desc, updated_desc) click to toggle source

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

@param [ Server::Description ] previous_desc Previous server description. @param [ Server::Description ] updated_desc The changed description.

@since 2.0.0

# 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