类:Mongo::Cluster::Topology::Single
Overview
定义集群处于单一拓扑结构时的行为。
常量摘要折叠
- NAME =
拓扑的显示名称。
'Single'
Loggable中包含的常量
实例属性摘要
从Base继承的属性
#compatibility_error 、 #logic_session_timeout 、 #monitoring 、 #options 、 #server_descriptions
包含在Monitoring::Publishable 中的属性
实例方法摘要折叠
-
#display_name ⇒ string
获取显示名称。
-
#has_read_server?(_cluster, _server_selector = nil) ⇒ true
确定拓扑是否会为提供的候选和读取偏好选择可读服务器。
-
#has_writable_server?(_集群) ⇒ true
确定拓扑结构是否会为提供的候选服务器选择可写服务器。
-
# replica_set? ⇒ false
单个拓扑不是副本集。
-
#servers(servers, _name = nil) ⇒ Array<Server>
为此拓扑结构选择适当的服务器。
-
# sharded? ⇒ false
单个拓扑结构不会被分片。
-
# single? ⇒ true
单一拓扑结构是单一的。
- #摘要⇒ 对象
-
#未知? ⇒ false
单个拓扑结构并非未知。
从Base继承的方法
#addresses 、 #兼容? , #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?
Monitoring::Publishable 中包含的方法
#publish_cmap_event 、 #publish_event 、 #publish_sdam_event
Loggable中包含的方法
#log_debug 、 #log_error 、 #log_ Fatal 、 #log_info 、 #log_warn 、 #logger
构造函数详情
该类从Mongo::Cluster::Topology::Base继承了一个构造函数
实例方法详细信息
#display_name ⇒ string
获取显示名称。
37 38 39 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 37 def 显示名称 self.class.名称.gsub(/ .*:: /, ' ') end |
#has_readable_服务器?(_集群, _服务器_selector = nil) ⇒ true
确定拓扑是否会为提供的候选和读取偏好选择可读服务器。
63 64 65 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 63 def has_read_server?(_cluster, 服务器 = nil) true end |
#has_writable_server?(_cluster) ⇒ true
确定拓扑结构是否会为提供的候选服务器选择可写服务器。
78 79 80 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 78 def has_writable_server?(_cluster) true end |
# replica_set? ⇒ false
单个拓扑不是副本集。
90 91 92 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 90 def replica_set? false end |
#服务器(服务器, _name = nil) ⇒ 数组<服务器>
为此拓扑结构选择适当的服务器。
104 105 106 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 104 def 服务器(服务器, _name = nil) 服务器.拒绝 { |server| server.未知? } end |
# sharded? ⇒ false
单个拓扑结构不会被分片。
116 117 118 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 116 def 分片的? false end |
# single? ⇒ true
单一拓扑结构是单一的。
128 129 130 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 128 def 单身? true end |
#摘要⇒对象
注意:
此方法是实验性的,可能会发生变化。
45 46 47 48 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 45 def 总结 详情 = server_descriptions.密钥.连接 (JOIN)(' , ') " #{ display_name } [ #{ details } ] " end |
#未知? ⇒ false
单个拓扑结构并非未知。
140 141 142 |
# File 'lib/ Mongo/ 集群/ 拓扑结构/single.rb', line 140 def 未知? false end |