Class: Mongo::Cluster::Topology::Unknown

Inherits:
Base
  • Object
show all
Includes:
NoReplicaSetOptions
Defined in:
lib/mongo/cluster/topology/unknown.rb

Overview

Defines behavior for when a cluster is in an unknown state.

Since:

  • 2.0.0

Constant Summary collapse

NAME =

The display name for the topology.

Since:

  • 2.0.0

'Unknown'.freeze

Constants included from Loggable

Loggable::PREFIX

Instance Attribute Summary

Attributes inherited from Base

#compatibility_error, #logical_session_timeout, #monitoring, #options, #server_descriptions

Attributes included from Monitoring::Publishable

#monitoring

Instance Method Summary collapse

Methods inherited from Base

#addresses, #compatible?, #data_bearing_servers?, #initialize, #max_election_id, #max_set_version, #new_max_election_id, #new_max_set_version, #replica_set_name, #server_hosts_match_any?

Methods included from Monitoring::Publishable

#publish_cmap_event, #publish_event, #publish_sdam_event

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Constructor Details

This class inherits a constructor from Mongo::Cluster::Topology::Base

Instance Method Details

#display_nameString

Get the display name.

Examples:

Get the display name.

Unknown.display_name

Returns:

  • (String)

    The display name.

Since:

  • 2.0.0



41
42
43
# File 'lib/mongo/cluster/topology/unknown.rb', line 41

def display_name
  self.class.name.gsub(/.*::/, '')
end

#has_readable_server?(cluster, server_selector = nil) ⇒ false

Determine if the topology would select a readable server for the provided candidates and read preference.

Examples:

Is a readable server present?

topology.has_readable_server?(cluster, server_selector)

Parameters:

  • cluster (Cluster)

    The cluster.

  • server_selector (ServerSelector) (defaults to: nil)

    The server selector.

Returns:

  • (false)

    An Unknown topology will never have a readable server.

Since:

  • 2.4.0



67
# File 'lib/mongo/cluster/topology/unknown.rb', line 67

def has_readable_server?(cluster, server_selector = nil); false; end

#has_writable_server?(cluster) ⇒ false

Determine if the topology would select a writable server for the provided candidates.

Examples:

Is a writable server present?

topology.has_writable_server?(servers)

Parameters:

  • cluster (Cluster)

    The cluster.

Returns:

  • (false)

    An Unknown topology will never have a writable server.

Since:

  • 2.4.0



80
# File 'lib/mongo/cluster/topology/unknown.rb', line 80

def has_writable_server?(cluster); false; end

#replica_set?false

An unknown topology is not a replica set.

Examples:

Is the topology a replica set?

Unknown.replica_set?

Returns:

  • (false)

    Always false.

Since:

  • 2.0.0



90
# File 'lib/mongo/cluster/topology/unknown.rb', line 90

def replica_set?; false; end

#servers(servers) ⇒ Object

Select appropriate servers for this topology.

Examples:

Select the servers.

Unknown.servers(servers)

Parameters:

  • servers (Array<Server>)

    The known servers.

Raises:

  • (Unknown)

    Cannot select servers when the topology is unknown.

Since:

  • 2.0.0



103
104
105
# File 'lib/mongo/cluster/topology/unknown.rb', line 103

def servers(servers)
  []
end

#sharded?false

An unknown topology is not sharded.

Examples:

Is the topology sharded?

Unknown.sharded?

Returns:

  • (false)

    Always false.

Since:

  • 2.0.0



115
# File 'lib/mongo/cluster/topology/unknown.rb', line 115

def sharded?; false; end

#single?true

An unknown topology is not single.

Examples:

Is the topology single?

Unknown.single?

Returns:

  • (true)

    Always false.

Since:

  • 2.0.0



125
# File 'lib/mongo/cluster/topology/unknown.rb', line 125

def single?; false; end

#summaryObject

Note:

This method is experimental and subject to change.

Since:

  • 2.7.0



49
50
51
52
# File 'lib/mongo/cluster/topology/unknown.rb', line 49

def summary
  details = server_descriptions.keys.join(',')
  "#{display_name}[#{details}]"
end

#unknown?true

An unknown topology is unknown.

Examples:

Is the topology unknown?

Unknown.unknown?

Returns:

  • (true)

    Always true.

Since:

  • 2.0.0



135
# File 'lib/mongo/cluster/topology/unknown.rb', line 135

def unknown?; true; end