Class Mongo::Cluster::Topology::Base
In: lib/mongo/cluster/topology/base.rb
Parent: Object

Defines behavior common to all topologies.

@since 2.7.0

Methods

Included Modules

Loggable Monitoring::Publishable

Attributes

compatibility_error  [R]  @return [ Exception ] compatibility_error If topology is incompatible
  with the driver, an exception with information regarding the incompatibility.
  If topology is compatible with the driver, nil.

@since 2.7.0

logical_session_timeout  [R]  The logical session timeout value in minutes.

@note The value is in minutes, unlike most other times in the

  driver which are returned in seconds.

@return [ Integer, nil ] The logical session timeout.

@since 2.7.0

monitoring  [R]  @return [ monitoring ] monitoring the monitoring.
options  [R]  @return [ Hash ] options The options.
server_descriptions  [R]  @return [ Hash ] server_descriptions The map of address strings to
  server descriptions, one for each server in the cluster.

@since 2.7.0

Public Class methods

Initialize the topology with the options.

@param [ Hash ] options The options. @param [ Monitoring ] monitoring The monitoring. @param [ Cluster ] cluster The cluster.

@option options [ Symbol ] :replica_set Name of the replica set to

  connect to. Can be left blank (either nil or the empty string are
  accepted) to discover the name from the cluster. If the addresses
  belong to different replica sets there is no guarantee which
  replica set is selected - in particular, the driver may choose
  the replica set name of a secondary if it returns its response
  prior to a primary belonging to a different replica set.
  This option can only be specified when instantiating a replica
  set topology.

@option options [ BSON::ObjectId ] :max_election_id Max election id

  per the SDAM specification.
  This option can only be specified when instantiating a replica
  set topology.

@option options [ Integer ] :max_set_version Max set version

  per the SDAM specification.
  This option can only be specified when instantiating a replica
  set topology.

@since 2.7.0 @api private

Public Instance methods

@return [ Array<String> ] addresses Server addresses.

@return [ true|false ] compatible Whether topology is compatible

  with the driver.

@since 2.7.0

@return [ true | false ] have_data_bearing_servers Whether the

  topology has any data bearing servers, for the purposes of
  logical session timeout calculation.

@api private

The largest electionId ever reported by a primary. May be nil.

@return [ BSON::ObjectId ] The election id.

@since 2.7.0

The largest setVersion ever reported by a primary. May be nil.

@return [ Integer ] The set version.

@since 2.7.0

Get the replica set name configured for this topology.

@example Get the replica set name.

  topology.replica_set_name

@return [ String ] The name of the configured replica set.

@since 2.0.0

[Validate]