Class: Mongo::Monitoring::Event::TopologyChanged

Inherits:
Event::Base
  • Object
show all
Defined in:
lib/mongo/monitoring/event/topology_changed.rb

Overview

Event fired when the topology changes.

Since:

  • 2.4.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(previous_topology, new_topology) ⇒ TopologyChanged

Create the event.

Examples:

Create the event.

TopologyChanged.new(previous, new)

Parameters:

Since:

  • 2.4.0



39
40
41
42
# File 'lib/mongo/monitoring/event/topology_changed.rb', line 39

def initialize(previous_topology, new_topology)
  @previous_topology = previous_topology
  @new_topology = new_topology
end

Instance Attribute Details

#new_topologyCluster::Topology (readonly)

Returns new_topology The new topology.

Returns:

Since:

  • 2.4.0



28
29
30
# File 'lib/mongo/monitoring/event/topology_changed.rb', line 28

def new_topology
  @new_topology
end

#previous_topologyCluster::Topology (readonly)

Returns previous_topology The previous topology.

Returns:

Since:

  • 2.4.0



25
26
27
# File 'lib/mongo/monitoring/event/topology_changed.rb', line 25

def previous_topology
  @previous_topology
end

Instance Method Details

#summaryString

Note:

This method is experimental and subject to change.

Returns a concise yet useful summary of the event.

Returns:

  • (String)

    String summary of the event.

Since:

  • 2.7.0



52
53
54
55
56
# File 'lib/mongo/monitoring/event/topology_changed.rb', line 52

def summary
  "#<#{self.class.name.sub(/^Mongo::Monitoring::Event::/, '')}" +
  " prev=#{previous_topology.summary}" +
  " new=#{new_topology.summary}>"
end