module Mongo::Cluster::Topology
Defines behaviour for getting servers.
@since 2.0.0
Constants
- OPTIONS
The 2 various topologies for server selection.
@since 2.0.0
Public Instance Methods
initial(seeds, options)
click to toggle source
Get the initial cluster topology for the provided options.
@example Get the initial cluster topology.
Topology.initial(topology: :replica_set)
@param [ Array<String> ] seeds The addresses of the configured servers. @param [ Hash ] options The cluster options.
@return [ ReplicaSet, Sharded, Single ] The topology.
@since 2.0.0
# File lib/mongo/cluster/topology.rb, line 49 def initial(seeds, options) if options.has_key?(:connect) OPTIONS.fetch(options[:connect]).new(options, seeds) elsif options.has_key?(:replica_set) ReplicaSet.new(options, seeds) else Unknown.new(options, seeds) end end