Class: Mongo::Cluster::Topology::Sharded
- Inherits:
-
Object
- Object
- Mongo::Cluster::Topology::Sharded
- Defined in:
- lib/mongo/cluster/topology/sharded.rb
Overview
Defines behaviour for when a cluster is in sharded topology.
Constant Summary collapse
- NAME =
The display name for the topology.
'Sharded'.freeze
Instance Method Summary collapse
-
#add_hosts?(description, servers) ⇒ false
Whether a server description’s hosts may be added to the cluster.
-
#display_name ⇒ String
Get the display name.
-
#elect_primary(description, servers) ⇒ Sharded
Elect a primary server within this topology.
-
#initialize(options, seeds = []) ⇒ Sharded
constructor
Initialize the topology with the options.
-
#remove_hosts?(description) ⇒ true
Whether a description can be used to remove hosts from the cluster.
-
#remove_server?(description, server) ⇒ true, false
Whether a specific server in the cluster can be removed, given a description.
-
#replica_set? ⇒ false
A sharded topology is not a replica set.
-
#replica_set_name ⇒ nil
Sharded topologies have no replica set name.
-
#servers(servers) ⇒ Array<Server>
Select appropriate servers for this topology.
-
#sharded? ⇒ true
A sharded topology is sharded.
-
#single? ⇒ false
A sharded topology is not single.
-
#standalone_discovered ⇒ Topology::Sharded
Notify the topology that a standalone was discovered.
-
#unknown? ⇒ false
A sharded topology is not unknown.
Constructor Details
#initialize(options, seeds = []) ⇒ Sharded
Initialize the topology with the options.
62 63 64 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 62 def initialize(, seeds = []) @options = end |
Instance Method Details
#add_hosts?(description, servers) ⇒ false
Whether a server description’s hosts may be added to the cluster.
112 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 112 def add_hosts?(description, servers); false; end |
#display_name ⇒ String
Get the display name.
37 38 39 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 37 def display_name NAME end |
#elect_primary(description, servers) ⇒ Sharded
Elect a primary server within this topology.
52 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 52 def elect_primary(description, servers); self; end |
#remove_hosts?(description) ⇒ true
Whether a description can be used to remove hosts from the cluster.
the cluster.
topology.remove_hosts?(description)
126 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 126 def remove_hosts?(description); true; end |
#remove_server?(description, server) ⇒ true, false
Whether a specific server in the cluster can be removed, given a description.
139 140 141 142 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 139 def remove_server?(description, server) remove_self?(description, server) || !(server.mongos? || server.unknown?) end |
#replica_set? ⇒ false
A sharded topology is not a replica set.
74 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 74 def replica_set?; false; end |
#replica_set_name ⇒ nil
Sharded topologies have no replica set name.
84 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 84 def replica_set_name; nil; end |
#servers(servers) ⇒ Array<Server>
Select appropriate servers for this topology.
96 97 98 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 96 def servers(servers) servers.select{ |server| server.mongos? } end |
#sharded? ⇒ true
A sharded topology is sharded.
152 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 152 def sharded?; true; end |
#single? ⇒ false
A sharded topology is not single.
162 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 162 def single?; false; end |
#standalone_discovered ⇒ Topology::Sharded
Notify the topology that a standalone was discovered.
182 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 182 def standalone_discovered; self; end |
#unknown? ⇒ false
A sharded topology is not unknown.
172 |
# File 'lib/mongo/cluster/topology/sharded.rb', line 172 def unknown?; false; end |