Class: BigBrother::ClusterCollection
- Inherits:
-
Object
- Object
- BigBrother::ClusterCollection
- Extended by:
- Forwardable
- Defined in:
- lib/big_brother/cluster_collection.rb
Instance Method Summary collapse
- #config(new_clusters) ⇒ Object
-
#initialize ⇒ ClusterCollection
constructor
A new instance of ClusterCollection.
- #ready_for_check ⇒ Object
- #running ⇒ Object
- #stopped ⇒ Object
Constructor Details
#initialize ⇒ ClusterCollection
Returns a new instance of ClusterCollection.
8 9 10 |
# File 'lib/big_brother/cluster_collection.rb', line 8 def initialize @clusters = {} end |
Instance Method Details
#config(new_clusters) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/big_brother/cluster_collection.rb', line 12 def config(new_clusters) (@clusters.keys - new_clusters.keys).each do |removed_name| @clusters.delete(removed_name).stop_monitoring! end new_clusters.each do |cluster_name, cluster| if @clusters.key?(cluster_name) current_cluster = @clusters[cluster_name] current_cluster.stop_relay_fwmark if current_cluster.is_a?(BigBrother::ActiveActiveCluster) && !cluster.is_a?(BigBrother::ActiveActiveCluster) @clusters[cluster_name] = cluster.incorporate_state(@clusters[cluster_name]) else @clusters[cluster_name] = cluster end end end |
#ready_for_check ⇒ Object
36 37 38 |
# File 'lib/big_brother/cluster_collection.rb', line 36 def ready_for_check @clusters.values.select(&:needs_check?) end |
#running ⇒ Object
28 29 30 |
# File 'lib/big_brother/cluster_collection.rb', line 28 def running @clusters.values.select(&:monitored?) end |
#stopped ⇒ Object
32 33 34 |
# File 'lib/big_brother/cluster_collection.rb', line 32 def stopped @clusters.values.reject(&:monitored?) end |