Class: Mongo::Cluster::Topology::Base
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable
|
|
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/mongo/cluster/topology/base.rb |
Overview
Defines behavior common to all topologies.
Constant Summary
::Mongo::Loggable
- Included
Class Method Summary
-
.new(options, monitoring, cluster) ⇒ Base
constructor
Internal use only
Internal use only
Initialize the topology with the options.
Instance Attribute Summary
- #compatibility_error ⇒ Exception readonly
- #compatible? ⇒ true|false readonly
- #data_bearing_servers? ⇒ true | false readonly Internal use only Internal use only
-
#logical_session_timeout ⇒ Integer?
readonly
The logical session timeout value in minutes.
- #monitoring ⇒ monitoring readonly
- #options ⇒ Hash readonly
- #server_descriptions ⇒ Hash readonly
- #cluster ⇒ Cluster readonly private Internal use only Internal use only
::Mongo::Monitoring::Publishable
- Included
Instance Method Summary
- #addresses ⇒ Array<String>
-
#max_election_id ⇒ BSON::ObjectId
The largest electionId ever reported by a primary.
-
#max_set_version ⇒ Integer
The largest setVersion ever reported by a primary.
- #new_max_election_id(description) Internal use only Internal use only
- #new_max_set_version(description) Internal use only Internal use only
-
#replica_set_name ⇒ String
Get the replica set name configured for this topology.
-
#server_hosts_match_any?(patterns) ⇒ true | false
Internal use only
Internal use only
Compares each server address against the list of patterns.
-
#validate_options(options, cluster) ⇒ Hash
private
Validates and/or transforms options as necessary for the topology.
::Mongo::Monitoring::Publishable
- Included
#publish_cmap_event, #publish_event, #publish_sdam_event, #command_completed, #command_failed, #command_started, #command_succeeded, #duration |
::Mongo::Loggable
- Included
#log_debug | Convenience method to log debug messages with the standard prefix. |
#log_error | Convenience method to log error messages with the standard prefix. |
#log_fatal | Convenience method to log fatal messages with the standard prefix. |
#log_info | Convenience method to log info messages with the standard prefix. |
#log_warn | Convenience method to log warn messages with the standard prefix. |
#logger | Get the logger instance. |
#_mongo_log_prefix, #format_message |
Instance Attribute Details
#cluster ⇒ Cluster (readonly, private)
# File 'lib/mongo/cluster/topology/base.rb', line 109
attr_reader :cluster
#compatibility_error ⇒ Exception
(readonly)
# File 'lib/mongo/cluster/topology/base.rb', line 151
attr_reader :compatibility_error
#compatible? ⇒ true
|false
(readonly)
# File 'lib/mongo/cluster/topology/base.rb', line 142
def compatible? @compatible end
#data_bearing_servers? ⇒ true
| false
(readonly)
# File 'lib/mongo/cluster/topology/base.rb', line 168
def data_bearing_servers? @have_data_bearing_servers end
#logical_session_timeout ⇒ Integer
? (readonly)
The value is in minutes, unlike most other times in the driver which are returned in seconds.
The logical session timeout value in minutes.
# File 'lib/mongo/cluster/topology/base.rb', line 161
attr_reader :logical_session_timeout
#monitoring ⇒ monitoring (readonly)
# File 'lib/mongo/cluster/topology/base.rb', line 118
attr_reader :monitoring
#options ⇒ Hash
(readonly)
# File 'lib/mongo/cluster/topology/base.rb', line 105
attr_reader :
#server_descriptions ⇒ Hash
(readonly)
# File 'lib/mongo/cluster/topology/base.rb', line 136
attr_reader :server_descriptions
Instance Method Details
#addresses ⇒ Array
<String
>
# File 'lib/mongo/cluster/topology/base.rb', line 113
def addresses cluster.addresses.map(&:seed) end
#max_election_id ⇒ BSON::ObjectId
The largest electionId ever reported by a primary. May be nil.
# File 'lib/mongo/cluster/topology/base.rb', line 178
def max_election_id [:max_election_id] end
#max_set_version ⇒ Integer
The largest setVersion ever reported by a primary. May be nil.
# File 'lib/mongo/cluster/topology/base.rb', line 188
def max_set_version [:max_set_version] end
#new_max_election_id(description)
# File 'lib/mongo/cluster/topology/base.rb', line 193
def new_max_election_id(description) if description.election_id && (max_election_id.nil? || description.election_id > max_election_id) description.election_id else max_election_id end end
#new_max_set_version(description)
# File 'lib/mongo/cluster/topology/base.rb', line 204
def new_max_set_version(description) if description.set_version && (max_set_version.nil? || description.set_version > max_set_version) description.set_version else max_set_version end end
#replica_set_name ⇒ String
Get the replica set name configured for this topology.
# File 'lib/mongo/cluster/topology/base.rb', line 128
def replica_set_name [:replica_set_name] end
#server_hosts_match_any?(patterns) ⇒ true
| false
Compares each server address against the list of patterns.
# File 'lib/mongo/cluster/topology/base.rb', line 223
def server_hosts_match_any?(patterns) server_descriptions.any? do |addr_spec, _desc| addr, _port = addr_spec.split(/:/) patterns.any? { |pattern| addr.end_with?(pattern) } end end
#validate_options(options, cluster) ⇒ Hash
(private)
Validates and/or transforms options as necessary for the topology.
# File 'lib/mongo/cluster/topology/base.rb', line 235
def (, cluster) end