class Mongo::Server::Description::Inspector::MemberDiscovered

Handles inspecting the result of an ismaster command to check if this a server is a member of a known topology.

@since 2.4.0

Public Class Methods

new(event_listeners) click to toggle source

Instantiate the member discovered inspection.

@example Instantiate the inspection.

MemberDiscovered.new(listeners)

@param [ Event::Listeners ] event_listeners The event listeners.

@since 2.4.0

# File lib/mongo/server/description/inspector/member_discovered.rb, line 35
def initialize(event_listeners)
  @event_listeners = event_listeners
end

Public Instance Methods

run(description, updated) click to toggle source

Run the member discovered inspection.

@example Run the inspection.

MemberDiscovered.run(description, {})

@param [ Description ] description The server description. @param [ Description ] updated The updated description.

@since 2.4.0

# File lib/mongo/server/description/inspector/member_discovered.rb, line 48
def run(description, updated)
  if (!description.primary? && updated.primary?) ||
      (!description.mongos? && updated.mongos?) ||
      (description.unknown? && !updated.unknown?)
    publish(Event::MEMBER_DISCOVERED, description, updated)
  end
end