class Mongo::Event::PrimaryElected

This handles primary elected events for server descriptions.

@since 2.0.0

Attributes

cluster[R]

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

Public Class Methods

new(cluster) click to toggle source

Initialize the new primary elected event handler.

@example Create the new handler.

PrimaryElected.new(cluster)

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

@since 2.0.0

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

Public Instance Methods

handle(description) click to toggle source

This event tells the cluster to take all previous primaries to an unknown state.

@example Handle the event.

primary_elected.handle(description)

@param [ Server::Description ] description The description of the

elected server.

@since 2.0.0

# File lib/mongo/event/primary_elected.rb, line 48
def handle(description)
  cluster.elect_primary!(description)
end