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

Methods included from Monitoring::Publishable

#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



38
39
40
# File 'lib/mongo/cluster/topology/unknown.rb', line 38

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



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

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



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

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



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

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



100
101
102
# File 'lib/mongo/cluster/topology/unknown.rb', line 100

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



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

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



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

def single?; false; end

#summaryObject

Note:

This method is experimental and subject to change.

Since:

  • 2.7.0



46
47
48
49
# File 'lib/mongo/cluster/topology/unknown.rb', line 46

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



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

def unknown?; true; end